Skip to content
KernGet the app

Academic writing

How to Structure a Thesis or Long Document in Typst

By Laxmi SolutionsPublished 2 min read

A thesis is easier to write, review and sync when it isn't one long file. Typst handles multi-file projects natively, and a handful of conventions keeps a long document tidy: a template, one file per chapter, labels on everything you reference, and separate numbering for the front matter.

A project layout that scales

thesis/
├── main.typ          # title page, outlines, includes
├── template.typ      # page, text and heading rules
├── refs.bib
├── chapters/
│   ├── introduction.typ
│   ├── methods.typ
│   └── results.typ
├── figures/
└── fonts/            # optional: fonts the template uses

main.typ stays short: it applies the template and pulls in each chapter. Everything about appearance lives in template.typ, so the chapters contain only writing.

Include one file per chapter

#import "template.typ": thesis
#show: thesis.with(title: [Coastal erosion models], author: "A. Student")

#include "chapters/introduction.typ"
#include "chapters/methods.typ"
#include "chapters/results.typ"

#bibliography("refs.bib")

#include evaluates a file and inserts its content, so set and show rules from the template apply inside every chapter. Use #import for files that define functions or variables, and #include for files that are content.

Paths in #include, #image and #bibliography are relative to the file they are written in. A figure used in chapters/results.typ is ../figures/plot.png.

Front matter with roman page numbers

Theses usually number the abstract and contents in roman numerals, then restart at 1 for the first chapter. Change the page numbering and reset the page counter at the switch:

#set page(numbering: "i")
#include "chapters/abstract.typ"
#outline()

#set page(numbering: "1")
#counter(page).update(1)
#include "chapters/introduction.typ"

Outlines: contents, figures and tables

#outline() builds the table of contents from your headings. The same function lists figures or tables by targeting them:

#outline(title: [Contents], depth: 3)
#outline(title: [List of Figures], target: figure.where(kind: image))
#outline(title: [List of Tables], target: figure.where(kind: table))

Label everything you reference

Give each figure, table, equation and heading you mention a label, then reference it with @. Typst numbers them and writes "Figure 3" or "Section 2.1" for you, and the references stay right when you reorder chapters.

#set math.equation(numbering: "(1)")

#figure(
  image("../figures/erosion.png", width: 80%),
  caption: [Shoreline change, 1990–2020.],
) <fig:erosion>

$ v = (Delta x) / (Delta t) $ <eq:rate>

As @fig:erosion shows, the rate in @eq:rate ...
  • A prefix such as fig:, tab:, eq: or sec: keeps labels readable and avoids clashes with citation keys.
  • Headings need numbering (#set heading(numbering: "1.1")) before they can be referenced.

Fonts, versions and backups

  • Keep the fonts your template needs in a fonts folder in the project. Typst on typst.app and Kern both load project fonts automatically, so the document looks the same everywhere.
  • Use Git. Chapters in separate files give readable diffs and fewer conflicts if you co-write. Kern can clone, commit, push and pull with any Git host.
  • Export PDF/A for submission if your university asks for an archival PDF. In Kern this is part of Kern Pro's export options.

Kern's gallery includes a thesis template to start from. For the basics of the language itself, see What Is Typst? and Typst vs LaTeX.