Skip to main content
v2026.11,986 entries · CC-BY 4.0

Thesis Template in LaTeX: Modular Guide

Build a thesis template in latex with modular chapter files, frontmatter macros, biblatex citations, and automated build scripts for TeX Live or Overleaf.

Written and maintained by CASRAI Editorial Board

Published

On this page

Preparing a doctoral dissertation or master’s thesis requires managing hundreds of pages, extensive bibliographies, complex mathematical notation, and strict institutional formatting guidelines. A modular thesis template in latex provides the structural scaffolding necessary to maintain consistency across long-form academic manuscripts while automating cross-referencing, figure numbering, and frontmatter generation.

What it is used for in research

In academic research, a structured latex template for thesis drafting separates substantive content from typographical layout. Rather than manually adjusting margins, running headers, and table formatting across individual chapters, researchers configure global rules once in a centralized preamble. This architectural discipline is particularly critical when managing multi-year dissertation projects involving continuous revisions, co-author feedback, and publisher submissions.

A production-ready latex thesis template serves three core functions in research workflows:

  • Modular Chapter Management: Large academic documents become unmanageable when kept in a single monolithic source file. A modular template breaks the dissertation into isolated chapters and frontmatter files, enabling targeted proofreading and rapid compilation. For researchers evaluating collaborative drafting options, comparing dedicated typesetting engines against cloud platforms like Google Docs vs. Overleaf vs. Word for co-authored manuscript drafting highlights where LaTeX’s deterministic builds offer substantial advantages.
  • Automated Structural Numbering: Equations, figures, tables, and algorithms maintain continuous or chapter-indexed numbering schemes automatically, eliminating broken cross-references during restructuring.
  • Institutional Compliance: Graduate schools enforce rigid regulations regarding binding margins, header positions, abstract placement, and roman versus arabic page numbering. A validated thesis template latex encodes these parameters directly into the document class options.

Install or access (official source only)

To use a thesis in latex template, researchers can either install a local TeX distribution or access a cloud-hosted development environment through official sources:

  • TeX Live (Multi-Platform / Linux / Windows): The official comprehensive TeX distribution maintained by the TeX Users Group (TUG). Available directly from tug.org/texlive. On Debian/Ubuntu Linux systems, install the full distribution using sudo apt-get install texlive-full. On Fedora/RHEL, use sudo dnf install texlive-scheme-full.
  • MacTeX (macOS): The official macOS distribution packaging TeX Live with macOS-specific GUI tools. Download the official installer package directly from the TeX Users Group at tug.org/mactex.
  • MiKTeX (Windows / Cross-Platform): An alternative open-source TeX distribution featuring automatic package installation. Available from miktex.org.
  • Overleaf (Web / Cloud): A collaborative online LaTeX editor providing built-in compilation servers and template hosting. Researchers working in browser environments can review web LaTeX editors for research to assess feature sets across hosted platforms.

When using command-line TeX installations, verify that the TeX package manager (tlmgr) has installed essential packages including koma-script, memoir, biblatex, biber, geometry, booktabs, and microtype by running:

tlmgr info koma-script memoir biblatex biber

Step-by-step task (numbered, with menu names or commands exactly as in the current docs)

The following step-by-step procedure establishes a clean, extensible latex for thesis template architecture using standard LaTeX project conventions.

1. Create the modular directory structure

Organize your project into dedicated subdirectories so that content, configuration, graphics, and bibliography databases remain clearly separated. In your terminal, initialize the following folder hierarchy:

mkdir -p thesis-project/{frontmatter,chapters,appendices,figures,bib}
cd thesis-project
touch main.tex preamble.tex bib/references.bib

2. Configure the root driver file (main.tex)

Open main.tex. This master file acts as the structural spine, loading the preamble and invoking sections sequentially via include. For long-form dissertations, standard document classes like report and book, or modern European typography classes like scrbook (from the KOMA-Script bundle), provide native chapter partitioning.

Populate main.tex with the following root configuration:

documentclass[12pt, a4paper, twoside, openright]{scrbook}

