Wikipedia

Help:Displaying a formula

This screenshot shows the formula E = mc2 being edited using VisualEditor. The visual editor shows a button that allows to choose one of three offered modes to display a formula.

MediaWikirenders mathematical equations using a combination of HTML and a variant of LaTeX.

The version of LaTeX used is a subset of AMS-LaTeX markup, a superset of LaTeX markup which is in turn a superset of TeX markup, for mathematical formulas. Only a limited part of the full TeX language is supported; see below for details.[a]

By default SVG images with non-visible MathML are generated. The older PNG images can be set via user preferences.[b] On some browsers like Firefox, it is possible to use MathML for display via extensions; see the main extension page at mw:Extension:Math for details. Client side MathJax is no longer supported.

Basics [ edit ]

Math markup goes inside <math>...</math>. Chemistry markup goes inside <math chem>...</math> or <chem>...</chem>. All these tags use TeX.

The TeX code has to be put literally: MediaWiki templates, predefined templates, and parameters cannot be used within math tags: pairs of double braces are ignored and "#" gives an error message. However, math tags work in the then and else part of #if, etc. See m:Template:Demo of attempt to use parameters within TeX (backlinks edit) for more information.

The now deprecated tag <ce> was considered too ambiguous, and it has been replaced by <chem>.[1]

LaTeX commands [ edit ]

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 [ edit ]

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 prefixing the escape character backslash \ or using special sequences:

\# \$ \% ^\wedge \& \_ \{ \} \sim \backslash

yielding

.

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 which gives .

The command \tilde produces a tilde which is placed over the next letter. For example, \tilde{a} gives . To produce just a tilde character ~, use \tilde{} which gives , placing a ~ over an empty box. Alternatively \sim produces , a large centred ~ which may be more appropriate in some situations.

The command \hat produces a hat over the next character, for example \hat{o} produces . For a stretchable version use \widehat{abc} giving . The wedge \wedge is normally used as a mathematical operator the sequence ^\wedge produces the best equivalent to the ASCII caret ^ character.

Spaces [ edit ]

"Whitespace" characters, such as blank or tab, are treated uniformly as "space" by LaTeX. Several consecutive whitespace characters are treated as one "space". See below for commands that produces spaces of different size.

LaTeX environments [ edit ]

Environments in LaTeX have a role that is quite similar to commands, but they usually have effect on a wider part of formula. Their syntax is:

\begin{environmentname}
   text to be influenced
 \end{environmentname}

Environments supported by Wikipedia include matrix, align, etc. See below.

Rendering [ edit ]

The font sizes and types are independent of browser settings or CSS. Font sizes and types will often deviate from what HTML renders. Vertical alignment with the surrounding text can also be a problem; a work-around is described in the "Alignment with normal text flow" section below. The CSS selector of the images is img.tex.

The alt text of the PNG images, which is displayed to visually impaired and other readers who cannot see the images, and is also used when the text is selected and copied, defaults to the wikitext that produced the image, excluding the <math> and </math>. You can override this by explicitly specifying an alt attribute for the math element. For example, <math alt="Square root of pi">\sqrt{\pi}</math> generates an image whose alt text is "Square root of pi". This should not be confused with the title attribute that produces popup text when the hovering over the PNG image, for example <math title="pi">\pi</math> generates an image whose popup text is "pi".

Apart from function and operator names, as is customary in mathematics, variables and letters are in italics; digits are not. For other text, (like variable labels) to avoid being rendered in italics like variables, use \text or \mathrm (formerly \rm). You can also define new function names using \operatorname{...}. For example, \text{abc} gives . \operatorname{...} provides spacing before and after the operator name when appropriate, as when a\operatorname{sn}b is rendered as (with space to the left and right of "sn") and a\operatorname{sn}(b+c) as (with space to the left and not to the right). LaTeX's starred version, \operatorname* is not supported, but a workaround is to add \limits instead. For example, \operatorname{sn}_{b>c}(b+c) \qquad\operatorname{sn}\limits_{b>c}(b+c) renders as

.

Latex does not have full support for Unicode characters, and not all characters render. Most Latin characters with accents render correctly. However some do not, in particular those that include multiple diacritics (e.g. with Latin letters used in Vietnamese) or that cannot be precomposed into a single character (such as the uppercase Latin letter W with ring), or that use other diacritics (like the ogonek or the double grave accent, used in Central European languages like Polish, or the horn attached above some vowels in Vietnamese), or other modified letter forms (used in IPA notations, or African languages, or in medieval texts), some digram ligatures (like IJ in Dutch), or Latin letters borrowed from Greek, or small capitals, as well as superscripts and subscript letters. For example, \text{ð} and \text{þ} (used in Icelandic) will give errors.

The normal way of entering quotation marks in text mode (two back ticks for the left and two apostrophes for the right), such as \text{a ``quoted'' word} will not work correctly. As a workaround, you can use the Unicode left and right quotation mark characters, which are available from the "Symbols" dropdown panel beneath the editor: \text{a “quoted” word}.

Force-rerendering of formulas [ edit ]

MediaWiki stores rendered formulas in a cache so that the images of those formulas do not need to be created each time the page is opened by a user. To force the rerendering of all formulas of a page, you must open it with the getter variables action=purge&mathpurge=true. Imagine for example there is a wrong rendered formula in the article Integral. To force the re-rendering of this formula you need to open the URL https://en.wikipedia.org/w/index.php?title=Integral&action=purge&mathpurge=true . Afterwards you need to bypass your browser cache so that the new created images of the formulas are actually downloaded. See also mw:Extension:Math#Purging pages that contain equations for more details.

TeX vs HTML [ edit ]

TeX markup is not the only way to produce special characters. As this comparison table shows, sometimes similar results can be achieved in HTML using Template:Math. See also Help:Special characters.

TeX syntax TeX rendering HTML syntax HTML rendering
\alpha {{math|''&alpha;''}} α
f(x) = x^2 {{math|''f''(''x'') {{=}} ''x''<sup>2</sup>}} f(x) = x2
\sqrt{2} {{math|{{radical|2}}}} 2
\sqrt{1-e^2} {{math|{{radical|1 &minus; ''e''<sup>2</sup>}}}} 1 − e2
\{1,e,\pi\} {{math|{{mset|1, ''e'', ''&pi;''}}}} {1, e, π}
|z + 1| \leq 2 {{math|{{abs|''z'' + 1}} &le; 2}} |z + 1| ≤ 2

