---
id: supported
title: Supported Functions
---
This is a list of TeX functions supported by KaTeX. It is sorted into logical groups.
There is a similar [Support Table](support_table.md), sorted alphabetically, that lists both supported and un-supported functions.
|||||
|:---------------------|:---------------------|:---------------------|:--------
|$\begin{matrix} a & b \\ c & d \end{matrix}$ | `\begin{matrix}` `a & b \\` `c & d` `\end{matrix}` |$\begin{array}{cc}a & b\\c & d\end{array}$ | `\begin{array}{cc}` `a & b \\` `c & d` `\end{array}`
|$\begin{pmatrix} a & b \\ c & d \end{pmatrix}$ |`\begin{pmatrix}` `a & b \\` `c & d` `\end{pmatrix}` |$\begin{bmatrix} a & b \\ c & d \end{bmatrix}$ | `\begin{bmatrix}` `a & b \\` `c & d` `\end{bmatrix}`
|$\begin{vmatrix} a & b \\ c & d \end{vmatrix}$ |`\begin{vmatrix}` `a & b \\` `c & d` `\end{vmatrix}` |$\begin{Vmatrix} a & b \\ c & d \end{Vmatrix}$ |`\begin{Vmatrix}` `a & b \\` `c & d` `\end{Vmatrix}`
|$\begin{Bmatrix} a & b \\ c & d \end{Bmatrix}$ |`\begin{Bmatrix}` `a & b \\` `c & d` `\end{Bmatrix}`|$\def\arraystretch{1.5}\begin{array}{c:c:c} a & b & c \\ \hline d & e & f \\ \hdashline g & h & i \end{array}$|`\def\arraystretch{1.5}` `\begin{array}{c:c:c}` `a & b & c \\ \hline` `d & e & f \\` `\hdashline` `g & h & i` `\end{array}`
|$x = \begin{cases} a &\text{if } b \\ c &\text{if } d \end{cases}$ |`x = \begin{cases}` `a &\text{if } b \\` `c &\text{if } d` `\end{cases}`|$\begin{rcases} a &\text{if } b \\ c &\text{if } d \end{rcases}⇒…$ |`\begin{rcases}` `a &\text{if } b \\` `c &\text{if } d` `\end{rcases}⇒…`|
|$\begin{smallmatrix} a & b \\ c & d \end{smallmatrix}$ | `\begin{smallmatrix}` `a & b \\` `c & d` `\end{smallmatrix}` |$$\sum_{\begin{subarray}{l} i\in\Lambda\\ 0`\begin{subarray}{l}` `i\in\Lambda\\` `0`\end{subarray}}`|
The auto-render extension will render the following environments even if they are not inside math delimiters such as `$$…$$`. They are display-mode only.
|||||
|:---------------------|:---------------------|:---------------------|:--------
|$$\begin{equation}\begin{split}a &=b+c\\&=e+f\end{split}\end{equation}$$ |`\begin{equation}` `\begin{split}` `a &=b+c\\` `&=e+f` `\end{split}` `\end{equation}` |$$\begin{align} a&=b+c \\ d+e&=f \end{align}$$ |`\begin{align}` `a&=b+c \\` `d+e&=f` `\end{align}` |
|$$\begin{gather} a=b \\ e=b+c \end{gather}$$ |`\begin{gather}` `a=b \\ ` `e=b+c` `\end{gather}`|$$\begin{alignat}{2}10&x+&3&y=2\\3&x+&13&y=4\end{alignat}$$ | `\begin{alignat}{2}` `10&x+&3&y=2\\` `3&x+&13&y=4` `\end{alignat}`
|$$\begin{CD}A @>a>> B \\@VbVV @AAcA\\C @= D\end{CD}$$ | `\begin{CD}` `A @>a>> B \\` `@VbVV @AAcA \\` `C @= D` `\end{CD}`
#### Other KaTeX Environments
| Environments | How they differ from those shown above |
|:-----------------------------------------------|:------------------|
| `darray`, `dcases`, `drcases` | … apply `displaystyle` |
| `matrix*`, `pmatrix*`, `bmatrix*` `Bmatrix*`, `vmatrix*`, `Vmatrix*` | … take an optional argument to set column alignment, as in `\begin{matrix*}[r]`
| `equation*`, `gather*` `align*`, `alignat*` | … have no automatic numbering. Alternatively, you can use `\nonumber` or `\notag` to omit the numbering for a specific row of the equation. |
| `gathered`, `aligned`, `alignedat` | … do not need to be in display mode. … have no automatic numbering. … must be inside math delimiters in order to be rendered by the auto-render extension. |
Acceptable line separators include: `\\`, `\cr`, `\\[distance]`, and `\cr[distance]`. *Distance* can be written with any of the [KaTeX units](#units).
The `{array}` environment supports `|` and `:` vertical separators.
The `{array}` environment does not yet support `\cline` or `\multicolumn`.
`\tag` can be applied to individual rows of top-level environments
(`align`, `align*`, `alignat`, `alignat*`, `gather`, `gather*`).
## HTML
The following "raw HTML" features are potentially dangerous for untrusted
inputs, so they are disabled by default, and attempting to use them produces
the command names in red (which you can configure via the `errorColor`
[option](options.md)). To fully trust your LaTeX input, you need to pass
an option of `trust: true`; you can also enable just some of the commands
or for just some URLs via the `trust` [option](options.md).
|||
|:----------------|:-------------------|
| $\href{https://katex.org/}{\KaTeX}$ | `\href{https://katex.org/}{\KaTeX}` |
| $\url{https://katex.org/}$ | `\url{https://katex.org/}` |
| $\includegraphics[height=0.8em, totalheight=0.9em, width=0.9em, alt=KA logo]{https://katex.org/img/khan-academy.png}$ | `\includegraphics[height=0.8em, totalheight=0.9em, width=0.9em, alt=KA logo]{https://katex.org/img/khan-academy.png}` |
| $\htmlId{bar}{x}$ …<span id="bar" class="enclosing">…x…</span>… | `\htmlId{bar}{x}` |
| $\htmlClass{foo}{x}$ …<span class="enclosing foo">…x…</span>… | `\htmlClass{foo}{x}` |
| $\htmlStyle{color: red;}{x}$ …<span style="color: red;" class="enclosing">…x…</span>… | `\htmlStyle{color: red;}{x}` |
| $\htmlData{foo=a, bar=b}{x}$ …<span data-foo="a" data-bar="b" class="enclosing">…x…</span>… | `\htmlData{foo=a, bar=b}{x}` |
`\includegraphics` supports `height`, `width`, `totalheight`, and `alt` in its first argument. `height` is required.
HTML extension (`\html`-prefixed) commands are non-standard, so loosening `strict` option for `htmlExtension` is required.
## Letters and Unicode
**Greek Letters**
Direct Input: $Α Β Γ Δ Ε Ζ Η Θ Ι \allowbreak Κ Λ Μ Ν Ξ Ο Π Ρ Σ Τ Υ Φ Χ Ψ Ω$
$\allowbreak α β γ δ ϵ ζ η θ ι κ λ μ ν ξ o π \allowbreak ρ σ τ υ ϕ χ ψ ω ε ϑ ϖ ϱ ς φ ϝ$
|||||
|---------------|-------------|-------------|---------------|
| $\Alpha$ `\Alpha` | $\Beta$ `\Beta` | $\Gamma$ `\Gamma`| $\Delta$ `\Delta`
| $\Epsilon$ `\Epsilon` | $\Zeta$ `\Zeta` | $\Eta$ `\Eta` | $\Theta$ `\Theta`
| $\Iota$ `\Iota` | $\Kappa$ `\Kappa` | $\Lambda$ `\Lambda` | $\Mu$ `\Mu`
| $\Nu$ `\Nu` | $\Xi$ `\Xi` | $\Omicron$ `\Omicron` | $\Pi$ `\Pi`
| $\Rho$ `\Rho` | $\Sigma$ `\Sigma` | $\Tau$ `\Tau` | $\Upsilon$ `\Upsilon`
| $\Phi$ `\Phi` | $\Chi$ `\Chi` | $\Psi$ `\Psi` | $\Omega$ `\Omega`
| $\varGamma$ `\varGamma`| $\varDelta$ `\varDelta` | $\varTheta$ `\varTheta` | $\varLambda$ `\varLambda` |
| $\varXi$ `\varXi`| $\varPi$ `\varPi` | $\varSigma$ `\varSigma` | $\varUpsilon$ `\varUpsilon` |
| $\varPhi$ `\varPhi` | $\varPsi$ `\varPsi`| $\varOmega$ `\varOmega` ||
| $\alpha$ `\alpha`| $\beta$ `\beta` | $\gamma$ `\gamma` | $\delta$ `\delta`|
| $\epsilon$ `\epsilon` | $\zeta$ `\zeta` | $\eta$ `\eta`| $\theta$ `\theta`|
| $\iota$ `\iota` | $\kappa$ `\kappa` | $\lambda$ `\lambda`| $\mu$ `\mu`|
| $\nu$ `\nu`| $\xi$ `\xi` | $\omicron$ `\omicron` | $\pi$ `\pi`|
| $\rho$ `\rho` | $\sigma$ `\sigma` | $\tau$ `\tau`| $\upsilon$ `\upsilon` |
| $\phi$ `\phi` | $\chi$ `\chi`| $\psi$ `\psi`| $\omega$ `\omega`|
| $\varepsilon$ `\varepsilon` | $\varkappa$ `\varkappa` | $\vartheta$ `\vartheta` | $\thetasym$ `\thetasym`
| $\varpi$ `\varpi`| $\varrho$ `\varrho` | $\varsigma$ `\varsigma` | $\varphi$ `\varphi`
| $\digamma $ `\digamma`
**Other Letters**
||||||
|:----------|:----------|:----------|:----------|:----------|
|$\imath$ `\imath`|$\nabla$ `\nabla`|$\Im$ `\Im`|$\Reals$ `\Reals`|$\text{\OE}$ `\text{\OE}`
|$\jmath$ `\jmath`|$\partial$ `\partial`|$\image$ `\image`|$\wp$ `\wp`|$\text{\o}$ `\text{\o}`
|$\aleph$ `\aleph`|$\Game$ `\Game`|$\Bbbk$ `\Bbbk`|$\weierp$ `\weierp`|$\text{\O}$ `\text{\O}`
|$\alef$ `\alef`|$\Finv$ `\Finv`|$\N$ `\N`|$\Z$ `\Z`|$\text{\ss}$ `\text{\ss}`
|$\alefsym$ `\alefsym`|$\cnums$ `\cnums`|$\natnums$ `\natnums`|$\text{\aa}$ `\text{\aa}`|$\text{\i}$ `\text{\i}`
|$\beth$ `\beth`|$\Complex$ `\Complex`|$\R$ `\R`|$\text{\AA}$ `\text{\AA}`|$\text{\j}$ `\text{\j}`
|$\gimel$ `\gimel`|$\ell$ `\ell`|$\Re$ `\Re`|$\text{\ae}$ `\text{\ae}`
|$\daleth$ `\daleth`|$\hbar$ `\hbar`|$\real$ `\real`|$\text{\AE}$ `\text{\AE}`
|$\eth$ `\eth`|$\hslash$ `\hslash`|$\reals$ `\reals`|$\text{\oe}$ `\text{\oe}`
Direct Input: $∂ ∇ ℑ Ⅎ ℵ ℶ ℷ ℸ ⅁ ℏ ð − ∗$
ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖÙÚÛÜÝÞßàáâãäåçèéêëìíîïðñòóôöùúûüýþÿ
₊₋₌₍₎₀₁₂₃₄₅₆₇₈₉ₐₑₕᵢⱼₖₗₘₙₒₚᵣₛₜᵤᵥₓᵦᵧᵨᵩᵪ⁺⁻⁼⁽⁾⁰¹²³⁴⁵⁶⁷⁸⁹ᵃᵇᶜᵈᵉᵍʰⁱʲᵏˡᵐⁿᵒᵖʳˢᵗᵘʷˣʸᶻᵛᵝᵞᵟᵠᵡ
Math-mode Unicode (sub|super)script characters will render as if you had written regular characters in a subscript or superscript. For instance, `A²⁺³` will render the same as `A^{2+3}`.
**Unicode**
The letters listed above will render properly in any KaTeX rendering mode.
In addition, Armenian, Brahmic, Georgian, Chinese, Japanese, and Korean glyphs are always accepted in text mode. However, these glyphs will be rendered from system fonts (not KaTeX-supplied fonts) so their typography may clash.
You can provide rules for CSS classes `.latin_fallback`, `.cyrillic_fallback`, `.brahmic_fallback`, `.georgian_fallback`, `.cjk_fallback`, and `.hangul_fallback` to provide fallback fonts for these languages.
Use of these glyphs may cause small vertical alignment issues: KaTeX has detailed metrics for listed symbols and most Latin, Greek, and Cyrillic letters, but other accepted glyphs are treated as if they are each as tall as the letter M in the current KaTeX font.
If the KaTeX rendering mode is set to `strict: false` or `strict: "warn"` (default), then KaTeX will accept all Unicode letters in both text and math mode.
All unrecognized characters will be treated as if they appeared in text mode, and are subject to the same issues of using system fonts and possibly using incorrect vertical alignment.
For Persian composite characters, a user-supplied [plug-in](https://github.com/HosseinAgha/persian-katex-plugin) is under development.
Any character can be written with the `\char` function and the Unicode code in hex. For example `\char"263a` will render as $\char"263a$.
## Layout
### Annotation
|||
|:------------------------------|:-----
|$\cancel{5}$ `\cancel{5}`|$\overbrace{a+b+c}^{\text{note}}$ `\overbrace{a+b+c}^{\text{note}}`
|$\bcancel{5}$ `\bcancel{5}` |$\underbrace{a+b+c}_{\text{note}}$ `\underbrace{a+b+c}_{\text{note}}`
|$\xcancel{ABC}$ `\xcancel{ABC}`|$\not =$ `\not =`
|$\sout{abc}$ `\sout{abc}`|$\boxed{\pi=\frac c d}$ `\boxed{\pi=\frac c d}`
|$a_{\angl n}$ `$a_{\angl n}`|$a_\angln$ `a_\angln`
|$\phase{-78^\circ}$`\phase{-78^\circ}` |
`\tag{hi} x+y^{2x}`
$$\tag{hi} x+y^{2x}$$
`\tag*{hi} x+y^{2x}`
$$\tag*{hi} x+y^{2x}$$
### Line Breaks
KaTeX 0.10.0+ will insert automatic line breaks in inline math after relations or binary operators such as “=” or “+”. These can be suppressed by `\nobreak` or by placing math inside a pair of braces, as in `{F=ma}`. `\allowbreak` will allow automatic line breaks at locations other than relations or operators.
Hard line breaks are `\\` and `\newline`.
In display math, KaTeX does not insert automatic line breaks. It ignores display math hard line breaks when rendering option `strict: true`.
### Vertical Layout
||||
|:--------------|:----------------------------------------|:-----
|$x_n$ `x_n` |$\stackrel{!}{=}$ `\stackrel{!}{=}`| $a \atop b$ `a \atop b`
|$e^x$ `e^x` |$\overset{!}{=}$ `\overset{!}{=}` | $a\raisebox{0.25em}{$b$}c$ `a\raisebox{0.25em}{$b$}c`
|$_u^o $ `_u^o `| $\underset{!}{=}$ `\underset{!}{=}` | $a+\left(\vcenter{\frac{\frac a b}c}\right)$ `a+\left(\vcenter{\hbox{$\frac{\frac a b}c$}}\right)`
||| $$\sum_{\substack{0
**Spacing**
| Function | Produces | Function | Produces|
|:----------------|:-------------------|:---------------------|:--------------------------------------|
| `\,` | ³∕₁₈ em space | `\kern{distance}` | space, width = *distance*
| `\thinspace` | ³∕₁₈ em space | `\mkern{distance}` | space, width = *distance*
| `\>` | ⁴∕₁₈ em space | `\mskip{distance}` | space, width = *distance*
| `\:` | ⁴∕₁₈ em space | `\hskip{distance}` | space, width = *distance*
| `\medspace` | ⁴∕₁₈ em space | `\hspace{distance}` | space, width = *distance*
| `\;` | ⁵∕₁₈ em space | `\hspace*{distance}` | space, width = *distance*
| `\thickspace` | ⁵∕₁₈ em space | `\phantom{content}` | space the width and height of content
| `\enspace` | ½ em space | `\hphantom{content}` | space the width of content
| `\quad` | 1 em space | `\vphantom{content}` | a strut the height of content
| `\qquad` | 2 em space | `\!` | – ³∕₁₈ em space
| `~` | non-breaking space | `\negthinspace` | – ³∕₁₈ em space
| `\` | space | `\negmedspace` | – ⁴∕₁₈ em space
| `\nobreakspace` | non-breaking space | `\negthickspace` | – ⁵∕₁₈ em space
| `\space` | space | `\mathstrut` | `\vphantom{(}`
**Notes:**
`distance` will accept any of the [KaTeX units](#units).
`\kern`, `\mkern`, `\mskip`, and `\hspace` accept unbraced distances, as in: `\kern1em`.
`\mkern` and `\mskip` will not work in text mode and both will write a console warning for any unit except `mu`.
## Logic and Set Theory
$\gdef\VERT{|}$
|||||
|:--------------------|:--------------------------|:----------------------------|:-----
|$\forall$ `\forall` |$\complement$ `\complement`|$\therefore$ `\therefore` |$\emptyset$ `\emptyset`
|$\exists$ `\exists` |$\subset$ `\subset` |$\because$ `\because` |$\empty$ `\empty`
|$\exist$ `\exist` |$\supset$ `\supset` |$\mapsto$ `\mapsto` |$\varnothing$ `\varnothing`
|$\nexists$ `\nexists`|$\mid$ `\mid` |$\to$ `\to` |$\implies$ `\implies`
|$\in$ `\in` |$\land$ `\land` |$\gets$ `\gets` |$\impliedby$ `\impliedby`
|$\isin$ `\isin` |$\lor$ `\lor` |$\leftrightarrow$ `\leftrightarrow`|$\iff$ `\iff`
|$\notin$ `\notin` |$\ni$ `\ni` |$\notni$ `\notni` |$\neg$ `\neg` or `\lnot`
| | $\Set{ x \VERT x<\frac 1 2 }$ \Set{ x | x<\frac 1 2 } | $\set{x\VERT x<5}$ \set{x|x<5} ||
Direct Input: $∀ ∴ ∁ ∵ ∃ ∣ ∈ ∉ ∋ ⊂ ⊃ ∧ ∨ ↦ → ← ↔ ¬$ ℂ ℍ ℕ ℙ ℚ ℝ
## Macros
|||
|:-------------------------------------|:------
|$\def\foo{x^2} \foo + \foo$ | `\def\foo{x^2} \foo + \foo`
|$\gdef\foo#1{#1^2} \foo{y} + \foo{y}$ | `\gdef\foo#1{#1^2} \foo{y} + \foo{y}`
| | `\edef\macroname#1#2…{definition to be expanded}`
| | `\xdef\macroname#1#2…{definition to be expanded}`
| | `\let\foo=\bar`
| | `\futurelet\foo\bar x`
| | `\global\def\macroname#1#2…{definition}`
| | `\newcommand\macroname[numargs]{definition}`
| | `\renewcommand\macroname[numargs]{definition}`
| | `\providecommand\macroname[numargs]{definition}`
Macros can also be defined in the KaTeX [rendering options](options.md).
Macros accept up to nine arguments: #1, #2, etc.
| KaTeX Unit | Value | KaTeX Unit | Value |
|:---|:---------------------|:---|:----------------|
| em | CSS em | bp | 1/72 inch × F × G|
| ex | CSS ex | pc | 12 KaTeX pt|
| mu | 1/18 CSS em | dd | 1238/1157 KaTeX pt |
| pt | 1/72.27 inch × F × G | cc | 14856/1157 KaTeX pt |
| mm | 1 mm × F × G | nd | 685/642 KaTeX pt |
| cm | 1 cm × F × G | nc | 1370/107 KaTeX pt|
| in | 1 inch × F × G | sp | 1/65536 KaTeX pt |
where:
F = (font size of surrounding HTML text)/(10 pt)
G = 1.21 by default, because KaTeX font-size is normally 1.21 × the surrounding font size. This value [can be overridden](font.md#font-size-and-lengths) by the CSS of an HTML page.
The effect of style and size:
| Unit | textstyle | scriptscript | huge |
|:------:|:-----------------:|:------------:|:------:|
|em or ex|$\rule{1em}{1em}$ |$\scriptscriptstyle\rule{1em}{1em}$ |$\huge\rule{1em}{1em}$
| mu |$\rule{18mu}{18mu}$|$\scriptscriptstyle\rule{18mu}{18mu}$|$\huge\rule{18mu}{18mu}$
| others |$\rule{10pt}{10pt}$|$\scriptscriptstyle\rule{10pt}{10pt}$|$\huge\rule{10pt}{10pt}$