Skip to main content

LaTeX Commands

Mathfields support over 800 LaTeX commands.

To enter a LaTeX command in mathfield press the ESC key or \
to enter LaTeX editing mode. Press ESC to exit LaTeX editing mode.

To examine the LaTeX code for an expression, select it, then press ESC.

Text Zone, Math Zone and Math Style

Math Zone

When in a Math Zone, the content is laid out using typesetting rules specific to math.

For example, variables such as x are displayed in italics, an appropriate amount of space is inserted around some letters such as f to improve their legibility, and white spaces are ignored.

In a Math Zone, the layout and size of some math elements is adjusted based on the context in which they are used. For example, superscripts and subscripts are displayed using a smaller font size: 2^2.

Inside a Math Zone, the Math Style indicate the size of the font used to display the content, and some layout options, such as placement of the limits of a sum or integral.

To override the default Math Style, use the following commands:

Math Style
\displaystyle

For equations in their own paragraph/block
\displaystyle \sum_{i=0}^n \frac{a_i}{1+x}\displaystyle \sum_{i=0}^n \frac{a_i}{1+x}
\textstyle

Confusingly, for inline math, not for text content
\textstyle \sum_{i=0}^n \frac{a_i}{1+x}\textstyle \sum_{i=0}^n \frac{a_i}{1+x}
\scriptstyle

For subscripts and superscripts
\scriptstyle \sum_{i=0}^n \frac{a_i}{1+x}\scriptstyle \sum_{i=0}^n \frac{a_i}{1+x}
\scriptscriptstyle

For subscripts and superscripts of subscripts and superscripts
\scriptscriptstyle \sum_{i=0}^n \frac{a_i}{1+x}\scriptscriptstyle \sum_{i=0}^n \frac{a_i}{1+x}

Text Zone

To include some textual content, use the \text{} or \textrm{} commands to switch to a Text Zone. Inside a Text Zone, white spaces are preserved and the spacing of characters is not adjusted.

if and only if x > 0
$$if and only if x > 0$$
\textrm{if and only if } x > 0
$$\textrm{if and only if } x > 0$$

The \text{} command will use the font defined by the CSS font-family property of the enclosing mathfield. The size of the text will adjust depending on the current math style (smaller in superscript/subscript).

\text{Donald Knuth created LaTeX}
$$\text{Donald Knuth created LaTeX}$$

The \textrm{} command works like \text{} but will use a serif (roman) font.

\textrm{Donald Knuth is the author of “The Art of Computer Programming”}
$$\textrm{Donald Knuth is the author of “The Art of Computer Programming”}$$

The \mbox{} command uses the same font as \text but its size does not account for the current math style.

\mbox{Donald Knuth received the Turing Award in 1974}
$$\mbox{Donald Knuth received the Turing Award in 1974}$$

The \textnormal{} command works like \text{}. But it's longer to type.

\textnormal{Donald Knuth is a Professor Emeritus at Stanford University}
$$\textnormal{Donald Knuth is a Professor Emeritus at Stanford University}$$

When in a Text Zone, use $...$ to switch back to an Inline Math Zone or \\[...\\] to switch to a Display (block) Math Zone.

Fractions and Binomials

The \frac command is used to represent a fraction. The first argument is the numerator, the second argument is the denominator. It will size itself according to the current math style (display, text (inline), script, scriptscript). The \dfrac and \tfrac commands force the math style to be display or text (inline) style respectively.

The \cfrac (continuous fraction) command has an optional argument, [l] or [r], that controls if the numerator is left-aligned or right-aligned.

\frac{}{}
$$\frac{\unicode{"2B1A}}{\unicode{"2B1A}}$$
\dfrac{}{}
$$\dfrac{\unicode{"2B1A}}{\unicode{"2B1A}}$$
\tfrac{}{}
$$\tfrac{\unicode{"2B1A}}{\unicode{"2B1A}}$$
\cfrac[l]{}{}
$$\cfrac[l]{1}{x+1}$$
\cfrac[r]{}{}
$$\cfrac[r]{1}{x+1}$$

The \pdiff command is a convenient shortcut for partial differentials.

\pdiff{}{}
$$\pdiff{\unicode{"2B1A}}{\unicode{"2B1A}}$$

The \binom command is used to represent a binomial coefficient. The \dbinom and \tbinom commands force the math style to be display or text (inline) style respectively.

\binom{}{}
$$\binom{\unicode{"2B1A}}{\unicode{"2B1A}}$$
\dbinom{}{}
$$\dbinom{\unicode{"2B1A}}{\unicode{"2B1A}}$$
\tbinom{}{}
$$\tbinom{\unicode{"2B1A}}{\unicode{"2B1A}}$$
Deprecated

The following commands are supported but their usage is generally discouraged when creating modern LaTeX content.

a \over b
$$a \over b$$
a \atop b
$$a \atop b$$
a \choose b
$$a \choose b$$
\overwithdelims\lbrace\rbrace
$${\unicode{"2B1A} \overwithdelims\lbrace\rbrace \unicode{"2B1A}}$$
\atopwithdelims\lbrace\rbrace
$${\unicode{"2B1A} \atopwithdelims\lbrace\rbrace \unicode{"2B1A}}$$

Binary Operators

Some binary operators can also be used as a unary operator: +, -, etc... Their spacing is adjusted accordingly. For example in \( -1-2 \) there is less space between - and 1 than there is between - and 2.

