LaTeX Setup & Writing Guide¶
How the thesis is built, organized, and written in LaTeX.
Build System¶
The thesis uses latexmk with pdflatex. All commands run from the latex/ directory.
latexmk handles the full compilation chain automatically:
- pdflatex (first pass — resolves structure)
- biber (bibliography from
references.bib) - makeglossaries (glossary entries)
- pdflatex (second pass — resolves references)
- pdflatex (third pass — final cross-references)
The .latexmkrc configures output to latex/build/ and defines a custom dependency for glossary generation.
File Structure¶
latex/
├── thesis.tex # Root document — entry point
├── .latexmkrc # latexmk configuration
├── abbreviations.tex # Acronym definitions (acro package)
├── glossary.tex # Glossary entries (glossaries package)
├── references.bib # Bibliography (biblatex + biber, IEEE style)
├── prefix/
│ ├── preamble.tex # All package imports and settings
│ └── title.tex # Title page layout
├── chapters/
│ ├── 0_kurzfassung.tex # Abstract (DE/EN)
│ ├── 1_einleitung.tex # Introduction
│ ├── 2_grundlagen.tex # Background
│ ├── 3_methodik.tex # Methodology
│ ├── 4_implementierung.tex # Implementation
│ ├── 5_ergebnisse.tex # Results
│ ├── 6_diskussion.tex # Discussion
│ ├── 7_fazit.tex # Conclusion
│ └── anhang.tex # Appendix
├── images/ # Figures (PNG, PDF)
└── build/ # Compiled output (gitignored)
Document Class¶
KOMA-Script scrbook — a standard thesis document class:
\documentclass[%
fontsize=12pt,
paper=a4,
BCOR=10mm, % binding correction
DIV=12, % text area proportioning
headsepline % line under header
]{scrbook}
Package Overview¶
Core¶
| Package | Purpose |
|---|---|
graphicx |
\includegraphics for figures |
tikz |
Diagrams (architecture, data flow) |
pgfplots |
Data charts (bar, line, scatter) |
siunitx |
Consistent number/unit formatting |
subcaption |
Subfigures with individual captions |
Tables & Lists¶
| Package | Purpose |
|---|---|
booktabs |
Professional table rules (\toprule, \midrule, \bottomrule) |
longtable |
Multi-page tables |
pdflscape |
Landscape pages for wide tables |
Citations & References¶
| Package | Purpose |
|---|---|
biblatex |
Citation management (IEEE numeric style) |
biber |
Bibliography processor |
hyperref |
Clickable cross-references and URLs |
cleveref |
Smart reference formatting (not yet added) |
Typography¶
| Package | Purpose |
|---|---|
microtype |
Microtypographic enhancements (kerning, protrusion) |
fontenc |
T1 font encoding for correct German umlauts |
lmodern |
Latin Modern fonts |
babel |
Language support (English) |
csquotes |
Context-sensitive quotation marks |
hyphenat |
Hyphenation control |
Code & Algorithms¶
| Package | Purpose |
|---|---|
listings |
Code listings with syntax highlighting |
algorithm2e |
Pseudocode algorithms |
Glossary & Abbreviations¶
| Package | Purpose |
|---|---|
acro |
Abbreviation management (\ac{CPU}, \ac{GPU}) |
glossaries |
Glossary entries (\gls{tensorflow}) |
Writing Conventions¶
Abbreviations¶
Define in abbreviations.tex with acro:
Use in text:
The \ac{CPU} processes inference requests.
% First use: "Central Processing Unit (CPU)"
% Later uses: "CPU"
Glossary Entries¶
Define in glossary.tex:
\newglossaryentry{tensorflow}{
name={TensorFlow},
description={Google's open-source framework for machine learning}
}
Reference in text:
Figures¶
Single figure:
\begin{figure}[htbp]
\centering
\includegraphics[width=0.8\textwidth]{images/example.png}
\caption{Description of the figure}
\label{fig:example}
\end{figure}
Stacked subfigures:
\begin{figure}[htbp]
\centering
\begin{subfigure}[b]{0.9\textwidth}
\centering
\includegraphics[width=\textwidth]{images/iter1.png}
\caption{First iteration}
\label{fig:iter-1}
\end{subfigure}
\vspace{1em}
\begin{subfigure}[b]{0.9\textwidth}
\centering
\includegraphics[width=\textwidth]{images/iter2.png}
\caption{Second iteration}
\label{fig:iter-2}
\end{subfigure}
\caption{Overall figure description}
\label{fig:iterations}
\end{figure}
Reference: Figure~\ref{fig:example} or Figures~\ref{fig:iter-1} and~\ref{fig:iter-2}.
Tables¶
\begin{table}[htbp]
\centering
\caption{Table caption}
\label{tab:example}
\begin{tabular}{@{}lcc@{}}
\toprule
\textbf{Column A} & \textbf{Column B} & \textbf{Column C} \\
\midrule
Row 1 & 123 & 456 \\
Row 2 & 789 & 012 \\
\bottomrule
\end{tabular}
\end{table}
TikZ Diagrams¶
Architecture diagrams use TikZ with custom styles:
\begin{tikzpicture}[
layer/.style={rectangle, rounded corners, draw, fill=#1, text=white,
minimum width=10cm, minimum height=0.8cm, align=center},
arrow/.style={-{Stealth[length=3mm]}, thick, gray!70},
]
\node[layer=blue!70] (a) {Layer 1};
\node[layer=green!60, below=0.4cm of a] (b) {Layer 2};
\draw[arrow] (a) -- (b);
\end{tikzpicture}
Pseudocode¶
\begin{algorithm}[htbp]
\caption{Algorithm name}
\KwIn{Input parameters}
\KwOut{Output result}
initialization\;
\While{condition}{
process data\;
\If{special case}{
handle exception\;
}
}
\Return result\;
\end{algorithm}
Inline Code¶
Use \texttt{} for inline code references:
Units and Numbers¶
Use siunitx for consistent formatting:
The inference took \SI{42.5}{ms}.
A dataset of \num{150000} images was used.
Temperature: \SI{37.2}{\celsius}
Citation Style¶
IEEE numeric style with sorting=none (citations appear in order of first use):
Bibliography entries go in references.bib.
Adding a New Chapter¶
- Create
chapters/N_chaptername.tex - Add to
thesis.tex: - Run
bun run latexto verify it compiles
Common Issues¶
| Issue | Solution |
|---|---|
| Undefined references on first build | Run again — latexmk resolves cross-references in later passes |
| Overfull hbox with long code strings | Use \path or break into shorter segments |
| Glossary not appearing | Ensure \makeglossaries is in preamble and \printglossaries is in document |
| Images not found | Check path relative to latex/ directory (e.g., images/file.png) |
| Missing font warnings | MiKTeX auto-installs on first use — confirm with user prompt |