KaTeX Test Code
Introduction
Why KaTeX
- KATEX is a fast, easy-to-use JavaScript library for TeX math rendering on the web.
hexo-theme-butterfly
recommends to use KaTeX rather than MathJax for better performance.- KaTex supports copy and paste of the rendered math expressions.
Reference
- All the #Supported Functions content is copied from upupming’s blog[1][2].
- The auther[1:1] states that this is the revised version of the original content from KaTeX Supported Functions[3].
Note
- I made some changes to the original content[2:1]
- Change #Macros, #HTML, and #Color section to avoid the conflict with markdown syntax. Read the note block for more information in each section.
- Change some expressions according to the KaTeX official site[3:1].
- Add some expressions that is not included in the original content[2:2].
Probably because the upgraded KaTex Documentation was not reflected.
Supported Functions
Accents
a′ a' |
a~ \tilde{a} |
g˚ \mathring{g} |
a′′ a'' |
ac \widetilde{ac} |
AB \overgroup{AB} |
a′ a^{\prime} |
AB \utilde{AB} |
AB \undergroup{AB} |
aˊ \acute{a} |
F \vec{F} |
AB \Overrightarrow{AB} |
yˉ \bar{y} |
AB \overleftarrow{AB} |
AB \overrightarrow{AB} |
a˘ \breve{a} |
AB \underleftarrow{AB} |
AB \underrightarrow{AB} |
aˇ \check{a} |
ac \overleftharpoon{ac} |
ac \overrightharpoon{ac} |
a˙ \dot{a} |
AB \overleftrightarrow{AB} |
AB \overbrace{AB} |
a¨ \ddot{a} |
AB \underleftrightarrow{AB} |
AB \underbrace{AB} |
aˋ \grave{a} |
AB \overline{AB} |
AB \overlinesegment{AB} |
θ^ \hat{\theta} |
AB \underline{AB} |
AB \underlinesegment{AB} |
ac \widehat{ac} |
ac \widecheck{ac} |
X \underbar{X} |
Accent functions inside \text{…}
aˊ \'{a} |
a˜ \~{a} |
a˙ \.{a} |
a˝ \H{a} |
aˋ \`{a} |
aˉ \={a} |
a¨ \"{a} |
aˇ \v{a} |
aˆ \^{a} |
a˘ \u{a} |
a˚ \r{a} |
See also letters
Delimiters
( ) ( ) |
( ) \lparen \rparen |
⌈ ⌉ ⌈ ⌉ |
⌈ ⌉ \lceil \rceil |
↑ \uparrow |
[ ] [ ] |
[ ] \lbrack \rbrack |
⌊ ⌋ ⌊ ⌋ |
⌊ ⌋ \lfloor \rfloor |
↓ \downarrow |
{} \{ \} |
{} \lbrace \rbrace |
⎰⎱ ⎰⎱ |
⎰⎱ \lmoustache \rmoustache |
↕ \updownarrow |
⟨ ⟩ ⟨ ⟩ |
⟨ ⟩ \langle \rangle |
⟮ ⟯ ⟮ ⟯ |
⟮ ⟯ \lgroup \rgroup |
⇑ \Uparrow |
∣ | |
∣ \vert |
┌┐ ┌ ┐ |
┌┐ \ulcorner \urcorner |
⇓ \Downarrow |
∥ \| |
∥ \Vert |
└┘ └ ┘ |
└┘ \llcorner \lrcorner |
⇕ \Updownarrow |
∣ ∣ \lvert \rvert |
∥ ∥ \lVert \rVert |
\left. |
\right. |
\ \backslash |
⟨ ⟩ \lang \rang |
< > \lt \gt |
[[]] ⟦ ⟧ |
[[ ]] \llbracket \rrbracket |
{[ ]} \lBrace \rBrace |
Delimiter Sizing
(AB) \left(\LARGE{AB}\right)
((((( ( \big( \Big( \bigg( \Bigg(
\left |
\big |
\bigl |
\bigm |
\bigr |
\middle |
\Big |
\Bigl |
\Bigm |
\Bigr |
\right |
\bigg |
\biggl |
\biggm |
\biggr |
\Bigg |
\Biggl |
\Biggm |
\Biggr |
Environments
acbd | \begin{matrix} a & b \\ c & d \end{matrix} |
acbd | \begin{array}{cc} a & b \\ c & d \end{array} |
(acbd) | \begin{pmatrix} a & b \\ c & d \end{pmatrix} |
[acbd] | \begin{bmatrix} a & b \\ c & d \end{bmatrix} |
acbd | \begin{vmatrix} a & b \\ c & d \end{vmatrix} |
acbd | \begin{Vmatrix} a & b \\ c & d \end{Vmatrix} |
{acbd} | \begin{Bmatrix} a & b \\ c & d \end{Bmatrix} |
adgbehcfi | \def\arraystretch{1.5} \begin{array}{c:c:c} a & b & c \\ \hline d & e & f \\ \hdashline g & h & i \end{array} |
x={acif bif d | \begin{cases} a &\text{if } b \\ c &\text{if } d \end{cases} |
acif bif d}⇒… | \begin{rcases} a &\text{if } b \\ c &\text{if } d \end{rcases}⇒… |
acbd | \begin{smallmatrix} a & b \\ c & d \end{smallmatrix} |
∑i∈Λ0<j<n | \sum_ {\begin{subarray}{l} i\in\Lambda \\ 0<j<n \end{subarray}} |
ad+e=b+c=f | \begin{aligned} a&=b+c \\ d+e&=f \end{aligned} |
103x+x+313y=2y=4 | \begin{alignedat}{2} 10&x+ &3&y = 2 \\ 3&x+&13&y = 4 \end{alignedat} |
a=be=b+c | \begin{gathered} a=b \\ e=b+c \end{gathered} |
… | … |
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.
The {array}
environment supports |
and :
vertical separators.
The {array}
environment does not yet support \cline
or \multicolumn
.
HTML
NOT WORKING IN HEXO
\href | \href{https://katex.org/}{\KaTeX} |
\url | \url{https://katex.org/} |
Letters and Unicode
Greek Letters
A \Alpha |
B \Beta |
Γ \Gamma |
Δ \Delta |
E \Epsilon |
Z \Zeta |
H \Eta |
Θ \Theta |
I \Iota |
K \Kappa |
Λ \Lambda |
M \Mu |
N \Nu |
Ξ \Xi |
O \Omicron |
Π \Pi |
P \Rho |
Σ \Sigma |
T \Tau |
Υ \Upsilon |
Φ \Phi |
X \Chi |
Ψ \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 |
ο \omicron |
π \pi |
ρ \rho |
σ \sigma |
τ \tau |
υ \upsilon |
ϕ \phi |
χ \chi |
ψ \psi |
ω \omega |
ε \varepsilon |
ϰ \varkappa |
ϑ \vartheta |
ϑ \thetasym |
ϖ \varpi |
ϱ \varrho |
ς \varsigma |
φ \varphi |
ϝ \digamma |
Direct Input :
ABΓΔEZHΘIKΛMNΞOΠPΣTΥΦXΨΩ
αβγδϵζηθικλμνξoπρστυϕχψωεϑϖϱςφϝ
Other Letters
\imath |
∇ \nabla |
ℑ \Im |
R \Reals |
Œ \text{\OE} |
\jmath |
∂ \partial |
ℑ \image |
℘ \wp |
ø \text{\o} |
ℵ \aleph |
⅁ \Game |
k \Bbbk |
℘ \weierp |
Ø \text{\O} |
ℵ \alef |
Ⅎ \Finv |
N \N |
Z \Z |
ß \text{\ss} |
ℵ \alefsym |
C \cnums |
N \natnums |
a˚ \text{\aa} |
ı \text{\i} |
ℶ \beth |
C \Complex |
R \R |
A˚ \text{\AA} |
ȷ \text{\j} |
ℷ \gimel |
ℓ \ell |
ℜ \Re |
æ \text{\ae} |
|
ℸ \daleth |
ℏ \hbar |
ℜ \real |
Æ \text{\AE} |
|
ð \eth |
ℏ \hslash |
R \reals |
œ \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 |
Bold Fractur | A-Z a-z |
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.
Layout
Annotation
5 \cancel{5} |
a+b+cnote \overbrace{a+b+c}^{\text{note}} |
5 \bcancel{5} |
notea+b+c \underbrace{a+b+c}_{\text{note}} |
ABC \xcancel{ABC} |
= \not = |
abc \sout{abc} |
π=dc \boxed{\pi=\frac c d} |
an a_{\angl n} |
an a_\angln |
−78∘ \phase{-78^\circ} |
\tag{hi} x+y^{2x}
x+y2x(hi)
\tag*{hi} x+y^{2x}
x+y2xhi
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
xn x_n |
=! \stackrel{!}{=} |
ba a \atop b |
ex e^x |
=! \overset{!}{=} |
abc a\raisebox{0.25em}{b}c |
uo _u^o |
!= \underset{!}{=} |
xn x_n |
=! \stackrel{!}{=} |
ba a \atop b |
ex e^x |
=! \overset{!}{=} |
a\raisebox{0.25em}{b}c a\raisebox{0.25em}{$b$}c |
uo _u^o |
!= \underset{!}{=} |
a+(cba) a+\left(\vcenter{\hbox{$\frac{\frac a b}c$}}\right) |
$$\sum_{\substack{0<i<m\0<j<n}}$$ \sum_{\substack{0<i<m\\0<j<n}} |
\raisebox
and \hbox
put their argument into text mode. To raise math, nest $…$
delimiters inside the argument as shown above.
\vcenter
can be written without an \hbox
if the strict
rendering option is false. In that case, omit the nested $…$
delimiters.
The second argument of \raisebox
can contain math if it is nested within $…$
delimiters, as in \raisebox{0.25em}{$\frac a b$}
Overlap and Spacing
=/ {=}\mathllap{/\,} |
(x2) \left(x^{\smash{2}}\right) |
/= \mathrlap{\,/}{=} |
y \sqrt{\smash[b]{y}} |
1≤i≤j≤n∑xij \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 |
\thinspace |
³∕₁₈ em space | \mkern{distance} |
space, width = distance |
\: |
⁴∕₁₈ em space | \mskip{distance} |
space, width = distance |
\medspace |
⁴∕₁₈ em space | \hskip{distance} |
space, width = distance |
\; |
⁵∕₁₈ em space | \hspace{distance} |
space, width = distance |
\thickspace |
⁵∕₁₈ em space | \hspace*{distance} |
space, width = distance |
\enspace |
½ em space | \phantom{content} |
space the width and height of content |
\quad |
1 em space | \hphantom{content} |
space the width of content |
\qquad |
2 em space | \vphantom{content} |
space the height of content |
~ |
non-breaking space | \! |
– ³∕₁₈ em space |
\<space> |
space | \negthinspace |
– ³∕₁₈ em space |
\nobreakspace |
non-breaking space | \negmedspace |
– ⁴∕₁₈ em space |
\space |
space | \negthickspace |
– ⁵∕₁₈ em space |
Notes:
distance
will accept any of the KaTeX 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
∀ \forall |
∁ \complement |
∴ \therefore |
∅ \emptyset |
∃ \exists |
⊂ \subset |
∵ \because |
∅ \empty |
∃ \exist |
⊃ \supset |
↦ \mapsto |
∅ \varnothing |
∄ \nexists |
∣ \mid |
→ \to |
⟹ \implies |
∈ \in |
∧ \land |
← \gets |
⟸ \impliedby |
∈ \isin |
∨ \lor |
↔ \leftrightarrow |
⟺ \iff |
∈/ \notin |
∋ \ni |
∋ \notni |
¬ \neg or \lnot |
{xx<21} \Set{ x | x<\frac 1 2 }
{x∣x<5} \set{x|x<5}
Direct Input :
∀ ∴ ∁ ∵ ∃ ∣ ∈ ∉ ∋ ⊂ ⊃ ∧ ∨ ↦ → ← ↔ ¬ ℂ ℍ ℕ ℙ ℚ ℝ
Macros
There shold be a space between {
and #
to avoid the conflict with the markdown syntax.
OR use {% raw %}
and {% endraw %}
to avoid the conflict.
$\gdef\bar#1{#1^2} \bar{x} + \bar{y}$
(X)$\gdef\bar#1{ #1^2} \bar{x} + \bar{y}$
(O){% raw %}$\gdef\bar#1{#1^2} \bar{x} + \bar{y}${% endraw %}
(O)
x2+x2 | \def\foo{x^2} \foo + \foo |
x2+y2 | \gdef\bar#1{ #1^2} \bar{x} + \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 nine arguments: #1, #2, etc.
\gdef
and \global\def
macros will persist between math expressions.
Available functions include:
\char
\mathchoice
\TextOrMath
\@ifstar
\@ifnextchar
\@firstoftwo
\@secondoftwo
\relax
@ is a valid character for commands, as if \makeatletter
were in effect.
Operators
Big Operators
∑ \sum |
∏ \prod |
⨂ \bigotimes |
⋁ \bigvee |
∫ \int |
∐ \coprod |
⨁ \bigoplus |
⋀ \bigwedge |
∬ \iint |
∫ \intop |
⨀ \bigodot |
⋂ \bigcap |
∭ \iiint |
∫ \smallint |
⨄ \biguplus |
⋃ \bigcup |
∮ \oint |
∬ \oiint |
∭ \oiiint |
⨆ \bigsqcup |
Direct Input :
∫ ∬ ∭ ∮ ∏ ∐ ∑ ⋀ ⋁ ⋂ ⋃ ⨀ ⨁ ⨂ ⨄ ⨆
Binary Operators
+ + |
⋅ \cdot |
⋗ \gtrdot |
x(moda) x \pmod a |
− - |
⋅ \cdotp |
⊺ \intercal |
x(a) x \pod a |
/ / |
⋅ \centerdot |
∧ \land |
⊳ \rhd |
∗ * |
∘ \circ |
⋋ \leftthreetimes |
⋌ \rightthreetimes |
⨿ \amalg |
⊛ \circledast |
. \ldotp |
⋊ \rtimes |
& \And |
⊚ \circledcirc |
∨ \lor |
∖ \setminus |
∗ \ast |
⊝ \circleddash |
⋖ \lessdot |
∖ \smallsetminus |
⊼ \barwedge |
⋓ \Cup |
⊲ \lhd |
⊓ \sqcap |
◯ \bigcirc |
∪ \cup |
⋉ \ltimes |
⊔ \sqcup |
mod \bmod |
⋎ \curlyvee |
xmoda x\mod a |
× \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 or \plusmn |
≀ \wr |
Direct Input : +−/∗⋅±×÷∓∔∧∨∩∪≀⊎⊓⊔⊕⊖⊗⊘⊙⊚⊛⊝
Fractions and Binomials
ba \frac{a}{b} |
ba \tfrac{a}{b} |
(a+1a] \genfrac ( ] {2pt}{1}a{a+1} |
ba {a \over b} |
ba \dfrac{a}{b} |
b+1a {a \above{2pt} b+1} |
a/b a/b |
1+b1a \cfrac{a}{1 + \cfrac{1}{b}} |
(kn) \binom{n}{k} |
(kn) \dbinom{n}{k} |
{kn} {n\brace k} |
(kn) {n \choose k} |
(kn) \tbinom{n}{k} |
[kn] {n\brack k} |
Math Operators
arcsin \arcsin |
cosec \cosec |
deg \deg |
sec \sec |
arccos \arccos |
cosh \cosh |
dim \dim |
sin \sin |
arctan \arctan |
cot \cot |
exp \exp |
sinh \sinh |
arctg \arctg |
cotg \cotg |
hom \hom |
sh \sh |
arcctg \arcctg |
coth \coth |
ker \ker |
tan \tan |
arg \arg |
csc \csc |
lg \lg |
tanh \tanh |
ch \ch |
ctg \ctg |
ln \ln |
tg \tg |
cos \cos |
cth \cth |
log \log |
th \th |
f \operatorname{f} | |||
argmax \argmax |
injlim \injlim |
min \min |
lim \varinjlim |
argmin \argmin |
lim \lim |
plim \plim |
lim \varliminf |
det \det |
liminf \liminf |
Pr \Pr |
lim \varlimsup |
gcd \gcd |
limsup \limsup |
projlim \projlim |
lim \varprojlim |
inf \inf |
max \max |
sup \sup |
|
f \operatorname*{f} | f \operatornamewithlimits{f} |
Functions in the bottom six rows of this table can take \limits
.
Square Root
x \sqrt{x}
3x \sqrt[3]{x}
Relations
=! \stackrel{!}{=}
= = |
≑ \doteqdot |
⪅ \lessapprox |
⌣ \smile |
< < |
≖ \eqcirc |
⋚ \lesseqgtr |
⊏ \sqsubset |
> > |
−: \eqcolon or\minuscolon |
⪋ \lesseqqgtr |
⊑ \sqsubseteq |
: : |
−:: \Eqcolon or\minuscoloncolon |
≶ \lessgtr |
⊐ \sqsupset |
≈ \approx |
=: \eqqcolon or\equalscolon |
≲ \lesssim |
⊒ \sqsupseteq |
≈: \approxcolon |
=:: \Eqqcolon or\equalscoloncolon |
≪ \ll |
⋐ \Subset |
≈:: \approxcoloncolon |
≂ \eqsim |
⋘ \lll |
⊂ \subset or \sub |
≊ \approxeq |
⪖ \eqslantgtr |
⋘ \llless |
⊆ \subseteq or \sube |
≍ \asymp |
⪕ \eqslantless |
< \lt |
⫅ \subseteqq |
∍ \backepsilon |
≡ \equiv |
∣ \mid |
≻ \succ |
∽ \backsim |
≒ \fallingdotseq |
⊨ \models |
⪸ \succapprox |
⋍ \backsimeq |
⌢ \frown |
⊸ \multimap |
≽ \succcurlyeq |
≬ \between |
≥ \ge |
⊶ \origof |
⪰ \succeq |
⋈ \bowtie |
≥ \geq |
∋ \owns |
≿ \succsim |
≏ \bumpeq |
≧ \geqq |
∥ \parallel |
⋑ \Supset |
≎ \Bumpeq |
⩾ \geqslant |
⊥ \perp |
⊃ \supset |
≗ \circeq |
≫ \gg |
⋔ \pitchfork |
⊇ \supseteq or \supe |
:≈ \colonapprox |
⋙ \ggg |
≺ \prec |
⫆ \supseteqq |
::≈ \Colonapprox or\coloncolonapprox |
⋙ \gggtr |
⪷ \precapprox |
≈ \thickapprox |
:− \coloneq or\colonminus |
> \gt |
≼ \preccurlyeq |
∼ \thicksim |
::− \Coloneq or\coloncolonminus |
⪆ \gtrapprox |
⪯ \preceq |
⊴ \trianglelefteq |
:= \coloneqq or\colonequals |
⋛ \gtreqless |
≾ \precsim |
≜ \triangleq |
::= \Coloneqq or\coloncolonequals |
⪌ \gtreqqless |
∝ \propto |
⊵ \trianglerighteq |
:∼ \colonsim |
≷ \gtrless |
≓ \risingdotseq |
∝ \varpropto |
::∼ \Colonsim or\coloncolonsim |
≳ \gtrsim |
∣ \shortmid |
△ \vartriangle |
≅ \cong |
⊷ \imageof |
∥ \shortparallel |
⊲ \vartriangleleft |
⋞ \curlyeqprec |
∈ \in or \isin |
∼ \sim |
⊳ \vartriangleright |
⋟ \curlyeqsucc |
⋈ \Join |
∼: \simcolon |
: \vcentcolon or\ratio |
⊣ \dashv |
≤ \le |
∼:: \simcoloncolon |
⊢ \vdash |
:: \dblcolon or\coloncolon |
≤ \leq |
≃ \simeq |
⊨ \vDash |
≐ \doteq |
≦ \leqq |
⌢ \smallfrown |
⊩ \Vdash |
≑ \Doteq |
⩽ \leqslant |
⌣ \smallsmile |
⊪ \Vvdash |
Direct Input:
= < > : ∈ ∋ ∝ ∼ ∽ ≂ ≃ ≅ ≈ ≊ ≍ ≎ ≏ ≐ ≑ ≒ ≓ ≖ ≗ ≜ ≡ ≤ ≥ ≦ ≧ ≫ ≬ ≳ ≷ ≺ ≻ ≼ ≽ ≾ ≿ ⊂ ⊃ ⊆ ⊇ ⊏ ⊐ ⊑ ⊒ ⊢ ⊣ ⊩ ⊪ ⊸ ⋈ ⋍ ⋐ ⋑ ⋔ ⋙ ⋛ ⋞ ⋟ ⌢ ⌣ ⩾ ⪆ ⪌ ⪕ ⪖ ⪯ ⪰ ⪷ ⪸ ⫅ ⫆ ≲ ⩽ ⪅ ≶ ⋚ ⪋ ⟂ ⊨ ⊶ ⊷ ≔ ≕ ⩴
Negated Relations
= \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 |
⋫ \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 |
↼ \leftharpoonup |
⇒ \rArr |
↻ \circlearrowright |
⇇ \leftleftarrows |
→ \rarr |
↶ \curvearrowleft |
↔ \leftrightarrow |
↾ \restriction |
↷ \curvearrowright |
⇔ \Leftrightarrow |
→ \rightarrow |
⇓ \Darr |
⇆ \leftrightarrows |
⇒ \Rightarrow |
⇓ \dArr |
⇋ \leftrightharpoons |
↣ \rightarrowtail |
↓ \darr |
↭ \leftrightsquigarrow |
⇁ \rightharpoondown |
⇠ \dashleftarrow |
⇚ \Lleftarrow |
⇀ \rightharpoonup |
⇢ \dashrightarrow |
⟵ \longleftarrow |
⇄ \rightleftarrows |
↓ \downarrow |
⟸ \Longleftarrow |
⇌ \rightleftharpoons |
⇓ \Downarrow |
⟷ \longleftrightarrow |
⇉ \rightrightarrows |
⇊ \downdownarrows |
⟺ \Longleftrightarrow |
⇝ \rightsquigarrow |
⇃ \downharpoonleft |
⟼ \longmapsto |
⇛ \Rrightarrow |
⇂ \downharpoonright |
⟶ \longrightarrow |
↱ \Rsh |
← \gets |
⟹ \Longrightarrow |
↘ \searrow |
⇔ \Harr |
↫ \looparrowleft |
↙ \swarrow |
⇔ \hArr |
↬ \looparrowright |
→ \to |
↔ \harr |
⇔ \Lrarr |
↞ \twoheadleftarrow |
↩ \hookleftarrow |
⇔ \lrArr |
↠ \twoheadrightarrow |
↪ \hookrightarrow |
↔ \lrarr |
⇑ \Uarr |
⟺ \iff |
↰ \Lsh |
⇑ \uArr |
⟸ \impliedby |
↦ \mapsto |
↑ \uarr |
⟹ \implies |
↗ \nearrow |
↑ \uparrow |
⇐ \Larr |
↚ \nleftarrow |
⇑ \Uparrow |
⇐ \lArr |
⇍ \nLeftarrow |
↕ \updownarrow |
← \larr |
↮ \nleftrightarrow |
⇕ \Updownarrow |
⇝ \leadsto |
⇎ \nLeftrightarrow |
↿ \upharpoonleft |
← \leftarrow |
↛ \nrightarrow |
↾ \upharpoonright |
⇐ \Leftarrow |
⇏ \nRightarrow |
⇈ \upuparrows |
↢ \leftarrowtail |
↖ \nwarrow |
|
↽ \leftharpoondown |
⇒ \Rarr |
Direct Input :
←↑→↓↔↕↖↗↘↙↚↛↞↠↢↣↦↩↪↫↬↭↮↰↱↶↷↺↻↼↽↾↾↿⇀⇁⇂⇃⇄⇆⇇⇈⇉⇊⇋⇌⇍⇎⇏⇐⇑⇒⇓⇔⇕⇚⇛⇝⇠⇢⟵⟶⟷⟸⟹⟺⟼↽
Extensible Arrows
abc \xleftarrow{abc} |
overunder \xrightarrow[under]{over} |
abc \xLeftarrow{abc} |
abc \xRightarrow{abc} |
abc \xleftrightarrow{abc} |
abc \xLeftrightarrow{abc} |
abc \xhookleftarrow{abc} |
abc \xhookrightarrow{abc} |
abc \xtwoheadleftarrow{abc} |
abc \xtwoheadrightarrow{abc} |
abc \xleftharpoonup{abc} |
abc \xrightharpoonup{abc} |
abc \xleftharpoondown{abc} |
abc \xrightharpoondown{abc} |
abc \xleftrightharpoons{abc} |
abc \xrightleftharpoons{abc} |
abc \xtofrom{abc} |
abc \xmapsto{abc} |
abc \xlongequal{abc} |
Extensible arrows all can take an optional argument in the same manner as \xrightarrow[under]{over}
.
Style, Color, Size, and Font
Class Assignment
\mathbin
\mathclose
\mathinner
\mathop
\mathopen
\mathord
\mathpunct
\mathrel
Color
Using #
inside $$
will cause a conflict with the markdown syntax.
To avoid this, use six-digit CSS hexadecimal style without the #
, OR use {% raw %}
and {% endraw %}
tags.
$\textcolor{#FF0000}{F=ma}$
(X)$\textcolor{FF0000}{F=ma}$
(O){% raw %}$\textcolor{#FF0000}{F=ma}${% endraw %}
(O)
Using $
inside $$
will cause a conflict with the markdown syntax. To avoid this, use \textit{}
instead of $…$
.
$\textcolor{red}{$F=ma$}$
(X)$\textcolor{red}{\textit{F=ma}}$
(O)
F=ma \color{blue} F=ma
Note that KaTeX \color
acts like a switch. This aligns with LaTeX and differs from MathJax.
Other KaTeX color functions expect the content to be a function argument:
F=ma \textcolor{blue}{F=ma}
F=ma \textcolor{228B22}{F=ma}
F=ma \colorbox{aqua}{\textit{F=ma}}
F=ma \fcolorbox{red}{aqua}{\textit{F=ma}}
For color definition, KaTeX color functions will accept the standard HTML predefined color names. They will also accept an RGB argument in CSS hexadecimal style. The “#” is optional before a six-digit specification.
Font
Ab0 \mathrm{Ab0} |
Ab0 \mathbf{Ab0} |
Ab \mathit{Ab} |
Ab0 \mathnormal{Ab0} |
Ab0 \textbf{Ab0} |
Ab \textit{Ab} |
Ab0 \textrm{Ab0} |
Ab0 \bf Ab0 |
Ab \it Ab |
Ab0 \rm Ab0 |
Ab0 \bold{Ab0} |
AB \Bbb{AB} |
Ab0 \textnormal{Ab0} |
Ab \boldsymbol{Ab} |
AB \mathbb{AB} |
Ab0 \text{Ab0} |
Ab \bm{Ab} |
Ab0 \frak{Ab0} |
Ab0 \mathsf{Ab0} |
Ab0 \mathtt{Ab0} |
Ab0 \mathfrak{Ab0} |
Ab0 \textsf{Ab0} |
Ab0 \texttt{Ab0} |
AB0 \mathcal{AB0} |
Ab0 \sf Ab0 |
Ab0 \tt Ab0 |
AB \mathscr{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 H. The other versions do not stack, e.g., \mathsf{\mathbf{H}}
will produce H.
In cases where KaTeX fonts do not have a bold glyph, \pmb
can simulate one. For example, \pmb{\mu}
renders as : μ
Size
AB \Huge AB |
AB \normalsize AB |
AB \huge AB |
AB \small AB |
AB \LARGE AB |
AB \footnotesize AB |
AB \Large AB |
AB \scriptsize AB |
AB \large AB |
AB \tiny AB |
Style
i=1∑n \displaystyle\sum_{i=1}^n |
∑i=1n \textstyle\sum_{i=1}^n |
x \scriptstyle x (The size of a first sub/superscript) |
x \scriptscriptstyle x (The size of subsequent sub/superscripts) |
xlim \lim\limits_x |
limx \lim\nolimits_x |
x^2 \verb!x^2! |
\text{…}
will accept nested $…$
fragments and render them in math mode.
Symbols and Punctuation
% comment |
… \dots |
KATEX \KaTeX |
% \% |
⋯ \cdots |
LATEX \LaTeX |
# \# |
⋱ \ddots |
TEX \TeX |
& \& |
… \ldots |
∇ \nabla |
_ \_ |
⋮ \vdots |
∞ \infty |
_ \text{\textunderscore} |
⋯ \dotsb |
∞ \infin |
– \text{--} |
… \dotsc |
✓ \checkmark |
– \text{\textendash} |
⋯ \dotsi |
† \dag |
— \text{---} |
⋯ \dotsm |
† \dagger |
— \text{\textemdash} |
… \dotso |
† \text{\textdagger} |
~ \text{\textasciitilde} |
⋅ \sdot |
‡ \ddag |
^ \text{\textasciicircum} |
… \mathellipsis |
‡ \ddagger |
‘ ` |
… \text{\textellipsis} |
‡ \text{\textdaggerdbl} |
‘ text{\textquoteleft} |
□ \Box |
‡ \Dagger |
‘ \lq |
□ \square |
∠ \angle |
’ \text{\textquoteright} |
■ \blacksquare |
∡ \measuredangle |
′ \rq |
△ \triangle |
∢ \sphericalangle |
“ \text{\textquotedblleft} |
▽ \triangledown |
⊤ \top |
" " |
◃ \triangleleft |
⊥ \bot |
” \text{\textquotedblright} |
▹ \triangleright |
$ \$ |
: \colon |
▽ \bigtriangledown |
$ \text{\textdollar} |
‵ \backprime |
△ \bigtriangleup |
£ \pounds |
′ \prime |
▲ \blacktriangle |
£ \mathsterling |
< \text{\textless} |
▼ \blacktriangledown |
£ \text{\textsterling} |
> \text{\textgreater} |
◀ \blacktriangleleft |
¥ \yen |
| \text{\textbar} |
▶ \blacktriangleright |
√ \surd |
∥ \text{\textbardbl} |
⋄ \diamond |
° \degree |
{ \text{\textbraceleft} |
◊ \Diamond |
° \text{\textdegree} |
} \text{\textbraceright} |
◊ \lozenge |
℧ \mho |
\ \text{\textbackslash} |
⧫ \blacklozenge |
╲ \diagdown |
¶ \text{\P} or \P |
⋆ \star |
╱ \diagup |
§ \text{\S} or \S |
★ \bigstar |
♭ \flat |
§ \text{\sect} |
♣ \clubsuit |
♮ \natural |
c◯ \copyright |
♣ \clubs |
♯ \sharp |
® \circledR |
♢ \diamondsuit |
♡ \heartsuit |
R◯ \text{\textregistered} |
♢ \diamonds |
♡ \hearts |
Ⓢ \circledS |
♠ \spadesuit |
♠ \spades |
a◯ \text{\textcircled a} |
✠ \maltese |
∘− \minuso |
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 | 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 by the CSS of an HTML page.
The effect of style and size:
Unit | textstyle | scriptscript | huge |
---|---|---|---|
em or ex | |||
mu | |||
others |