Delimiters: $…$ (inline), $$…$$ (display), also \(…\) and \[…\].
Inline: $e^{i\pi} + 1 = 0$
Display:
$$\sum_{i=1}^{n} i^3 = \left(\frac{n(n+1)}{2}\right)^2$$
$$\int_{-\infty}^{\infty} e^{-x^2}\,dx = \sqrt{\pi}$$
Matrices and cases:
$$A = \begin{pmatrix} a & b \\ c & d \end{pmatrix} \qquad |x| = \begin{cases} x & x \ge 0 \\ -x & x < 0 \end{cases}$$
Defined in the KaTeX plugin's configuration — add your own there:
\NN $\NN$ | \ZZ $\ZZ$ | \QQ $\QQ$ | \RR $\RR$ | \CC $\CC$ |
$\ce{CO2 + C -> 2 CO}$ renders as $\ce{CO2 + C -> 2 CO}$
$$\ce{SO4^2- + Ba^2+ -> BaSO4 v}$$
Delimiter: backticks. Rendered to MathML on the server, so it is in the page source and needs no JavaScript.
| Input | Output | ||
`x_(1,2)=(-b+-sqrt(b^2-4a c))/(2a)` | `x_(1,2)=(-b+-sqrt(b | 2-4a c))/(2a)` | |
|---|---|---|---|
`sum_(i=1)^n i^3` | `sum_(i=1) | n i | 3` |
`int_0^1 x^2 dx` | `int_0 | 1 x | 2 dx` |
`lim_(x->0) sin(x)/x = 1` | `lim_(x→0) sin(x)/x = 1` | ||
`((a,b),(c,d))` | `1)` | ||
`AA x in RR, EE y in QQ` | `AA x in RR, EE y in QQ` | ||
`A uu B nn C` | `A uu B nn C` | ||
`root(3)(x)` | `root(3)(x)` |
Starting an expression with a space switches it to display style:
` sum_(i=1)^n i^3` gives ` sum_(i=1)^n i^3`
This implementation is server-side PHP, and differs slightly from the original JavaScript:
$$…$$ (that belongs to KaTeX here).„like this”, not text{like this}.(: and :); « and » mean much-less/greater-than.\alpha etc.) — write alpha./ binds loosely after lim: write `lim_(x->0) {:sin(x)/x:}`, not `lim_(x->0) sin(x)/x`.To show the delimiters literally, wrap them in '''' or a code block: * `not math` and $not katex$%%
AsciiMath corpus renders 33 AsciiMath expressions — handy for checking that nothing broke after an upgrade.