Skip to content

Math and equations

Enable math in document frontmatter, then use dollar delimiters for inline and display equations.

AI-assisted, human-approvednovem uses AI to review and keep our documentation up to date.

Available in: document content, including presentations and continuous articles. With latex: true, equations are omitted from e-mail output.

Enable math

Set latex: true in the YAML frontmatter at the very start of the document. This enables math throughout the document. Without it, dollar-delimited equations remain literal text.

This complete example includes a page declaration before the content:

---
title: Equation examples
latex: true
---

{{ page }}
# $title

Energy is given by $E = mc^2$.

$$
x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}
$$

Inline equations

Wrap an equation in a single dollar sign on each side to keep it in the surrounding text:

The identity $x^2 + y^2 = z^2$ relates the sides of a right triangle.
The mean is $\bar{x} = \frac{1}{n}\sum_{i=1}^{n} x_i$.

Keep the equation on one line. Do not put whitespace immediately inside the delimiters: $x^2$ renders as math; $ x^2 $ stays literal. Spaces within the equation, such as $x + y$, are allowed.

Display equations

Use double dollar signs for a separate display equation. The opening $$ must start on its own line, with only optional indentation before it. Both single-line and multiline forms are supported:

$$ E = mc^2 $$

$$
\sum_{i=1}^{n} i = \frac{n(n+1)}{2}
$$

For several aligned equations, put an aligned environment inside the display delimiters. Use & for the alignment point and \\ to separate rows:

$$
\begin{aligned}
a + b &= c \\
a &= c - b
\end{aligned}
$$

Writing Text $$x^2$$ mid-paragraph does not create a display equation.

Commands and delimiters

Equations use the LaTeX math syntax supported by KaTeX, including fractions (\frac{a}{b}), roots (\sqrt{x}), Greek letters (\alpha), subscripts (x_i), superscripts (x^2), and sums (\sum_{i=1}^{n}).

Use $...$ and $$...$$ as the delimiters. The alternative LaTeX delimiters \(...\) and \[...\] are not recognised. This is a math renderer; full LaTeX documents, preambles, and package loading are not supported.

Currency and literal text

With math enabled, $5 and $10 stays literal because the space before the second dollar sign prevents it from closing an equation. Other currency text can be parsed as math: Range $5-$10, Pay $5/$10, and Pay $5, then $x$. all contain a later dollar sign on the same line that can close an equation.

Escape currency dollar signs with a backslash when math is enabled, especially when currency and an inline equation share a line. Inline code and fenced code blocks also keep equation source literal:

The price is \$5 and the model is $x^2$.
Range \$5-\$10.
Write `$x^2$` to show the syntax without rendering it.

Document variables, such as $title and $page, use a dollar prefix without a closing dollar sign. Inline math takes precedence: a variable followed by an inline equation on the same source line becomes part of the equation. For example, See $title and $x^2$ ok. is parsed as one equation containing title and $x^2, rather than a variable followed by an equation.

Put document variables and inline equations on separate source lines:

Report: $title

The model is $x^2$.