% Load custom configuration and packages
input{preamble.tex}

% Optional: Compile only the active chapter during drafting
% includeonly{chapters/ch02-methods}

begin{document}

% --- FRONT MATTER (Roman numerals, unnumbered chapters) ---
frontmatter
include{frontmatter/titlepage}
include{frontmatter/abstract}
include{frontmatter/acknowledgements}

% --- NAVIGATION TABLES ---
tableofcontents
listoffigures
listoftables

% --- MAIN MATTER (Arabic numerals, numbered chapters) ---
mainmatter
include{chapters/ch01-intro}
include{chapters/ch02-methods}
include{chapters/ch03-results}
include{chapters/ch04-discussion}
include{chapters/ch05-conclusion}

% --- BACK MATTER (Appendices and Bibliography) ---
appendix
include{appendices/app-a-data}

backmatter
printbibliography[heading=bibintoc, title={References}]

end{document}

3. Assemble the preamble configuration (preamble.tex)

Create preamble.tex to centralize package imports, typography options, and macro definitions. Define custom markup macros cleanly using newcommand in LaTeX to ensure repeatable mathematical notation across all chapters.

% Geometry and page layout
usepackage[top=25mm, bottom=25mm, left=30mm, right=20mm, bindingoffset=10mm]{geometry}

% Language and font typography
usepackage[utf8]{inputenc}
usepackage[T1]{fontenc}
usepackage{lmodern}
usepackage{microtype} % Improved justification and optical margin alignment

% Mathematics and scientific notation
usepackage{amsmath, amssymb, amsthm}

% Tables and graphics
usepackage{graphicx}
graphicspath{{figures/}}
usepackage{booktabs}
usepackage{array}

% Bibliography management with BibLaTeX and Biber
usepackage[backend=biber, style=apa, sorting=nyt]{biblatex}
addbibresource{bib/references.bib}

% Navigation, Table of Contents, and Hyperlinks
setcounter{tocdepth}{2}
setcounter{secnumdepth}{2}

usepackage[colorlinks=true, linkcolor=blue, citecolor=blue, urlcolor=blue]{hyperref}

For fine-grained control over sectional depth in the generated navigation pages, refer to our detailed guide on LaTeX contents page syntax and depth.

4. Draft modular chapter files

Create individual chapter files inside the chapters/ directory. Each chapter begins directly with a chapter{...} command and contains standard sectional headings:

% chapters/ch01-intro.tex
chapter{Introduction}
label{ch:intro}

section{Background and Context}
label{sec:intro-bg}
This chapter establishes the research questions and theoretical foundations.

section{Research Objectives}
label{sec:intro-obj}
The investigation assesses reproducible computational workflows across three domains.

When compiling long documents, the include macro writes a dedicated auxiliary file (such as ch01-intro.aux). This enables selective compilation: uncommenting includeonly{chapters/ch02-methods} in main.tex compiles only Chapter 2 while fully preserving global cross-references and page counters.

5. Populate references in the BibLaTeX database

In bib/references.bib, store citations in standard BibTeX / BibLaTeX format. When importing journal publications, researchers can convert identifiers into clean bibliographic entries using the citation from DOI reference tool.

@article{Knuth1984,
  author  = {Donald E. Knuth},
  title   = {Literate Programming},
  journal = {The Computer Journal},
  year    = {1984},
  volume  = {27},
  number  = {2},
  pages   = {97--111},
  doi     = {10.1093/comjnl/27.2.97}
}

6. Compile the complete document via CLI

Generating the finished PDF with accurate bibliographies and cross-references requires a multi-pass compilation sequence. Using the official latexmk build automation utility, run:

latexmk -pdf -synctex=1 -interaction=nonstopmode main.tex

Alternatively, execute the four manual passes sequentially:

pdflatex main.tex
biber main
pdflatex main.tex
pdflatex main.tex

Output and how to read it

