Function Support in \(\KaTeX\)

This is a list of TeX functions supported by KaTeX. It is sorted into logical groups.

Some behaviors vary by rendering option. strict: true allows only those inputs that work in LaTeX. strict: false or strict: "warn" (default) accept a looser syntax.

For a list of things that are not (yet) in KaTeX, there is a wiki page.

Accents

\(a'\) a' \(\grave{a}\) \grave{a} \(\overleftarrow{AB}\) \overleftarrow{AB} \(\overrightarrow{AB}\) \overrightarrow{AB}
\(a''\) a'' \(\hat{\theta}\) \hat{\theta} \(\underleftarrow{AB}\) \underleftarrow{AB} \(\underrightarrow{AB}\) \underrightarrow{AB}
\(a^{\prime}\) a^{\prime} \(\widehat{ac}\) \widehat{ac} \(\overleftrightarrow{AB}\) \overleftrightarrow{AB} \(\overbrace{AB}\) \overbrace{AB}
\(\acute{a}\) \acute{a} \(\mathring{g}\) \mathring{g} \(\underleftrightarrow{AB}\) \underleftrightarrow{AB} \(\underbrace{AB}\) \underbrace{AB}
\(\bar{y}\) \bar{y} \(\tilde{a}\) \tilde{a} \(\overgroup{AB}\) \overgroup{AB} \(\overlinesegment{AB}\) \overlinesegment{AB}
\(\breve{a}\) \breve{a} \(\widetilde{ac}\) \widetilde{ac} \(\undergroup{AB}\) \undergroup{AB} \(\underlinesegment{AB}\) \underlinesegment{AB}
\(\check{a}\) \check{a} \(\vec{F}\) \vec{F} \(\overleftharpoon{ac}\) \overleftharpoon{ac} \(\overrightharpoon{ac}\) \overrightharpoon{ac}
\(\dot{a}\) \dot{a} \(\overline{AB}\) \overline{AB} \(\Overrightarrow{AB}\) \Overrightarrow{AB} \(\utilde{AB}\) \utilde{AB}
\(\ddot{a}\) \ddot{a} \(\underline{AB}\) \underline{AB} \(\widecheck{ac}\) \widecheck{ac}

Accent functions inside \text{…}

\(\text{\'{a}}\) \'{a} \(\text{\~{a}}\) \~{a} \(\text{\.{a}}\) \.{a} \(\text{\H{a}}\) \H{a}
\(\text{\`{a}}\) \`{a} \(\text{\={a}}\) \={a} \(\text{\"{a}}\) \"{a} \(\text{\v{a}}\) \v{a}
\(\text{\^{a}}\) \^{a} \(\text{\u{a}}\) \u{a} \(\text{\r{a}}\) \r{a}

See also letters.

Delimiters

\((\,)\) ( ) \({\lt\:\gt}\) \lt
\gt
\(⌈\:⌉\) ⌈ ⌉ \(\lceil\:\rceil\) \lceil
\rceil
\(\uparrow\) \uparrow
\([\:]\) [ ] \(\lbrack\:\rbrack\) \lbrack
\rbrack
\(⌊\:⌋\) ⌊ ⌋ \(\lfloor\:\rfloor\) \lfloor
\rfloor
\(\downarrow\) \downarrow
\(\{\,\}\) \{ \} \(\lbrace\:\rbrace\) \lbrace
\rbrace
\(⎰\:⎱\) ⎰⎱ \(\lmoustache\:\rmoustache\) \lmoustache
\rmoustache
\(\updownarrow\) \updownarrow
\(⟨\:⟩\) ⟨ ⟩ \(\langle\:\rangle\) \langle
\rangle
\(⟮\:⟯\) ⟮ ⟯ \(\lgroup\:\rgroup\) \lgroup
\rgroup
\(\Uparrow\) \Uparrow
\(|\) | \(\vert\) \vert ┌ ┐ ┌ ┐ \(\ulcorner \urcorner\) \ulcorner
\urcorner
\(\Downarrow\) \Downarrow
\(\|\) \| \(\Vert\) \Vert └ ┘ └ ┘ \(\llcorner \lrcorner\) \llcorner
\lrcorner
\(\Updownarrow\) \Updownarrow
\(\lvert\;\rvert\) \lvert
\rvert
\(\lVert\;\rVert\) \lVert
\rVert
\left. \right.
\(\backslash\) \backslash

Delimiter Sizing

\(\left(\LARGE{AB}\right)\) \left( \LARGE{AB} \right) \left \big \bigl \bigr
\middle \Big \Bigl \Bigr
\(( \big( \Big( \bigg( \Bigg(\) ( \big( \Big( \bigg( \Bigg( \right \bigg \biggl \biggr
\Bigg \Biggl \Biggr

Environments

\(\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{aligned} a&=b+c \\ d+e&=f \end{aligned}\)
\begin{aligned}
   a&=b+c \\
   d+e&=f
\end{aligned}
\(\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{alignedat}{2}10&x+&3&y=2\\3&x+&13&y=4\end{alignedat}\)
\begin{alignedat}{2}
   10&x+ &3&y = 2 \\
    3&x+&13&y = 4
\end{alignedat}
\(\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{gathered} a=b \\ e=b+c \end{gathered}\)
\begin{gathered}
   a=b \\ 
   e=b+c
\end{gathered}
\(\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}

KaTeX also supports {darray} and {dcases}.

Acceptable line separators include: \\, \cr, \\[distance], and \cr[distance]. Distance can be written with any of the KaTeX units.

KaTeX does not yet support \cline or \multicolumn.

HTML

\(\href{https://khan.github.io/KaTeX/}{katex}\) \href{https://khan.github.io/KaTeX/}{katex}

Greek Letters

Direct Input: Α Β Γ Δ Ε Ζ Η Θ Ι Κ Λ Μ Ν Ξ Ο Π Ρ Σ Τ Υ Φ Χ Ψ Ω
α β γ δ ϵ ζ η θ ι κ λ μ ν ξ o π ρ σ τ υ ϕ χ ψ ω ε ϑ ϖ ϱ ς φ
Γ \Gamma Δ \Delta Θ \Theta Λ \Lambda
Ξ \Xi Π \Pi Σ \Sigma Υ \Upsilon
Φ \Phi Ψ \Psi Ω \Omega
Γ \varGamma Δ \varDelta Θ \varTheta Λ \varLambda
Ξ \varXi Π \varPi Σ \varSigma Υ \varUpsilon
Φ \varPhi Ψ \varPsi Ω \varOmega
α \alpha β \beta γ \gamma δ \delta
ϵ \epsilon ζ \zeta η \eta θ \theta
ι \iota κ \kappa λ \lambda μ \mu
ν \nu ξ \xi o \omicron π \pi
ρ \rho σ \sigma τ \tau υ \upsilon
ϕ \phi χ \chi ψ \psi ω \omega
ε \varepsilon ϰ \varkappa ϑ \vartheta ϖ \varpi
ϱ \varrho ς \varsigma φ \varphi ϝ \digamma

Other Letters

\(\imath\) \imath ð \eth \Im \(\text{\aa}\) \text{\aa} \(\text{\o}\) \text{\o}
\(\jmath\) \jmath \Finv \Re \(\text{\AA}\) \text{\AA} \(\text{\O}\) \text{\O}
\aleph \Game \wp \(\text{\ae}\) \text{\ae} \(\text{\ss}\) \text{\ss}
\beth \ell \partial \(\text{\AE}\) \text{\AE} \(\text{\i}\) \text{\i}
\gimel \hbar \nabla \(\text{\oe}\) \text{\oe} \(\text{\j}\) \text{\j}
\daleth \hslash \(\Bbbk\) \Bbbk \(\text{\OE}\) \text{\OE}
Direct Input: ∂ ð ∇ ℑ Ⅎ ℵ ℶ ℷ ℸ ⅁ ℏ
ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖÙÚÛÜÝÞß
àáâãäåçèéêëìíîïðñòóôöùúûüýþÿ

Unicode Mathematical Alphanumeric Symbols

Item Range Item Range
Bold A-Z a-z 0-9     Double-struck A-Z k
Italic A-Z a-z Sans serif A-Z a-z 0-9
Bold Italic A-Z a-z Sans serif bold A-Z a-z 0-9
Script A-Z Sans serif italic A-Z a-z
Fractur A-Z a-z Monospace A-Z a-z 0-9

Unicode

The letters listed above will render in any KaTeX rendering mode.

If the KaTeX rendering mode is set to strict: false or strict:"warn" (default), then KaTeX will accept all Unicode letters. The letters not listed above will be rendered from system fonts, not KaTeX-supplied fonts, so their typography may clash. They may also cause small vertical alignment issues. KaTeX has detailed metrics for glyphs in Latin, Greek, and Cyrillic, but other glyphs are treated as if they are each as tall as the letter M.

For Persian composite characters, a user-supplied plug-in is under development.


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} \(\boxed{\pi = \frac c d}\) \boxed{\pi=\frac c d}
\(\sout{abc}\) \sout{abc}
\(\not =\) \not =

\tag{hi} x+y^{2x}

\[\tag{hi} x+y^{2x} \]

\tag*{hi} x+y^{2x}

\[\tag*{hi} x+y^{2x} \]

\tag is not yet supported inside environments.

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 placing math inside a pair of braces, as in {F=ma}.

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.

Overlap

\({=}\mathllap{/\,}\) {=}\mathllap{/\,} \(\left(x^{\smash{2}}\right)\) \left(x^{\smash{2}}\right)
\(\mathrlap{\,/}{=}\) \mathrlap{\,/}{=}    \(\sqrt{\smash[b]{y}}\) \sqrt{\smash[b]{y}}
\( \displaystyle \sum_{\mathclap{1\le i\le j\le n}} x_{ij}\) \sum_{\mathclap{1\le i\le j\le n}} x_{ij}

KaTeX also supports \llap, \rlap, and \clap, but they will take only text, not math, as arguments.

Spacing

Function Produces Function Produces
\! – ³∕₁₈ em space \kern{distance} space, width = distance
\, ³∕₁₈ em space \mkern{distance} space, width = distance
\thinspace ³∕₁₈ em space \skip{distance} space, width = distance
\: ⁴∕₁₈ em space \mskip{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
~ non-breaking space
\space space
\nobreakspace non-breaking space
\<space> space

Notes:

{distance} will accept any of the KaTeX units.

\kern, \mkern, 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.


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\raisebox{0.25em}{$b$}c\)  a\raisebox{0.25em}{$b$}c

Also see environments.

Logic and Set Theory

\forall \complement \therefore ¬ \neg or \lnot
\exists \subset \because \emptyset or \varnothing
\nexists \supset \mapsto
\in \mid \to \implies
\notin \land \gets \impliedby
\ni \lor \leftrightarrow \iff
\(\notni\) \notni
Direct Input: ∀ ∴ ∁ ∵ ∃ ∣ ∈ ∉ ∋ ⊂ ⊃ ∧ ∨ ↦ → ← ↔ ¬ ℂ ℍ ℕ ℙ ℚ ℝ ℤ

See also relations and binary operators.

Macros

\(\def\foo{x^2}\foo + \foo\) \def\foo{x^2} \foo + \foo
\(\gdef\bar#1{#1^2} \bar{y} + \bar{y}\) \gdef\bar#1{#1^2} \bar{y} + \bar{y}
\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.

Macros accept up to ten arguments: #1, #2, etc.

\gdef and \global\def macros will persist between math expressions.

Available functions include every function on this page and:

\mathchoice \@ifstar \@firstoftwo \relax
\TextOrMath \@ifnextchar \@secondoftwo

@ is a valid character for commands, as if \makeatletter were in effect.

Big Operators

\sum \prod \bigvee \bigotimes
\int \coprod \bigwedge \bigoplus
\iint \intop \bigcap \bigodot
\iiint \smallint \bigcup \biguplus
\oint \bigsqcup
Direct Input: ∫ ∬ ∭ ∮ ∏ ∐ ∑ ⋀ ⋁ ⋂ ⋃ ⨀ ⨁ ⨂ ⨄ ⨆

Binary Operators

+ + \cdot \gtrdot \(x \pmod a\) x \pmod a
- \cdotp \intercal \(x \pod a\) x \pod a
/ / \(\centerdot\) \centerdot \land \rhd
* \circ \leftthreetimes \rightthreetimes
⨿ \amalg \circledast . \ldotp \rtimes
& \And \circledcirc \lor \setminus
\ast \circleddash \lessdot \(\smallsetminus\) \smallsetminus
\barwedge \Cup \lhd \sqcap
\bigcirc \cup \ltimes \sqcup
mod \bmod \curlyvee mod \mod × \times
\boxdot \curlywedge \mp \unlhd
\boxminus ÷ \div \odot \unrhd
\boxplus \divideontimes \ominus \uplus
\boxtimes \dotplus \oplus \vee
\bullet \doublebarwedge \otimes \veebar
\Cap \doublecap \oslash \wedge
\cap \doublecup ± \pm \wr
Direct Input: + - / * ⋅ ± × ÷ ∓ ∔ ∧ ∨ ∩ ∪ ≀ ⊎ ⊓ ⊔ ⊕ ⊖ ⊗ ⊘ ⊙ ⊚ ⊛ ⊝ ⊞ ⊟ ⊠ ⊡ ⊺ ⊻ ⊼ ⋇ ⋉ ⋊ ⋋ ⋌ ⋎ ⋏ ⋒ ⋓ ⩞

Binomial Coefficients

\(\binom{n}{k}\) \binom{n}{k} \(\dbinom{n}{k}\) \dbinom{n}{k} \(\left\langle n \atop k \right\rangle\) \left\langle
n \atop k
\right\rangle
\({n}\choose{k}\) {n}\choose{k} \(\tbinom{n}{k}\) \tbinom{n}{k}

Fractions

\(\frac{a}{b}\) \frac{a}{b} \(\tfrac{a}{b}\) \tfrac{a}{b} \({a}/{b}\) {a}/{b}
\({a}\over{b}\) {a}\over{b} \(\dfrac{a}{b}\) \dfrac{a}{b} \(\cfrac{a}{1 + \cfrac{1}{b}}\) \cfrac{a}{1 + \cfrac{1}{b}}

Math Operators

\(\operatorname{asin} x\) \operatorname{asin} x
arcsin \arcsin cotg \cotg ln \ln det \det
arccos \arccos coth \coth log \log gcd \gcd
arctan \arctan csc \csc sec \sec inf \inf
arctg \arctg ctg \ctg sin \sin lim \lim
arcctg \arcctg cth \cth sinh \sinh lim inf \liminf
arg \arg deg \deg sh \sh lim sup \limsup
ch \ch dim \dim tan \tan max \max
cos \cos exp \exp tanh \tanh min \min
cosec \cosec hom \hom tg \tg Pr \Pr
cosh \cosh ker \ker th \th sup \sup
cot \cot lg \lg

Functions on the right side of this table can take \limits.

Sqrt

\(\sqrt{x}\)  \sqrt{x}
\(\sqrt[3]{x}\)  \sqrt[3]{x}

Relations

\(\stackrel{!}{=}\) \stackrel{!}{=}
= = \curlyeqsucc \gtrapprox \perp \succapprox
< < \dashv \gtreqless \pitchfork \succcurlyeq
> > \(\dblcolon\) \dblcolon \gtreqqless \prec \succeq
: : \doteq \gtrless \precapprox \succsim
\approx \Doteq \gtrsim \preccurlyeq \Supset
\approxeq \doteqdot \in \preceq \supset
\asymp \eqcirc \Join \precsim \supseteq
\backepsilon \(\eqcolon\) \eqcolon \le \propto \supseteqq
\backsim \(\Eqcolon\) \Eqcolon \leq \risingdotseq \thickapprox
\backsimeq \(\eqqcolon\) \eqqcolon \leqq \shortmid \thicksim
\between \(\Eqqcolon\) \Eqqcolon \leqslant \shortparallel \trianglelefteq
\bowtie \eqsim \lessapprox \sim \triangleq
\bumpeq \eqslantgtr \lesseqgtr \simeq \trianglerighteq
\Bumpeq \eqslantless \lesseqqgtr \(\smallfrown\) \smallfrown \varpropto
\circeq \equiv \lessgtr \(\smallsmile\) \smallsmile \vartriangle
\(\colonapprox\) \colonapprox \fallingdotseq \lesssim \smile \vartriangleleft
\(\Colonapprox\) \Colonapprox \frown \ll \sqsubset \vartriangleright
\(\coloneq\) \coloneq \ge \lll \sqsubseteq \(\vcentcolon\) \vcentcolon
\(\Coloneq\) \Coloneq \geq \llless \sqsupset \vdash
\(\coloneqq\) \coloneqq \geqq < \lt \sqsupseteq \vDash
\(\Coloneqq\) \Coloneqq \geqslant \mid \Subset \Vdash
\(\colonsim\) \colonsim \gg \models \subset \Vvdash
\(\Colonsim\) \Colonsim \ggg \multimap \subseteq
\cong \gggtr \owns \subseteqq
\curlyeqprec > \gt \parallel \succ
Direct Input: = < > : ∈ ∋ ∝ ∼ ∽ ≂ ≃ ≅ ≈ ≊ ≍ ≎ ≏ ≐ ≑ ≒ ≓ ≖ ≗ ≜ ≡ ≤ ≥ ≦ ≧ ≪ ≫ ≬ ≳ ≷ ≺ ≻ ≼ ≽ ≾ ≿ ⊂ ⊃ ⊆ ⊇ ⊏ ⊐ ⊑ ⊒ ⊢ ⊣ ⊩ ⊪ ⊸ ⋈ ⋍ ⋐ ⋑ ⋔ ⋘ ⋙ ⋛ ⋞ ⋟ ⌢ ⌣ ⩾ ⪆ ⪌ ⪕ ⪖ ⪯ ⪰ ⪷ ⪸ ⫅ ⫆ ≲ ⩽ ⪅ ≶ ⋚ ⪋ ⟂ ⊨ ≔ ≕ ⩴ ≘ ≙ ≚ ≛ ≝ ≞ ≟

Negated Relations

\(\not =\) \not =
\gnapprox \ngeqslant \nsubseteq \precneqq
\gneq \ngtr \nsubseteqq \precnsim
\gneqq \nleq \nsucc \subsetneq
\gnsim \nleqq \nsucceq \subsetneqq
\gvertneqq \nleqslant \nsupseteq \succnapprox
\lnapprox \nless \nsupseteqq \succneqq
\lneq \nmid \ntriangleleft \succnsim
\lneqq \notin \ntrianglelefteq \supsetneq
\lnsim \(\notni\) \notni \ntriangleright \supsetneqq
\lvertneqq \nparallel \ntrianglerighteq \varsubsetneq
\ncong \nprec \nvdash \varsubsetneqq
\ne \npreceq \nvDash \varsupsetneq
\neq \nshortmid \nVDash \varsupsetneqq
\ngeq \nshortparallel \nVdash
\ngeqq \nsim \precnapprox
Direct Input: ∉ ∌ ∤ ∦ ≁ ≆ ≠ ≨ ≩ ≮ ≯ ≰ ≱ ⊀ ⊁ ⊈ ⊉ ⊊ ⊋ ⊬ ⊭ ⊮ ⊯ ⋠ ⋡ ⋦ ⋧ ⋨ ⋩ ⋬ ⋭ ⪇ ⪈ ⪉ ⪊ ⪵ ⪶ ⪹ ⪺ ⫋ ⫌

Arrows

\circlearrowleft \Leftarrow \looparrowright \rightrightarrows
\circlearrowright \leftarrowtail \Lsh \rightsquigarrow
\curvearrowleft \leftharpoondown \mapsto \Rrightarrow
\curvearrowright \leftharpoonup \nearrow \Rsh
\dashleftarrow \leftleftarrows \nleftarrow \searrow
\dashrightarrow \leftrightarrow \nLeftarrow \swarrow
\downarrow \Leftrightarrow \nleftrightarrow \to
\Downarrow \leftrightarrows \nLeftrightarrow \twoheadleftarrow
\downdownarrows \leftrightharpoons \nrightarrow \twoheadrightarrow
\downharpoonleft \leftrightsquigarrow \nRightarrow \uparrow
\downharpoonright \Lleftarrow \nwarrow \Uparrow
\gets \longleftarrow \restriction \updownarrow
\hookleftarrow \Longleftarrow \rightarrow \Updownarrow
\hookrightarrow \longleftrightarrow \Rightarrow \upharpoonleft
\iff \Longleftrightarrow \rightarrowtail \upharpoonright
\impliedby \longmapsto \rightharpoondown \upuparrows
\implies \longrightarrow \rightharpoonup
\leadsto \Longrightarrow \rightleftarrows
\leftarrow \looparrowleft \rightleftharpoons
Direct Input: ← ↑ → ↓ ↔ ↕ ↖ ↗ ↘ ↙ ↚ ↛ ↞ ↠ ↢ ↣ ↦ ↩ ↪ ↫ ↬ ↭ ↮ ↰ ↱ ↶ ↷ ↺ ↻ ↼ ↽ ↾ ↾ ↿ ⇀ ⇁ ⇂ ⇃ ⇄ ⇆ ⇇ ⇈ ⇉ ⇊ ⇋ ⇌ ⇍ ⇎ ⇏ ⇐ ⇑ ⇒ ⇓ ⇔ ⇕ ⇚ ⇛ ⇝ ⇠ ⇢ ⟵ ⟶ ⟷ ⟸ ⟹ ⟺ ⟼

Extensible Arrows

\(\xrightarrow{over}\) \xrightarrow{over} \(\xRightarrow{abc}\) \xRightarrow{abc} \(\xrightharpoonup{abc}\) \xrightharpoonup{abc}
\(\xrightarrow[under]{over}\) \xrightarrow[under]{over} \(\xmapsto{abc}\) \xmapsto{abc} \(\xrightharpoondown{abc}\) \xrightharpoondown{abc}
\(\xleftarrow{abc}\) \xleftarrow{abc} \(\xLeftarrow{abc}\) \xLeftarrow{abc} \(\xleftharpoonup{abc}\) \xleftharpoonup{abc}
\(\xleftrightarrow{abc}\) \xleftrightarrow{abc} \(\xLeftrightarrow{abc}\) \xLeftrightarrow{abc} \(\xleftharpoondown{abc}\) \xleftharpoondown{abc}
\(\xhookleftarrow{abc}\) \xhookleftarrow{abc} \(\xhookrightarrow{abc}\) \xhookrightarrow{abc} \(\xrightleftharpoons{abc}\) \xrightleftharpoons{abc}
\(\xtwoheadrightarrow{abc}\) \xtwoheadrightarrow{abc} \(\xlongequal{abc}\) \xlongequal{abc} \(\xleftrightharpoons{abc}\) \xleftrightharpoons{abc}
\(\xtwoheadleftarrow{abc}\) \xtwoheadleftarrow{abc} \(\xtofrom{abc}\) \xtofrom{abc}

Extensible arrows all can take an optional argument in the same manner as \xrightarrow[under]{over}.

Class Assignment

\mathbin \mathclose \mathinner \mathop
\mathopen \mathord \mathpunct \mathrel

Color

As of KaTeX 0.8.1, the behavior of \color depends on the setting of rendering option colorIsTextColor.

When colorIsTextColor is set to: false (default) true
\color behaves as it does in: LaTeX MathJax
(or KaTeX pre 0.8.1)
That is, \color: … acts like a switch. … expects content to be a function argument.
Examples: \(\color{blue} F=ma\) \color{blue} F=ma \(\textcolor{blue}{F=ma}\) \color{blue}{F=ma}
\(\color{#228B22} F=ma \) \color{#228B22} F=ma \(\textcolor{#228B22}{F=ma}\) \color{#228B22}{F=ma}

Other KaTeX color functions always expect the content to be a function argument.

\(\textcolor{blue}{F=ma}\) \textcolor{blue}{F=ma}
\(\textcolor{#228B22}{F=ma}\) \textcolor{#228B22}{F=ma}
\(\colorbox{aqua}{A}\) \colorbox{aqua}{A}
\(\fcolorbox{red}{aqua}{A}\) \fcolorbox{red}{aqua}{A}

For color definition, KaTeX color functions will accept the standard HTML predefined color names. They will also accept an RGB argument in CSS hexa­decimal style.

Font

AB \mathrm{AB} AB \mathbf{AB} AB \mathit{AB} AB \mathsf{AB} AB \mathtt{AB}
AB \textrm{AB} AB \textbf{AB} AB \textit{AB} AB \textsf{AB} AB \texttt{AB}
AB \rm AB AB \bf AB AB \it AB AB \sf AB AB \tt AB
AB \textnormal{AB} AB \bold{AB} AB \Bbb{AB} AB \mathcal{AB} AB \frak{AB}
AB \text{AB} AB \boldsymbol{AB} AB \mathbb{AB} AB \mathscr{AB} AB \mathfrak{AB}
AB \bm{AB}

One can stack font family, font weight, and font shape by using the \textXX versions of the font functions. So \textsf{\textbf{H}} will produce \(\textsf{\textbf{H}}\). The other versions do not stack, e.g., \mathsf{\mathbf{H}} will produce \(\mathsf{\mathbf{H}}\).

Size

\(\Huge AB\) \Huge AB \(\normalsize AB\) \normalsize AB
\(\huge AB\) \huge AB \(\small AB\) \small AB
\(\LARGE AB\) \LARGE AB \(\footnotesize AB\) \footnotesize AB
\(\Large AB\) \Large AB \(\scriptsize AB\) \scriptsize AB
\(\large AB\) \large AB \(\tiny AB\) \tiny AB

Style

\(\displaystyle\sum_{i=1}^n\) \displaystyle\sum_{i=1}^n
\(\textstyle\sum_{i=1}^n\) \textstyle\sum_{i=1}^n
\(\scriptstyle x\) \scriptstyle x The size of a first sub/superscript
\(\scriptscriptstyle x\) \scriptscriptstyle x The size of subsequent sub/superscripts
\(\lim\limits_x\) \lim\limits_x
\(\lim\nolimits_x\) \lim\nolimits_x
\(\verb! x^2 !\) \verb!x^2!
\(\text{x}\) \text{x}

\text{…} will accept nested $…$ fragments or nested \(…\) fragments and render them in math mode.

\text{…} will render an extended range of characters. See Letters inside \text.

Symbols and Punctuation

% comment \Box \dots \checkmark
% \% \square \cdots \dag
# \# \blacksquare \ddots \dagger
& \& \(\triangle\) \triangle \ldots \text{\textdagger}
_ \_ \(\triangledown\) \triangledown \vdots \ddag
_ \text{\textunderscore} \(\triangleleft\) \triangleleft \mathellipsis \ddagger
\text{--} \(\triangleright\) \triangleright \text{\textellipsis} \text{\textdaggerdbl}
\text{\textendash} \(\bigtriangledown\) \bigtriangledown \flat $ \$
\text{---} \(\bigtriangleup\) \bigtriangleup \natural $ \text{\textdollar}
\text{\textemdash} \blacktriangle \sharp £ \pounds
` \blacktriangledown \(\copyright\) \copyright £ \text{\textsterling}
\text{\textquoteleft} \blacktriangleleft ® \circledR ¥ \yen
\(\lq\) \lq \blacktriangleright \(\text{\textregistered}\) \text{\textregistered} \surd
\text{\textquoteright} \diamond \circledS ° \degree
\(\rq\) \rq \Diamond \(\text{\textcircled a}\) \text{\textcircled a} \diagdown
\text{\textquotedblleft} \lozenge \clubsuit \diagup
" " \blacklozenge \diamondsuit \mho
\text{\textquotedblright} \star \heartsuit \maltese
: \colon \bigstar \spadesuit \(\text{\P}\) \text{\P}
\backprime | \text{\textbar} \angle \(\text{\S}\) \text{\S}
\prime \text{\textbardbl} \measuredangle \nabla
< \text{\textless} { \text{\textbraceleft} \sphericalangle \infty
> \text{\textgreater} } \text{\textbraceright} \top \(\text{\textasciitilde}\) \text{\textasciitilde}
\bot
\(\KaTeX\) \KaTeX \(\LaTeX\) \LaTeX \(\TeX\) \TeX
Direct Input: £ ¥ ∇ ∞ · ∠ ∡ ∢ ♠ ♡ ♢ ♣ ♭ ♮ ♯ ✓ ° …  ⋮  ⋯  ⋱  ! ‼

Units

In KaTeX, units are proportioned as they are in TeX.
KaTeX units are different than CSS units.

KaTeX Unit Value KaTeX Unit Value
em CSS em bp \(\frac 1{72}\) inch × F × G
ex CSS ex pc 12 KaTeX pt
mu \(\frac 1{18}\) CSS em dd \(\frac{1238}{1157}\) KaTeX pt
pt \(\frac 1{72.27}\) inch × F × G    cc \(\frac{14856}{1157}\) KaTeX pt
mm 1 mm × F × G nd \(\frac{685}{642}\) KaTeX pt
cm 1 cm × F × G nc \(\frac{1370}{107}\) KaTeX pt
in 1 inch × F × G sp \(\frac 1{65536}\) KaTeX pt
where: F = \(\large \frac{\text{font size of surrounding HTML text}}{10\text{ pt}}\)
G = 1.21 by default, because KaTeX font-size is normally 1.21 × the surrounding font size. This value can be over-ridden by the CSS of an HTML page. For example, on this page, G = 1.0.

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}\)