Care should be taken when writing sets within {{math}}, as braces can conflict with template syntax. The {{mset}} template is available to help with this as shown in the example above. Likewise, {{abs}} encloses its parameter inside vertical bars to help with the pipe character conflicting with template syntax.

The codes on the left produce the symbols on the right, but the latter can also be put directly in the wikitext, except for ‘=’.

HTML syntax Rendering
&alpha; &beta; &gamma; &delta; &epsilon; &zeta;
&eta; &theta; &iota; &kappa; &lambda; &mu; &nu;
&xi; &omicron; &pi; &rho; &sigma; &sigmaf;
&tau; &upsilon; &phi; &chi; &psi; &omega;

α β γ δ ε ζ

η θ ι κ λ μ ν

ξ ο π ρ σ ς

τ υ φ χ ψ ω

&Gamma; &Delta; &Theta; &Lambda; &Xi; &Pi;
&Sigma; &Phi; &Psi; &Omega;

Γ Δ Θ Λ Ξ Π

Σ Φ Ψ Ω

&int; &sum; &prod; &radic; &minus; &plusmn; &infin;
&asymp; &prop; = &equiv; &ne; &le; &ge;
&times; &middot; &sdot; &divide; &part; &prime; &Prime;
&nabla; &permil; &deg; &there4; &empty;

∫ ∑ ∏ √ − ± ∞

≈ ∝ = ≡ ≠ ≤ ≥

× · ⋅ ÷ ∂ ′ ″

∇ ‰ ° ∴ ∅

&isin; &notin; &cap; &cup; &sub; &sup; &sube; &supe;
&not; &and; &or; &exist; &forall;
&rArr; &hArr; &rarr; &harr; &uarr; &darr;
&alefsym; - &ndash; &mdash;

∈ ∉ ∩ ∪ ⊂ ⊃ ⊆ ⊇

¬ ∧ ∨ ∃ ∀

⇒ ⇔ → ↔ ↑ ↓

ℵ - – —

The project has not reached a consensus on HTML and TeX because each has advantages in some situations.

Native MathML [ edit ]

The default MathML/SVG renderer option, selectable through My Preferences - Appearance - Math, generates hidden MathML code. This code can be used by screen readers and other assistive technology. To actually display the MathML in Firefox you can install the Native MathML extension, or simply copy its CSS rules to your Wikipedia user stylesheet. In either case, you must have fonts that support MathML installed on your system. For copy-paste support also install MathML Copy. Details on using MathML in other systems can be found at mw:Extension:Math.

Formatting using TeX [ edit ]

Functions, symbols, special characters [ edit ]

Accents and diacritics [ edit ]

\dot{a}, \ddot{a}, \acute{a}, \grave{a}
\check{a}, \breve{a}, \tilde{a}, \bar{a}
\hat{a}, \widehat{a}, \vec{a}

Standard numerical functions [ edit ]

\exp_a b = a^b, \exp b = e^b, 10^m
\ln c, \lg d = \log e, \log_{10} f
\sin a, \cos b, \tan c, \cot d, \sec e, \csc f
\arcsin h, \arccos i, \arctan j
\sinh k, \cosh l, \tanh m, \coth n
\operatorname{sh}k, \operatorname{ch}l, \operatorname{th}m, \operatorname{coth}n
\operatorname{argsh}o, \operatorname{argch}p, \operatorname{argth}q
\sgn r, \left\vert s \right\vert
\min(x,y), \max(x,y)

Bounds [ edit ]

\min x, \max y, \inf s, \sup t
\lim u, \liminf v, \limsup w
\dim p, \deg q, \det m, \ker\phi

Projections [ edit ]

\Pr j, \hom l, \lVert z \rVert, \arg z

Differentials and derivatives [ edit ]

dt, \mathrm{d}t, \partial t, \nabla\psi
dy/dx, \mathrm{d}y/\mathrm{d}x, \frac{dy}{dx}, \frac{\mathrm{d}y}{\mathrm{d}x}, \frac{\partial^2}{\partial x_1\partial x_2}y
\prime, \backprime, f^\prime, f', f'', f^{(3)}, \dot y, \ddot y

Letter-like symbols or constants [ edit ]

\infty, \aleph, \complement, \backepsilon, \eth, \Finv, \hbar
\Im, \imath, \jmath, \Bbbk, \ell, \mho, \wp, \Re, \circledS, \S, \P, \AA

Modular arithmetic [ edit ]

s_k \equiv 0 \pmod{m}
a \bmod b
\gcd(m, n), \operatorname{lcm}(m, n)
\mid, \nmid, \shortmid, \nshortmid

Radicals [ edit ]

\surd, \sqrt{2}, \sqrt[n]{2}, \sqrt[3]{\frac{x^3+y^3}{2}}

Operators [ edit ]

+, -, \pm, \mp, \dotplus
\times, \div, \divideontimes, /, \backslash
\cdot, * \ast, \star, \circ, \bullet
\boxplus, \boxminus, \boxtimes, \boxdot
\oplus, \ominus, \otimes, \oslash, \odot
\circleddash, \circledcirc, \circledast
\bigoplus, \bigotimes, \bigodot

Sets [ edit ]

\{ \}, \O \empty \emptyset, \varnothing
\in, \notin \not\in, \ni, \not\ni
\cap, \Cap, \sqcap, \bigcap
\cup, \Cup, \sqcup, \bigcup, \bigsqcup, \uplus, \biguplus
\setminus, \smallsetminus, \times
\subset, \Subset, \sqsubset
\supset, \Supset, \sqsupset
\subseteq, \nsubseteq, \subsetneq, \varsubsetneq, \sqsubseteq
\supseteq, \nsupseteq, \supsetneq, \varsupsetneq, \sqsupseteq
\subseteqq, \nsubseteqq, \subsetneqq, \varsubsetneqq
\supseteqq, \nsupseteqq, \supsetneqq, \varsupsetneqq

Relations [ edit ]