Upon successful compilation of your template latex thesis, the build toolchain generates the primary document along with auxiliary index files:

  • main.pdf: The compiled publication-ready thesis document containing all formatted text, high-resolution figures, clickable internal bookmarks, and the bibliography.
  • main.log: The primary diagnostic log file detailing package loading orders, font selection, page break calculations, and warnings.
  • main.toc, main.lof, main.lot: Cached tabular data generated during pass 1 and consumed during pass 2 to populate the Table of Contents, List of Figures, and List of Tables.
  • main.bcf and main.bbl: Control files and formatted reference entries produced by Biber for BibLaTeX.

To inspect build health, search main.log for key diagnostic patterns:

  • Overfull hbox: Indicates that a line of text, mathematical formula, or table cell exceeds the horizontal text margin. The log identifies the exact line number and the excess dimension (for example, Overfull hbox (12.4pt too wide) detected at line 148).
  • Underfull vbox: Indicates that vertical page stretching occurred, typically caused by forced page breaks (newpage) before large floating figures or tables.
  • Undefined references: Signaled by LaTeX Warning: There were undefined references or LaTeX Warning: Citation 'Knuth1984' on page 12 undefined, indicating that an additional compilation pass or a Biber execution is required.

Troubleshooting

When customizing a latex template thesis, configuration errors typically stem from package incompatibilities or stale auxiliary files. The following table outlines verified troubleshooting resolutions:

Observed Issue Root Cause Verified Solution
Question marks (??) appear in place of citations and cross-references Auxiliary reference databases have not been synchronized or Biber was not executed. Execute biber main, followed by two passes of pdflatex main.tex. If errors persist, delete all *.aux and *.bcf files and recompile.
Overfull hbox warnings in bibliography entries Long URLs or digital object identifiers fail to hyphenate within standard justification margins. Load usepackage{xurl} immediately after hyperref to permit URL line breaks across arbitrary characters.
Chapters start on the left (even) page instead of the right (odd) page Two-sided printing layout defaults were overwritten or openright option was omitted. Specify twoside, openright in documentclass. Use cleardoublepage before starting new major divisions.
Package clash: “Package titlesec Error: Entered in horizontal mode” The titlesec package conflicts with KOMA-Script (scrbook) or memoir internal heading routines. Remove titlesec. Use native KOMA-Script heading commands (addtokomafont{chapter}{...}) or Memoir’s built-in chapterstyle.
Page numbers in preliminary frontmatter appear as Arabic instead of Roman The frontmatter macro was placed after the title or abstract, or custom counters were reset incorrectly. Ensure frontmatter appears immediately following begin{document} and precedes all preliminary sections.

Free alternatives (table)

Researchers configuring an academic writing environment have access to multiple free, open-source typesetting platforms and template ecosystems:

Tool / Environment Architecture Primary Strength Ideal Academic Use Case Official Source
TeX Live / MacTeX Local CLI distribution Comprehensive offline engine with deterministic package management and CLI automation. Full PhD dissertations managed with local Git version control. tug.org/texlive
Overleaf (Community / Cloud) Cloud browser environment Real-time collaborative editing, instant visual preview, and centralized cloud backups. Collaborative dissertations and real-time supervisor review cycles. overleaf.com
LyX Visual WYSIWYM GUI processor Combines the visual comfort of a word processor with the structural typesetting power of LaTeX. Researchers seeking LaTeX mathematical rigor without manual code drafting. lyx.org
Quarto / R Markdown Computational publishing system Directly weaves executable code (R, Python, Julia) and live plots into LaTeX dissertation templates. Empirical, data-intensive, and computationally reproducible theses. quarto.org
Typst Modern standalone typesetting engine Sub-second compilation speeds, clean syntax, and integrated scripting without legacy TeX macro complexity. Technical reports, working papers, and modern university dissertation formats. typst.app

FAQ

What is the best document class for a thesis template in LaTeX?

For standard North American dissertations, the classic report or book class provides a reliable foundation. For European typography adhering to DIN standards with built-in binding correction (BCOR), the KOMA-Script scrbook class is widely regarded as the most flexible. Researchers seeking an all-in-one class that eliminates external package dependencies should consider memoir.

