Maths
Write every equation in Typst syntax.
Quarto reads $...$ and $$...$$ as LaTeX. math: typst tells the extension to read them as Typst instead, so one syntax writes every equation of the document:
extensions:
typst-render:
math: typstThis page sets that option in its own front matter, so every equation below is Typst.
Where the takeover applies
| Output | What happens |
|---|---|
| HTML, Reveal.js, and EPUB | Each equation is compiled to native MathML, so it stays selectable text and scales with the text around it. Typst 0.15 or later is needed. |
| Typst | Each equation passes through unchanged, and the Typst compiler reads it directly. |
| PDF, Word, and the rest | Quarto’s own renderer stays in place, so the equations are read as LaTeX. |
On an older Typst the extension writes a warning and leaves the HTML equations to Quarto. For a document that must produce PDF or Word as well, use the block form in Equations that work everywhere.
math is a global option. Set it under extensions.typst-render in the document or the project, never on a block.
Inline and display
The sum $f(x) = sum_(i=0)^n x_i$ sits in the sentence.
$$
e^(i pi) + 1 = 0
$$The sum sits in the sentence.
Numbering and cross-references
The takeover runs after Quarto has numbered the equations, so labels and @eq- references keep working:
$$
integral_0^1 x^2 dif x = 1/3
$$ {#eq-integral}
See @eq-integral.(1)
See Equation 1.
Typst maths syntax
Typst writes maths with words and parentheses rather than backslashes. The most common differences:
| LaTeX | Typst |
|---|---|
\frac{a}{b} |
a/b |
\sum_{i=0}^{n} |
sum_(i=0)^n |
\int_0^1 x^2\,dx |
integral_0^1 x^2 dif x |
\alpha \beta \gamma |
alpha beta gamma |
\sqrt{x} |
sqrt(x) |
\mathbf{v} |
bold(v) |
\begin{matrix} |
mat(...) |
\begin{cases} |
cases(...) |
A matrix:
$$
A = mat(1, 2; 3, 4)
$$A piecewise definition:
$$
abs(x) = cases(
x & "if" x >= 0,
-x & "if" x < 0,
)
$$The Typst maths reference lists every symbol and function.
Equations that work everywhere
Without the takeover, a {typst} block compiles an equation to an image, and an image reaches every format:
```{typst}
$ sum_(k=1)^n k = (n(n+1))/2 $
```The same holds for an inline expression:
The area is `{typst} $pi r^2$`{alt="pi r squared"} for a circle of radius r.The area is for a circle of radius r.
Choose between the two by output:
math: typstfor HTML and Typst, where the equations stay text.- A block or an inline expression for a document that must also produce PDF, Word, or PowerPoint.
An image carries no text, so give it an alt attribute for a reader who cannot see it.