=, \ne, \neq, \equiv, \not\equiv
\doteq, \doteqdot, \overset{\underset{\mathrm{def}}{}}{=}, :=
\sim, \nsim, \backsim, \thicksim, \simeq, \backsimeq, \eqsim, \cong, \ncong
\approx, \thickapprox, \approxeq, \asymp, \propto, \varpropto
<, \nless, \ll, \not\ll, \lll, \not\lll, \lessdot
>, \ngtr, \gg, \not\gg, \ggg, \not\ggg, \gtrdot
\le, \leq, \lneq, \leqq, \nleq, \nleqq, \lneqq, \lvertneqq
\ge, \geq, \gneq, \geqq, \ngeq, \ngeqq, \gneqq, \gvertneqq
\lessgtr, \lesseqgtr, \lesseqqgtr, \gtrless, \gtreqless, \gtreqqless
\leqslant, \nleqslant, \eqslantless
\geqslant, \ngeqslant, \eqslantgtr
\lesssim, \lnsim, \lessapprox, \lnapprox
\gtrsim, \gnsim, \gtrapprox, \gnapprox
\prec, \nprec, \preceq, \npreceq, \precneqq
\succ, \nsucc, \succeq, \nsucceq, \succneqq
\preccurlyeq, \curlyeqprec
\succcurlyeq, \curlyeqsucc
\precsim, \precnsim, \precapprox, \precnapprox
\succsim, \succnsim, \succapprox, \succnapprox

Geometric [ edit ]

\parallel, \nparallel, \shortparallel, \nshortparallel
\perp, \angle, \sphericalangle, \measuredangle, 45^\circ
\Box, \square, \blacksquare, \diamond, \Diamond, \lozenge, \blacklozenge, \bigstar
\bigcirc, \triangle, \bigtriangleup, \bigtriangledown
\vartriangle, \triangledown
\blacktriangle, \blacktriangledown, \blacktriangleleft, \blacktriangleright

Logic [ edit ]

\forall, \exists, \nexists
\therefore, \because, \And
\lor \vee, \curlyvee, \bigvee

don't use \or which is now deprecated

\land \wedge, \curlywedge, \bigwedge

don't use \and which is now deprecated

\bar{q}, \bar{abc}, \overline{q}, \overline{abc},

\lnot \neg, \not\operatorname{R}, \bot, \top



\vdash \dashv, \vDash, \Vdash, \models
\Vvdash \nvdash \nVdash \nvDash \nVDash
\ulcorner \urcorner \llcorner \lrcorner

Arrows [ edit ]

\Rrightarrow, \Lleftarrow
\Rightarrow, \nRightarrow, \Longrightarrow \implies
\Leftarrow, \nLeftarrow, \Longleftarrow
\Leftrightarrow, \nLeftrightarrow, \Longleftrightarrow \iff
\Uparrow, \Downarrow, \Updownarrow
\rightarrow \to, \nrightarrow, \longrightarrow
\leftarrow \gets, \nleftarrow, \longleftarrow
\leftrightarrow, \nleftrightarrow, \longleftrightarrow
\uparrow, \downarrow, \updownarrow
\nearrow, \swarrow, \nwarrow, \searrow
\mapsto, \longmapsto
\rightharpoonup \rightharpoondown \leftharpoonup \leftharpoondown \upharpoonleft \upharpoonright \downharpoonleft \downharpoonright \rightleftharpoons \leftrightharpoons
\curvearrowleft \circlearrowleft \Lsh \upuparrows \rightrightarrows \rightleftarrows \rightarrowtail \looparrowright
\curvearrowright \circlearrowright \Rsh \downdownarrows \leftleftarrows \leftrightarrows \leftarrowtail \looparrowleft
\hookrightarrow \hookleftarrow \multimap \leftrightsquigarrow \rightsquigarrow \twoheadrightarrow \twoheadleftarrow

Special [ edit ]

\amalg \P \S \% \dagger \ddagger \ldots \cdots
\smile \frown \wr \triangleleft \triangleright
\diamondsuit, \heartsuit, \clubsuit, \spadesuit, \Game, \flat, \natural, \sharp

Unsorted (new stuff) [ edit ]

\diagup \diagdown \centerdot \ltimes \rtimes \leftthreetimes \rightthreetimes
\eqcirc \circeq \triangleq \bumpeq \Bumpeq \doteqdot \risingdotseq \fallingdotseq
\intercal \barwedge \veebar \doublebarwedge \between \pitchfork
\vartriangleleft \ntriangleleft \vartriangleright \ntriangleright
\trianglelefteq \ntrianglelefteq \trianglerighteq \ntrianglerighteq

For a little more semantics on these symbols, see the brief TeX Cookbook.

Larger expressions [ edit ]

Subscripts, superscripts, integrals [ edit ]

