Mathematics
Mathematics is rendered with KaTeX, which implements a large, fast subset of LaTeX math mode. If you write LaTeX, you already write this.
Inline math
Wrap in single dollars:
The map $f: X \to Y$ is continuous if $f^{-1}(U)$ is open for every open $U$.The map is continuous if is open for every open .
The LaTeX delimiters \( ... \) work too, so sources pasted from a .tex
file render without rewriting.
Display math
Wrap in double dollars on their own lines:
$$
\int_{-\infty}^{\infty} e^{-x^2} \, dx = \sqrt{\pi}
$$\[ ... \] is equivalent. Display math that overflows a narrow screen
scrolls horizontally instead of breaking the layout.
Multi-line and aligned equations
The standard alignment environments work inside display math:
$$
\begin{aligned}
(a+b)^2 &= a^2 + 2ab + b^2 \\
(a-b)^2 &= a^2 - 2ab + b^2
\end{aligned}
$$Also available: cases, matrix / pmatrix / bmatrix / vmatrix,
gathered, array. See the full
list of supported environments.
Common commands
| You write | You get |
|---|---|
\frac{a}{b}, \tfrac{a}{b} | , |
\sqrt{x}, \sqrt[3]{x} | , |
x_i, x^2, x_i^2 | , , |
\sum_{i=1}^{n} | |
\int_a^b, \oint | , |
\lim_{x \to 0} | |
\alpha, \beta, \Gamma, \Omega | |
\mathbb{R}, \mathcal{L}, \mathfrak{g} | |
\leq, \geq, \neq, \approx, \equiv | |
\in, \subset, \cup, \cap, \setminus | |
\to, \mapsto, \implies, \iff | |
\infty, \partial, \nabla, \hbar | |
\langle x, y \rangle | |
\hat{x}, \bar{x}, \vec{v}, \dot{x} |
The authoritative reference is KaTeX's supported functions page.
Limits and behavior
- Errors render in place. A command KaTeX does not know renders the raw source in red rather than failing the page – you see exactly what to fix.
- Math mode only. KaTeX renders math, not LaTeX documents: no
\documentclass, no\section, no text-mode environments. Document structure is Markdown's job; only the mathematics goes in dollars. - No custom macros.
\newcommanddefinitions do not persist across math spans; write commands out in full. - A literal dollar sign is
\$in prose. Inside code spans and code blocks,$is always literal and math is never rendered. - Diagrams (commutative diagrams,
tikzcd) are not math-mode KaTeX – use a TikZ block.