LaTeX - Tips

From XennisWiki
(Redirected from Cleveref)
Jump to: navigation, search

Some tips for LaTeX

Basics

URL

Further information: LaTeX-Wörterbuch: url

\usepackage{hyperref}
Link to the Google homepage \url{http://google.com}.

Footnote

\usepackage{footnote}
% ...
My example text here\footnote{Test, and here my footnote}.

Use footnotes in a table (further information: Using footnote in tables)

\usepackage{footnote}
% ...
\begin{savenotes}
    \begin{table}
        \begin{tabular}{|l|c|}
            \hline
            Hello & World\footnote{Here is my footnote.} \\
            \hline
            % ...
        \end{tabular}
    \end{table}
\end{savenotes}

Include tex File

Include the file example.tex from the directory path/to/the/file:

\input{path/to/the/file/example}

Include the example.tex, which has to be in the same directory

\include{example}

Define a command

\newcommand{\example}{\mathrm{Example}}

Example with one parameter (packet color is required)

\newcommand{\h}[1]{{\color{blue}{#1}}}

Symbols

Further information: LaTeX/ Akzente und Sonderzeichen

Command Symbol
\varphi $ \varphi $
\mathcal O $ \mathcal O $
\R, \mathbb N $ \R, \mathbb N $
\mathrm i $ \mathrm i $
\dot{s}, \ddot{s} $ \dot{s}, \ddot{s} $
\to $ \to $
\mapsto $ \mapsto $
\verb!C++! $ \verb!C++! $
\overline c, \hat c, \widehat C $ \overline c, \hat c, \widehat C $
\int_0^n $ \int_0^n $
\infty $ \infty $
Commando Symbol
\& $ \& $
\le, \ge $ \le, \ge $
\lceil x \rceil, \lfloor x \rfloor $ \lceil x \rceil, \lfloor x \rfloor $
\langle x, y \rangle $ \langle x, y \rangle $
\subseteq, \sqsubseteq $ \subseteq, \sqsubseteq $
\vee, \wedge $ \vee, \wedge $
n \times m $ n \times m $


Format text

Color

\usepackage{color}
\usepackage{xcolor}
The following text {\color{blue}{appears in blue}}.

Underline, strike through, etc.

Further information: LaTeX-Wörterbuch: ulem, Unterstreichen und durchstreichen von Text in Latex

\usepackage{ulem}
\sout{strike through}
\uline{underlined}
\uuline{double underlined}
\uwave{wavy underline}

Background color

This text is \colorbox{yellow!50}{yellow}!

Packages

All packages you find in the

Cross references (cleveref)

\usepackage{cleveref}
% E.g. for German:
%\usepackage[german]{cleveref}

Cleverref outputs fig. 1 (or for German Abb. 1)

Like shown in~\cref{fig:full_system}

Index of abbreviations (nomencl)

Defintion
% Index of abbreviations
\usepackage[intoc]{nomencl}
  \let\abbrev\nomenclature
  \renewcommand{\nomname}{Abkürzungsverzeichnis}
  \setlength{\nomlabelwidth}{.01\hsize}
   \renewcommand{\nomlabel}[1]{#1 \dotfill}
   \setlength{\nomitemsep}{-\parsep}
   \makenomenclature
% Custom command
\newcommand{\abk}[2]{#1\abbrev{#1}{#2}}
Usage
\abk{XML}{Extensible Markup Language}

\printnomenclature

To create the index of abbreviations, execute the following command

makeindex %.nlo -s nomencl.ist -o %.nls

Scripts

Figures command

% Usage: \xefig[5cm]{path/file}{Label}{Caption}
\newcommand{\xefig}[4][\columnwidth]
{
  \begin{figure}[tbp]
    \begin{center}
      \includegraphics[width=#1]{#2}
      \caption{#4}
      \label{fig:#3}
    \end{center}
  \end{figure}
}
% Usage: \myfigtwo2[Column width]{path/file}{Label}{Caption}{Caption subfigure a}{Caption subfigure b}
\newcommand{\xefigtwo}[6][\columnwidth]
{
  \begin{figure}[tbp]
    \begin{center}
      {
        \subfigure[#5]
          { \includegraphics[width=.#1\columnwidth]{#2-a} \label{fig:#3-a} }
          \quad
        \subfigure[#6]
          { \includegraphics[width=.#1\columnwidth]{#2-b} \label{fig:#3-b} }
      }
      \caption{#4}
      \label{fig:#3}
    \end{center}
  \end{figure}
}

Weiteres

Seitenränder einstellen

\usepackage{geometry}
\geometry{a4paper,left=5mm,right=5mm, top=5mm, bottom=5mm}

Keine Absatzeinzug

\setlength{\parindent}{0em}

PDF-Formulare

siehe Creating pdf-forms with LaTeX

PDF (seitenfüllend und im Querformat) einbinden

Ausführliche Hilfe: LaTeX-Wörterbuch: includepdf

\usepackage{pdfpages}
\includepdf[pages={1},landscape=true]{../myFile.pdf}

Guillemets (Anführungszeichen)

\newcommand{\xf}[1]{\frqq #1\flqq}

See also