# Math rendering (KaTeX)

Math is rendered inside the app by KaTeX. No network request is made, and
nothing is sent anywhere to typeset a formula.

## Inline

The Pythagorean identity $a^2 + b^2 = c^2$ sits in the run of text, as does
Euler's $e^{i\pi} + 1 = 0$ and a simple fraction $\tfrac{3}{4}$.

Currency is deliberately left alone: a price of $5 or $29.99 in ordinary prose
is not treated as math, because a lone dollar sign is far more often money than
it is a delimiter.

## Display

$$
\int_{-\infty}^{\infty} e^{-x^2}\,dx = \sqrt{\pi}
$$

$$
\frac{\partial}{\partial t}\,u(x,t) = \alpha \frac{\partial^2}{\partial x^2}\,u(x,t)
$$

## Matrices and aligned equations

$$
A = \begin{pmatrix}
1 & 2 & 3 \\
4 & 5 & 6 \\
7 & 8 & 9
\end{pmatrix}
\qquad
A^{\mathsf{T}} = \begin{pmatrix}
1 & 4 & 7 \\
2 & 5 & 8 \\
3 & 6 & 9
\end{pmatrix}
$$

$$
\begin{aligned}
(x + y)^2 &= x^2 + 2xy + y^2 \\
(x - y)^2 &= x^2 - 2xy + y^2 \\
(x + y)(x - y) &= x^2 - y^2
\end{aligned}
$$

## Sums, limits and cases

$$
\sum_{n=1}^{\infty} \frac{1}{n^2} = \frac{\pi^2}{6}
\qquad
\lim_{h \to 0} \frac{f(x+h) - f(x)}{h} = f'(x)
$$

$$
\operatorname{sgn}(x) =
\begin{cases}
-1 & \text{if } x < 0 \\
\phantom{-}0 & \text{if } x = 0 \\
\phantom{-}1 & \text{if } x > 0
\end{cases}
$$

## Chemistry and units

$$
\mathrm{2\,H_2 + O_2 \rightarrow 2\,H_2O}
\qquad
c = 2.998 \times 10^{8}\ \mathrm{m\,s^{-1}}
$$

A single-line display block also works: $$E = mc^2$$
