Underleaf Logo
Underleaf
UniversitiesAccessibilityBlogPricing
Log InTry Free

How to Write a Thesis in LaTeX: Complete Guide

April 4, 2026

How to Write a Thesis in LaTeX: Complete Guide

Writing a thesis or dissertation in LaTeX produces a professional, consistently formatted document that handles hundreds of pages without breaking. This guide covers everything from choosing the right document class to managing your bibliography and organizing multi-chapter projects.

Why Use LaTeX for a Thesis?

Most universities offer (or require) LaTeX templates for theses. Even when Word is acceptable, LaTeX has practical advantages for long documents:

  • Stable with long documents — Word can become sluggish or corrupt past 100 pages. LaTeX handles any length.
  • Automatic numbering — Chapters, sections, figures, tables, and equations are all numbered automatically. Reorder a chapter and everything updates.
  • Superior math typesetting — If your thesis involves equations, LaTeX is unmatched.
  • Bibliography management — BibTeX/BibLaTeX handles citations and reference formatting automatically.
  • Version control friendly — LaTeX files are plain text, so they work well with Git for tracking changes.

Choosing a Document Class

The document class determines your thesis layout. Most universities provide their own class file. If yours doesn't, start with one of these:

  • report — The standard LaTeX class for long documents with chapters. A safe default.
  • book — Similar to report but adds front/back matter separation and two-sided printing by default.
  • memoir — A flexible class with extensive customization options. Good if your university doesn't provide a template.
\documentclass[12pt, a4paper]{report} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage{amsmath, amssymb} \usepackage{graphicx} \usepackage[hidelinks]{hyperref} \usepackage[style=authoryear, backend=biber]{biblatex} \addbibresource{references.bib} \title{Your Thesis Title} \author{Your Name} \date{\today} \begin{document} \maketitle \tableofcontents \include{chapters/introduction} \include{chapters/literature-review} \include{chapters/methodology} \include{chapters/results} \include{chapters/conclusion} \printbibliography \end{document}

Organizing a Multi-Chapter Project

Don't put everything in one file. Split your thesis into separate files for each chapter:

thesis/ ├── main.tex % Master file ├── references.bib % Bibliography database ├── chapters/ │ ├── introduction.tex │ ├── literature-review.tex │ ├── methodology.tex │ ├── results.tex │ └── conclusion.tex ├── figures/ │ ├── fig1.pdf │ └── fig2.png └── appendices/ └── appendix-a.tex

Use \include{} for chapters (adds page breaks) or \input{} for smaller sections you want to inline. The \includeonly{} command in the preamble lets you compile just one chapter at a time during writing, which speeds up iteration.

Essential Packages for Thesis Writing

  • geometry — Set page margins. \usepackage[margin=1in]{geometry}
  • setspace — Double-spacing for review drafts. \doublespacing
  • fancyhdr — Custom headers and footers with chapter titles and page numbers.
  • biblatex — Modern bibliography management. Supports every citation style.
  • hyperref — Clickable cross-references and table of contents links. Use [hidelinks] to remove colored boxes.
  • cleveref — Smart cross-references that automatically say "Figure 1" or "Equation 3" instead of just the number.
  • booktabs — Professional-looking tables with \toprule, \midrule, and \bottomrule.
  • subcaption — Sub-figures and sub-tables within a single float.

Front Matter: Title Page, Abstract, and ToC

Most theses need a title page, abstract, acknowledgments, and table of contents before the main chapters. With the report or book class, you can use \frontmatter, \mainmatter, and \backmatter (in book) to switch page numbering styles automatically:

% Title page \begin{titlepage} \centering \vspace*{2cm} {\Huge\bfseries Your Thesis Title\par} \vspace{1.5cm} {\Large Your Name\par} \vspace{1cm} {\large A thesis submitted for the degree of\\ Doctor of Philosophy\par} \vspace{1cm} {\large Department of Computer Science\\ University Name\par} \vfill {\large \today\par} \end{titlepage} % Abstract \begin{abstract} Your abstract text here. Keep it under 300 words. \end{abstract} % Table of contents \tableofcontents \listoffigures \listoftables

Managing Your Bibliography

Create a references.bib file with your BibTeX entries. Use biblatex with biber as the backend for the most flexible and modern approach:

% In your preamble \usepackage[style=authoryear, backend=biber]{biblatex} \addbibresource{references.bib} % In your text As shown by \textcite{smith2024}, the results indicate... This has been confirmed \parencite{jones2023, lee2025}. % At the end of your document \printbibliography

Cross-References Done Right

Label everything and reference it by label. Never hard-code numbers:

\chapter{Results} \label{ch:results} As discussed in \Cref{ch:methodology}, we used... \begin{figure}[htbp] \centering \includegraphics[width=0.8\linewidth]{figures/fig1.pdf} \caption{Accuracy across model sizes.} \label{fig:accuracy} \end{figure} \Cref{fig:accuracy} shows that accuracy improves with scale.

The cleveref package (\Cref) automatically prepends "Figure", "Chapter", or "Table" to the reference. If you reorder chapters or figures, all numbers and labels update on the next compile.

Common Pitfalls

  1. Not using \includeonly — Compiling a full 200-page thesis every time you change a sentence is slow. Use \includeonly{chapters/results} to compile just the chapter you're working on.
  2. Forgetting to run Biber biblatex requires running the biber command between LaTeX compilations. The sequence is: pdflatex → biber → pdflatex → pdflatex. Overleaf handles this automatically.
  3. Overfull hbox warnings — These mean text is overflowing into margins. Fix with \sloppy (globally) or \begin{sloppypar} (locally), or rephrase the sentence.
  4. Placing figures with [H] — The [H] placement specifier from float forces figures to appear exactly where you put them, which usually creates ugly page breaks. Use [htbp] and let LaTeX optimize placement.
  5. Not backing up your work — Use Git or Overleaf's version history. LaTeX files are plain text and diff beautifully.

Writing Your Thesis Faster

A few practical tips for maintaining momentum:

  • Write the introduction last — It's much easier to introduce your work after you know what the work actually contains.
  • Use TODO markers — Add % TODO: cite source for this claim comments so you can keep writing without stopping to look up every reference.
  • Compile often — Catch errors early. A missing brace on page 5 is much easier to find than one buried in 50 pages of new content.
  • Use Overleaf for collaboration — If your advisor needs to comment on drafts, Overleaf's commenting and track-changes features make this straightforward.
Underleaf Logo
Underleaf

Empowering students and researchers with AI-powered tools for academic writing.

Go to appContact us

Company

PricingBlogTutorialsAffiliate Program

Free Tools

Image to LaTeXExcel to LaTeXArXiv to LaTeXTikZ GeneratorThesis GeneratorChrome ExtensionAll Tools

© 2026 Underleaf. All rights reserved.