1 | |
---|
2 | For working with LaTeX you can take advantage of a variety of books and free introductions and tutorials on the internet. A competent contact point for LaTeX beginners is the LaTeX Wikibook, which is available under \url{http://en.wikibooks.org/wiki/LaTeX}. |
---|
3 | |
---|
4 | The following sections give examples of the most important LaTeX environments and commands. |
---|
5 | |
---|
6 | \section{Tables} |
---|
7 | |
---|
8 | Tables have to be realized with the help of the \textit{table} environment. Tables shall be sequentially numbered for each chapter and described in terms of a short caption (cf. Table~\ref{tab:diplomaseminar}). |
---|
9 | |
---|
10 | \begin{table}[htb] |
---|
11 | \centering |
---|
12 | \begin{tabular}{|l|c|c|} |
---|
13 | \hline \textbf{Name} & \textbf{Date} & \textbf{Title} \\ |
---|
14 | \hline |
---|
15 | \hline Mustermann Adam & 18.5 & T1 \\ |
---|
16 | \hline Musterfrau Eva & 22.6 & T2 \\ |
---|
17 | \hline |
---|
18 | \end{tabular} |
---|
19 | \caption{Seminar for Master Students} |
---|
20 | \label{tab:diplomaseminar} |
---|
21 | \end{table} |
---|
22 | |
---|
23 | |
---|
24 | \section{Figures} |
---|
25 | |
---|
26 | Like tables, figures shall be sequentially numbered for each chapter and described in terms of a short caption). You could either produce your drawings directly inside Latex using PSTricks\footnote{\url{http://tug.org/PSTricks}}, Tikz\footnote{\url{http://sourceforge.net/projects/pgf}}, or any set of macros dedicated to your requirements (cf. Figure~\ref{fig:samplefigure_tikz}). Alternatively, you may include figures prepared in external tools (cf. Figure~\ref{fig:samplefigure_pdf}). Note, to ensure high quality printing, all figures must have at least 300 dpi. |
---|
27 | |
---|
28 | \begin{figure} |
---|
29 | \centering |
---|
30 | \begin{tikzpicture}[->, auto, node distance=2.8cm, semithick] |
---|
31 | \node[initial, state] (1) {$S_1$}; |
---|
32 | \node[state] (2) [right of=1] {$S_2$}; |
---|
33 | |
---|
34 | \path (1) edge [bend left] node {0} (2) |
---|
35 | (1) edge [loop above] node {1} (1) |
---|
36 | (2) edge [bend left] node {0} (1) |
---|
37 | (2) edge [loop above] node {1} (2); |
---|
38 | \end{tikzpicture} |
---|
39 | \caption{Sample figure} |
---|
40 | \label{fig:samplefigure_tikz} |
---|
41 | \end{figure} |
---|
42 | |
---|
43 | \begin{figure}[tb] |
---|
44 | \centering |
---|
45 | \includegraphics[width=0.7\textwidth]{figures/figure1} |
---|
46 | \caption{Sample figure} |
---|
47 | \label{fig:samplefigure_pdf} |
---|
48 | \end{figure} |
---|
49 | |
---|
50 | |
---|
51 | \section{Fonts} |
---|
52 | |
---|
53 | When introducing important terms for the first time use \emph{emphasize}. For a consistent look and feel of proper names like {\cd} and {\uml{Observer}} pattern you may define macros in the main document \texttt{thesis.tex}. |
---|
54 | |
---|
55 | \section{Code} |
---|
56 | |
---|
57 | For short code fragments use the \textit{verbatim} environment. |
---|
58 | |
---|
59 | \begin{verbatim} |
---|
60 | //Start Program |
---|
61 | System.out.println("Hello World!"); |
---|
62 | //End Program |
---|
63 | \end{verbatim} |
---|
64 | |
---|
65 | A much better alternative is the \textit{algorithm} environment (cf. Algorithm~\ref{alg:samplealgorithm}). This environment offers special formatting features for loops, operations and comments. |
---|
66 | |
---|
67 | \begin{algorithm}[t] |
---|
68 | \SetKwData{Left}{left} |
---|
69 | \SetKwData{This}{this} |
---|
70 | \SetKwData{Up}{up} |
---|
71 | \SetKwFunction{Union}{Union} |
---|
72 | \SetKwFunction{FindCompress}{FindCompress} |
---|
73 | \SetKwInOut{Input}{input} |
---|
74 | \SetKwInOut{Output}{output} |
---|
75 | |
---|
76 | \Input{A bitmap $Im$ of size $w\times l$} |
---|
77 | \Output{A partition of the bitmap} |
---|
78 | |
---|
79 | \BlankLine |
---|
80 | |
---|
81 | \emph{special treatment of the first line}\; |
---|
82 | \For{$i\leftarrow 2$ \KwTo $l$}{ |
---|
83 | \emph{special treatment of the first element of line $i$}\; |
---|
84 | \For{$j\leftarrow 2$ \KwTo $w$}{\label{forins} |
---|
85 | \Left$\leftarrow$ \FindCompress{$Im[i,j-1]$}\; |
---|
86 | \Up$\leftarrow$ \FindCompress{$Im[i-1,]$}\; |
---|
87 | \This$\leftarrow$ \FindCompress{$Im[i,j]$}\; |
---|
88 | \If(\tcp*[r]{O(\Left,\This)==1}){\Left compatible with \This}{\label{lt} |
---|
89 | \lIf{\Left $<$ \This}{\Union{\Left,\This}}\; |
---|
90 | \lElse{\Union{\This,\Left}\;} |
---|
91 | } |
---|
92 | \If(\tcp*[r]{O(\Up,\This)==1}){\Up compatible with \This}{\label{ut} |
---|
93 | \lIf{\Up $<$ \This}{\Union{\Up,\This}}\; |
---|
94 | \tcp{\This is put under \Up to keep tree as flat as possible}\label{cmt} |
---|
95 | \lElse{\Union{\This,\Up}}\tcp*[r]{\This linked to \Up}\label{lelse} |
---|
96 | } |
---|
97 | } |
---|
98 | \lForEach{element $e$ of the line $i$}{\FindCompress{p}} |
---|
99 | } |
---|
100 | \caption{Sample algorithm}\label{alg:samplealgorithm} |
---|
101 | \end{algorithm} |
---|
102 | |
---|