Typst Guide

Typst Headings

= for level 1, == for level 2, up to ======. #set heading(numbering: ...) for numbering, #show heading for styling.

The basics

= Top-level heading (chapter / section)
== Second level
=== Third level
==== Fourth level

// With numbering
#set heading(numbering: "1.")

= Introduction          // 1. Introduction
== Background           // 1.1. Background
=== Definitions         // 1.1.1. Definitions
= Methods               // 2. Methods

Numbering patterns

PatternOutput
"1."1. 2. 3.
"1.1"1, 1.1, 1.1.1 hierarchy
"I."I. II. III. (Roman)
"A."A. B. C. (letters)
"A.1."A. (level 1), A.1. (level 2)
"1.1.a)"Mixed: 1, 1.1, 1.1.a)

Custom heading styling

// All headings: bold + 14pt
#show heading: set text(weight: "bold", size: 14pt)

// Only level-1 headings: large + colored + spacing
#show heading.where(level: 1): it => {
  v(1.5em)
  text(size: 22pt, weight: "bold", fill: rgb("#1A4480"), it.body)
  v(0.5em)
}

// Level-2: medium + accent
#show heading.where(level: 2): it => {
  v(1em)
  text(size: 14pt, weight: "semibold", fill: rgb("#666"), it.body)
  v(0.3em)
}

// Level-3: italic
#show heading.where(level: 3): it => {
  text(size: 12pt, style: "italic", weight: "bold", it.body)
}

Chapter on new page

#show heading.where(level: 1): it => {
  pagebreak(weak: true)    // soft break (no extra empty page)
  v(2em)
  text(size: 28pt, weight: "bold", it.body)
  v(1em)
}

Cross-references

= Methodology <methodology>

== Data <data>

// Body text:
See @methodology for the approach,
and @data for the dataset details.

// Renders: "See Section 2 for the approach, and Section 2.1 for..."
// (depends on numbering pattern)

Unnumbered heading

#heading(numbering: none)[Acknowledgments]

// Or via outline argument
= Acknowledgments
#set heading(outlined: false)    // also skips TOC

Add "Chapter N:" prefix

#set heading(numbering: "1.")

#show heading.where(level: 1): it => {
  pagebreak(weak: true)
  v(2em)
  text(size: 14pt)[Chapter #counter(heading).display()]
  v(0.3em)
  text(size: 24pt, weight: "bold", it.body)
  v(1em)
}

= Introduction       // renders: "Chapter 1\nIntroduction"
= Background         // "Chapter 2\nBackground"
Try Typst headings live

TypeTeX is a free in-browser Typst editor — write headings, customize their style, see results in milliseconds.

Try TypeTeX free

Frequently Asked Questions

How do I create a heading in Typst?

Use = at the start of a line for a top-level heading: = Introduction. == is second-level (subsection), === is third (subsubsection), up to ====== (sixth level). Equivalent to LaTeX's \section, \subsection, \subsubsection.

How do I number headings in Typst?

Add #set heading(numbering: "1.") to your document. Now headings render as '1. Introduction', '2. Methods', etc. For two-level numbering: "1.1" gives '1.1', '1.2'. For Roman: "I." gives 'I.', 'II.'. Place the #set rule once near the top of your document.

How do I customize heading appearance?

Use a #show rule: #show heading: set text(weight: "bold", size: 14pt). For more control: #show heading: it => { v(1em); text(size: 18pt, weight: "bold", fill: blue, it.body); v(0.5em) }. The 'it' is the heading element being styled.

How do I target only level-1 headings (chapters)?

#show heading.where(level: 1): it => { ... }. Use .where(level: N) to filter by level. Chain conditions with multiple where calls or in one: heading.where(level: 1, numbering: "1.").

How do I make chapters start on a new page?

#show heading.where(level: 1): it => { pagebreak(weak: true); it }. Every level-1 heading triggers a page break before it. Place once at the document top; applies to all level-1 headings.

How do I cross-reference a heading?

Add a label after the heading: = Methodology <methodology>. Then reference: 'See @methodology for details.' Typst auto-fills 'Section 2' (or whatever the heading kind/numbering produces). Hyperref-style automatic linking.

How do I make a heading unnumbered (skip numbering for one heading)?

#heading(numbering: none)[Acknowledgments] — explicit function call with numbering: none. Or, if your numbering rule excludes some heading levels, you can structure with that. Most templates expose an unnumbered() helper.

Can I have different numbering at different levels?

Yes. The numbering pattern applies to nested levels: "1." gives '1', '1.1' (auto-implies sub-numbering), '1.1.1' for deeper. Mixed patterns: "A.1" gives 'A. Heading 1', 'A.1. Subheading 1.1', 'B.', etc. Each character in the pattern represents one level.

How do I add a chapter prefix like 'Chapter 1: Introduction'?

#show heading.where(level: 1): it => [Chapter #counter(heading).display(): #it.body]. Pulls the current heading counter and prefixes 'Chapter' before the title. Templates often expose this as a #chapter() function.

More Typst guides