Set up a thesis in LaTeX (bachelor, master, PhD)
Use a class with chapters, such as scrreprt or report. Keep one main file with the preamble and the order of the parts, and load each chapter from its own file with \include. A common order is title page, abstract, table of contents, chapters, appendix, bibliography and declaration.
The snippets use the document class scrreprt.
The main file
The main file contains the preamble and the frame of the thesis. \include{chapters/method} reads chapters/method.tex and starts a new page. \appendix switches the chapter numbers to letters, and heading=bibintoc lists the bibliography in the table of contents. \chapter* gives the declaration a heading without number and without entry in the table of contents. The citations need the sequence pdfLaTeX, Biber, pdfLaTeX, pdfLaTeX.
Complete document:
\documentclass[a4paper, 12pt, oneside]{scrreprt}
\usepackage[T1]{fontenc}
\usepackage[english]{babel}
\usepackage{csquotes}
\usepackage{graphicx}
\usepackage[onehalfspacing]{setspace}
\usepackage[style=authoryear]{biblatex}
\addbibresource{references.bib}
\usepackage[hidelinks]{hyperref}
\title{Measuring Wind Speed with Ultrasound}
\subject{Master's Thesis}
\author{Anna Schmidt}
\date{12 May 2025}
\begin{document}
\pagenumbering{roman}
\maketitle
\begin{abstract}
This thesis examines the measurement error of an ultrasonic wind sensor.
\end{abstract}
\tableofcontents
\cleardoublepage
\pagenumbering{arabic}
\include{chapters/introduction}
\include{chapters/method}
\appendix
\include{chapters/appendix}
\printbibliography[heading=bibintoc]
\chapter*{Declaration of Authorship}
I declare that I have written this thesis on my own and have used no sources other than those listed.
\vspace{2cm}
\noindent\rule{6cm}{0.4pt}\\
Place, date, signature
\end{document}A chapter file
A chapter file such as chapters/introduction.tex starts with \chapter and contains neither \documentclass nor \begin{document}. A \label after the heading lets other chapters refer to it with \ref.
\chapter{Introduction}\label{chap:introduction}
Ultrasonic sensors measure wind speed without moving parts \parencite{weber2019}.
Chapter~\ref{chap:method} describes the test setup.
\section{Research question}
How large is the measurement error at low temperatures?Roman page numbers for the front matter
In the main file above, \pagenumbering{roman} numbers the pages before the first chapter with i, ii, iii, and \pagenumbering{arabic} starts again at 1; the \cleardoublepage before it finishes the current page first. The book classes scrbook and book have \frontmatter, \mainmatter and \backmatter for this. Chapters in the front and back matter get no number in these classes. scrreprt and report do not define these three commands.
Complete document:
\documentclass[a4paper, 12pt]{scrbook}
\begin{document}
\frontmatter
\tableofcontents
\chapter{Preface}
This text is on a page with a roman number.
\mainmatter
\chapter{Introduction}
The first chapter starts on page 1.
\backmatter
\chapter{Afterword}
This chapter has no number.
\end{document}Margins, line spacing and font size
Many institutions prescribe these values. geometry sets the margins, setspace with the option onehalfspacing the line spacing, and the class option 12pt the font size. Footnotes and captions keep single spacing.
This goes into the preamble.
\usepackage[left=3cm, right=2.5cm, top=2.5cm, bottom=2.5cm]{geometry}
\usepackage[onehalfspacing]{setspace}Compile single chapters while writing
\includeonly in the preamble limits the run to the listed chapters. Page numbers, chapter numbers and references to the other chapters stay as they were, because LaTeX still reads the .aux files of the chapters it skips. Remove the line for the final version.
This goes into the preamble.
\includeonly{chapters/method}File chapters/introduction.tex:
\chapter{Introduction}\label{chap:introduction}
Ultrasonic sensors measure wind speed without moving parts \parencite{weber2019}.
Chapter~\ref{chap:method} describes the test setup.
\section{Research question}
How large is the measurement error at low temperatures?File chapters/method.tex:
\chapter{Method}\label{chap:method}
Two transducers face each other at a distance of 20 cm.File chapters/appendix.tex:
\chapter{Raw data}\label{chap:raw-data}
The measured values of all test runs are listed here.File references.bib:
@article{weber2019,
author = {Weber, Ben and Schmidt, Anna},
title = {Ultrasonic Sensors in Wind Tunnels},
journal = {Journal of Example Studies},
year = {2019},
volume = {12},
number = {3},
pages = {45--67}
}Pitfalls
\includealways starts a new page and cannot be used inside an included file. For parts without a page break, use\input; see Split a document into multiple files in LaTeX.- Ask for the rules of your institution before you start. Title page, margins, citation style and the wording of the declaration are often prescribed.
- For a thesis in German, load
\usepackage[ngerman]{babel}. The generated headings then read "Inhaltsverzeichnis", "Abbildungsverzeichnis" and "Literatur".
Compiled with pdfLaTeX from TeX Live 2023.
Related pages
- How-to Split a document into multiple files in LaTeX
- How-to Create a title page in LaTeX
- How-to Create a table of contents in LaTeX
- How-to Create a bibliography in LaTeX with biblatex and Biber
- How-to Page numbers in LaTeX
- Package
fontenc - Package
babel - Package
csquotes - Package
graphicx - Package
setspace