Currently there may be errors shown on top of a page, because of a missing Wiki update (PHP version and extension DPL3). |
Topics | Help • Register • News • History • How to • Sequences statistics • Template prototypes |
Help:Math rendering
Contents
- 1 Math rendering
- 1.1 The < math > command
- 1.2 Special characters
- 1.3 Accents/diacritics
- 1.4 Standard numerical functions
- 1.5 Bounds
- 1.6 Projections
- 1.7 Differentials and derivatives
- 1.8 Letter-like symbols or constants
- 1.9 Modular arithmetic
- 1.10 Radicals
- 1.11 Operators
- 1.12 Sets
- 1.13 Relations
- 1.14 Geometric
- 1.15 Logic
- 1.16 Arrows
- 1.17 Special
- 1.18 Subscripts, superscripts, integrals
- 1.19 Fractions, matrices, multilines
- 1.20 Parenthesizing big expressions, brackets, bars
- 1.21 Alphabets and typefaces
- 1.22 Mixed text faces
- 1.23 Color
- 1.24 Spacing
Math rendering
This is a brief introduction to how to post maths in wiki format.
All maths notation needs to appear between the math tags, <math>
and </math>
.
Math commands are preceded by a backslash, like this: \sum
.
The < math > command
LaTeX commands are case-sensitive, and take one of the following two formats:
- They start with a backslash
\
and then have a name consisting of letters only. Command names are terminated by a space, a number or any other "non-letter". - They consist of a backslash
\
and exactly one non-letter.
Some commands need an argument, which has to be given between curly braces { }
after the command name. Some commands support optional parameters, which are added after the command name in square brackets []
. The general syntax is:
\commandname[option1,option2,...]{argument1}{argument2}...
Special characters
The following symbols are reserved characters that either have a special meaning under LaTeX or are unavailable in all the fonts. If you enter them directly in your text, they will normally not render, but rather do things you did not intend.
# $ % ^ & _ { } ~ \
These characters can be entered by adding a prefix backslash:
\# \$ \% \textasciicircum{} \& \_ \{ \} \~{} \textbackslash{}
The other symbols and many more can be rendered with special commands in mathematical formulae or as accents.
The backslash character \
can not be entered by adding another backslash in front of it (\\
); this sequence is used for line breaking. For introducing a backslash in math mode, you can use \backslash
instead.
The command \~
produces a tilde which is placed over the next letter. For example \~n
/ gives ñ
. To produce just the character ~
, use \~{}
which places a ~
over an empty box. Alternatively \sim
produces a large centred ~
which may be more appropriate in some situations, but may not render properly in simple expressions which are converted to HTML.
Similarly, the command \^
produces a hat over the next character, for example \^{o}
produces ô
. If you need in text to display the ^
symbol you have to use \textasciicircum
.
Accents/diacritics | |
---|---|
\dot{a}, \ddot{a}, \acute{a}, \grave{a}
|
[math]\displaystyle{ \dot{a}, \ddot{a}, \acute{a}, \grave{a} }[/math] |
\check{a}, \breve{a}, \tilde{a}, \bar{a}
|
[math]\displaystyle{ \check{a}, \breve{a}, \tilde{a}, \bar{a} }[/math] |
\hat{a}, \widehat{a}, \vec{a}
|
[math]\displaystyle{ \hat{a}, \widehat{a}, \vec{a} }[/math] |
Standard numerical functions | |
\exp_a b = a^b, \exp b = e^b, 10^m
|
[math]\displaystyle{ \exp_a b = a^b, \exp b = e^b, 10^m }[/math] |
\ln c, \lg d = \log e, \log_{10} f
|
[math]\displaystyle{ \ln c, \lg d = \log e, \log_{10} f }[/math] |
\sin a, \cos b, \tan c, \cot d, \sec e, \csc f
|
[math]\displaystyle{ \sin a, \cos b, \tan c, \cot d, \sec e, \csc f }[/math] |
\arcsin h, \arccos i, \arctan j
|
[math]\displaystyle{ \arcsin h, \arccos i, \arctan j }[/math] |
\sinh k, \cosh l, \tanh m, \coth n
|
[math]\displaystyle{ \sinh k, \cosh l, \tanh m, \coth n }[/math] |
\left\vert s \right\vert
|
[math]\displaystyle{ \left\vert s \right\vert }[/math] |
\min(x,y), \max(x,y)
|
[math]\displaystyle{ \min(x,y), \max(x,y) }[/math] |
Bounds | |
\min x, \max y, \inf s, \sup t
|
[math]\displaystyle{ \min x, \max y, \inf s, \sup t }[/math] |
\lim u, \liminf v, \limsup w
|
[math]\displaystyle{ \lim u, \liminf v, \limsup w }[/math] |
\dim p, \deg q, \det m, \ker\phi
|
[math]\displaystyle{ \dim p, \deg q, \det m, \ker\phi }[/math] |
Projections | |
\Pr j, \hom l, \lVert z \rVert, \arg z
|
[math]\displaystyle{ \Pr j, \hom l, \lVert z \rVert, \arg z }[/math] |
Differentials and derivatives | |
dt, \operatorname{d}\!t, \partial t, \nabla\psi
|
[math]\displaystyle{ dt, \operatorname{d}\!t, \partial t, \nabla\psi }[/math] |
dy/dx, \operatorname{d}\!y/\operatorname{d}\!x, {dy \over dx}, {\operatorname{d}\!y\over\operatorname{d}\!x}, {\partial^2\over\partial x_1\partial x_2}y
|
[math]\displaystyle{ dy/dx, \operatorname{d}\!y/\operatorname{d}\!x, {dy \over dx}, {\operatorname{d}\!y\over\operatorname{d}\!x}, {\partial^2\over\partial x_1\partial x_2}y }[/math] |
\prime, f^\prime, f', f, f^{(3)}, \dot y, \ddot y
|
[math]\displaystyle{ \prime, f^\prime, f', f'', f^{(3)} \!, \dot y, \ddot y }[/math] |
Letter-like symbols or constants | |
\infty, \aleph, \hbar
|
[math]\displaystyle{ \infty, \aleph, \hbar }[/math] |
\Im, \imath, \jmath, \ell, \wp, \Re
|
[math]\displaystyle{ \Im, \imath, \jmath, \ell, \wp, \Re }[/math] |
Modular arithmetic | |
s_k \equiv 0 \pmod{m}
|
[math]\displaystyle{ s_k \equiv 0 \pmod{m} }[/math] |
a\,\bmod\,b
|
[math]\displaystyle{ a\,\bmod\,b }[/math] |
\gcd(m, n), \operatorname{lcm}(m, n)
|
[math]\displaystyle{ \gcd(m, n), \operatorname{lcm}(m, n) }[/math] |
\mid, \not\mid
|
[math]\displaystyle{ \mid, \not\mid }[/math] |
Radicals | |
\surd, \sqrt{2}, \sqrt[n]{}, \sqrt[3]{x^3+y^3 \over 2}
|
[math]\displaystyle{ \surd, \sqrt{2}, \sqrt[n]{}, \sqrt[3]{x^3+y^3 \over 2} }[/math] |
Operators | |
+, -, \pm, \mp, \dot+
|
[math]\displaystyle{ +, -, \pm, \mp, \dot+ }[/math] |
\times, \div, /, \backslash
|
[math]\displaystyle{ \times, \div, /, \backslash }[/math] |
\cdot, * \ast, \star, \circ, \bullet
|
[math]\displaystyle{ \cdot, * \ast, \star, \circ, \bullet }[/math] |
\oplus, \ominus, \otimes, \oslash, \odot
|
[math]\displaystyle{ \oplus, \ominus, \otimes, \oslash, \odot }[/math] |
\bigoplus, \bigotimes, \bigodot
|
[math]\displaystyle{ \bigoplus, \bigotimes, \bigodot }[/math] |
Sets | |
\{ \}, \emptyset
|
[math]\displaystyle{ \{ \}, \emptyset }[/math] |
\in, \notin, \ni, \not\ni
|
[math]\displaystyle{ \in, \notin, \ni, \not\ni }[/math] |
\cap, \sqcap, \bigcap
|
[math]\displaystyle{ \cap, \sqcap, \bigcap }[/math] |
\cup, \sqcup, \bigcup, \bigsqcup, \uplus, \biguplus
|
[math]\displaystyle{ \cup, \sqcup, \bigcup, \bigsqcup, \uplus, \biguplus }[/math] |
\setminus, \times
|
[math]\displaystyle{ \setminus, \times }[/math] |
\subset, \supset, \subseteq, \not\subseteq, \sqsubseteq, \supseteq, \not\supseteq, \sqsupseteq
|
[math]\displaystyle{ \subset, \supset, \subseteq, \not\subseteq, \sqsubseteq, \supseteq, \not\supseteq, \sqsupseteq }[/math] |
Relations | |
=, \ne, \neq, \equiv, \not\equiv
|
[math]\displaystyle{ =, \ne, \neq, \equiv, \not\equiv }[/math] |
\dot=, \overset{\underset{\mathrm{def}}{}}{=}, :=
|
[math]\displaystyle{ \dot=, \overset{\underset{\mathrm{def}}{}}{=}, := \! }[/math] |
\sim, \simeq, :\sim, \cong, \not\cong
|
[math]\displaystyle{ \sim, \simeq, :\sim, \cong, \not\cong }[/math] |
\approx, \asymp, \propto
|
[math]\displaystyle{ \approx, \asymp, \propto }[/math] |
<, \not<, \ll, \not\ll
|
[math]\displaystyle{ \lt , \not\lt , \ll, \not\ll }[/math] |
>, \not>, \gg, \not\gg
|
[math]\displaystyle{ \gt , \not\gt , \gg, \not\gg }[/math] |
\le, \leq, \not\leq
|
[math]\displaystyle{ \le, \leq, \not\leq }[/math] |
\ge, \geq, \not\geq
|
[math]\displaystyle{ \ge, \geq, \not\geq }[/math] |
\prec, \not\prec, \preceq, \not\preceq
|
[math]\displaystyle{ \prec, \not\prec, \preceq, \not\preceq }[/math] |
\succ, \not\succ, \succeq, \not\succeq
|
[math]\displaystyle{ \succ, \not\succ, \succeq, \not\succeq }[/math] |
Geometric | |
\parallel, \not\parallel
|
[math]\displaystyle{ \parallel, \not\parallel }[/math] |
\perp, \angle, 45^\circ
|
[math]\displaystyle{ \perp, \angle, 45^\circ }[/math] |
\bigcirc, \triangle \bigtriangleup, \bigtriangledown
|
[math]\displaystyle{ \bigcirc, \triangle \bigtriangleup, \bigtriangledown }[/math] |
Logic | |
\forall, \exists, \not\exists
|
[math]\displaystyle{ \forall, \exists, \not\exists }[/math] |
\vee, \bigvee
|
[math]\displaystyle{ \vee, \bigvee }[/math] |
\land, \wedge, \bigwedge
|
[math]\displaystyle{ \land, \wedge, \bigwedge }[/math] |
\bar{q}, \bar{abc}, \overline{q}, \overline{abc}, \lnot \neg, \not\operatorname{R}, \bot, \top
|
[math]\displaystyle{ \bar{q}, \bar{abc}, \overline{q}, \overline{abc}, \lnot \neg, \not\operatorname{R}, \bot, \top }[/math] |
\vdash, \dashv, \not\vdash, \not\dashv, \models
|
[math]\displaystyle{ \vdash, \dashv, \not\vdash, \not\dashv, \models }[/math] |
Arrows | |
\Rightarrow, \not\Rightarrow, \Longrightarrow
|
[math]\displaystyle{ \Rightarrow, \not\Rightarrow, \Longrightarrow }[/math] |
\Leftarrow, \not\Leftarrow, \Longleftarrow
|
[math]\displaystyle{ \Leftarrow, \not\Leftarrow, \Longleftarrow }[/math] |
\Leftrightarrow, \not\Leftrightarrow, \Longleftrightarrow \iff
|
[math]\displaystyle{ \Leftrightarrow, \not\Leftrightarrow, \Longleftrightarrow \iff }[/math] |
\Uparrow, \Downarrow, \Updownarrow
|
[math]\displaystyle{ \Uparrow, \Downarrow, \Updownarrow }[/math] |
\rightarrow \to, \not\rightarrow, \longrightarrow
|
[math]\displaystyle{ \rightarrow \to, \not\rightarrow, \longrightarrow }[/math] |
\leftarrow \gets, \not\leftarrow, \longleftarrow
|
[math]\displaystyle{ \leftarrow \gets, \not\leftarrow, \longleftarrow }[/math] |
\leftrightarrow, \not\leftrightarrow, \longleftrightarrow
|
[math]\displaystyle{ \leftrightarrow, \not\leftrightarrow, \longleftrightarrow }[/math] |
\uparrow, \downarrow, \updownarrow
|
[math]\displaystyle{ \uparrow, \downarrow, \updownarrow }[/math] |
\nearrow, \swarrow, \nwarrow, \searrow
|
[math]\displaystyle{ \nearrow, \swarrow, \nwarrow, \searrow }[/math] |
\mapsto, \longmapsto
|
[math]\displaystyle{ \mapsto, \longmapsto }[/math] |
\rightharpoonup \rightharpoondown \leftharpoonup \leftharpoondown \rightleftharpoons
|
[math]\displaystyle{ \rightharpoonup \rightharpoondown \leftharpoonup \leftharpoondown \rightleftharpoons }[/math] |
\hookrightarrow \hookleftarrow
|
[math]\displaystyle{ \hookrightarrow \hookleftarrow }[/math] |
Special | |
\amalg \S \% \dagger \ddagger \ldots \cdots
|
[math]\displaystyle{ \amalg \S \% \dagger \ddagger \ldots \cdots }[/math] |
\smile \frown \wr \triangleleft \triangleright
|
[math]\displaystyle{ \smile \frown \wr \triangleleft \triangleright }[/math] |
\diamondsuit, \heartsuit, \clubsuit, \spadesuit, \flat, \natural, \sharp
|
[math]\displaystyle{ \diamondsuit, \heartsuit, \clubsuit, \spadesuit, \flat, \natural, \sharp }[/math] |
Subscripts, superscripts, integrals
Feature | Syntax | How it looks rendered |
---|---|---|
Superscript | a^2 |
[math]\displaystyle{ a^2 }[/math] |
Subscript | a_2 |
[math]\displaystyle{ a_2 }[/math] |
Grouping | 10^{30} a^{2+2} |
[math]\displaystyle{ 10^{30} a^{2+2} }[/math] |
a_{i,j} b_{f'} |
[math]\displaystyle{ a_{i,j} b_{f'} }[/math] | |
Combining sub & super without and with horizontal separation | x_2^3 |
[math]\displaystyle{ x_2^3 }[/math] |
{x_2}^3 |
[math]\displaystyle{ {x_2}^3 \,\! }[/math] | |
Super super | 10^{10^{8}} |
[math]\displaystyle{ 10^{10^{8}} }[/math] |
Preceding and/or additional sub & super | \sideset{_1^2}{_3^4}\prod_a^b |
[math]\displaystyle{ \sideset{_1^2}{_3^4}\prod_a^b }[/math] |
{}_1^2\!\Omega_3^4 |
[math]\displaystyle{ {}_1^2\!\Omega_3^4 }[/math] | |
Stacking | \overset{\alpha}{\omega} |
[math]\displaystyle{ \overset{\alpha}{\omega} }[/math] |
\underset{\alpha}{\omega} |
[math]\displaystyle{ \underset{\alpha}{\omega} }[/math] | |
\overset{\alpha}{\underset{\gamma}{\omega}} |
[math]\displaystyle{ \overset{\alpha}{\underset{\gamma}{\omega}} }[/math] | |
\stackrel{\alpha}{\omega} |
[math]\displaystyle{ \stackrel{\alpha}{\omega} }[/math] | |
Derivatives | x', y, f', f |
[math]\displaystyle{ x', y'', f', f'' }[/math] |
x^\prime, y^{\prime\prime} |
[math]\displaystyle{ x^\prime, y^{\prime\prime} }[/math] | |
Derivative dots | \dot{x}, \ddot{x} |
[math]\displaystyle{ \dot{x}, \ddot{x} }[/math] |
Underlines, overlines, vectors | \hat a \ \bar b \ \vec c |
[math]\displaystyle{ \hat a \ \bar b \ \vec c }[/math] |
\overrightarrow{a b} \ \overleftarrow{c d} \ \widehat{d e f} |
[math]\displaystyle{ \overrightarrow{a b} \ \overleftarrow{c d} \ \widehat{d e f} }[/math] | |
\overline{g h i} \ \underline{j k l} |
[math]\displaystyle{ \overline{g h i} \ \underline{j k l} }[/math] | |
Arc (workaround) | \overset{\frown} {AB} |
[math]\displaystyle{ \overset{\frown} {AB} }[/math] |
Arrows | A \xleftarrow{n+\mu-1} B \xrightarrow[T]{n\pm i-1} C |
[math]\displaystyle{ A \xleftarrow{n+\mu-1} B \xrightarrow[T]{n\pm i-1} C }[/math] |
Overbraces | \overbrace{ 1+2+\cdots+100 }^{5050} |
[math]\displaystyle{ \overbrace{ 1+2+\cdots+100 }^{5050} }[/math] |
Underbraces | \underbrace{ a+b+\cdots+z }_{26} |
[math]\displaystyle{ \underbrace{ a+b+\cdots+z }_{26} }[/math] |
Sum | \sum_{k=1}^N k^2 |
[math]\displaystyle{ \sum_{k=1}^N k^2 }[/math] |
Sum (force \textstyle )
|
\textstyle \sum_{k=1}^N k^2 |
[math]\displaystyle{ \textstyle \sum_{k=1}^N k^2 }[/math] |
Sum in a fraction (default \textstyle )
|
\frac{\sum_{k=1}^N k^2}{a} |
[math]\displaystyle{ \frac{\sum_{k=1}^N k^2}{a} }[/math] |
Sum in a fraction (force \displaystyle )
|
\frac{\displaystyle \sum_{k=1}^N k^2}{a} |
[math]\displaystyle{ \frac{\displaystyle \sum_{k=1}^N k^2}{a} }[/math] |
Sum in a fraction (alternative limits style) | \frac{\sum\limits^{^N}_{k=1} k^2}{a} |
[math]\displaystyle{ \frac{\sum\limits^{^N}_{k=1} k^2}{a} }[/math] |
Product | \prod_{i=1}^N x_i |
[math]\displaystyle{ \prod_{i=1}^N x_i }[/math] |
Product (force \textstyle )
|
\textstyle \prod_{i=1}^N x_i |
[math]\displaystyle{ \textstyle \prod_{i=1}^N x_i }[/math] |
Coproduct | \coprod_{i=1}^N x_i |
[math]\displaystyle{ \coprod_{i=1}^N x_i }[/math] |
Coproduct (force \textstyle )
|
\textstyle \coprod_{i=1}^N x_i |
[math]\displaystyle{ \textstyle \coprod_{i=1}^N x_i }[/math] |
Limit | \lim_{n \to \infty}x_n |
[math]\displaystyle{ \lim_{n \to \infty}x_n }[/math] |
Limit (force \textstyle )
|
\textstyle \lim_{n \to \infty}x_n |
[math]\displaystyle{ \textstyle \lim_{n \to \infty}x_n }[/math] |
Integral | \int\limits_{1}^{3}\frac{e^3/x}{x^2}\, dx |
[math]\displaystyle{ \int\limits_{1}^{3}\frac{e^3/x}{x^2}\, dx }[/math] |
Integral (alternative limits style) | \int_{1}^{3}\frac{e^3/x}{x^2}\, dx |
[math]\displaystyle{ \int_{1}^{3}\frac{e^3/x}{x^2}\, dx }[/math] |
Integral (force \textstyle )
|
\textstyle \int\limits_{-N}^{N} e^x\, dx |
[math]\displaystyle{ \textstyle \int\limits_{-N}^{N} e^x\, dx }[/math] |
Integral (force \textstyle , alternative limits style)
|
\textstyle \int_{-N}^{N} e^x\, dx |
[math]\displaystyle{ \textstyle \int_{-N}^{N} e^x\, dx }[/math] |
Double integral | \iint\limits_D \, dx\,dy |
[math]\displaystyle{ \iint\limits_D \, dx\,dy }[/math] |
Triple integral | \iiint\limits_E \, dx\,dy\,dz |
[math]\displaystyle{ \iiint\limits_E \, dx\,dy\,dz }[/math] |
Quadruple integral | \iiiint\limits_F \, dx\,dy\,dz\,dt |
[math]\displaystyle{ \iiiint\limits_F \, dx\,dy\,dz\,dt }[/math] |
Line or path integral | \int_{(x,y)\in C} x^3\, dx + 4y^2\, dy |
[math]\displaystyle{ \int_{(x,y)\in C} x^3\, dx + 4y^2\, dy }[/math] |
Closed line or path integral | \oint_{(x,y)\in C} x^3\, dx + 4y^2\, dy |
[math]\displaystyle{ \oint_{(x,y)\in C} x^3\, dx + 4y^2\, dy }[/math] |
Intersections | \bigcap_{i=_1}^n E_i |
[math]\displaystyle{ \bigcap_{i=_1}^n E_i }[/math] |
Unions | \bigcup_{i=_1}^n E_i |
[math]\displaystyle{ \bigcup_{i=_1}^n E_i }[/math] |
Fractions, matrices, multilines
Feature | Syntax | How it looks rendered |
---|---|---|
Fractions | \frac{2}{4}=0.5 or {2 \over 4}=0.5
|
[math]\displaystyle{ \frac{2}{4}=0.5 }[/math] |
Small fractions | \tfrac{2}{4} = 0.5
|
[math]\displaystyle{ \tfrac{2}{4} = 0.5 }[/math] |
Large (normal) fractions | \dfrac{2}{4} = 0.5 \qquad \dfrac{2}{c + \dfrac{2}{d + \dfrac{2}{4}}} = a
|
[math]\displaystyle{ \dfrac{2}{4} = 0.5 \qquad \dfrac{2}{c + \dfrac{2}{d + \dfrac{2}{4}}} = a }[/math] |
Large (nested) fractions | \cfrac{2}{c + \cfrac{2}{d + \cfrac{2}{4}}} = a
|
[math]\displaystyle{ \cfrac{2}{c + \cfrac{2}{d + \cfrac{2}{4}}} = a }[/math] |
Cancellations in fractions Note does not work with MathJax workaround: using \not |
\cfrac{x}{1 + \cfrac{\not{y}}{\not{y}}} = \cfrac{x}{2}
|
[math]\displaystyle{ \cfrac{x}{1 + \cfrac{\not{y}}{\not{y}}} = \cfrac{x}{2} }[/math] |
Binomial coefficients | \binom{n}{k}
|
[math]\displaystyle{ \binom{n}{k} }[/math] |
Small binomial coefficients | \tbinom{n}{k}
|
[math]\displaystyle{ \tbinom{n}{k} }[/math] |
Large (normal) binomial coefficients | \dbinom{n}{k}
|
[math]\displaystyle{ \dbinom{n}{k} }[/math] |
Matrices | \begin{matrix} x & y \\ z & v \end{matrix} |
[math]\displaystyle{ \begin{matrix} x & y \\ z & v \end{matrix} }[/math] |
\begin{vmatrix} x & y \\ z & v \end{vmatrix} |
[math]\displaystyle{ \begin{vmatrix} x & y \\ z & v \end{vmatrix} }[/math] | |
\begin{Vmatrix} x & y \\ z & v \end{Vmatrix} |
[math]\displaystyle{ \begin{Vmatrix} x & y \\ z & v \end{Vmatrix} }[/math] | |
\begin{bmatrix} 0 & \cdots & 0 \\ \vdots & \ddots & \vdots \\ 0 & \cdots & 0 \end{bmatrix} |
[math]\displaystyle{ \begin{bmatrix} 0 & \cdots & 0 \\ \vdots & \ddots & \vdots \\ 0 & \cdots & 0 \end{bmatrix} }[/math] | |
\begin{Bmatrix} x & y \\ z & v \end{Bmatrix} |
[math]\displaystyle{ \begin{Bmatrix} x & y \\ z & v \end{Bmatrix} }[/math] | |
\begin{pmatrix} x & y \\ z & v \end{pmatrix} |
[math]\displaystyle{ \begin{pmatrix} x & y \\ z & v \end{pmatrix} }[/math] | |
\bigl( \begin{smallmatrix} a&b\\ c&d \end{smallmatrix} \bigr) |
[math]\displaystyle{ \bigl( \begin{smallmatrix} a&b\\ c&d \end{smallmatrix} \bigr) }[/math] | |
Case distinctions | f(n) = \begin{cases} n/2, & \text{if }n\text{ is even} \\ 3n+1, & \text{if }n\text{ is odd} \end{cases} |
[math]\displaystyle{ f(n) = \begin{cases} n/2, & \text{if }n\text{ is even} \\ 3n+1, & \text{if }n\text{ is odd} \end{cases} }[/math] |
Multiline equations | \begin{align} f(x) & = (a+b)^2 \\ & = a^2+2ab+b^2 \\ \end{align} |
[math]\displaystyle{ \begin{align} f(x) & = (a+b)^2 \\ & = a^2+2ab+b^2 \\ \end{align} }[/math] |
\begin{alignat}{2} f(x) & = (a-b)^2 \\ & = a^2-2ab+b^2 \\ \end{alignat} |
[math]\displaystyle{ \begin{alignat}{2} f(x) & = (a-b)^2 \\ & = a^2-2ab+b^2 \\ \end{alignat} }[/math] | |
Multiline equations (must define number of columns used ({lcr}) (should not be used unless needed) | \begin{array}{lcl} z & = & a \\ f(x,y,z) & = & x + y + z \end{array} |
[math]\displaystyle{ \begin{array}{lcl} z & = & a \\ f(x,y,z) & = & x + y + z \end{array} }[/math] |
Multiline equations (more) | \begin{array}{lcr} z & = & a \\ f(x,y,z) & = & x + y + z \end{array} |
[math]\displaystyle{ \begin{array}{lcr} z & = & a \\ f(x,y,z) & = & x + y + z \end{array} }[/math] |
Breaking up a long expression so that it wraps when necessary, at the expense of destroying correct spacing | f(x) = \sum_{n=0}^\infty a_n x^n = a_0+a_1x+a_2x^2+\cdots |
[math]\displaystyle{ f(x) = \sum_{n=0}^\infty a_n x^n = a_0 +a_1x+a_2x^2+\cdots }[/math] |
Simultaneous equations | \begin{cases} 3x + 5y + z \\ 7x - 2y + 4z \\ -6x + 3y + 2z \end{cases} |
[math]\displaystyle{ \begin{cases} 3x + 5y + z \\ 7x - 2y + 4z \\ -6x + 3y + 2z \end{cases} }[/math] |
Arrays | \begin{array}{|c|c|c|} a & b & S \\ \hline 0&0&1\\ 0&1&1\\ 1&0&1\\ 1&1&0\\ \end{array} |
[math]\displaystyle{ \begin{array}{|c|c|c|} a & b & S \\ \hline 0&0&1\\ 0&1&1\\ 1&0&1\\ 1&1&0\\ \end{array} }[/math] |
Parenthesizing big expressions, brackets, bars
You can use various delimiters with \left and \right:
Feature | Syntax | How it looks rendered |
---|---|---|
Bad | ( \frac{1}{2} )
|
[math]\displaystyle{ ( \frac{1}{2} ) }[/math] |
Good | \left ( \frac{1}{2} \right )
|
[math]\displaystyle{ \left ( \frac{1}{2} \right ) }[/math] |
Parentheses | \left ( \frac{a}{b} \right )
|
[math]\displaystyle{ \left ( \frac{a}{b} \right ) }[/math] |
Brackets | \left [ \frac{a}{b} \right ] \quad \left \lbrack \frac{a}{b} \right \rbrack
|
[math]\displaystyle{ \left [ \frac{a}{b} \right ] \quad \left \lbrack \frac{a}{b} \right \rbrack }[/math] |
Braces | \left \{ \frac{a}{b} \right \} \quad \left \lbrace \frac{a}{b} \right \rbrace
|
[math]\displaystyle{ \left \{ \frac{a}{b} \right \} \quad \left \lbrace \frac{a}{b} \right \rbrace }[/math] |
Angle brackets | \left \langle \frac{a}{b} \right \rangle
|
[math]\displaystyle{ \left \langle \frac{a}{b} \right \rangle }[/math] |
Bars and double bars | \left | \frac{a}{b} \right \vert \quad \left \Vert \frac{c}{d} \right \| |
[math]\displaystyle{ \left | \frac{a}{b} \right \vert \quad \left \Vert \frac{c}{d} \right \| }[/math] |
Floor and ceiling functions: | \left \lfloor \frac{a}{b} \right \rfloor \quad \left \lceil \frac{c}{d} \right \rceil
|
[math]\displaystyle{ \left \lfloor \frac{a}{b} \right \rfloor \quad \left \lceil \frac{c}{d} \right \rceil }[/math] |
Slashes and backslashes | \left / \frac{a}{b} \right \backslash
|
[math]\displaystyle{ \left / \frac{a}{b} \right \backslash }[/math] |
Up, down, and up-down arrows | \left \uparrow \frac{a}{b} \right \downarrow \quad \left \Uparrow \frac{a}{b} \right \Downarrow \quad \left \updownarrow \frac{a}{b} \right \Updownarrow
|
[math]\displaystyle{ \left \uparrow \frac{a}{b} \right \downarrow \quad \left \Uparrow \frac{a}{b} \right \Downarrow \quad \left \updownarrow \frac{a}{b} \right \Updownarrow }[/math] |
Delimiters can be mixed, as long as \left and \right match |
\left [ 0,1 \right ) \left \langle \psi \right | |
[math]\displaystyle{ \left [ 0,1 \right ) \left \langle \psi \right | }[/math] |
Use \left. and \right. if you do not want a delimiter to appear |
\left . \frac{A}{B} \right \} \to X
|
[math]\displaystyle{ \left . \frac{A}{B} \right \} \to X }[/math] |
Size of the delimiters (add "l" or "r" to indicate the side for proper spacing) | ( \bigl( \Bigl( \biggl( \Biggl( \dots \Biggr] \biggr] \Bigr] \bigr] ]
|
[math]\displaystyle{ ( \bigl( \Bigl( \biggl( \Biggl( \dots \Biggr] \biggr] \Bigr] \bigr] ] }[/math] |
\{ \bigl\{ \Bigl\{ \biggl\{ \Biggl\{ \dots \Biggr\rangle \biggr\rangle \Bigr\rangle \bigr\rangle \rangle
|
[math]\displaystyle{ \{ \bigl\{ \Bigl\{ \biggl\{ \Biggl\{ \dots \Biggr\rangle \biggr\rangle \Bigr\rangle \bigr\rangle \rangle }[/math] | |
\big\| \Big\| \bigg\| \Bigg\| \dots \Bigg| \bigg| \Big| \big| | | [math]\displaystyle{ \| \big\| \Big\| \bigg\| \Bigg\| \dots \Bigg| \bigg| \Big| \big| | }[/math] | |
\lfloor \bigl\lfloor \Bigl\lfloor \biggl\lfloor \Biggl\lfloor \dots \Biggr\rceil \biggr\rceil \Bigr\rceil \bigr\rceil \ceil
|
[math]\displaystyle{ \lfloor \bigl\lfloor \Bigl\lfloor \biggl\lfloor \Biggl\lfloor \dots \Biggr\rceil \biggr\rceil \Bigr\rceil \bigr\rceil \rceil }[/math] | |
\uparrow \big\uparrow \Big\uparrow \bigg\uparrow \Bigg\uparrow \dots \Bigg\Downarrow \bigg\Downarrow \Big\Downarrow \big\Downarrow \Downarrow
|
[math]\displaystyle{ \uparrow \big\uparrow \Big\uparrow \bigg\uparrow \Bigg\uparrow \dots \Bigg\Downarrow \bigg\Downarrow \Big\Downarrow \big\Downarrow \Downarrow }[/math] | |
\updownarrow \big\updownarrow \Big\updownarrow \bigg\updownarrow \Bigg\updownarrow \dots \Bigg\Updownarrow \bigg\Updownarrow \Big\Updownarrow \big\Updownarrow \Updownarrow
|
[math]\displaystyle{ \updownarrow \big\updownarrow \Big\updownarrow \bigg\updownarrow \Bigg\updownarrow \dots \Bigg\Updownarrow \bigg\Updownarrow \Big\Updownarrow \big\Updownarrow \Updownarrow }[/math] | |
/ \big/ \Big/ \bigg/ \Bigg/ \dots \Bigg\backslash \bigg\backslash \Big\backslash \big\backslash \backslash
|
[math]\displaystyle{ / \big/ \Big/ \bigg/ \Bigg/ \dots \Bigg\backslash \bigg\backslash \Big\backslash \big\backslash \backslash }[/math] |
Alphabets and typefaces
Greek alphabet | |
---|---|
\Gamma \Delta \Theta \Lambda \Xi \Pi \Sigma \Upsilon \Phi \Psi \Omega
|
[math]\displaystyle{ \Gamma \Delta \Theta \Lambda \Xi \Pi \Sigma \Upsilon \Phi \Psi \Omega }[/math] |
\alpha \beta \gamma \delta \epsilon \zeta \eta \theta
|
[math]\displaystyle{ \alpha \beta \gamma \delta \epsilon \zeta \eta \theta }[/math] |
\iota \kappa \lambda \mu \nu \xi \pi \rho
|
[math]\displaystyle{ \iota \kappa \lambda \mu \nu \xi \pi \rho }[/math] |
\sigma \tau \upsilon \phi \chi \psi \omega
|
[math]\displaystyle{ \sigma \tau \upsilon \phi \chi \psi \omega }[/math] |
\varepsilon \varpi \varrho \varsigma \vartheta \varphi
|
[math]\displaystyle{ \varepsilon \varpi \varrho \varsigma \vartheta \varphi }[/math] |
Hebrew symbols | |
\aleph
|
[math]\displaystyle{ \aleph }[/math] |
Blackboard bold/scripts | |
\mathbb{ABCDEFGHI}
|
[math]\displaystyle{ \mathbb{ABCDEFGHI} }[/math] |
\mathbb{JKLMNOPQR}
|
[math]\displaystyle{ \mathbb{JKLMNOPQR} }[/math] |
\mathbb{STUVWXYZ}
|
[math]\displaystyle{ \mathbb{STUVWXYZ} }[/math] |
Boldface | |
\mathbf{ABCDEFGHI}
|
[math]\displaystyle{ \mathbf{ABCDEFGHI} }[/math] |
\mathbf{JKLMNOPQR}
|
[math]\displaystyle{ \mathbf{JKLMNOPQR} }[/math] |
\mathbf{STUVWXYZ}
|
[math]\displaystyle{ \mathbf{STUVWXYZ} }[/math] |
\mathbf{abcdefghijklm}
|
[math]\displaystyle{ \mathbf{abcdefghijklm} }[/math] |
\mathbf{nopqrstuvwxyz}
|
[math]\displaystyle{ \mathbf{nopqrstuvwxyz} }[/math] |
\mathbf{0123456789}
|
[math]\displaystyle{ \mathbf{0123456789} }[/math] |
Boldface (Greek) | |
\boldsymbol{\Gamma \Delta \Theta \Lambda \Xi \Pi \Sigma \Upsilon \Phi \Psi \Omega}
|
[math]\displaystyle{ \boldsymbol{\Gamma \Delta \Theta \Lambda \Xi \Pi \Sigma \Upsilon \Phi \Psi \Omega} }[/math] |
\boldsymbol{\alpha\beta\gamma\delta\epsilon\zeta\eta\theta}
|
[math]\displaystyle{ \boldsymbol{\alpha\beta\gamma\delta\epsilon\zeta\eta\theta} }[/math] |
\boldsymbol{\iota\kappa\lambda\mu\nu\xi\pi\rho}
|
[math]\displaystyle{ \boldsymbol{\iota\kappa\lambda\mu\nu\xi\pi\rho} }[/math] |
\boldsymbol{\sigma\tau\upsilon\phi\chi\psi\omega}
|
[math]\displaystyle{ \boldsymbol{\sigma\tau\upsilon\phi\chi\psi\omega} }[/math] |
\boldsymbol{\varepsilon \varpi \varrho \varsigma \vartheta \varphi}
|
[math]\displaystyle{ \boldsymbol{\varepsilon \varpi \varrho \varsigma \vartheta \varphi} }[/math] |
Italics (default for Latin alphabet) | |
\mathit{0123456789}
|
[math]\displaystyle{ \mathit{0123456789} }[/math] |
Greek italics | |
\mathit{\Gamma \Delta \Theta \Lambda \Xi \Pi \Sigma \Upsilon \Phi \Psi \Omega}
|
[math]\displaystyle{ \mathit{\Gamma \Delta \Theta \Lambda \Xi \Pi \Sigma \Upsilon \Phi \Psi \Omega} }[/math] |
Roman typeface | |
\mathrm{ABCDEFGHI}
|
[math]\displaystyle{ \mathrm{ABCDEFGHI} }[/math] |
\mathrm{JKLMNOPQR}
|
[math]\displaystyle{ \mathrm{JKLMNOPQR} }[/math] |
\mathrm{STUVWXYZ}
|
[math]\displaystyle{ \mathrm{STUVWXYZ} }[/math] |
\mathrm{abcdefghijklm}
|
[math]\displaystyle{ \mathrm{abcdefghijklm} }[/math] |
\mathrm{nopqrstuvwxyz}
|
[math]\displaystyle{ \mathrm{nopqrstuvwxyz} }[/math] |
\mathrm{0123456789}
|
[math]\displaystyle{ \mathrm{0123456789} }[/math] |
Sans serif | |
\mathsf{ABCDEFGHI}
|
[math]\displaystyle{ \mathsf{ABCDEFGHI} }[/math] |
\mathsf{JKLMNOPQR}
|
[math]\displaystyle{ \mathsf{JKLMNOPQR} }[/math] |
\mathsf{STUVWXYZ}
|
[math]\displaystyle{ \mathsf{STUVWXYZ} }[/math] |
\mathsf{abcdefghijklm}
|
[math]\displaystyle{ \mathsf{abcdefghijklm} }[/math] |
\mathsf{nopqrstuvwxyz}
|
[math]\displaystyle{ \mathsf{nopqrstuvwxyz} }[/math] |
\mathsf{0123456789}
|
[math]\displaystyle{ \mathsf{0123456789} }[/math] |
Sans serif Greek | |
\mathsf{\Gamma \Delta \Theta \Lambda \Xi \Pi \Sigma \Upsilon \Phi \Psi \Omega}
|
[math]\displaystyle{ \mathsf{\Gamma \Delta \Theta \Lambda \Xi \Pi \Sigma \Upsilon \Phi \Psi \Omega} }[/math] |
Calligraphy/script | |
\mathcal{ABCDEFGHI}
|
[math]\displaystyle{ \mathcal{ABCDEFGHI} }[/math] |
\mathcal{JKLMNOPQR}
|
[math]\displaystyle{ \mathcal{JKLMNOPQR} }[/math] |
\mathcal{STUVWXYZ}
|
[math]\displaystyle{ \mathcal{STUVWXYZ} }[/math] |
Fraktur typeface | |
\mathfrak{ABCDEFGHI}
|
[math]\displaystyle{ \mathfrak{ABCDEFGHI} }[/math] |
\mathfrak{JKLMNOPQR}
|
[math]\displaystyle{ \mathfrak{JKLMNOPQR} }[/math] |
\mathfrak{STUVWXYZ}
|
[math]\displaystyle{ \mathfrak{STUVWXYZ} }[/math] |
\mathfrak{abcdefghijklm}
|
[math]\displaystyle{ \mathfrak{abcdefghijklm} }[/math] |
\mathfrak{nopqrstuvwxyz}
|
[math]\displaystyle{ \mathfrak{nopqrstuvwxyz} }[/math] |
\mathfrak{0123456789}
|
[math]\displaystyle{ \mathfrak{01234567890} }[/math] |
Small scriptstyle text | |
{\scriptstyle\text{abcdefghijklm}}
|
[math]\displaystyle{ {\scriptstyle\text{abcdefghijklm}} }[/math] |
Mixed text faces
Feature | Syntax | How it looks rendered |
---|---|---|
Italicised characters (spaces are ignored) | x y z
|
[math]\displaystyle{ x y z }[/math] |
Non-italicised characters | \text{x y z}
|
[math]\displaystyle{ \text{x y z} }[/math] |
Mixed italics (bad) | \text{if} n \text{is even}
|
[math]\displaystyle{ \text{if} n \text{is even} }[/math] |
Mixed italics (good) | \text{if }n\text{ is even}
|
[math]\displaystyle{ \text{if }n\text{ is even} }[/math] |
Mixed italics (alternative: ~ or "\ " forces a space) | \text{if}~n\ \text{is even}
|
[math]\displaystyle{ \text{if}~n\ \text{is even} }[/math] |
Color
Equations can use color with the \color
command.
{\color{Blue}{x^2}}+{\color{Orange}{2x}}-{\color{LimeGreen}{1}}
- [math]\displaystyle{ {\color{Blue}{x^2}}+{\color{Orange}{2x}}-{\color{LimeGreen}{1}} }[/math]
x_{1,2}=\frac{{\color{Blue}{-b}}\pm\sqrt{\color{Red}{b^2-4ac}}}{\color{Green}{2a}}
- [math]\displaystyle{ x_{1,2}=\frac{{\color{Blue}{-b}}\pm\sqrt{\color{Red}{b^2-4ac}}}{\color{Green}{2a}} }[/math]
There are several alternate notations styles
{\color{Blue}x^2}+{\color{Orange}2x}-{\color{LimeGreen}1}
- [math]\displaystyle{ {\color{Blue}x^2}+{\color{Orange}2x}-{\color{LimeGreen}1} }[/math]
\color{Blue}x^2\color{Black}+\color{Orange}2x\color{Black}-\color{LimeGreen}1
- [math]\displaystyle{ \color{Blue}x^2\color{Black}+\color{Orange}2x\color{Black}-\color{LimeGreen}1 }[/math]
\color{Blue}{x^2}+\color{Orange}{2x}-\color{LimeGreen}{1}
- [math]\displaystyle{ \color{Blue}{x^2}+\color{Orange}{2x}-\color{LimeGreen}{1} }[/math]
Some color names are predeclared according to the following table, you can use them directly for the rendering of formulas (or for declaring the intended color of the page background).
[math]\displaystyle{ \color{Blue}{\text{Blue}} }[/math] | [math]\displaystyle{ \color{BlueGreen}{\text{BlueGreen}} }[/math] | [math]\displaystyle{ \color{BlueViolet}{\text{BlueViolet}} }[/math] | [math]\displaystyle{ \color{BrickRed}{\text{BrickRed}} }[/math] |
[math]\displaystyle{ \color{Brown}{\text{Brown}} }[/math] | [math]\displaystyle{ \color{BurntOrange}{\text{BurntOrange}} }[/math] | [math]\displaystyle{ \color{CadetBlue}{\text{CadetBlue}} }[/math] | [math]\displaystyle{ \color{CarnationPink}{\text{CarnationPink}} }[/math] |
[math]\displaystyle{ \color{DarkOrchid}{\text{DarkOrchid}} }[/math] | [math]\displaystyle{ \color{Emerald}{\text{Emerald}} }[/math] | [math]\displaystyle{ \color{ForestGreen}{\text{ForestGreen}} }[/math] | [math]\displaystyle{ \color{Fuchsia}{\text{Fuchsia}} }[/math] |
[math]\displaystyle{ \color{Mahogany}{\text{Mahogany}} }[/math] | [math]\displaystyle{ \color{Maroon}{\text{Maroon}} }[/math] | [math]\displaystyle{ \color{Melon}{\text{Melon}} }[/math] | [math]\displaystyle{ \color{MidnightBlue}{\text{MidnightBlue}} }[/math] |
[math]\displaystyle{ \color{Mulberry}{\text{Mulberry}} }[/math] | [math]\displaystyle{ \color{NavyBlue}{\text{NavyBlue}} }[/math] | [math]\displaystyle{ \color{OliveGreen}{\text{OliveGreen}} }[/math] | [math]\displaystyle{ \color{Orange}{\text{Orange}} }[/math] |
[math]\displaystyle{ \color{OrangeRed}{\text{OrangeRed}} }[/math] | [math]\displaystyle{ \color{Orchid}{\text{Orchid}} }[/math] | [math]\displaystyle{ \color{Peach}{\text{Peach}} }[/math] | [math]\displaystyle{ \color{Periwinkle}{\text{Periwinkle}} }[/math] |
[math]\displaystyle{ \color{PineGreen}{\text{PineGreen}} }[/math] | [math]\displaystyle{ \color{Plum}{\text{Plum}} }[/math] | [math]\displaystyle{ \color{ProcessBlue}{\text{ProcessBlue}} }[/math] | [math]\displaystyle{ \color{Purple}{\text{Purple}} }[/math] |
[math]\displaystyle{ \color{RawSienna}{\text{RawSienna}} }[/math] | [math]\displaystyle{ \color{Red}{\text{Red}} }[/math] | [math]\displaystyle{ \color{RedOrange}{\text{RedOrange}} }[/math] | [math]\displaystyle{ \color{RedViolet}{\text{RedViolet}} }[/math] |
[math]\displaystyle{ \color{Rhodamine}{\text{Rhodamine}} }[/math] | [math]\displaystyle{ \color{RoyalBlue}{\text{RoyalBlue}} }[/math] | [math]\displaystyle{ \color{RoyalPurple}{\text{RoyalPurple}} }[/math] | [math]\displaystyle{ \color{RubineRed}{\text{RubineRed}} }[/math] |
[math]\displaystyle{ \color{Salmon}{\text{Salmon}} }[/math] | [math]\displaystyle{ \color{SeaGreen}{\text{SeaGreen}} }[/math] | [math]\displaystyle{ \color{Sepia}{\text{Sepia}} }[/math] | [math]\displaystyle{ \color{SkyBlue}{\text{SkyBlue}} }[/math] |
Note that color should not be used as the only way to identify something, because it will become meaningless on black-and-white media or for color-blind people.
Spacing
Note that <math></math>
handles most spacing automatically, but you may sometimes want manual control.
Feature | Syntax | How it looks rendered |
---|---|---|
double quad space | a \qquad b
|
[math]\displaystyle{ a \qquad b }[/math] |
quad space | a \quad b
|
[math]\displaystyle{ a \quad b }[/math] |
text space | a\ b
|
[math]\displaystyle{ a\ b }[/math] |
large space | a\;b
|
[math]\displaystyle{ a\;b }[/math] |
small space | a\,b
|
[math]\displaystyle{ a\,b }[/math] |
tiny space (use for multiplication of factors) | ab
|
[math]\displaystyle{ ab }[/math] |
no space (use for multi-letter variables) | \mathit{ab}
|
[math]\displaystyle{ \mathit{ab} }[/math] |
small negative space | a\!b
|
[math]\displaystyle{ a\!b }[/math] |