Typst Table of Contents
One function: #outline(). Auto-renders from your headings. Targets: figures, tables, equations. Depth-limitable. No two-pass compile.
Basic TOC
#outline() // standard TOC
#outline(depth: 2) // limit to two levels deep
#outline(title: [Contents]) // custom title
#outline(title: none) // no titleList of figures and tables
// Main TOC
#outline()
#pagebreak()
// List of figures
#outline(
title: [List of Figures],
target: figure.where(kind: image),
)
#pagebreak()
// List of tables
#outline(
title: [List of Tables],
target: figure.where(kind: table),
)Skip headings from TOC
// One-off: pass outlined to the heading
#heading(outlined: false)[Acknowledgments]
// Or via show rule
#show heading.where(level: 3): set heading(outlined: false)
// All level-3 headings now skip TOCCustomize TOC entry style
#show outline.entry: it => {
// Bold for level 1
if it.level == 1 {
v(0.6em) // extra space before chapters
text(weight: "bold", it)
} else {
it
}
}
#outline()Front matter pagination + TOC
// Title page (no number)
#set page(numbering: none)
... title page content ...
#pagebreak()
// Front matter (Roman numerals)
#set page(numbering: "i")
#counter(page).update(1)
#outline()
#pagebreak()
#outline(title: [List of Figures], target: figure.where(kind: image))
// Main matter (Arabic)
#pagebreak()
#set page(numbering: "1")
#counter(page).update(1)
= Introduction
... main content ...TypeTeX is a free in-browser Typst editor — add an outline, see the TOC update as you write headings.
Try TypeTeX freeFrequently Asked Questions
Place #outline() where you want the TOC. Typst auto-generates from your headings — no two-pass compile needed (unlike LaTeX). The TOC updates immediately as you add or remove headings.
Pass depth: #outline(depth: 2) shows only level-1 and level-2 headings. depth: 1 shows only top-level. depth: 3 shows three levels deep. Default is unlimited (shows all heading levels).
#outline(target: figure) for list of figures. #outline(target: figure.where(kind: table)) for list of tables. Place after the main #outline(). Both auto-populate from your figure() calls.
Pass outlined: false to the heading: #heading(outlined: false)[Acknowledgments]. Or with #set: #set heading(outlined: false) for a section, then turn back on with #set heading(outlined: true).
#outline(title: [Contents]) sets a custom title. #outline(title: none) removes the title entirely. Default is 'Contents' (or 'Outline' depending on language).
Use a #show rule on outline.entry: #show outline.entry: it => { ... }. Inside, you can access it.body (the heading text), it.fill (dot leader), it.page (page number). Customize spacing, fonts, layout per level.
#pagebreak() #outline() #pagebreak(). Or define a wrapper: #let toc-page = { pagebreak(); outline(); pagebreak() }. Common for theses where the TOC sits between front matter and main content.
Typst's #outline() is one function call — no \makeindex / makeglossaries / two-pass compile. Auto-renders. Filters by kind (figure, table). Customizable via #show rules. LaTeX's \tableofcontents requires running pdflatex twice and using the tocloft package for non-trivial customization.