What Is Typst? A Practical Introduction
By Laxmi SolutionsUpdated 3 min read
Typst is a markup-based typesetting system for papers, reports, theses, resumes and slides. It does the same job as LaTeX, beautiful PDFs with first-class math, with a simpler syntax, readable error messages and compiles fast enough to preview as you type. This guide explains what Typst is and walks through the syntax you need to write your first document.
Typst in one paragraph
Typst is open source (Apache 2.0), written in Rust, and was first released publicly in 2023. You write plain text files ending in .typ; the Typst compiler turns them into PDF, and also PNG, SVG or, experimentally, HTML. Its compiler is incremental: after a change it redoes only the work that change affects, which is why editors can show a live preview.
Markup: the everyday syntax
Common formatting has short syntax, close to Markdown:
| You write | You get |
|---|---|
= Introduction | A heading (== for a subheading) |
*bold* and _italic_ | Strong and emphasised text |
- item / + item | A bullet list / a numbered list |
$x^2$ | Inline math |
$ x^2 $ (with spaces) | Display math on its own line |
<intro> and @intro | A label and a reference to it |
// note | A comment |
Functions, set rules and show rules
Everything beyond basic markup is a function call that starts with #: #image("plot.png"), #table(...), #pagebreak(). Three ideas cover most styling:
- A set rule sets default arguments for every later call:
#set text(size: 11pt)changes all text after it. - A show rule changes how an element looks:
#show heading: set text(fill: blue)colours every heading. #letdefines your own variables and functions, the way\newcommanddoes in LaTeX, but with a real programming language behind it.
A complete document:
#set page(paper: "a4", margin: 2cm)
#set text(size: 11pt)
#set heading(numbering: "1.")
= Introduction
Typst is *fast* and _simple_. A circle's area is $A = pi r^2$.
$ sum_(k=1)^n k = (n(n+1)) / 2 $
#let note(body) = block(fill: luma(235), inset: 8pt, radius: 4pt, body)
#note[Functions are ordinary code.]Math without backslashes
Typst math reads like what you would say aloud. Symbols have names without backslashes (alpha, pi, infinity), a/b is a fraction, and common arrows and relations have shorthands such as ->, <= and !=. Brackets grow to fit their content automatically. Our Typst math cheat sheet lists the common commands next to their LaTeX equivalents.
Packages and templates
Typst Universe is the official package registry. Import a package by name and version, and the compiler downloads it the first time:
#import "@preview/cetz:0.5.2"Packages provide diagrams, slides, resume layouts, theorem boxes and journal templates. The ecosystem is younger and smaller than LaTeX's CTAN, so check that what you need exists before committing a large project.
Where you can write Typst
- The web app at typst.app, from the company behind Typst, with real-time collaboration.
- The command-line compiler, with any text editor, on Windows, macOS and Linux.
- On Android, Kern runs the official Typst compiler on the phone, offline: see how to write Typst on Android. Kern is an independent app, not affiliated with Typst GmbH.
Coming from LaTeX? Read Typst vs LaTeX to decide which to use, and how to convert a LaTeX project to Typst when you're ready to switch.