What is the difference between input and include in a thesis template?

The include{filename} command issues a clearpage, generates an independent auxiliary file (filename.aux), and allows selective compilation via includeonly{...} in the preamble. It should be used for standalone chapters. In contrast, input{filename} simply pastes the source code inline without page breaks or separate auxiliary files, making it ideal for preamble configurations and short table fragments.

How do I satisfy university binding margin requirements?

When using standard classes, load the geometry package and specify explicit margin dimensions along with a binding offset: usepackage[top=25mm, bottom=25mm, left=30mm, right=20mm, bindingoffset=10mm]{geometry}. In KOMA-Script classes, binding correction is built directly into the class options via BCOR=10mm and DIV=calc.

Should I use BibTeX or BibLaTeX for my dissertation references?

Modern academic workflows strongly favor biblatex paired with the biber backend over legacy BibTeX. BibLaTeX provides full native UTF-8 Unicode character support, seamless integration with complex author-year styles (such as APA 7th and Chicago 18th), and robust handling of digital object identifiers (DOIs) and electronic repository links.

How can I accelerate compilation times when writing a large thesis?

Add includeonly{chapters/ch03-results} to the preamble of your root main.tex file. When compiling, LaTeX will process only the specified chapter while maintaining the global numbering, citations, and table of contents entries established by the cached .aux files of all other chapters.

Sources (official docs)

  • The LaTeX Project. LaTeX2e Documentation and Core Guides. TeX Users Group and The LaTeX Project. Official specifications for document classes, sectional commands, and file inclusion. Read 2026-11-10. https://www.latex-project.org/help/documentation/
  • Kohm, Markus. KOMA-Script: A Versatile LaTeX2e Bundle. Comprehensive TeX Archive Network (CTAN). Technical documentation for scrbook, scrreprt, type area calculation, and binding offsets. Read 2026-11-10. https://ctan.org/pkg/koma-script
  • Wilson, Peter, and Lars Madsen. The Memoir Class for Configurable Typesetting. Comprehensive TeX Archive Network (CTAN). User manual for dissertation layout, chapter styles, and frontmatter management. Read 2026-11-10. https://ctan.org/pkg/memoir
  • Overleaf Team. How to Write a Thesis in LaTeX (Part 1: Basic Structure). Overleaf Documentation / Digital Science. Official guide covering modular project architecture, preamble design, and compilation cycles. Read 2026-11-10. https://www.overleaf.com/learn/latex/How_to_Write_a_Thesis_in_LaTeX_(Part_1):_Basic_Structure

Follow CASRAI

Research-administration guidance, standards updates and independent tool reviews.

Ask CASRAI · free to try

Ask about Thesis Template in LaTeX: Modular Guide

2 free questions a day, no account.

An AI assistant for research: funder rules, compliance, methods and publishing. It links the sources behind its answers and labels answers that come from a web search.

Answers draw on CASRAI's guides and dictionary plus the federal and funder documents we index: Federal Register, Grants.gov, Regulations.gov and UKRI.

Works on this site and inside Claude, Cursor and the AI tools you already use.

Everything CASRAI publishes — this page, the dictionary, the guides and the news — stays open to read, with no account and no card.

Referenced across the research world

University of Cambridge logoColumbia University logoCrossref logoUniversity of Edinburgh logoHarvard University logoUniversity of Oxford logoPrinceton University logoStanford School of Medicine logoUniversity College London logoORCID logoUniversity of Cambridge logoColumbia University logoCrossref logoUniversity of Edinburgh logoHarvard University logoUniversity of Oxford logoPrinceton University logoStanford School of Medicine logoUniversity College London logoORCID logo
  • University of Cambridge logo
  • Columbia University logo
  • Crossref logo
  • University of Edinburgh logo
  • Harvard University logo
  • University of Oxford logo
  • Princeton University logo
  • Stanford School of Medicine logo
  • University College London logo
  • ORCID logo

View CASRAI adoption →