Typst is a modern markup-based typesetting system that aims to be a friendlier alternative to LaTeX. It compiles plain-text markup into polished PDFs – typically within milliseconds – offers a clean scripting language for automation and comes with live-preview tooling that makes writing documents feel fast and interactive.
In the following short tutorial we install Typst, write our first document, style it with functions, typeset some math, add a bit of scripting logic and finally generate content programmatically. We also take a look at templates and editor tooling.
Installation
Typst ships as a single self-contained binary, so there are no runtime dependencies to worry about.
mise install typst
brew install typst
sudo snap install typst
To verify your installation, check the version:
typst --version
Running the command above should print something like this:
typst 0.15.1 (9dfd3a08)
|
Tip
|
If you don’t want to install anything, you can also try Typst in the browser with the Typst web app. |
A First Document
Typst documents use a lightweight markup syntax that should feel familiar if you have ever written Markdown. We create a file named hello.typ:
= Hello Typst
This is my *first* document written in _Typst_.
- it compiles fast
- it has a clean syntax
- it produces beautiful PDFs
To compile the document into a PDF, we run the compiler:
typst compile hello.typ
On success Typst stays silent and simply writes a hello.pdf next to the source file:
For a tight edit-compile loop, Typst can watch the file and recompile on every change:
typst watch hello.typ
watching hello.typ
writing to hello.pdf
[09:17:47] compiled successfully in 2.84 ms
Styling with Functions
Styling in Typst is done through functions. Instead of cryptic LaTeX commands we call named functions with keyword arguments to set page geometry, fonts and headings. A set rule applies to everything that follows in the current scope, while a show rule transforms how matching elements are rendered.
This is our styled document, saved as styled.typ:
#set page(paper: "a4", margin: 2cm)
#set text(font: "New Computer Modern", size: 11pt)
#set heading(numbering: "1.")
#show heading.where(level: 1): set text(fill: rgb("#1a5fb4"))
= Introduction
Typst lets us configure the whole document with a few rules.
== Motivation
A set rule applies to everything that follows in the current scope.
visit www.hascode.com! :D
Compiling it with typst compile styled.typ produces a numbered, A4-formatted PDF with blue top-level headings:
Math
Math is one of Typst’s strongest selling points: formulas are written inline between dollar signs, and a space after the opening $ turns them into a centered block. No backslashes, no environments. We save this as math.typ:
The sum of the first $n$ natural numbers is
$ sum_(i=1)^n i = (n (n + 1)) / 2 $
|
Tip
|
The equivalent LaTeX would be \sum_{i=1}^{n} i = \frac{n(n+1)}{2}.
|
Scripting and Variables
Typst comes with a built-in scripting language. We switch from markup mode into code mode with the hash symbol and can define variables, call functions and build reusable logic right inside our document.
This is our example script, saved as script.typ:
#let author = "Micha Kops"
#let year = 2026
#let greeting(name) = [Hello, #name!]
= Report #year
#greeting(author)
The sum of the first ten numbers is #{
let total = 0
for i in range(1, 11) {
total += i
}
total
}.
The same using a built-in: #range(1, 11).sum().
After compiling with typst compile script.typ, the rendered page reads:
Report 2026
Hello, Micha Kops!
The sum of the first ten numbers is 55.
The same using a built-in: 55.
Generating Content Programmatically
Because markup and code are interchangeable, we can generate repetitive content from data instead of writing it by hand. Here we render a table from a list of records, saved as table.typ:
#let news = (
("Important news", "2026-04-12"),
("Some other news", "2026-04-12"),
("And news, news, news", "2026-04-12"),
)
#table(
columns: 2,
table.header[*Headline*][*Date*],
..for (title, date) in news { (title, date) },
)
Compiling it with typst compile table.typ renders a two-column table with a header row and one row per news item. Add a record to the list and the table grows with it.
VS Code Extension
For an integrated authoring experience with live preview, auto-completion and inline diagnostics, the Tinymist extension is the recommended choice:
Template Catalogue
Typst ships a package and template ecosystem called Universe. Instead of starting from scratch, we can bootstrap a document from a published template:
typst init @preview/charged-ieee my-paper
Without a version, the latest published release of the template is used. Browse the full catalogue of templates and packages here:
Typst or LaTeX?
Typst shines for new documents: compilation is fast, error messages are readable, and the scripting language is far more approachable than TeX macros. LaTeX still has the edge when a publisher or journal requires its own LaTeX class, or when you depend on one of the many specialized packages that have no Typst counterpart yet. For everything else – reports, notes, slides, CVs, internal documentation – Typst is well worth a try.
Resources
Article Updates
-
2026-12-03: Initial version of the article published.