Skip to content
Tutorials Center
My learning

Topics

Lesson 37 of 38 ยท Projects and Practice

Project: Structure a Thesis or Book

Plan and build a thesis in LaTeX: front matter, chapter files, appendices, bibliography per chapter, headers, list of figures and a build setup that scales.

A thesis is the longest document most people write with LaTeX, and it is where LaTeX pays off: automatic numbering, a bibliography with hundreds of entries, an index of figures, consistent notation and chapters you can reorder. This project designs a thesis structure that you can adapt to your university's rules.

First check what your university provides. Many supply a class or template that fixes the title page, margins and declaration. If so, keep their files untouched and put your content in chapter files. If you have no template, follow the plan below.

Choosing a class

Use report or book for chapters; memoir or KOMA-Script (scrreprt, scrbook) when you want more control with fewer extra packages. This lesson uses book with openany so that a chapter can start on any page. Use openright if your department wants chapters on right-hand pages.

The folder structure

TEXT
thesis/
  main.tex
  preamble.tex
  frontmatter/
    titlepage.tex
    declaration.tex
    abstract.tex
    acknowledgements.tex
    abbreviations.tex
  chapters/
    01-introduction.tex
    02-background.tex
    03-method.tex
    04-results.tex
    05-discussion.tex
    06-conclusion.tex
  appendices/
    a-data-tables.tex
    b-code-listings.tex
  figures/
    ch03/
    ch04/
  references.bib
  .latexmkrc

Numbered file names keep the chapters in order; per-chapter figure folders prevent clashes.

main.tex

LATEX
\documentclass[12pt, a4paper, twoside, openany]{book}
\input{preamble}
%\includeonly{chapters/03-method}   % uncomment to build only one chapter

\begin{document}

\frontmatter
\pagenumbering{roman}
\input{frontmatter/titlepage}
\input{frontmatter/declaration}
\input{frontmatter/abstract}
\input{frontmatter/acknowledgements}
\tableofcontents
\listoffigures
\listoftables
\printglossary[type=\acronymtype]

\mainmatter
\include{chapters/01-introduction}
\include{chapters/02-background}
\include{chapters/03-method}
\include{chapters/04-results}
\include{chapters/05-discussion}
\include{chapters/06-conclusion}

\appendix
\include{appendices/a-data-tables}
\include{appendices/b-code-listings}

\backmatter
\printbibliography[heading=bibintoc]
\end{document}

\frontmatter numbers pages with roman numerals and leaves chapters unnumbered; \mainmatter restarts at 1 with arabic numerals and numbers chapters; \appendix changes chapter numbering to letters; \backmatter removes chapter numbering again. Compile faster while writing by uncommenting \includeonly. Cross-references to other chapters still work because the .aux files are kept (labels and cross-references).

preamble.tex

LATEX
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{microtype}
\usepackage[a4paper, inner=3.2cm, outer=2.5cm, top=3cm, bottom=3cm]{geometry}
\usepackage{setspace}\onehalfspacing
\usepackage{amsmath, amssymb, amsthm}
\usepackage{graphicx, booktabs, siunitx}
\usepackage{fancyhdr}
\usepackage{csquotes}
\usepackage[backend=biber, style=authoryear, giveninits=true]{biblatex}
\addbibresource{references.bib}
\usepackage[acronym,toc]{glossaries}\makeglossaries
\usepackage[colorlinks=true, allcolors=black]{hyperref}   % black links for print
\usepackage[capitalise]{cleveref}

\pagestyle{fancy}
\fancyhf{}
\fancyhead[LE,RO]{\thepage}
\fancyhead[RE]{\nouppercase{\leftmark}}
\fancyhead[LO]{\nouppercase{\rightmark}}

\newtheorem{theorem}{Theorem}[chapter]
\newtheorem{definition}{Definition}[chapter]

This combines everything from packages, layout and headers and bibliographies. Two-sided layouts use inner and outer margins so that binding space is on the correct side. A thesis printed on paper often uses black link colours (allcolors=black) and an electronic version uses blue; make it a switch with \newif\ifprint.

Notation and macros

Collect notation in preamble.tex or macros.sty:

LATEX
\newcommand{\vect}[1]{\mathbf{#1}}
\newcommand{\norm}[1]{\left\lVert#1\right\rVert}
\DeclareMathOperator*{\argmax}{arg\,max}

Changing a symbol, for example from \vect{x} bold to arrow vectors, becomes a single edit across 200 pages (custom commands).

The stand-in below plans page numbering for the sections of a thesis. It follows the rules above: roman numerals in front matter, arabic from the first chapter, and letters for appendices. It is also a quick way to see how long each part is.

JS Thesis page plan

Press Run (or Ctrl + Enter) to see the console output here.

No output.

Front matter content

Typical items: title page (university logo, title, author, supervisor, degree, date), declaration of originality, abstract (and a translated abstract if required), acknowledgements, table of contents, lists of figures and tables, abbreviations. Put each in its own file; only the title page usually needs custom layout with titlepage and \vfill.

Chapter discipline

  • Start each chapter with a short roadmap and end with a summary.
  • One label prefix per chapter helps navigation: fig:ch3-pipeline.
  • Keep figures vector (PDF) and use \graphicspath{{figures/}}.
  • Per-chapter bibliographies are possible with refsection, but a single list at the end is usual.
  • Write in short paragraphs and run chktex to spot style mistakes.

Final steps

  1. Check the university's checklist for margins, fonts, binding and PDF/A requirements (pdfx package or \usepackage[a-2b]{pdfx}).
  2. Build from scratch with latexmk -C && latexmk -pdf main.tex; fix every warning.
  3. Verify the table of contents, lists and cross-references on the final pages.
  4. Create a read-only archive: sources, data, scripts and the final PDF with a tag in Git (version control).

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. Which command switches to roman page numbers and unnumbered chapters in a book?

    \frontmatter uses roman numerals; \mainmatter switches to arabic numbering and numbered chapters.
  2. 2. What does \includeonly{chapters/03-method} do?

    It speeds up builds while editing; other chapters' numbers remain from earlier runs.
  3. 3. Why use inner and outer margins in geometry for a thesis?

    In a two-sided layout the inner margin sits at the binding and is often larger.
  4. 4. What should you do if the university provides a thesis class?

    Official templates encode the required layout; customise through your own macros, not the class file.

Summary

  • Use book or report, with \frontmatter, \mainmatter, \appendix and \backmatter to control numbering.
  • Split into front matter, chapter and appendix files; \include with \includeonly speeds up work.
  • Centralise packages, notation and styles in one preamble.
  • Plan for glossaries, lists, one bibliography and a reproducible final build.

Next: Practice Exercises