Feature Syntax How it looks rendered
Superscript a^2, a^{x+3}
Subscript a_2
Grouping 10^{30} a^{2+2}
a_{i,j} b_{f'}
Combining sub & super without and with horizontal separation x_2^3
{x_2}^3
Super super 10^{10^{8}}
Preceding and/or additional sub & super \sideset{_1^2}{_3^4}\prod_a^b
{}_1^2\!\Omega_3^4
Stacking \overset { \alpha }{ \omega }
\underset { \alpha }{ \omega }
\overset { \alpha }{ \underset { \gamma }{ \omega }}
\stackrel { \alpha }{ \omega }
Derivatives x', y'', f', f''
x^\prime, y^{\prime\prime}
Derivative dots \dot{x}, \ddot{x}
Underlines, overlines, vectors \hat a \ \bar b \ \vec c
\overrightarrow{a b}\ \overleftarrow{c d}\ \widehat{d e f}
\overline{g h i}\ \underline{j k l}
Arc (workaround) \overset{\frown}{AB}
Arrows A \xleftarrow{n+\mu-1} B \xrightarrow[T]{n\pm i-1} C
Overbraces \overbrace{ 1+2+\cdots+100 }^{5050}
Underbraces \underbrace{ a+b+\cdots+z }_{26}
Sum \sum_{k=1}^N k^2
Sum (force \textstyle) \textstyle\sum_{k=1}^N k^2
Sum in a fraction (default \textstyle) \frac{\sum_{k=1}^N k^2}{a}
Sum in a fraction (force \displaystyle) \frac{\displaystyle\sum_{k=1}^N k^2}{a}
Sum in a fraction (alternative limits style) \frac{\sum\limits^{^N}_{k=1} k^2}{a}
Product \prod_{i=1}^N x_i
Product (force \textstyle) \textstyle\prod_{i=1}^N x_i
Coproduct \coprod_{i=1}^N x_i
Coproduct (force \textstyle) \textstyle\coprod_{i=1}^N x_i
Limit \lim_{n \to\infty}x_n
Limit (force \textstyle) \textstyle\lim_{n \to\infty}x_n
Integral \int\limits_{1}^{3}\frac{e^3/x}{x^2}\, dx
Integral (alternative limits style) \int_{1}^{3}\frac{e^3/x}{x^2}\, dx
Integral (force \textstyle) \textstyle\int\limits_{-N}^{N} e^x dx
Integral (force \textstyle, alternative limits style) \textstyle\int_{-N}^{N} e^x dx
Double integral \iint\limits_D dx\,dy
Triple integral \iiint\limits_E dx\,dy\,dz
Quadruple integral \iiiint\limits_F dx\,dy\,dz\,dt
Line or path integral \int_{(x,y)\in C} x^3\, dx + 4y^2\, dy
Closed line or path integral \oint_{(x,y)\in C} x^3\, dx + 4y^2\, dy
Intersections \bigcap_{i=1}^n E_i
Unions \bigcup_{i=1}^n E_i

Display attribute [ edit ]

The <math> tag can take a display attribute with possible values of inline and block.

Inline [ edit ]

If the value of the display attribute is inline, the contents will be rendered in inline mode; i.e., there will be no new paragraph for the equation and the operators will be rendered to consume only a small amount of vertical space.

Example [ edit ]

The sum converges to 2.

The next line-width is not disturbed by large operators.

The code for the math example reads:

<mathdisplay="inline">\sum_{i=0}^\infty 2^{-i}</math>
Technical implementation [ edit ]

Technically the command \textstyle will be added to the user input before the tex command is passed to the renderer. The result will be displayed without further formatting by outputting the image or MathMLelement to the page.

Block [ edit ]

In block-style the equation is rendered in its own paragraph and the operators are rendered consuming less horizontal space.

Example [ edit ]

The equation

It was entered as

<mathdisplay="block">\text{geometric series:}\quad \sum_{i=0}^\infty 2^{-i}=2 </math>
Technical implementation [ edit ]

Technically the command \displaystyle will be added to the user input, if the user input does not contain the string \displaystyle or \align before the tex command is passed to the renderer. The result will be displayed in a new paragraph. Therefore, the style of the MathImage is altered i.e. the style attribute "display:block;margin:auto" is added. For MathML it is ensured that display=inline is replaced by display block which produces a new paragraph

Not specified [ edit ]

If nothing is specified the current behavior is preserved. That means all equations are rendered in display style but not using a new paragraph.

Example [ edit ]

The sum converges to 2.

The next line-width is disturbed by large operators.

The code for the math example reads:

<math>\sum_{i=0}^\infty 2^{-i}</math>

The equation

It was entered as

<math>\text{geometric series:}\quad \sum_{i=0}^\infty 2^{-i}=2 </math>

Fractions, matrices, multilines [ edit ]

Feature Syntax How it looks rendered
Fractions \frac{2}{4}=0.5 or {2 \over 4}=0.5
Small fractions (force \textstyle) \tfrac{2}{4} = 0.5
Large (normal) fractions (force \displaystyle) \dfrac{2}{4} = 0.5 \qquad \dfrac{2}{c + \dfrac{2}{d + \dfrac{2}{4}}} = a
Large (nested) fractions \cfrac{2}{c + \cfrac{2}{d + \cfrac{2}{4}}} = a
Cancellations in fractions \cfrac{x}{1 + \cfrac{\cancel{y}}{\cancel{y}}} = \cfrac{x}{2}
Binomial coefficients \binom{n}{k}
Small binomial coefficients (force \textstyle) \tbinom{n}{k}
Large (normal) binomial coefficients (force \displaystyle) \dbinom{n}{k}
Matrices
\begin{matrix}
x & y \\
z & v
\end{matrix}
\begin{vmatrix}
x & y \\
z & v
\end{vmatrix}
\begin{Vmatrix}
x & y \\
z & v
\end{Vmatrix}
\begin{bmatrix}
0 & \cdots & 0 \\
\vdots & \ddots & \vdots \\
0 & \cdots & 0
\end{bmatrix}
\begin{Bmatrix}
x & y \\
z & v
\end{Bmatrix}
\begin{pmatrix}
x & y \\
z & v
\end{pmatrix}
\bigl( \begin{smallmatrix}
a&b\\ c&d
\end{smallmatrix} \bigr)
Case distinctions
f(n) =
\begin{cases}
n/2, & \text{if }n\text{ is even} \\
3n+1, & \text{if }n\text{ is odd}
\end{cases}
Multiline equations
\begin{align}
f(x) & = (a+b)^2 \\
& = a^2+2ab+b^2 \\
\end{align}
\begin{alignat}{2}
f(x) & = (a-b)^2 \\
& = a^2-2ab+b^2 \\
\end{alignat}
Multiline equations (must define number of columns used ({lcl})) (should not be used unless needed)
\begin{array}{lcl}
z & = & a \\
f(x,y,z) & = & x + y + z
\end{array}
Multiline equations (more)
\begin{array}{lcr}
z & = & a \\
f(x,y,z) & = & x + y + z
\end{array}
Breaking up a long expression so that it wraps when necessary, at the expense of destroying correct spacing
<math>f(x) \,\!</math>
<math>= \sum_{n=0}^\infty a_n x^n </math>
<math>= a_0+a_1x+a_2x^2+\cdots</math>
Simultaneous equations
\begin{cases}
3x + 5y + z \\
7x - 2y + 4z \\
-6x + 3y + 2z
\end{cases}
Arrays
\begin{array}{|c|c|c|} a & b & S \\
\hline
0 & 0 & 1 \\
0 & 1 & 1 \\
1 & 0 & 1 \\
1 & 1 & 0 \\
\end{array}

Parenthesizing big expressions, brackets, bars [ edit ]

Feature Syntax How it looks rendered
☒NBad ( \frac{1}{2} )^n
GoodcheckY \left ( \frac{1}{2} \right )^n

You can use various delimiters with \left and \right:

Feature Syntax How it looks rendered
Parentheses \left ( \frac{a}{b} \right )
Brackets \left [ \frac{a}{b} \right ] \quad

\left\lbrack\frac{a}{b}\right\rbrack
Braces \left\{\frac{a}{b}\right\}\quad

\left\lbrace\frac{a}{b}\right\rbrace
Angle brackets \left\langle\frac{a}{b}\right\rangle
Bars and double bars \left | \frac{a}{b} \right \vert \quad

\left\Vert\frac{c}{d}\right\|
Floor and ceiling functions: \left\lfloor\frac{a}{b}\right\rfloor\quad

\left\lceil\frac{c}{d}\right\rceil
Slashes and backslashes \left / \frac{a}{b} \right \backslash
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
Delimiters can be mixed,

as long as \left and \right match
\left [ 0,1 \right )

\left\langle\psi\right |


Use \left. and \right. if you

do not want a delimiter to appear
\left . \frac{A}{B} \right \} \to X
Size of the delimiters (add "l" or "r" to indicate the side for proper spacing) ( \bigl( \Bigl( \biggl( \Biggl( \dots \Biggr] \biggr] \Bigr] \bigr] ]
\{ \bigl\{ \Bigl\{ \biggl\{ \Biggl\{ \dots

\Biggr\rangle \biggr\rangle \Bigr\rangle \bigr\rangle \rangle
\|\big\|\Big\|\bigg\|\Bigg\|\dots\Bigg| \bigg| \Big| \big| |
\lfloor \bigl\lfloor \Bigl\lfloor \biggl\lfloor \Biggl\lfloor \dots

\Biggr\rceil \biggr\rceil \Bigr\rceil \bigr\rceil \ceil
\uparrow \big\uparrow \Big\uparrow \bigg\uparrow \Bigg\uparrow \dots

\Bigg\Downarrow \bigg\Downarrow \Big\Downarrow \big\Downarrow \Downarrow
\updownarrow \big\updownarrow \Big\updownarrow \bigg\updownarrow \Bigg\updownarrow \dots

\Bigg\Updownarrow \bigg\Updownarrow \Big\Updownarrow \big\Updownarrow \Updownarrow
/ \big/ \Big/ \bigg/ \Bigg/ \dots

\Bigg\backslash \bigg\backslash \Big\backslash \big\backslash \backslash

Equation numbering [ edit ]

The templates {{NumBlk}} and {{EquationRef}} can be used to number equations. The template {{EquationNote}} can be used to refer to a numbered equation from surrounding text. For example, the following syntax:

{{NumBlk|:|<math>x^2 + y^2 + z^2 = 1</math>|{{EquationRef|1}}}}

produces the following result (note the equation number in the right margin):

 

 

 

 

(1)

Later on, the text can refer to this equation by its number using syntax like this:

As seen in equation ({{EquationNote|1}}), blah blah blah...

The result looks like this:

As seen in equation (1), blah blah blah...

The equation number produced by {{EquationNote}} is a link that the user can click to go immediately to the cited equation.

Alphabets and typefaces [ edit ]

Texvc cannot render arbitrary Unicode characters. Those it can handle can be entered by the expressions below. For others, such as Cyrillic, they can be entered as Unicode or HTML entities in running text, but cannot be used in displayed formulas.

Greek alphabet
\Alpha \Beta \Gamma \Delta \Epsilon \Zeta \Eta \Theta
\Iota \Kappa \Lambda \Mu \Nu \Xi \Omicron \Pi
\Rho \Sigma \Tau \Upsilon \Phi \Chi \Psi \Omega
\alpha \beta \gamma \delta \epsilon \zeta \eta \theta
\iota \kappa \lambda \mu \nu \xi \omicron \pi
\rho \sigma \tau \upsilon \phi \chi \psi \omega
\varGamma \varDelta \varTheta \varLambda \varXi \varPi \varSigma \varPhi \varUpsilon \varOmega
\varepsilon \digamma \varkappa \varpi \varrho \varsigma \vartheta \varphi
Hebrew symbols
\aleph \beth \gimel \daleth
Blackboard bold/scripts
\mathbb{ABCDEFGHI}
\mathbb{JKLMNOPQR}
\mathbb{STUVWXYZ}
Boldface
\mathbf{ABCDEFGHI}
\mathbf{JKLMNOPQR}
\mathbf{STUVWXYZ}
\mathbf{abcdefghijklm}
\mathbf{nopqrstuvwxyz}
\mathbf{0123456789}
Boldface (Greek)
\boldsymbol { \Alpha \Beta \Gamma \Delta \Epsilon \Zeta \Eta \Theta }
\boldsymbol { \Iota \Kappa \Lambda \Mu \Nu \Xi \Omicron \Pi }
\boldsymbol { \Rho \Sigma \Tau \Upsilon \Phi \Chi \Psi \Omega }
\boldsymbol { \alpha \beta \gamma \delta \epsilon \zeta \eta \theta }
\boldsymbol { \iota \kappa \lambda \mu \nu \xi \omicron \pi }
\boldsymbol { \rho \sigma \tau \upsilon \phi \chi \psi \omega }
\boldsymbol { \varepsilon\digamma\varkappa\varpi }
\boldsymbol { \varrho\varsigma\vartheta\varphi }
Italics (default for Latin alphabet)
\mathit{0123456789}
Greek italics (default for lowercase Greek)
\mathit { \Alpha \Beta \Gamma \Delta \Epsilon \Zeta \Eta \Theta }
\mathit { \Iota \Kappa \Lambda \Mu \Nu \Xi \Omicron \Pi }
\mathit { \Rho \Sigma \Tau \Upsilon \Phi \Chi \Psi \Omega }
Greek uppercase boldface italics
\boldsymbol { \varGamma \varDelta \varTheta \varLambda }
\boldsymbol { \varXi \varPi \varSigma \varUpsilon \varOmega }
Roman typeface
\mathrm{ABCDEFGHI}
\mathrm{JKLMNOPQR}
\mathrm{STUVWXYZ}
\mathrm{abcdefghijklm}
\mathrm{nopqrstuvwxyz}
\mathrm{0123456789}
Sans serif
\mathsf{ABCDEFGHI}
\mathsf{JKLMNOPQR}
\mathsf{STUVWXYZ}
\mathsf{abcdefghijklm}
\mathsf{nopqrstuvwxyz}
\mathsf{0123456789}
Sans serif Greek (capital only)
\mathsf { \Alpha \Beta \Gamma \Delta \Epsilon \Zeta \Eta \Theta }
\mathsf { \Iota \Kappa \Lambda \Mu \Nu \Xi \Omicron \Pi }
\mathsf { \Rho \Sigma \Tau \Upsilon \Phi \Chi \Psi \Omega }
Calligraphy/script
\mathcal{ABCDEFGHI}
\mathcal{JKLMNOPQR}
\mathcal{STUVWXYZ}
Fraktur typeface
\mathfrak{ABCDEFGHI}
\mathfrak{JKLMNOPQR}
\mathfrak{STUVWXYZ}
\mathfrak{abcdefghijklm}
\mathfrak{nopqrstuvwxyz}
\mathfrak{0123456789}
Small scriptstyle text
{\scriptstyle\text{abcdefghijklm}}

Mixed text faces [ edit ]

Feature Syntax How it looks rendered
Italicised characters (spaces are ignored) x y z
Non-italicised characters \text{x y z}
Mixed italics (bad) \text{if} n \text{is even}
Mixed italics (good) \text{if }n\text{ is even}
Mixed italics (alternative: ~ or "\ " forces a space) \text{if}~n\ \text{is even}

Color [ edit ]

Equations can use color with the \color command. For example,

  • {\color{Blue}x^2}+{\color{Orange}2x}-{\color{LimeGreen}1}
  • x_{1,2}=\frac{{\color{Blue}-b}\pm\sqrt{\color{Red}b^2-4ac}}{\color{Green}2a }

There are several alternate notations styles

  • {\color{Blue}x^2}+{\color{Orange}2x}-{\color{LimeGreen}1} works with both texvc and MathJax
  • \color{Blue}x^2\color{Black}+\color{Orange}2x\color{Black}-\color{LimeGreen}1 works with both texvc and MathJax
  • \color{Blue}{x^2}+\color{Orange}{2x}-\color{LimeGreen}{1} only works with MathJax

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).

Colors supported

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. See WP:Manual of Style (accessibility)#Color.

Latex does not have a command for setting the background color. The most effective way of setting a background color is by setting a CSS styling rule for a table cell:

{| class="wikitable" align="center"
| style="background-color: gray;"      | <math>x^2</math>
| style="background-color: Goldenrod;" | <math>y^3</math>
|}

Rendered as:

Custom colours can be defined using:

\definecolor{myorange}{rgb}{1,0.65,0.4}\color{myorange}e^{i \pi}\color{Black} + 1 = 0

Formatting issues [ edit ]

Spacing [ edit ]

TeX handles most spacing automatically, but you may sometimes want manual control.

Feature Syntax How it looks rendered
double quad space a \qquad b
quad space a \quad b
text space a\ b
text space in text mode a \text{ } b
large space a\;b
medium space a\<b [not supported]
small space a\,b
tiny space (use for multiplication of factors) ab
tiny space (syntax space ignored) a b
no space (use for multi-letter variables) \mathit{ab}
small negative space a\!b

Automatic spacing may be broken in very long expressions (because they produce an overfull hbox in TeX):

0+1+2+3+4+5+6+7+8+9+10+11+12+13+14+15+16+17+18+19+20+\cdots

This can be remedied by putting a pair of braces { } around the whole expression:

{0+1+2+3+4+5+6+7+8+9+10+11+12+13+14+15+16+17+18+19+20+\cdots}



When relational symbols such as are employed as ordinary symbols, for example in bra–ket notation, additional spacing may have to be avoided:

Feature Syntax How it looks rendered
without special formatting | \uparrow \rangle
explicit opening and closing delimiter \left| \uparrow\right\rangle
with additional braces | {\uparrow} \rangle
arrow as ordinary symbol | \mathord\uparrow \rangle

Alignment with normal text flow [ edit ]

Because of the default CSS

        
        img
        .
        tex
        {
        vertical-align
        :
        middle
        ;
        }
      

an inline expression like should look good.

If you need to align it otherwise, use <math style="vertical-align:-100%;">...</math> and play with the vertical-align argument until you get it right; however, how it looks may depend on the browser and the browser settings.

If you rely on this workaround, if and when the rendering on the server gets fixed in a future release, this extra manual offset will suddenly make every affected formula align incorrectly. So use it sparingly, if at all.

Unimplemented elements and workarounds [ edit ]

\oiint and \oiiint [ edit ]

Elements which are not yet implemented are \oiint, namely a two-fold integral \iint () with a circular curve through the centre of the two integrals, and similarly \oiiint, a circular curve through three integrals. In contrast, \oint () exists for the single dimension (integration over a curved line within a plane or any space with higher dimension).

These elements appear in many contexts: \oiint denotes a surface integral over the closed 2d boundary of a 3d region (which occurs in much of 3d vector calculus and physical applications – like Maxwell's equations), likewise \oiiint denotes integration over the closed 3d boundary (surface volume) of a 4d region, and they would be strong candidates for the next TeX version. As such there are a lot of workarounds in the present version.

However, since no standardisation exists as yet, any workaround like this (which uses many \! symbols for backspacing) should be avoided, if possible. See below for a possibility using PNG image enforcement.

Note that \iint (the double integral) and \iiint (the triple integral) are still not kerned as they should preferably be, and are currently rendered as if they were successive \int symbols; this is not a major problem for reading the formulas, even if the integral symbols before the last one do not have bounds, so it's best to avoid backspacing "hacks" as they may be inconsistent with a possible future better implementation of integrals symbols (with more precisely computed kerning positions).

\oiint and \oiiint as PNG images [ edit ]

These symbols are available as PNG images which are also integrated into two templates, {{oiint}} and {{oiiint}}, which take care of the formatting around the symbols.

The templates have three parameters:

preintegral
the text or formula immediately before the integral
intsubscpt
the subscript below the integral
integrand
the text or formula immediately after the integral
Examples [ edit ]
  • Stokes' theorem: <math>\oiint_{\scriptstyle S}( \nabla \times \mathbf{F} ) \cdot {\mathrm d}\mathbf{S} = \oint_{\partial S} \mathbf{F} \cdot {\mathrm d}\boldsymbol{\ell} </math>
  • Ampère's law + correction: {{oiint | preintegral=<math>\oint_C \mathbf{B}\cdot{\mathrm d} \boldsymbol{\ell} = \mu_0 </math> | intsubscpt = <math>{\scriptstyle S}</math> | integrand = <math>\left ( \mathbf{J} + \epsilon_0\frac{\partial \mathbf{E}}{\partial t} \right ) \cdot {\mathrm d}\mathbf{S}</math> }}
\oiint
  • Continuity of 4-momentum flux (in general relativity):[2]<math display=block> \mathbf{P} = \oiiint_{\scriptstyle \partial \Omega} \mathbf{T} \cdot {\mathrm d}^3\boldsymbol{\Sigma} = 0 </math>

Oriented \oiint and \oiiint as PNG images [ edit ]

Some variants of \oiint and \oiiint have arrows on them to indicate the sense of integration, such as a line integral around a closed curve in the clockwise sense, and higher dimensional analogues. These are not implemented in TeX on Wikipedia either, although the template {{intorient}} is available - see link for details.

Arc notation \overarc [ edit ]

\overarc is not yet implemented to display the arc notation. However, there exists a workaround: use \overset{\frown}{AB}, which gives

Triple dot \dddot [ edit ]

\dddot is not implemented. For a workaround use \overset{...}{x}, which gives .

Starred operatorname \operatorname* [ edit ]

The starred version of \operatorname is not currently supported. A workaround for

\operatorname*{median}_{j\,\ne\,i} X_{i,j}

is

\operatorname{\underset{\mathit{j\,\ne\,i}}{median}} X_{i,j}

Strikethrough [ edit ]

Strikethrough like \sout or \st is not implemented, nor is overlapping like \rlap. This means struck characters like ƛ are difficult to type, except the hardcoded \hbar. A workaround suffix for a normal strikethrough is q \!\!\!\frac{}{\ }, and for elevated strikethrough is \lambda\!\!\!^{{}^\underline{\ \ }}, which give

Syntax to avoid [ edit ]

The texvc processor accepts some non-standard syntax. These should be avoided as the MathJax based renderers do not support these syntax.

Unicode characters [ edit ]

Non-ASCII Unicode characters like π work in MathML, and MathJax but not in texvc so should currently be avoided. In the long term it may be possible to use these characters.

Deprecated syntax [ edit ]

The following texvc commands are now deprecated and should be avoided. This is part of an effort to update the math engine see mw:Extension:Math/Roadmap for details. A bot User:Texvc2LaTeXBot will replace this syntax on the English Wikipedia.

Current syntax Suggested replacement Comment
$ \$ redefinition would involve changing the character code
% \% redefinition would involve changing the character code
\or \lor see [1]; causes teubner to fail
\and \land causes normal align environment to fail
\pagecolor remove not needed and not working anymore, done manually
\part \partial acceptable if the document doesn't use sectioning with \part.
\ang \angle this only conflicts with siunitx package.
\C \Complex conflicts with puenc.def e.g. from hyperref package
\H \mathbb{H} conflicts with text command \H{0} which is ő.
\bold \mathbf
\Bbb \mathbb

Chemistry [ edit ]

There are three ways to render chemical sum formulas as used in chemical equations:

  • <chem>...</chem> (<ce>...</ce> is a deprecated alias for it)
  • <math chem>...</math>
  • {{chem}} and {{chem2}}

<chem>X</chem> is short for <mathchem>\ce{X}</math> (where X is a chemical sum formula)

Technically, <math chem> is a math tag with the extension mhchem enabled, according to the MathJax documentation.

Note, that the commands \cee and \cf are disabled, because they are marked as deprecated in the mhchem LaTeX package documentation.

If the formula reaches a certain "complexity", spaces might be ignored (<chem>A + B</chem> might be rendered as if it were <chem>A+B</chem> with a positive charge). In that case, write <chem>A{} + B</chem> (and not <chem>{A} + {B}</chem> as was previously suggested). This will allow auto-cleaning of formulas once the bug will be fixed and/or a newer mhchem version will be used.

Please note that there are still major issues with mhchem support in MediaWiki. Some issue can be solved by enabling the extension using <math chem> and formatting individual items with \ce. For example,

  • <math chem>\ce{pIC_{50}} = -\log_{10} \ce{(IC_{50})}</math>

Molecular and condensed formula [ edit ]

mhchem {{chem}} {{chem2}} Equivalent HTML
Markup Renders as
<chem>H2O</chem>

<chem>Sb2O3</chem>

<chem>(NH4)2S</chem>

Markup Renders as
{{chem|H|2|O}}

H

2
O

{{chem|Sb|2|O|3}}

Sb

2
O

3

{{chem|({{chem|N|H|4}})|2|S}}

(NH

4
)

2
S

Markup Renders as
{{chem2|H2O}}

H

2
O

{{chem2|Sb2O3}}

Sb

2
O

3

{{chem2|(NH4)2S}}

(NH

4
)

2
S

Markup Renders as
H<sub>2</sub>O

H2O

Sb<sub>2</sub>O<sub>3</sub>

Sb2O3

(NH<sub>4</sub>)<sub>2</sub>S

(NH4)2S

Bonds [ edit ]

mhchem Equivalent {{chem}} and HTML {{chem2}}
Markup Renders as
<chem>C6H5-CHO</chem>

<chem>A-B=C#D</chem>

Markup Renders as
{{chem|C|6|H|5}}-CHO
<br/>
C<sub>6</sub>H<sub>5</sub>-CHO

C

6
H

5
-CHO

C6H5-CHO

A-B=C≡D

N/A

Markup Renders as
{{chem2|C6H5\sCHO}}

C

6
H

5
−CHO

{{chem2|1=A\sB=C≡D}}

A−B=C≡D

Charges [ edit ]

mhchem {{chem}} Equivalent HTML
Markup Renders as
<chem>H+</chem>

<chem>NO3-</chem>

<chem>CrO4^2-</chem>

<chem>AgCl2-</chem>

<chem>[AgCl2]-</chem>

<chem>Y^99+</chem>
<chem>Y^{99+}</chem>



Markup Renders as
{{chem|H|+}}

H+

{{chem|N|O|3|-}}

NO

3

{{chem|Cr|O|4|2-}}

CrO2−

4

{{chem|Ag|Cl|2|-}}

AgCl

2

{{chem|[{{chem|Ag|Cl|2}}]|-}}

[AgCl

2
]

{{chem|Y|99+}}

Y99+

Markup Renders as
H<sup>+</sup>

H+

NO<sub>3</sub><sup>−</sup>

NO3

CrO<sub>4</sub><sup>2-</sup>

CrO42-

AgCl<sub>2</sub><sup>−</sup>

AgCl2

[AgCl<sub>2</sub>]<sup>−</sup>

[AgCl2]

Y<sup>99+</sup>

Y99+

Addition compounds and stoichiometric numbers [ edit ]

mhchem {{chem}} {{chem2}}
Markup Renders as
<chem>MgSO4.7H2O</chem>

<chem>KCr(SO4)2*12H2O</chem>

<chem>CaSO4.1/2H2O + 1\!1/2 H2O -> CaSO4.2H2O</chem>

<chem>25/2 O2 + C8H18 -> 8 CO2 + 9 H2O</chem>

Markup Renders as
                      {{chem|Mg|S|O|4}}&middot;7{{chem|H|2|O}}
                    

MgSO

4
·7H

2
O

                      {{chem|K|Cr|({{chem|S|O|4}})|2}}&middot;12{{chem|H|2|O}}
                    

KCr(SO

4
)

2
·12H

2
O

                      {{chem|Ca|S|O|4}}&middot;&frac12;{{chem|H|2|O}} + 1&frac12;{{chem|H|2|O}} → {{chem|Ca|S|O|4}}&middot;2{{chem|H|2|O}}
                    

CaSO

4
·½H

2
O
+ 1½H

2
O
CaSO

4
·2H

2
O

                      {{frac|25|2}}{{chem|O|2}} + {{chem|C|8|H|18}} → 8{{chem|C|O|2}} + 9{{chem|H|2|O}}
                    

252O

2
+ C

8
H

18
→ 8CO

2
+ 9H

2
O

Markup Renders as
{{chem2|MgSO4*7H2O}}

MgSO

4
·7H2O

{{chem2|KCr(SO4)2*12H2O}}

KCr(SO

4
)

2
·12H2O

{{chem2|2CaSO4*H2O + 3H2O -> 2CaSO4*2H2O}}

2CaSO

4
·H2O + 3H

2
O → 2CaSO

4
·2H2O

{{chem2|25 O2 + 2 C8H18 -> 16 CO2 + 18 H2O}}

25 O

2
+ 2 C

8
H

18
→ 16 CO

2
+ 18 H

2
O

Wiki linking [ edit ]

{{chem}}
Markup
25 {{chem|link=oxygen|O|2}} + 2 {{chem|link=octane|C|8|H|18}} → 16 {{chem|link=Carbon dioxide|C|O|2}} + 18 {{chem|link=water|H|2|O}}
Renders as 25 O

2
+ 2 C

8
H

18
→ 16 CO

2
+ 18 H

2
O
{{chem2}}
Markup
{{chem2|25 [[oxygen|O2]] + 2 [[octane|C8H18]] -> 16 [[Carbon dioxide|CO2]] + 18 [[water|H2O]]}}
Renders as 25 O

2
+ 2 C

8
H

18
→ 16 CO

2
+ 18 H

2
O

(Italic) Math [ edit ]

mhchem
Markup
                      <chem>{C_\mathit{x}H_\mathit{y}} + \mathit{z}O2 -> {\mathit{x}CO2} + \frac{\mathit{y}}{2}H2O</chem>
                    
Renders as
{{chem}}
Markup
{{chem|C|''x''|H|''y''}} + ''z''{{chem|O|2}} → ''x''{{chem|C|O|2}} + {{frac|''y''|2}}{{chem|H|2|O}}
Renders as C

x
H

y
+ zO

2
xCO

2
+ ​y2H

2
O

Oxidation states [ edit ]

mhchem
Markup
<chem>Fe^{II}Fe^{III}2O4</chem>
Renders as
{{chem}} with <sup>...</sup>
Markup
{{chem|Fe|<sup>II</sup>|Fe|<sup>III</sup>|2|O|4}}
Renders as FeIIFeIII

2
O

4

Greek characters [ edit ]

mhchem Equivalent {{chem}} and HTML
Markup Renders as
                      <chem>\mu-Cl</chem>
                    

                      <chem>[Fe(\eta^5-C5H5)2]</chem>
                    

Markup Renders as
                      ''μ''-Cl
                    

μ-Cl

                      
[{{chem|Fe|(''η''<sup>5</sup>-{{chem|C|5|H|5}})|2}}]

<br/>

[Fe(''η''<sup>5</sup>-C<sub>5</sub>H<sub>5</sub>)<sub>2</sub>]

[Fe(η5-C

5
H

5
)

2
]

[Fe(η5-C5H5)2]

Isotopes [ edit ]

mhchem Equivalent {{chem}} and HTML
Markup Renders as
                      <chem>^{227}_{90}Th+</chem>
                    

                      <chem>^0_{-1}n-</chem>
                    

Markup Renders as
{{chem|227|90|Th|+}}

227

90
Th+

{{chem|0|-1}}n<sup>−</sup>

0

-1
n

States [ edit ]

States subscripting is not IUPAC recommendation.

mhchem {{chem}}
Markup Renders as
<chem>H2_{(aq)}</chem>

<chem>CO3^{2-}(aq)</chem>

Markup Renders as
{{chem|H|2(aq)}}

H

2(aq)

{{chem|C|O|3|2-}}(aq)

CO2−

3
(aq)

Precipitate [ edit ]

mhchem
Markup
<chem>Ba^2+ + SO4^{2-} -> BaSO4(v)</chem>
Renders as
{{chem}}
Markup
{{chem|Ba|2+}} + {{chem|S|O|4|2-}} → {{chem|Ba|S|O|4}}↓
Renders as Ba2+

+ SO2−

4
BaSO

4
{{chem2}}
Markup
{{chem2|Ba(2+) + SO4(2-) -> BaSO4↓}}
Renders as Ba2+ + SO2−

4
→ BaSO

4
Equivalent HTML
Markup
                      Ba<sup>2+</sup> + SO<sub>4</sub><sup>2&minus;</sup> &rarr; BaSO<sub>4</sub>&darr;
                    
Renders as Ba2+ + SO42− → BaSO4

Reaction arrows [ edit ]

Markup Renders as
<chem>A ->B</chem>

<chem>A <- B</chem>

<chem>A <=> B</chem>

<chem>A <=>> B</chem>

<chem>A <<=> B</chem>

              <chem>A ->[{}\atop x] B</chem>
            

              <chem>A ->[\text{text above}][\text{text below}] B</chem>
            

              <chem>A ->[{}\atop\ce{+H2O}] B</chem>
            

Comparison of arrow symbols [ edit ]

Markup Renders as
<math>\rightarrow</math>

<math>\rightleftarrows</math>

<math>\rightleftharpoons</math>

<math>\leftrightarrow</math>

<math>\longrightarrow</math>
<chem>-></chem>



<math>\rightleftharpoons</math>
<chem><=></chem>



<math>\longleftrightarrow</math>
<chem><-></chem>



Further examples using ordinary LaTeX tags [ edit ]

<math chem>\begin{align}\overbrace{\ce{2Fe3O4}}^{\text{magnetite}} + \ce{1/2 O2 ->}\ &{\color{Brown}\overbrace{\ce{3(\lambda{-}Fe2O3)}}^{\text