Typst is a markup-based typesetting system designed as a modern alternative to LaTeX. It compiles in milliseconds, has a built-in scripting language, and produces publication-quality PDFs.
Why Typst Matters
LaTeX is 40 years old. Its error messages are cryptic, compilation is slow, and the learning curve is steep. Typst offers the same typesetting quality with instant compilation and readable syntax.
What you get for free:
- Millisecond compilation (vs minutes for LaTeX)
- Readable syntax (Markdown-like)
- Built-in scripting language for dynamic content
- Auto-completion and error messages that make sense
- Bibliography management
- Math typesetting on par with LaTeX
- SVG, PNG, and PDF output
- Templates and packages
Quick Start
# Install
cargo install --locked typst-cli
# Compile to PDF
typst compile document.typ
# Watch mode (recompile on save)
typst watch document.typ
# Or use the web editor at typst.app
Basic Document
#set page(paper: "a4")
#set text(font: "New Computer Modern", size: 11pt)
#set heading(numbering: "1.1")
= Introduction
This is a *Typst* document. It compiles in _milliseconds_.
== Why Typst
LaTeX takes minutes. Typst takes milliseconds.
- Modern syntax
- Instant feedback
- Better error messages
=== Sub-section
Code blocks work naturally:
python
def hello():
print("Hello from Typst!")
== Math
Inline math: $E = m c^2$
Display math:
$ integral_0^infinity e^(-x^2) d x = sqrt(pi) / 2 $
$ sum_(k=0)^n binom(n, k) x^k y^(n-k) = (x + y)^n $
plaintext
Scripting
// Variables and computation
#let project_name = "My Research"
#let version = 3
#let date = datetime.today().display("[month repr:long] [day], [year]")
// Functions
#let alert(body) = {
block(
fill: rgb("#fff3cd"),
inset: 12pt,
radius: 4pt,
[*Warning:* #body]
)
}
= #project_name v#version
Generated on #date.
#alert[This is a draft document.]
// Loops
#for i in range(1, 6) {
[Chapter #i: TBD\ ]
}
// Conditionals
#if version >= 3 [
This is the latest version.
] else [
Please update to the latest version.
]
Tables
#table(
columns: (auto, 1fr, 1fr, 1fr),
inset: 8pt,
align: center,
[*Language*], [*Compile Time*], [*Error Quality*], [*Year*],
[LaTeX], [Minutes], [Cryptic], [1984],
[Typst], [Milliseconds], [Clear], [2023],
[Markdown], [Fast], [N/A], [2004],
[Groff], [Fast], [Moderate], [1990],
)
Academic Paper Template
#set document(
title: "Novel Approach to Widget Optimization",
author: "A. Researcher",
)
#set page(margin: (x: 2.5cm, y: 2.5cm))
#set text(font: "New Computer Modern", size: 11pt)
#set par(justify: true, leading: 0.65em)
#set heading(numbering: "1.1")
// Title block
#align(center)[
#text(17pt, weight: "bold")[Novel Approach to Widget Optimization]
#text(12pt)[A. Researcher]\
#text(10pt, style: "italic")[University of Examples]\
#text(10pt)[researcher\@example.edu]
#v(1em)
*Abstract*\
#text(size: 10pt)[
We present a novel approach to optimizing widgets
that achieves 3x improvement over existing methods.
]
]
= Introduction
Widgets are fundamental to modern computing @smith2024.
= Methodology
Our approach uses the following formula:
$ W_("opt") = argmin_(w in cal(W)) sum_(i=1)^N L(f(x_i; w), y_i) + lambda ||w||_2^2 $
= Results
#figure(
table(
columns: 3,
[*Method*], [*Accuracy*], [*Speed*],
[Baseline], [72.3%], [100ms],
[Ours], [91.7%], [34ms],
),
caption: [Comparison of methods],
)
#bibliography("refs.bib")
Useful Links
- Official Site
- GitHub
- Documentation
- Packages — community templates
Building document automation? Check out my developer tools on Apify for ready-made web scrapers, or email spinov001@gmail.com for custom solutions.
Top comments (0)