+
$$+$$
-
$$-$$
\pm
$$\pm$$
\mp
$$\mp$$
a / b
$$a / b$$
\nicefrac{3}{4}
$$\nicefrac{3}{4}$$
\div
$$\div$$
\divides
$$\divides$$
\sqrt{}
$$\sqrt{\unicode{"2B1A}}$$
\sqrt[]{}
$$\sqrt[\unicode{"2B1A}]{\unicode{"2B1A}}$$
\surd{}
$$\surd{}$$
\intercal
$$\intercal$$
\dotplus
$$\dotplus$$
\doublebarwedge
$$\doublebarwedge$$
\divideontimes
$$\divideontimes$$
\times
$$\times$$
\cdot
$$\cdot$$
*
$$*$$
\ast
$$\ast$$
\star
$$\star$$
\ltimes
$$\ltimes$$
\rtimes
$$\rtimes$$
\leftthreetimes
$$\leftthreetimes$$
\rightthreetimes
$$\rightthreetimes$$
\circ
$$\circ$$
\bullet
$$\bullet$$
\centerdot
$$\centerdot$$

\boxminus
$$\boxminus$$
\boxplus
$$\boxplus$$
\boxtimes
$$\boxtimes$$
\boxdot
$$\boxdot$$

\ominus
$$\ominus$$
\oplus
$$\oplus$$
\otimes
$$\otimes$$
\odot
$$\odot$$
\circleddash
$$\circleddash$$
\circledast
$$\circledast$$
\circledcirc
$$\circledcirc$$
\oslash
$$\oslash$$

Functions

\exp
$$\exp$$
\ln
$$\ln$$
\log
$$\log$$
\lg
$$\lg$$
\lb
$$\lb$$
\ker
$$\ker$$
\det
$$\det$$
\arg
$$\arg$$
\dim
$$\dim$$
\gcd
$$\gcd$$
\argmin
$$\argmin$$
\argmax
$$\argmax$$
\plim
$$\plim$$

Trigonometry

\degree
$$\unicode{"2B1A}\degree$$
^\circ
$$\unicode{"2B1A}^\circ$$
\ang{}
$$\ang{\unicode{"2B1A}}$$
\arccos
$$\arccos$$
\arcsin
$$\arcsin$$
\arctan
$$\arctan$$
\cos
$$\cos$$
\cosh
$$\cosh$$
\cot
$$\cot$$
\coth
$$\coth$$
\csc
$$\csc$$
\sec
$$\sec$$
\sin
$$\sin$$
\sinh
$$\sinh$$
\tan
$$\tan$$
\tanh
$$\tanh$$

Non-Standard Trig Functions

The commands in this section are not part of the standard LaTeX distribution but are available in some packages. Use them with caution as they may not be supported by all LaTeX engines. Consider using \operatorname{} instead.

\arctg
$$\arctg$$
\arcctg
$$\arcctg$$
\ch
$$\ch$$
\ctg
$$\ctg$$
\cth
$$\cth$$
\cotg
$$\cotg$$
\cosec
$$\cosec$$
\sh
$$\sh$$
\tg
$$\tg$$
\th
$$\th$$

Bounds

\max
$$\max$$
\min
$$\min$$
\sup
$$\sup$$
\inf
$$\inf$$
\lim
$$\lim$$
\liminf
$$\liminf$$
\limsup
$$\limsup$$
\injlim
$$\injlim$$
\varlimsup
$$\varlimsup$$
\varliminf
$$\varliminf$$
\varinjlim
$$\varinjlim$$

Projections

\Pr
$$\Pr$$
\hom
$$\hom$$
\varprojlim
$$\varprojlim$$
\projlim
$$\projlim$$

Modulo

n \pmod{3}
$$n \pmod{3}$$
n \mod{3}
$$n \mod{3}$$
n \bmod 3
$$n \bmod 3$$

Custom Functions

To define a custom function use the \operatorname{} command: the name of the function will be displayed in upright font and with the appropriate spacing.

\operatorname{argth}(\theta)
$$\operatorname{argth}(\theta)$$

Unicode

If a symbol is not available as a LaTeX command, you can use the Unicode codepoint of the character. The commands below can be used to insert a Unicode character in a mathfield.

Command
\unicode{}The argument is a Unicode codepoint expressed as a number. To use a hexadecimal number, start the argument with x or " and use uppercase A-F for hexadecimal digits.
  • \Large\unicode{10775} \unicode{10775}
  • \Large\unicode{"2A17} \unicode{"2A17}
  • \Large\unicode{x2A17} \unicode{x2A17}
\charThe argument is also a Unicode codepoint, but the {...} delimiters are optional when using ".
  • \Large\char"2A17 \char"2A17
^^
^^^^
Followed by 2 or 4 hexadecimal digits with lowercase a-f to specify a Unicode codepoint.
  • \Large^^4a ^^4a
  • \Large^^^^2a17 ^^^^2a17
Note

The codepoint of the Unicode character ⨗ U+2A17 INTEGRAL WITH LEFTWARDS ARROW WITH HOOK is 10775 in decimal, 2A1716 in hexadecimal. The codepoint of the letter J is 004A16 in hexadecimal. Learn more about Mathematical Operators and Symbols in Unicode on Wikipedia.

Large Operators

Large operators display their limits above and below or adjacent to the operator, depending on the math style (Display Style or Text Style) and on the operator.

The position of the limits can be controlled with \limits, \nolimits or \displaylimits after the operator. The \limits command forces the display of the limits above and below the operator, \nolimits forces the display of the limits adjacent to the operator, and \displaylimits uses an automatic position, based on the operator and current math style.

\limits\nolimits\displaylimits
\sum_{i=0}^n\limits \sum_{i=0}^n\nolimits \sum_{i=0}^n\displaylimits
\sum_{i=0}^n\limits\sum_{i=0}^n\nolimits\sum_{i=0}^n\displaylimits
\int_0^\infty\limits \int_0^\infty\nolimits \int_0^\infty\displaylimits
\int_0^\infty\limits\int_0^\infty\nolimits\int_0^\infty\displaylimits

In Display Style, the \intop and \ointop commands display their limits above and below by default, while the \int command display its limit adjacent.

\sum
$$\sum_{n=0}^\infty$$
\prod
$$\prod_{n=0}^\infty$$
\coprod
$$\coprod_{n=0}^\infty$$
\int
$$\int_0^\infty$$
\intop
$$\intop_0^\infty$$
\iint
Double integral
$$\iint_0^\infty$$
\iiint
Tripe integral
$$\iiint_0^\infty$$
\oint
Contour integral
$$\oint_C$$
\smallint
Always displayed small
$$\smallint$$
\bigcup
$$\bigcup$$
\bigcap
$$\bigcap$$
\bigvee
$$\bigvee$$
\bigwedge
$$\bigwedge$$
\biguplus
$$\biguplus$$
\bigotimes
$$\bigotimes$$
\bigoplus
$$\bigoplus$$
\bigodot
$$\bigodot$$
\bigsqcup
$$\bigsqcup$$

\oiint
Surface integral
$$\oiint$$
\oiiint
Volume integral
$$\oiiint$$
\intclockwise
$$\intclockwise$$
\varointclockwise
$$\varointclockwise$$
\ointctrclockwise
$$\ointctrclockwise$$
\intctrclockwise
$$\intctrclockwise$$
\Cap
$$\Cap$$
\Cup
$$\Cup$$
\doublecap
$$\doublecap$$
\doublecup
$$\doublecup$$
\sqcup
$$\sqcup$$
\sqcap
$$\sqcap$$
\uplus
$$\uplus$$
\wr
$$\wr$$
\amalg
$$\amalg$$

Logic

Quantifiers

\forall
$$\forall$$
\exists
$$\exists$$
\nexists
$$\nexists$$

Unary/Binary Operators

\land
$$\land$$
\wedge
$$\wedge$$
\lor
$$\lor$$
\vee
$$\vee$$
\barwedge
$$\barwedge$$
\veebar
$$\veebar$$
\nor
$$\nor$$
\curlywedge
$$\curlywedge$$
\curlyvee
$$\curlyvee$$
\lnot
$$\lnot$$
\neg
$$\neg$$

Relational Operators

\to
$$\to$$
\gets
$$\gets$$
\implies
$$\implies$$
\impliedby
$$\impliedby$$
\biconditional
$$\biconditional$$
\therefore
$$\therefore$$
\because
$$\because$$
\leftrightarrow
$$\leftrightarrow$$
\Leftrightarrow
$$\Leftrightarrow$$
\roundimplies
$$\roundimplies$$
\models
$$\models$$
\vdash
$$\vdash$$
\dashv
$$\dashv$$

Arrows

\rightarrow
$$\rightarrow$$
\leftarrow
$$\leftarrow$$
\twoheadrightarrow
$$\twoheadrightarrow$$
\twoheadleftarrow
$$\twoheadleftarrow$$
\rightarrowtail
$$\rightarrowtail$$
\leftarrowtail
$$\leftarrowtail$$
\dashrightarrow
$$\dashrightarrow$$
\dashleftarrow
$$\dashleftarrow$$
\longrightarrow
$$\longrightarrow$$
\longleftarrow
$$\longleftarrow$$
\longleftrightarrow
$$\longleftrightarrow$$
\Rightarrow
$$\Rightarrow$$
\Leftarrow
$$\Leftarrow$$
\Longrightarrow
$$\Longrightarrow$$
\Longleftarrow
$$\Longleftarrow$$
\Longleftrightarrow
$$\Longleftrightarrow$$
\mapsto
$$\mapsto$$
\longmapsto
$$\longmapsto$$
\multimap
$$\multimap$$
\uparrow
$$\uparrow$$
\downarrow
$$\downarrow$$
\updownarrow
$$\updownarrow$$
\Uparrow
$$\Uparrow$$
\Downarrow
$$\Downarrow$$
\Updownarrow
$$\Updownarrow$$
\rightharpoonup
$$\rightharpoonup$$
\leftharpoonup
$$\leftharpoonup$$
\rightharpoondown
$$\rightharpoondown$$
\leftharpoondown
$$\leftharpoondown$$
\rightleftharpoons
$$\rightleftharpoons$$
\leftrightharpoons
$$\leftrightharpoons$$
\searrow
$$\searrow$$
\nearrow
$$\nearrow$$
\swarrow
$$\swarrow$$
\nwarrow
$$\nwarrow$$
\Rrightarrow
$$\Rrightarrow$$
\Lleftarrow
$$\Lleftarrow$$
\leftrightarrows
$$\leftrightarrows$$
\rightleftarrows
$$\rightleftarrows$$
\curvearrowright
$$\curvearrowright$$
\curvearrowleft
$$\curvearrowleft$$
\hookrightarrow
$$\hookrightarrow$$
\hookleftarrow
$$\hookleftarrow$$
\looparrowright
$$\looparrowright$$
\looparrowleft
$$\looparrowleft$$
\circlearrowright
$$\circlearrowright$$
\circlearrowleft
$$\circlearrowleft$$
\rightrightarrows
$$\rightrightarrows$$
\leftleftarrows
$$\leftleftarrows$$
\upuparrows
$$\upuparrows$$
\downdownarrows
$$\downdownarrows$$
\Rsh
$$\Rsh$$
\Lsh
$$\Lsh$$
\upharpoonright
$$\upharpoonright$$
\upharpoonleft
$$\upharpoonleft$$
\downharpoonright
$$\downharpoonright$$
\downharpoonleft
$$\downharpoonleft$$
\restriction
$$\restriction$$
\rightsquigarrow
$$\rightsquigarrow$$
\leftrightsquigarrow
$$\leftrightsquigarrow$$
\leadsto
$$\leadsto$$

Negated Arrows

\nrightarrow
$$\nrightarrow$$
\nleftarrow
$$\nleftarrow$$
\nleftrightarrow
$$\nleftrightarrow$$
\nRightarrow
$$\nRightarrow$$
\nLeftarrow
$$\nLeftarrow$$
\nLeftrightarrow
$$\nLeftrightarrow$$

Extensible Arrows

The length of the arrow commands above is fixed. The length of the commands in this section is determined by the length of the content above and below the arrows, which is specified as an argument (and optional argument):

\xrightarrow[\text{long text below}]{}
$$\xrightarrow[\text{long text below}]{}$$
\xrightarrow{\text{long text above}}
$$\xrightarrow{\text{long text above}}$$
\xrightarrow[\text{and below}]{\text{long text above}}
$$\xrightarrow[\text{and below}]{\text{long text above}}$$
\xlongequal[]{}
$$\xlongequal[below]{above}$$
\xrightarrow[]{}
$$\xrightarrow[below]{above}$$
\xleftarrow[]{}
$$\xleftarrow[below]{above}$$
\xleftrightarrow[]{}
$$\xleftrightarrow[below]{above}$$
\xtwoheadrightarrow[]{}
$$\xtwoheadrightarrow[below]{above}$$
\xtwoheadleftarrow[]{}
$$\xtwoheadleftarrow[below]{above}$$
\xRightarrow[]{}
$$\xRightarrow[below]{above}$$
\xLeftarrow[]{}
$$\xLeftarrow[below]{above}$$
\xrightharpoonup[]{}
$$\xrightharpoonup[below]{above}$$
\xleftharpoonup[]{}
$$\xleftharpoonup[below]{above}$$
\xrightharpoondown[]{}
$$\xrightharpoondown[below]{above}$$
\xleftharpoondown[]{}
$$\xleftharpoondown[below]{above}$$
\xrightleftharpoons[]{}
$$\xrightleftharpoons[below]{above}$$
\xleftrightharpoons[]{}
$$\xleftrightharpoons[below]{above}$$
\xhookrightarrow[]{}
$$\xhookrightarrow[below]{above}$$
\xhookleftarrow[]{}
$$\xhookleftarrow[below]{above}$$
\xmapsto[]{}
$$\xmapsto[below]{above}$$
\xtofrom[]{}
$$\xtofrom[below]{above}$$

Accents

\dot
$$\dot{\unicode{"2B1A}}$$
\ddot
$$\ddot{\unicode{"2B1A}}$$
\dddot
$$\dddot{\unicode{"2B1A}}$$
\ddddot
$$\ddddot{\unicode{"2B1A}}$$
\mathring
$$\mathring{\unicode{"2B1A}}$$
\tilde
$$\tilde{\unicode{"2B1A}}$$
\bar
$$\bar{\unicode{"2B1A}}$$
\breve
$$\breve{\unicode{"2B1A}}$$
\check
$$\check{\unicode{"2B1A}}$$
\hat
$$\hat{\unicode{"2B1A}}$$
\vec
$$\vec{\unicode{"2B1A}}$$

Deprecated Accents


Deprecated

The following commands are supported for compatibility with existing content, but their use is generally discouraged when creating new LaTeX content when an equivalent Unicode character is available.

For example use é rather than \'{e}.


\acute
$$\acute{e}$$
\grave
$$\grave{e}$$
\^
$$\^{e}$$
\`
$$\`{e}$$
\'
$$\'{e}$$
\"
$$\"{a}$$
\=
$$\={a}$$
\c
$$\c{c}$$
\~
$$\~{n}$$

Extensible Accents

Regular accents have a fixed width and do not stretch. For example, compare:

\vec{ABC}
$$\vec{ABC}$$
\overrightarrow{ABC}
$$\overrightarrow{ABC}$$

\overline{ABC}
$$\overline{ABC}$$
\overgroup{ABC}
$$\overgroup{ABC}$$
\overbrace{ABC}
$$\overbrace{ABC}$$
\overlinesegment{ABC}
$$\overlinesegment{ABC}$$
\overrightarrow{ABC}
$$\overrightarrow{ABC}$$
\overleftarrow{ABC}
$$\overleftarrow{ABC}$$
\overleftrightarrow{ABC}
$$\overleftrightarrow{ABC}$$
\overarc{ABC}
$$\overarc{ABC}$$
\overparen{ABC}
$$\overparen{ABC}$$
\wideparen{ABC}
$$\wideparen{ABC}$$
\widetilde{ABC}
$$\widetilde{ABC}$$
\widehat{ABC}
$$\widehat{ABC}$$
\widecheck{ABC}
$$\widecheck{ABC}$$
\Overrightarrow{ABC}
$$\Overrightarrow{ABC}$$
\overleftharpoon{ABC}
$$\overleftharpoon{ABC}$$
\overrightharpoon{ABC}
$$\overrightharpoon{ABC}$$
\underline{ABC}
$$\underline{ABC}$$
\undergroup{ABC}
$$\undergroup{ABC}$$
\underbrace{ABC}
$$\underbrace{ABC}$$
\underlinesegment{ABC}
$$\underlinesegment{ABC}$$
\underrightarrow{ABC}
$$\underrightarrow{ABC}$$
\underleftarrow{ABC}
$$\underleftarrow{ABC}$$
\underleftrightarrow{ABC}
$$\underleftrightarrow{ABC}$$
\underarc{ABC}
$$\underarc{ABC}$$
\underparen{ABC}
$$\underparen{ABC}$$
\utilde{ABC}
$$\utilde{ABC}$$

Relational Operators

To display a vertical "stack" of two symbols as a relational operator, use the \stackrel command: a\stackrel{?}{=}b a\stackrel{?}{=}b.

=
$$=$$
<
$$<$$
\lt
$$\lt$$
>
$$>$$
\gt
$$\gt$$
\le
$$\le$$
\leq
$$\leq$$
\ge
$$\ge$$
\geq
$$\geq$$
\shortparallel
$$\shortparallel$$
\leqslant
$$\leqslant$$
\geqslant
$$\geqslant$$
\gtrsim
$$\gtrsim$$
\approxeq
$$\approxeq$$
\thickapprox
$$\thickapprox$$
\lessapprox
$$\lessapprox$$
\gtrapprox
$$\gtrapprox$$
\precapprox
$$\precapprox$$
\succapprox
$$\succapprox$$
\thicksim
$$\thicksim$$
\succsim
$$\succsim$$
\precsim
$$\precsim$$
\backsim
$$\backsim$$
\eqsim
$$\eqsim$$
\backsimeq
$$\backsimeq$$
\lesssim
$$\lesssim$$
\smallsmile
$$\smallsmile$$
\smallfrown
$$\smallfrown$$
\leqq
$$\leqq$$
\eqslantless
$$\eqslantless$$
\lll
$$\lll$$
\lessgtr
$$\lessgtr$$
\lesseqgtr
$$\lesseqgtr$$
\lesseqqgtr
$$\lesseqqgtr$$
\risingdotseq
$$\risingdotseq$$
\fallingdotseq
$$\fallingdotseq$$
\preccurlyeq
$$\preccurlyeq$$
\curlyeqprec
$$\curlyeqprec$$
\vDash
$$\vDash$$
\Vvdash
$$\Vvdash$$
\bumpeq
$$\bumpeq$$
\Bumpeq
$$\Bumpeq$$
\geqq
$$\geqq$$
\eqslantgtr
$$\eqslantgtr$$
\ggg
$$\ggg$$
\gtrless
$$\gtrless$$
\gtreqless
$$\gtreqless$$
\gtreqqless
$$\gtreqqless$$
\succcurlyeq
$$\succcurlyeq$$
\curlyeqsucc
$$\curlyeqsucc$$
\Vdash
$$\Vdash$$
\shortmid
$$\shortmid$$
\between
$$\between$$
\pitchfork
$$\pitchfork$$
\varpropto
$$\varpropto$$
\llless
$$\llless$$
\gggtr
$$\gggtr$$
\doteqdot
$$\doteqdot$$
\Doteq
$$\Doteq$$
\eqcirc
$$\eqcirc$$
\circeq
$$\circeq$$
\lhd
$$\lhd$$
\rhd
$$\rhd$$
\lessdot
$$\lessdot$$
\gtrdot
$$\gtrdot$$
\ll
$$\ll$$
\gg
$$\gg$$
\coloneq
$$\coloneq$$
\measeq
$$\measeq$$
\eqdef
$$\eqdef$$
\questeq
$$\questeq$$
\cong
$$\cong$$
\equiv
$$\equiv$$
\prec
$$\prec$$
\preceq
$$\preceq$$
\succ
$$\succ$$
\succeq
$$\succeq$$
\perp
$$\perp$$
\propto
$$\propto$$
\smile
$$\smile$$
\frown
$$\frown$$
\sim
$$\sim$$
\doteq
$$\doteq$$
\bowtie
$$\bowtie$$
\Join
$$\Join$$
\asymp
$$\asymp$$
\approx
$$\approx$$
\parallel
$$\parallel$$
\simeq
$$\simeq$$
\ratio
$$\ratio$$
\coloncolon
$$\coloncolon$$
\colonequals
$$\colonequals$$
\coloncolonequals
$$\coloncolonequals$$
\equalscolon
$$\equalscolon$$
\equalscoloncolon
$$\equalscoloncolon$$
\colonminus
$$\colonminus$$
\coloncolonminus
$$\coloncolonminus$$
\minuscolon
$$\minuscolon$$
\minuscoloncolon
$$\minuscoloncolon$$
\coloncolonapprox
$$\coloncolonapprox$$
\coloncolonsim
$$\coloncolonsim$$
\simcolon
$$\simcolon$$
\simcoloncolon
$$\simcoloncolon$$
\approxcoloncolon
$$\approxcoloncolon$$
\notni
$$\notni$$
\ordinarycolon
$$\ordinarycolon$$
\vcentcolon
$$\vcentcolon$$
\dblcolon
$$\dblcolon$$
\coloneqq
$$\coloneqq$$
\Coloneqq
$$\Coloneqq$$
\coloneq
$$\coloneq$$
\Coloneq
$$\Coloneq$$
\eqqcolon
$$\eqqcolon$$
\Eqqcolon
$$\Eqqcolon$$
\eqcolon
$$\eqcolon$$
\Eqcolon
$$\Eqcolon$$
\colonapprox
$$\colonapprox$$
\Colonapprox
$$\Colonapprox$$
\colonsim
$$\colonsim$$
\Colonsim
$$\Colonsim$$

Negated Relational Operators

To negate other relational operators, use the \not command, e.g. \( \not\equiv \) \not\equiv.

\ne
$$\ne$$
\neq
$$\neq$$
\not=
$$\not=$$
\not
$$\not$$
\nless
$$\nless$$
\nleq
$$\nleq$$
\lneq
$$\lneq$$
\lneqq
$$\lneqq$$
\nleqq
$$\nleqq$$
\nleqslant
$$\nleqslant$$
\ngeq
$$\ngeq$$
\lvertneqq
$$\lvertneqq$$
\lnsim
$$\lnsim$$
\lnapprox
$$\lnapprox$$
\nprec
$$\nprec$$
\npreceq
$$\npreceq$$
\precnsim
$$\precnsim$$
\precnapprox
$$\precnapprox$$
\nsim
$$\nsim$$
\nshortmid
$$\nshortmid$$
\nmid
$$\nmid$$
\nvdash
$$\nvdash$$
\nvDash
$$\nvDash$$
\ngtr
$$\ngtr$$
\ngeqslant
$$\ngeqslant$$
\ngeqq
$$\ngeqq$$
\gneq
$$\gneq$$
\gneqq
$$\gneqq$$
\gvertneqq
$$\gvertneqq$$
\gnsim
$$\gnsim$$
\gnapprox
$$\gnapprox$$
\nsucc
$$\nsucc$$
\nsucceq
$$\nsucceq$$
\succnsim
$$\succnsim$$
\succnapprox
$$\succnapprox$$
\ncong
$$\ncong$$
\nshortparallel
$$\nshortparallel$$
\nparallel
$$\nparallel$$
\nVDash
$$\nVDash$$
\nVdash
$$\nVdash$$
\precneqq
$$\precneqq$$
\succneqq
$$\succneqq$$
\unlhd
$$\unlhd$$
\unrhd
$$\unrhd$$

Sets

\emptyset
$$\emptyset$$
\varnothing
$$\varnothing$$

To represent sets such as the natural numbers, integers, real numbers, etc., use the \mathbb command for best compatibility, e.g. \mathbb{N} \mathbb{N} or \mathbb{C} \mathbb{C}, etc...

Non standard commands, may not be supported by all LaTeX engines:

\N
$$\N$$
\R
$$\R$$
\Q
$$\Q$$
\C
$$\C$$
\Z
$$\Z$$
\P
$$\P$$
\doubleStruckCapitalN
$$\doubleStruckCapitalN$$
\doubleStruckCapitalR
$$\doubleStruckCapitalR$$
\doubleStruckCapitalQ
$$\doubleStruckCapitalQ$$
\doubleStruckCapitalZ
$$\doubleStruckCapitalZ$$
\doubleStruckCapitalP
$$\doubleStruckCapitalP$$

Set Operators

\cap
$$\cap$$
\cup
$$\cup$$
\setminus
$$\setminus$$
\smallsetminus
$$\smallsetminus$$
\complement
$$\complement$$

Relational Set Operators

\nsupseteqq
$$\nsupseteqq$$
\supsetneq
$$\supsetneq$$
\varsupsetneq
$$\varsupsetneq$$
\supsetneqq
$$\supsetneqq$$
\varsupsetneqq
$$\varsupsetneqq$$
\nsubseteqq
$$\nsubseteqq$$
\subseteqq
$$\subseteqq$$
\Subset
$$\Subset$$
\sqsubset
$$\sqsubset$$
\supseteqq
$$\supseteqq$$
\Supset
$$\Supset$$
\sqsupset
$$\sqsupset$$
\sqsubseteq
$$\sqsubseteq$$
\sqsupseteq
$$\sqsupseteq$$
\in
$$\in$$
\notin
$$\notin$$
\ni
$$\ni$$
\owns
$$\owns$$
\backepsilon
$$\backepsilon$$
\subset
$$\subset$$
\supset
$$\supset$$
\subseteq
$$\subseteq$$
\supseteq
$$\supseteq$$
\subsetneq
$$\subsetneq$$
\varsubsetneq
$$\varsubsetneq$$
\subsetneqq
$$\subsetneqq$$
\varsubsetneqq
$$\varsubsetneqq$$
\nsubset
$$\nsubset$$
\nsupset
$$\nsupset$$
\nsubseteq
$$\nsubseteq$$
\nsupseteq
$$\nsupseteq$$

Greek

\alpha
$$\alpha$$
\beta
$$\beta$$
\gamma
$$\gamma$$
\delta
$$\delta$$
\epsilon
$$\epsilon$$
\varepsilon
$$\varepsilon$$
\zeta
$$\zeta$$
\eta
$$\eta$$
\theta
$$\theta$$
\vartheta
$$\vartheta$$
\iota
$$\iota$$
\kappa
$$\kappa$$
\varkappa
$$\varkappa$$
\lambda
$$\lambda$$
\mu
$$\mu$$
\nu
$$\nu$$
\xi
$$\xi$$
\omicron
$$\omicron$$
\pi
$$\pi$$
\varpi
$$\varpi$$
\rho
$$\rho$$
\varrho
$$\varrho$$
\sigma
$$\sigma$$
\varsigma
$$\varsigma$$
\tau
$$\tau$$
\phi
$$\phi$$
\varphi
$$\varphi$$
\upsilon
$$\upsilon$$
\chi
$$\chi$$
\psi
$$\psi$$
\omega
$$\omega$$
\digamma
$$\digamma$$

\Alpha
$$\Alpha$$
\Beta
$$\Beta$$
\Gamma
$$\Gamma$$
\varGamma
$$\varGamma$$
\Delta
$$\Delta$$
\varDelta
$$\varDelta$$
\Epsilon
$$\Epsilon$$
\Zeta
$$\Zeta$$
\Eta
$$\Eta$$
\Theta
$$\Theta$$
\varTheta
$$\varTheta$$
\Iota
$$\Iota$$
\Kappa
$$\Kappa$$
\Lambda
$$\Lambda$$
\varLambda
$$\varLambda$$
\Mu
$$\Mu$$
\Nu
$$\Nu$$
\Xi
$$\Xi$$
\varXi
$$\varXi$$
\Omicron
$$\Omicron$$
\Pi
$$\Pi$$
\varPi
$$\varPi$$
\Rho
$$\Rho$$
\Sigma
$$\Sigma$$
\varSigma
$$\varSigma$$
\Tau
$$\Tau$$
\Phi
$$\Phi$$
\varPhi
$$\varPhi$$
\Upsilon
$$\Upsilon$$
\varUpsilon
$$\varUpsilon$$
\Chi
$$\Chi$$
\Psi
$$\Psi$$
\varPsi
$$\varPsi$$
\Omega
$$\Omega$$
\varOmega
$$\varOmega$$

Hebrew

\aleph
$$\aleph$$
\beth
$$\beth$$
\gimel
$$\gimel$$
\daleth
$$\daleth$$

Letterlike Symbols

@
$$@$$
\mid
$$\mid$$
\top
$$\top$$
\bot
$$\bot$$
\nabla
$$\nabla$$
\partial
$$\partial$$
\ell
$$\ell$$
\hbar
$$\hbar$$
\pounds
$$\pounds$$
\euro
$$\euro$$
\And
$$\And$$
\$
$$\$$$
\%
$$\%$$
\differencedelta
$$\differencedelta$$
\wp
$$\wp$$
\hslash
$$\hslash$$
\Finv
$$\Finv$$
\Game
$$\Game$$
\eth
$$\eth$$
\mho
$$\mho$$
\Bbbk
$$\Bbbk$$
\yen
$$\yen$$
\imath
$$\imath$$
\jmath
$$\jmath$$
\degree
$$\degree$$
\Re
$$\Re$$
\Im
$$\Im$$

Delimiters

A delimiter, also called a fence, is a symbol used to group some symbols, for example parentheses, brackets, braces, etc...

To grow delimiters based on their content, use \left...\right.

Regular delimiters\left...\right
\lbrace x \| \frac{x}{2} > 0\rbrace \left\lbrace x \middle\| \frac{x}{2} > 0\right\rbrace
\lbrace x | \frac{x}{2} > 0\rbrace\left\lbrace x \middle| \frac{x}{2} > 0\right\rbrace

The left and right delimiters do not have to match:

  • \(\displaystyle \left\lparen \frac1x \right\rbrack\) \left\lparen \frac1x \right\rbrack

To omit a delimiter, use .:

  • \(\displaystyle \left\lparen \frac1x \right.\) \left\lparen \frac1x \right.

The argument to \left, \right and \middle can be one of the following commands.

\lparen
$$\lparen$$
\rparen
$$\rparen$$
\lbrace
$$\lbrace$$
\rbrace
$$\rbrace$$
\langle
$$\langle$$
\rangle
$$\rangle$$
\lfloor
$$\lfloor$$
\rfloor
$$\rfloor$$
\lceil
$$\lceil$$
\rceil
$$\rceil$$
\vert
$$\vert$$
\lvert
$$\lvert$$
\rvert
$$\rvert$$
\|
$$\|$$
\Vert
$$\Vert$$
\mVert
$$\mVert$$
\lVert
$$\lVert$$
\rVert
$$\rVert$$
\lbrack
$$\lbrack$$
\rbrack
$$\rbrack$$
\{
$$\{$$
\}
$$\}$$
(
$$($$
)
$$)$$
[
$$[$$
]
$$]$$
\ulcorner
$$\ulcorner$$
\urcorner
$$\urcorner$$
\llcorner
$$\llcorner$$
\lrcorner
$$\lrcorner$$
\lgroup
$$\lgroup$$
\rgroup
$$\rgroup$$
\lmoustache
$$\lmoustache$$
\rmoustache
$$\rmoustache$$
\mvert
$$\mvert$$

Punctuation

.
$$.$$
?
$$?$$
!
$$!$$
:
$$:$$
\Colon
$$\Colon$$
\colon
$$\colon$$
,
$$,$$
;
$$;$$
"
$$"$$

Dots

\cdotp
$$\cdotp$$
\ldotp
$$\ldotp$$
\vdots
$$\vdots$$
\cdots
$$\cdots$$
\ddots
$$\ddots$$
\ldots
$$\ldots$$
\mathellipsis
$$\mathellipsis$$

Shapes

\square
$$\square$$
\Box
$$\Box$$
\blacksquare
$$\blacksquare$$

\bigcirc
$$\bigcirc$$
\circledS
$$\circledS$$
\circledR
$$\circledR$$

\diamond
$$\diamond$$
\Diamond
$$\Diamond$$
\lozenge
$$\lozenge$$
\blacklozenge
$$\blacklozenge$$

\triangleleft
$$\triangleleft$$
\triangleright
$$\triangleright$$
\triangle
$$\triangle$$
\triangledown
$$\triangledown$$
\blacktriangleleft
$$\blacktriangleleft$$
\blacktriangleright
$$\blacktriangleright$$
\blacktriangle
$$\blacktriangle$$
\blacktriangledown
$$\blacktriangledown$$

\vartriangle
$$\vartriangle$$
\vartriangleleft
$$\vartriangleleft$$
\vartriangleright
$$\vartriangleright$$

\triangleq
$$\triangleq$$
\trianglelefteq
$$\trianglelefteq$$
\trianglerighteq
$$\trianglerighteq$$
\ntriangleleft
$$\ntriangleleft$$
\ntriangleright
$$\ntriangleright$$
\ntrianglelefteq
$$\ntrianglelefteq$$
\ntrianglerighteq
$$\ntrianglerighteq$$

\bigtriangleup
$$\bigtriangleup$$
\bigtriangledown
$$\bigtriangledown$$

\dagger
$$\dagger$$
\dag
$$\dag$$
\ddag
$$\ddag$$
\ddagger
$$\ddagger$$
\maltese
$$\maltese$$

St Mary's Road Symbols for Theoretical Computer Science

\mapsfrom
$$\mapsfrom$$
\Mapsfrom
$$\Mapsfrom$$
\MapsTo
$$\MapsTo$$
\Yup
$$\Yup$$
\lightning
$$\lightning$$
\leftarrowtriangle
$$\leftarrowtriangle$$
\rightarrowtriangle
$$\rightarrowtriangle$$
\leftrightarrowtriangle
$$\leftrightarrowtriangle$$
\boxdot
$$\boxdot$$
\bigtriangleup
$$\bigtriangleup$$
\bigtriangledown
$$\bigtriangledown$$
\boxbar
$$\boxbar$$
\Lbag
$$\Lbag$$
\Rbag
$$\Rbag$$
\llbracket
$$\llbracket$$
\rrbracket
$$\rrbracket$$
\longmapsfrom
$$\longmapsfrom$$
\Longmapsfrom
$$\Longmapsfrom$$
\Longmapsto
$$\Longmapsto$$
\boxslash
$$\boxslash$$
\boxbslash
$$\boxbslash$$
\boxast
$$\boxast$$
\boxcircle
$$\boxcircle$$
\boxbox
$$\boxbox$$
\fatsemi
$$\fatsemi$$
\leftslice
$$\leftslice$$
\rightslice
$$\rightslice$$
\interleave
$$\interleave$$
\biginterleave
$$\biginterleave$$
\sslash
$$\sslash$$
\talloblong
$$\talloblong$$

Layout

These commands change the amount of space around a symbol: \mathop{} treats its argument as if it was a large operator, \mathrel{} a relational operator, \mathbin{} a binary operator, \mathopen{} and \mathclose{} an opening and closing delimiter, respectively, \mathpunct{} a punctuation, \mathinner{} a fraction, and \mathord{} an ordinary symbol

x\mathop{+}0+1
$$x\mathop{+}0+1$$
x=\mathbin{arg}=0
$$x=\mathbin{arg}=0$$
x=\mathrel{arg}=0
$$x=\mathrel{arg}=0$$
x=\mathopen{arg}=0
$$x=\mathopen{arg}=0$$
x=\mathclose{arg}=0
$$x=\mathclose{arg}=0$$
x=\mathpunct{arg}=0
$$x=\mathpunct{arg}=0$$
x=\mathinner{arg}=0
$$x=\mathinner{arg}=0$$
x=\mathord{arg}=0
$$x=\mathord{arg}=0$$

\overset{arg}{x=0}
$$\overset{arg}{x=0}$$
\underset{arg}{x=0}
$$\underset{arg}{x=0}$$
\overunderset{arg}{x=0}{y=1}
$$\overunderset{arg}{x=0}{y=1}$$
\stackrel{arg}{x=0}
$$\stackrel{arg}{x=0}$$
\stackbin{arg}{x=0}
$$\stackbin{arg}{x=0}$$
\rlap{/}0
$$\rlap{/}0$$
o\llap{/}
$$o\llap{/}$$
o\mathllap{/}
$$o\mathllap{/}$$
\mathrlap{/}0
$$\mathrlap{/}0$$

Spacing

\hspace
$$\unicode{"203A}\hspace{1em}\unicode{"2039}$$
\hspace*
$$\unicode{"203A}\hspace*{1em}\unicode{"2039}$$
\!
$$\unicode{"203A}\!\unicode{"2039}$$
\,
$$\unicode{"203A}\,\unicode{"2039}$$
:
$$\unicode{"203A}\:\unicode{"2039}$$
;
$$\unicode{"203A}\;\unicode{"2039}$$
\enskip
$$\unicode{"203A}\enskip\unicode{"2039}$$
\enspace
$$\unicode{"203A}\enspace\unicode{"2039}$$
\quad
$$\unicode{"203A}\quad\unicode{"2039}$$
\qquad
$$\unicode{"203A}\qquad\unicode{"2039}$$

Decorations

\textcolor{blue}{x+1=0}
Recommended over `\color`
$$\textcolor{blue}{x+1=0}$$
{\color{blue} x+1=0}
$${\color{blue} x+1=0}$$
\colorbox{yellow}{\[ax^2+bx+c\]}
The argument is in Text Mode. Use \\[...\\] to switch to math mode
$$\colorbox{yellow}{\[ax^2+bx+c\]}$$
\fcolorbox{#cd0030}{#ffd400}{\unicode{"2B1A}}
$$\fcolorbox{#cd0030}{#ffd400}{\unicode{"2B1A}}$$
\boxed{1+\frac{1}{x}}
$$\boxed{1+\frac{1}{x}}$$
\bbox[]{\unicode{"2B1A}}
See MathJax BBox documentation
$$\bbox[]{\unicode{"2B1A}}$$
\rule[]{2em}{1em}
The arguments are the width and height. The optional argument is an offset from the baseline.
$$\rule[]{2em}{1em}$$

Notations

\enclose

The \enclose command is very flexible. It accepts three arguments, two of which are required:

\enclose{<notation>}[<style>]{<body>}
  • <notation> a list of whitespace-delimited values:
box
$$\enclose{box}{x=0}$$
roundedbox
$$\enclose{roundedbox}{x=0}$$
circle
$$\enclose{circle}{x=0}$$
top
$$\enclose{top}{x=0}$$
left
$$\enclose{left}{x=0}$$
bottom
$$\enclose{bottom}{x=0}$$
right
$$\enclose{right}{x=0}$$
horizontalstrike
$$\enclose{horizontalstrike}{x=0}$$
verticalstrike
$$\enclose{verticalstrike}{x=0}$$
updiagonalstrike
$$\enclose{updiagonalstrike}{x=0}$$
downdiagonalstrike
$$\enclose{downdiagonalstrike}{x=0}$$
updiagonalarrow
$$\enclose{updiagonalarrow}{x=0}$$
phasorangle
$$\enclose{phasorangle}{x=0}$$
radical
$$\enclose{radical}{x=0}$$
longdiv
$$\enclose{longdiv}{x=0}$$
actuarial
$$\enclose{actuarial}{x=0}$$
madruwb
$$\enclose{madruwb}{x=0}$$

They can be combined:

\enclose{roundedbox updiagonalstrike}{x=0}
$$\enclose{roundedbox updiagonalstrike}{x=0}$$
  • <style> an optional list of comma separated key-value pairs including:
    • mathbackground="<color>" background color of the expression
    • mathcolor="<color>" color of the notation, for example red or #cd0030 or rgba(205, 0, 11, .4).
    • padding="<dimension>" "auto" or an amount of padding around the content
    • shadow="<shadow>": "auto" or "none" or a CSS box-shadow expression for example, "0 0 2px rgba(0, 0, 0, 0.5)".
    • in addition the style property can include a stroke style expression that follows the shorthand syntax of the CSS border property, for example "2px solid red".
  • <body> a math expression that is "enclosed" by the specified notations
Note

\enclose is a LaTeX extension introduced by MathJax that follows the <menclose> definition of MathML.

\enclose{updiagonalstrike roundedbox}[1px solid red, mathbackground="#fbc0bd"]{x=0}
$$\enclose{updiagonalstrike roundedbox}[1px solid red, mathbackground="#fbc0bd"]{x=0}$$
\enclose{circle}[mathbackground="#fbc0bd"]{\frac1x}
$$\enclose{circle}[mathbackground="#fbc0bd"]{\frac1x}$$
\enclose{roundedbox}[1px dotted #cd0030]{\frac{x^2+y^2}{\sqrt{x^2+y^2}}}
$$\enclose{roundedbox}[1px dotted #cd0030]{\frac{x^2+y^2}{\sqrt{x^2+y^2}}}$$

\cancel, \bcancel and \xcancel

Command...is a shorthand for...
\cancel{body}
$$\cancel{\unicode{"2B1A}}$$
\enclose{updiagonalstrike}{body}
\bcancel{body}
$$\bcancel{\unicode{"2B1A}}$$
\enclose{downdiagonalstrike}{body}
\xcancel{body}
$$\xcancel{\unicode{"2B1A}}$$
\enclose{updiagonalstrike downdiagonalstrike}{body}
Note

The \cancel, \bcancel and \xcancel commands are part of the "cancel" LaTeX package.

Shortcuts

Some commands are shortcuts for common notations:

Command...is a shorthand for...
\angl{body} \angl{body}\enclose{actuarial}{body}
\angln \angln\enclose{actuarial}{n}
\anglr \anglr\enclose{actuarial}{r}
\anglk \anglk\enclose{actuarial}{k}

Colors

To change the foreground color, use the \textcolor{}{} command.

To change the background, use the \colorbox{}{} command.

The first argument of these commands is a color specified as:

  • one of red, orange, yellow, lime, green, teal, blue, indigo,
  • purple, magenta, black, dark-grey, grey, light-grey, `white.
  • a RGB color using the standard CSS format (#d7170b or rgb(240, 20, 10))
  • one of the 68 colors from dvips color name (CadetBlue). Note that these names are case-sensitive.
  • one of the 10 Mathematica color from ColorData[97, "ColorList"] (M0 to M9)
  • a color defined using the syntax from the xcolor package, for example: Blue!20!Black!30!Green
  • if the color is prefixed with a -, the complementary color is used

The following color names are recommended:

Note

These colors have been carefully selected for a balanced representation of the range of hues on the color circle, with similar lightness and intensity. They will map to different color values than the dvips colors of the same name.

Note

To have proper legibility based on usage, these color names will map to different values when used as a foreground color and a background color. To use a specific color value, use a RGB color instead.

Note

For best portability between versions of TeX, limit yourself to this subset of DVIPS colors: White, Black, Gray, Red, Orange, Yellow, LimeGreen, Green, TealBlue, Blue, Violet, Purple and Magenta. Those names are case-sensitive.

Font Styling

\selectfont
$$\text{\selectfont}$$

Bold

\fontseries{b}
$$\text{\fontseries{b}Don Knuth}$$
\boldsymbol{}
$$\boldsymbol{Don Knuth}$$
{\bfseries}
$$\text{\bfseries Don Knuth}$$
{\mdseries}
$$\text{\mdseries Don Knuth}$$
\bm{}
$$\bm{ABCabc}$$
\bold{}
$$\bold{ABCabc}$$
\textbf{}
$$\textbf{Don Knuth}$$
\textmd{}
$$\textmd{Don Knuth}$$
\mathbf{}
$$\mathbf{ABCabc}$$
\mathbfit{}
$$\mathbfit{ABCabc}$$

Italic

\upshape
$$\text{\upshape Don Knuth}$$
\slshape
$$\text{\slshape Don Knuth}$$
\textup{}
upright
$$\textup{Don Knuth}$$
\textsl{}
slanted
$$\textsl{Don Knuth}$$
\textit{}
italic
$$\textit{Don Knuth}$$
\mathit{}
math italic
$$\mathit{Don Knuth}$$

Font Family

Typewriter / Monospace

\fontfamily{}
$$\text{\fontfamily{cmtt}Don Knuth}$$
\texttt{}
$$\texttt{Don Knuth}$$
\mathtt{}
$$\mathtt{ABCabc}$$
\ttfamily
$$${\ttfamily ABCabc}$$

Sans-Serif

\textsf{}
$$\textsf{Don Knuth}$$
\mathsf{}
$$\mathsf{ABCabc}$$
\sffamily
$${\sffamily ABCabc}$$

Math Variants

\mathfrak{ABCdef}
Fraktur
$$\mathfrak{ABCdef}$$
\mathcal{ABCdef}
Caligraphic
$$\mathcal{ABC}$$
\mathscr{ABCdef}
Script
$$\mathscr{ABCdef}$$
\mathbb{}
Blackboard
$$\mathbb{ABCabc}$$
\Bbb{}
$$\Bbb{ABCdef}$$
{\frak}
$$${\frak ABC}$$
\text{\rmfamily}
$$\text{\rmfamily ABCabc}$$

MathJax HTML Extension

Mathfields support some commands from the MathJax HTML extension.

\class

\class{custom-CSS-class}{x+1}
$$\class{custom-CSS-class}{x+1}$$

When used in a <math-field> component, the class names should refer to a stylesheet defined with a <style> tag inside the <math-field> element.

<math-field>
<style>
#custom-CSS-class {
box-shadow: 0 0 10px #000; border-radius: 8px; padding: 8px;
}
</style>

\class{custom-CSS-class}{\frac{1}{x+1}}

</math-field>

\cssId

Apply an element ID to the expression. The element can then be styled using CSS.

#custom-CSS-class { 
box-shadow: 0 0 4px #999;
border-radius: 8px;
padding: 8px;
}
\cssId{custom-CSS-class}{\text{Don Knuth}}
$$\cssId{custom-CSS-class}{\text{Don Knuth}}$$

\htmlData

The argument of this command is a comma-delimited list of key/value pairs, e.g. \htmlData{foo=green,bar=blue}{x=0}. A corresponding foo and bar DOM attributes are attached to the rendered DOM element.

\htmlData{foo=green,bar=blue}{ \text{Don Knuth} }
$$\htmlData{foo=green,bar=blue}{ \text{Don Knuth} }$$

Other Extensions

\error

The argument of this command is a string that will be rendered with a red background and a red underline.

\text{Don \error{\text{Knuht}}}
$$\text{Don \error{\text{Knuht}}}$$

\texttip

The first argument is a math expression to display, the second argument is the text to display on hover.

\texttip{e^{i\pi}-1=0}{The most beautiful equation}
$$\texttip{e^{i\pi}-1=0}{The most beautiful equation}$$

\mathtip

The first argument is a math expression to display, the second argument is the a math expression to display on hover.

\mathtip{e^{i\pi}}{-1}
$$\mathtip{e^{i\pi}}{-1}$$

Others

\text{\fontshape{sc}Don Knuth}
Small Caps
$$\text{\fontshape{sc}Don Knuth}$$
{\scshape Don Knuth}
Small Caps
$${\scshape Don Knuth}$$
\textsc{Don Knuth}
Small Caps
$$\textsc{Don Knuth}$$
\textrm{Don Knuth}
Roman
$$\textrm{Don Knuth}$$
\mathrm{Don Knuth}
Roman
$$\mathrm{Don Knuth}$$
\text{Don {\em Knuth}}
Emphasis
$$\text{Don {\em Knuth}}$$
\text{Don \emph{Knuth}}
Emphasis
$$\text{Don \emph{Knuth}}$$
Deprecated

The following commands are supported for compatibility with existing content, but their use is generally discouraged when creating new LaTeX content

{\bf Don Knuth}
Use `\textbf{}` or `\bfseries` instead
$${\bf Don Knuth}$$
{\it Don Knuth}
Use `\textit{}` or `\itshape` instead
$${\it Don Knuth}$$

Sizing

In LaTeX using the sizing commands below may not always achieve the expected result. In mathfields, the sizing commands are applied consistently to text and math mode.

These size are relative to the font-size property of the mathfield.

\tiny{e^{i\pi}+1=0}
$$\tiny{e^{i\pi}+1=0}$$
\scriptsize{e^{i\pi}+1=0}
$$\scriptsize{e^{i\pi}+1=0}$$
\footnotesize{e^{i\pi}+1=0}
$$\footnotesize{e^{i\pi}+1=0}$$
\small{e^{i\pi}+1=0}
$$\small{e^{i\pi}+1=0}$$
\normalsize{e^{i\pi}+1=0}
$$\normalsize{e^{i\pi}+1=0}$$
\large{e^{i\pi}+1=0}
$$\large{e^{i\pi}+1=0}$$
\Large{e^{i\pi}+1=0}
$$\Large{e^{i\pi}+1=0}$$
\LARGE{e^{i\pi}+1=0}
$$\LARGE{e^{i\pi}+1=0}$$
\huge{e^{i\pi}+1=0}
$$\huge{e^{i\pi}+1=0}$$
\Huge{e^{i\pi}+1=0}
$$\Huge{e^{i\pi}+1=0}$$

The size of delimiters can be controlled manually with the commands below. The \left...\right... commands calculate automatically the size of the delimiters based on the content.

warning

The command must be followed by a delimiter, for example ( or \lbrace or \lbrack. If the command is used on its own, nothing is displayed.

\bigl( \bigm\| \bigr)
$$\bigl( \bigm\| \bigr)$$
\Bigl( \Bigm\| \Bigr)
$$\Bigl( \Bigm\| \Bigr)$$
\biggl( \biggm\| \biggr)
$$\biggl( \biggm\| \biggr)$$
\Biggl( \Biggm\| \Biggr)
$$\Biggl( \Biggm\| \Biggr)$$

Various

\infty
$$\infty$$
\prime
$$\prime$$
\doubleprime
$$\doubleprime$$
/
$$/$$
\/
$$\/$$
|
$$|$$
\backslash
$$\backslash$$
\diagup
$$\diagup$$
\sharp
$$\sharp$$
\flat
$$\flat$$
\natural
$$\natural$$
\#
$$\#$$
\&
$$\&$$
\clubsuit
$$\clubsuit$$
\heartsuit
$$\heartsuit$$
\spadesuit
$$\spadesuit$$
\diamondsuit
$$\diamondsuit$$
\angle
$$\angle$$
\_
$$\_$$
\checkmark
$$\checkmark$$
\measuredangle
$$\measuredangle$$
\sphericalangle
$$\sphericalangle$$
\backprime
$$\backprime$$
\backdoubleprime
$$\backdoubleprime$$
\originalof
$$\originalof$$
\laplace
$$\laplace$$
\imageof
$$\imageof$$
\Laplace
$$\Laplace$$

$$−$$
`
$$`$$
~
$$~$$
\space
$$\space$$
\smash[]{}
$$\smash[]{}$$
\vphantom{}
$$\vphantom{}$$
\hphantom{}
$$\hphantom{}$$
\phantom{}
$$\phantom{}$$

MediaWiki (texvc.sty package)

Mathfields support the commands used by MediaWiki pages, except for the deprecated ones.

\darr
$$\darr$$
\dArr
$$\dArr$$
\Darr
$$\Darr$$
\lang
$$\lang$$
\rang
$$\rang$$
\uarr
$$\uarr$$
\uArr
$$\uArr$$
\Uarr
$$\Uarr$$
\N
$$\N$$
\R
$$\R$$
\Z
$$\Z$$
\alef
$$\alef$$
\alefsym
$$\alefsym$$
\Alpha
$$\Alpha$$
\Beta
$$\Beta$$
\bull
$$\bull$$
\Chi
$$\Chi$$
\clubs
$$\clubs$$
\cnums
$$\cnums$$
\Complex
$$\Complex$$
\Dagger
$$\Dagger$$
\diamonds
$$\diamonds$$
\empty
$$\empty$$
\Epsilon
$$\Epsilon$$
\Eta
$$\Eta$$
\exist
$$\exist$$
\harr
$$\harr$$
\hArr
$$\hArr$$
\Harr
$$\Harr$$
\hearts
$$\hearts$$
\image
$$\image$$
\infin
$$\infin$$
\Iota
$$\Iota$$
\isin
$$\isin$$
\Kappa
$$\Kappa$$
\larr
$$\larr$$
\lArr
$$\lArr$$
\Larr
$$\Larr$$
\lrarr
$$\lrarr$$
\lrArr
$$\lrArr$$
\Lrarr
$$\Lrarr$$
\Mu
$$\Mu$$
\natnums
$$\natnums$$
\Nu
$$\Nu$$
\Omicron
$$\Omicron$$
\plusmn
$$\plusmn$$
\rarr
$$\rarr$$
\rArr
$$\rArr$$
\Rarr
$$\Rarr$$
\real
$$\real$$
\reals
$$\reals$$
\Reals
$$\Reals$$
\Rho
$$\Rho$$
\sdot
$$\sdot$$
\sect
$$\sect$$
\spades
$$\spades$$
\sub
$$\sub$$
\sube
$$\sube$$
\supe
$$\supe$$
\Tau
$$\Tau$$
\thetasym
$$\thetasym$$
\weierp
$$\weierp$$
\Zeta
$$\Zeta$$

Physics

Braket Notation

Mathfields support the commands of the braket package

\bra{\Psi}
$$\bra{\Psi}$$
\ket{\Psi}
$$\ket{\Psi}$$
\braket{ab}
$$\braket{ab}$$
\Bra{ab}
$$\Bra{ab}$$
\Ket{ab}
$$\Ket{ab}$$
\Braket{ab}
$$\Braket{ab}$$

Chemistry (mhchem package)

Mathfields support the commands of the mhchem package.

Chemical Formulas

\ce{H2O}
$$\ce{H2O}$$
\ce{Sb2O3}
$$\ce{Sb2O3}$$

Charges

\ce{[AgCl2]-}
$$\ce{[AgCl2]-}$$
\ce{Y^99+}
$$\ce{Y^99+}$$
\ce{Y^{99+}}
$$\ce{Y^{99+}}$$
\ce{H+}
$$\ce{H+}$$
\ce{CrO4^2-}
$$\ce{CrO4^2-}$$

Stoichiometric numbers

\ce{2 H2O}
$$\ce{2 H2O}$$
\ce{2H2O}
$$\ce{2H2O}$$
\ce{0.5 H2O}
$$\ce{0.5 H2O}$$
\ce{1/2 H2O}
$$\ce{1/2 H2O}$$
\ce{(1/2) H2O}
$$\ce{(1/2) H2O}$$
\ce{$n$ H2O}
$$\ce{$n$ H2O}$$

Isotopes

\ce{^{227}_{90}Th+}
$$\ce{^{227}_{90}Th+}$$
\ce{^227_90Th+}
$$\ce{^227_90Th+}$$
\ce{^{0}_{-1}n^{-}}
$$\ce{^{0}_{-1}n^{-}}$$
\ce{^0_-1n-}
$$\ce{^0_-1n-}$$
\ce{H{}^3HO}
$$\ce{H{}^3HO}$$
\ce{H^3HO}
$$\ce{H^3HO}$$

Complex Examples

\ce{CO2 + C -> 2 CO}
$$\ce{CO2 + C -> 2 CO}$$
\ce{Hg^2+ ->[I-] HgI2 ->[I-] [Hg^{II}I4]^2-}
$$\ce{Hg^2+ ->[I-] HgI2 ->[I-] [Hg^{II}I4]^2-}$$
\ce{$K = \ce{\frac{[Hg^2+][Hg]}{[Hg2^2+]}}$}
$$\ce{$K = \ce{\frac{[Hg^2+][Hg]}{[Hg2^2+]}}$}$$
\ce{Hg^2+ ->[I-] $\underset{\mathrm{red}}{\ce{HgI2}}$ ->[I-] $\underset{\mathrm{red}}{\ce{[Hg^{II}I4]^2-}}$}
$$\ce{Hg^2+ ->[I-] $\underset{\mathrm{red}}{\ce{HgI2}}$ ->[I-] $\underset{\mathrm{red}}{\ce{[Hg^{II}I4]^2-}}$}$$

Macros

\iff
$$\iff$$
\set{ab}
$$\set{ab}$$
\rd
$$\rd$$
\rD
$$\rD$$
\scriptCapitalE
$$\scriptCapitalE$$
\scriptCapitalH
$$\scriptCapitalH$$
\scriptCapitalL
$$\scriptCapitalL$$
\gothicCapitalC
$$\gothicCapitalC$$
\gothicCapitalH
$$\gothicCapitalH$$
\gothicCapitalI
$$\gothicCapitalI$$
\gothicCapitalR
$$\gothicCapitalR$$
\imaginaryI
$$\imaginaryI$$
\imaginaryJ
$$\imaginaryJ$$
\exponentialE
$$\exponentialE$$
\differentialD
$$\differentialD$$
\capitalDifferentialD
$$\capitalDifferentialD$$
\Set{ x\in\mathbf{R}^2 \;\middle|\; 0<{|x|}<5 }
$$\Set{ x\in\mathbf{R}^2 \;\middle|\; 0<{|x|}<5 }$$

Environments / Matrixes

Environments are used to typeset a set of related items, for example cells in a matrix, or multi-line equations.

Each row in a tabular environment is separated by a \\ command.

Each column is separated by a &.

Matrixes

array

A simple table with no delimiters.

\begin{array}{lc}
a + 1 & b + 1 \\
c & \frac{1}{d}
\end{array}
$$\begin{array}{lc} a + 1 & b + 1 \\ c & \frac{1}{d} \end{array}$$

The {lc} argument specifies how many columns there are and how they should be formated:

  • l: left-aligned
  • c: centered
  • r: right-aligned

To add a vertical line separating columns, add a | character in the column format:

\begin{array}{l|c}
a + 1 & b + 1 \\
c & \frac{1}{d}
\end{array}
$$\begin{array}{l|c} a + 1 & b + 1 \\ c & \frac{1}{d} \end{array}$$

To add a double vertical line separating columns, add two | characters in the column format:

\begin{array}{l||c}
a + 1 & b + 1 \\
c & \frac{1}{d}
\end{array}
$$\begin{array}{l||c} a + 1 & b + 1 \\ c & \frac{1}{d} \end{array}$$

To add a dashed vertical line between two columns, use ::

\begin{array}{l:c}
a + 1 & b + 1 \\
c & \frac{1}{d}
\end{array}
$$\begin{array}{l:c} a + 1 & b + 1 \\ c & \frac{1}{d} \end{array}$$

matrix

The matrix environment is very similar to array, but it does not have an argument to specify the format of the columns.

\begin{matrix}
a + 1 & b + 1 \\
c & \frac{1}{d}
\end{matrix}
$$\begin{matrix} a + 1 & b + 1 \\ c & \frac{1}{d} \end{matrix}$$

To specify the format of the columns, use the starred version and an optional argument. This applies to all the other matrix environments.

\begin{matrix*}[l|r]
a + 1 & b + 1 \\
c & \frac{1}{d}
\end{matrix}
$$\begin{matrix*}[l|r] a + 1 & b + 1 \\ c & \frac{1}{d} \end{matrix}$$

pmatrix

A matrix with parentheses as delimiters.

\begin{pmatrix}
a + 1 & b + 1 \\
c & \frac{1}{d}
\end{pmatrix}
$$\begin{pmatrix} a + 1 & b + 1 \\ c & \frac{1}{d} \end{pmatrix}$$

bmatrix

A matrix with square brackets as delimiters.

\begin{bmatrix}
a + 1 & b + 1 \\
c & \frac{1}{d}
\end{bmatrix}
$$\begin{bmatrix} a + 1 & b + 1 \\ c & \frac{1}{d} \end{bmatrix}$$

Bmatrix

A matrix with braces (curly brackets) as delimiters.

\begin{Bmatrix}
a + 1 & b + 1 \\
c & \frac{1}{d}
\end{Bmatrix}
$$\begin{Bmatrix} a + 1 & b + 1 \\ c & \frac{1}{d} \end{Bmatrix}$$

vmatrix

A matrix with single bars as delimiters.

\begin{vmatrix}
a + 1 & b + 1 \\
c & \frac{1}{d}
\end{vmatrix}
$$\begin{vmatrix} a + 1 & b + 1 \\ c & \frac{1}{d} \end{vmatrix}$$

Vmatrix

A matrix with double bars as delimiters.

\begin{Vmatrix}
a + 1 & b + 1 \\
c & \frac{1}{d}
\end{Vmatrix}
$$\begin{Vmatrix} a + 1 & b + 1 \\ c & \frac{1}{d} \end{Vmatrix}$$

smallmatrix

A matrix typeset in a way that may be suitable on the same line as text.

\begin{smallmatrix}
a + 1 & b + 1 \\
c & \frac{1}{d}
\end{smallmatrix}
$$\begin{smallmatrix} a + 1 & b + 1 \\ c & \frac{1}{d} \end{smallmatrix}$$

Other Environments

cases, dcases and rcases

Use these environments to write piecewise functions:

f(n) = \begin{cases}
1 & \text{if } n = 0 \\
f(n-1) + f(n-2) & \text{if } n \ge 2
\end{cases}
$$f(n) = \begin{cases} 1 & \text{if } n = 0 \\ f(n-1) + f(n-2) & \text{if } n \ge 2 \end{cases}$$

To typeset the content in Display style, use dcases instead:

f(n) = \begin{dcases}
1 & \text{if } n = 0 \\
f(n-1) + f(n-2) & \text{if } n \ge 2
\end{dcases}
$$f(n) = \begin{dcases} 1 & \text{if } n = 0 \\ f(n-1) + f(n-2) & \text{if } n \ge 2 \end{dcases}$$

To display the brace on the right, use rcases.

f(n) = \begin{rcases}
1 & \text{if } n = 0 \\
f(n-1) + f(n-2) & \text{if } n \ge 2
\end{rcases}
$$f(n) = \begin{rcases} 1 & \text{if } n = 0 \\ f(n-1) + f(n-2) & \text{if } n \ge 2 \end{rcases}$$

gather

Consecutive equations without alignment

\begin{gather}
3(a-x) = 3.5x + a - 1 \\
3a - 3x = 3.5x + a - 1 \\
a = \frac{13}{4} , x - \frac{1}{2}
\end{gather}
$$\begin{gather} 3(a-x) = 3.5x + a - 1 \\ 3a - 3x = 3.5x + a - 1 \\ a = \frac{13}{4} , x - \frac{1}{2} \end{gather}$$

multline

The first line is left aligned, the last line is right aligned, and all the intermediate lines are centered.

\begin{multline}
3(a-x) = 3.5x + a - 1 \\
3a - 3x = 3.5x + a - 1 \\
a = \frac{13}{4}x - \frac{1}{2}
\end{multline}
$$\begin{multline} 3(a-x) = 3.5x + a - 1 \\ 3a - 3x = 3.5x + a - 1 \\ a = \frac{13}{4}x - \frac{1}{2} \end{multline}$$

align

\begin{align}
f(x) & = (a+b)^2 \\
& = a^2+2ab+b^2 \\
\end{align}
$$\begin{align} f(x) & = (a+b)^2 \\ & = a^2+2ab+b^2 \\ \end{align}$$

Others

\begin{math}
x+\frac12
\end{math}
$$\begin{math} x+\frac12 \end{math}$$
\begin{displaymath}
x+\frac12
\end{displaymath}
$$\begin{displaymath} x+\frac12 \end{displaymath}$$
\begin{equation}
x+\frac12
\end{equation}
$$\begin{equation} x+\frac12 \end{equation}$$
\begin{subequations}
x+\frac12
\end{subequations}
$$\begin{subequations} x+\frac12 \end{subequations}$$
\begin{eqnarray}
x+\frac12
\end{eqnarray}
$$\begin{eqnarray} x+\frac12 \end{eqnarray}$$

Avoid center, use align instead.

\begin{center}
\text{first}
\end{center}
$$\begin{center} \text{first} \end{center}$$

The following environments do not form a math environment by themselves but can be used as building blocks for more elaborate structures:

\begin{gathered}3(a-x) = 3.5x + a - 1 \\
3a - 3x = 3.5x + a - 1 \\
a = \frac{13}{4}x - \frac{1}{2}
\end{gathered}
$$\begin{gathered}3(a-x) = 3.5x + a - 1 \\ 3a - 3x = 3.5x + a - 1 \\ a = \frac{13}{4}x - \frac{1}{2} \end{gathered}$$
\begin{split}3(a-x) = 3.5x + a - 1 \\
3a - 3x = 3.5x + a - 1 \\
a = \frac{13}{4}x - \frac{1}{2}
\end{split}
$$\begin{split}3(a-x) = 3.5x + a - 1 \\ 3a - 3x = 3.5x + a - 1 \\ a = \frac{13}{4}x - \frac{1}{2} \end{split}$$
\begin{aligned}3(a-x) = 3.5x + a - 1 \\
3a - 3x = 3.5x + a - 1 \\
a = \frac{13}{4}x - \frac{1}{2}
\end{aligned}
$$\begin{aligned}3(a-x) = 3.5x + a - 1 \\ 3a - 3x = 3.5x + a - 1 \\ a = \frac{13}{4}x - \frac{1}{2} \end{aligned}$$

TeX Registers

The math typesetting is influenced by some "constants" that are stored in "registers". Those registers can be set globally on a mathfield using the mf.registers property.

RegisterPurpose
arrayrulewidthWidth of separator lines in array environments
arraycolsepAmount of space between separator lines
arraystretchStretch factor between rows in an environment
delimitershortfall
doublerulesepAmount of space between adjacent separator lines
jotVertical space between the lines for all math expressions which allow multiple lines
fboxruleDefault width of the border with commands such as \boxed or \fbox
fboxsepDefault padding between a box and its content
medmuskipAmount of space around a binary operator. See also thinmuskip, thickmuskip.
nulldelimiterspaceHorizontal space of an empty delimiter
thickmuskipAmount of space around a relational operator. See also medmuskip, thinmuskip.
thinmuskipAmount of space around math punctuation. See also medmuskip, thickmuskip.

TeX Primitives

The commands below are TeX primitives. Most are only useful when writing TeX packages or macros.

Command
%Anything after a % character and an end of line character is interpreted as a comment and ignored
\limits
\nolimits
\relax
\noexpand
\obeyspacesIn Math Mode, spaces are normally ignored. Using this command spaces will be preserved even in Math Mode.
\bgroup
\egroup
Begin/End group, synonym for open/close brace
\string
\csname
\endcsname
Turn the next tokens, until \endcsname, into a command
\ensuremath{}If in Math Mode, does nothing. Otherwise, switch to Math Mode.