Formatting using TeX

Functions, symbols, special characters[edit]

Accents and diacritics[edit]

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

Standard numerical functions[edit]

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

Bounds[edit]

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

Projections[edit]

\Pr j, \hom l, \lVert z \rVert, \arg z{\displaystyle \Pr j,\hom l,\lVert z\rVert ,\arg z} 

Differentials and derivatives[edit]

dt, \mathrm{d}t, \partial t, \nabla\psi{\displaystyle 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{\displaystyle 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{\displaystyle \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{\displaystyle \infty ,\aleph ,\complement ,\backepsilon ,\eth ,\Finv ,\hbar } 
\Im, \imath, \jmath, \Bbbk, \ell, \mho, \wp, \Re, \circledS, \S, \P, \AA{\displaystyle \Im ,\imath ,\jmath ,\Bbbk ,\ell ,\mho ,\wp ,\Re ,\circledS ,\S ,\P ,\mathrm {\AA} } 

Modular arithmetic[edit]

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

Radicals[edit]

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

Operators[edit]

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

Sets[edit]

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

Relations[edit]

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

Geometric[edit]

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

Logic[edit]

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

don't use \or which is now deprecated

{\displaystyle \lor ,\vee ,\curlyvee ,\bigvee } 
\land \wedge, \curlywedge, \bigwedge

don't use \and which is now deprecated

{\displaystyle \land ,\wedge ,\curlywedge ,\bigwedge } 
\bar{q}, \bar{abc}, \overline{q}, \overline{abc},

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

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

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

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

Arrows[edit]

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

Special[edit]

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

Unsorted (new stuff)[edit]

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

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

Larger expressions[edit]

Subscripts, superscripts, integrals[edit]

FeatureSyntaxHow it looks rendered
Superscripta^2, a^{x+3}{\displaystyle a^{2},a^{x+3}} 
Subscripta_2{\displaystyle a_{2}} 
Grouping10^{30} a^{2+2}{\displaystyle 10^{30}a^{2+2}} 
a_{i,j} b_{f'}{\displaystyle a_{i,j}b_{f'}} 
Combining sub & super without and with horizontal separationx_2^3{\displaystyle x_{2}^{3}} 
{x_2}^3{\displaystyle {x_{2}}^{3}} 
Super super10^{10^{8}}{\displaystyle 10^{10^{8}}} 
Preceding and/or additional sub & super\sideset{_1^2}{_3^4}\prod_a^b{\displaystyle \sideset {_{1}^{2}}{_{3}^{4}}\prod _{a}^{b}} 
{}_1^2\!\Omega_3^4{\displaystyle {}_{1}^{2}\!\Omega _{3}^{4}} 
Stacking\overset{\alpha}{\omega}{\displaystyle {\overset {\alpha }{\omega }}} 
\underset{\alpha}{\omega}{\displaystyle {\underset {\alpha }{\omega }}} 
\overset{\alpha}{\underset{\gamma}{\omega}}{\displaystyle {\overset {\alpha }{\underset {\gamma }{\omega }}}} 
\stackrel{\alpha}{\omega}{\displaystyle {\stackrel {\alpha }{\omega }}} 
Derivativesx', y'', f', f''{\displaystyle x',y'',f',f''} 
x^\prime, y^{\prime\prime}{\displaystyle x^{\prime },y^{\prime \prime }} 
Derivative dots\dot{x}, \ddot{x}{\displaystyle {\dot {x}},{\ddot {x}}} 
Underlines, overlines, vectors\hat a \ \bar b \ \vec c{\displaystyle {\hat {a}}\ {\bar {b}}\ {\vec {c}}} 
\overrightarrow{a b} \ \overleftarrow{c d} \ \widehat{d e f}{\displaystyle {\overrightarrow {ab}}\ {\overleftarrow {cd}}\ {\widehat {def}}} 
\overline{g h i} \ \underline{j k l}{\displaystyle {\overline {ghi}}\ {\underline {jkl}}} 
Arc (workaround)\overset{\frown} {AB}{\displaystyle {\overset {\frown }{AB}}} 
ArrowsA \xleftarrow{n+\mu-1} B \xrightarrow[T]{n\pm i-1} C{\displaystyle A{\xleftarrow {n+\mu -1}}B{\xrightarrow[{T}]{n\pm i-1}}C} 
Overbraces\overbrace{ 1+2+\cdots+100 }^{5050}{\displaystyle \overbrace {1+2+\cdots +100} ^{5050}} 
Underbraces\underbrace{ a+b+\cdots+z }_{26}{\displaystyle \underbrace {a+b+\cdots +z} _{26}} 
Sum\sum_{k=1}^N k^2{\displaystyle \sum _{k=1}^{N}k^{2}} 
Sum (force \textstyle)\textstyle \sum_{k=1}^N k^2{\displaystyle \textstyle \sum _{k=1}^{N}k^{2}} 
Sum in a fraction (default \textstyle)\frac{\sum_{k=1}^N k^2}{a}{\displaystyle {\frac {\sum _{k=1}^{N}k^{2}}{a}}} 
Sum in a fraction (force \displaystyle)\frac{\displaystyle \sum_{k=1}^N k^2}{a}{\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}{\displaystyle {\frac {\sum \limits _{k=1}^{^{N}}k^{2}}{a}}} 
Product\prod_{i=1}^N x_i{\displaystyle \prod _{i=1}^{N}x_{i}} 
Product (force \textstyle)\textstyle \prod_{i=1}^N x_i{\displaystyle \textstyle \prod _{i=1}^{N}x_{i}} 
Coproduct\coprod_{i=1}^N x_i{\displaystyle \coprod _{i=1}^{N}x_{i}} 
Coproduct (force \textstyle)\textstyle \coprod_{i=1}^N x_i{\displaystyle \textstyle \coprod _{i=1}^{N}x_{i}} 
Limit\lim_{n \to \infty}x_n{\displaystyle \lim _{n\to \infty }x_{n}} 
Limit (force \textstyle)\textstyle \lim_{n \to \infty}x_n{\displaystyle \textstyle \lim _{n\to \infty }x_{n}} 
Integral\int\limits_{1}^{3}\frac{e^3/x}{x^2}\, dx{\displaystyle \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{\displaystyle \int _{1}^{3}{\frac {e^{3}/x}{x^{2}}}\,dx} 
Integral (force \textstyle)\textstyle \int\limits_{-N}^{N} e^x dx{\displaystyle \textstyle \int \limits _{-N}^{N}e^{x}dx} 
Integral (force \textstyle, alternative limits style)\textstyle \int_{-N}^{N} e^x dx{\displaystyle \textstyle \int _{-N}^{N}e^{x}dx} 
Double integral\iint\limits_D dx\,dy{\displaystyle \iint \limits _{D}dx\,dy} 
Triple integral\iiint\limits_E dx\,dy\,dz{\displaystyle \iiint \limits _{E}dx\,dy\,dz} 
Quadruple integral\iiiint\limits_F dx\,dy\,dz\,dt{\displaystyle \iiiint \limits _{F}dx\,dy\,dz\,dt} 
Line or path integral\int_{(x,y)\in C} x^3\, dx + 4y^2\, dy{\displaystyle \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{\displaystyle \oint _{(x,y)\in C}x^{3}\,dx+4y^{2}\,dy} 
Intersections\bigcap_{i=1}^n E_i{\displaystyle \bigcap _{i=1}^{n}E_{i}} 
Unions\bigcup_{i=1}^n E_i{\displaystyle \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: there will be no new paragraph for the equation and the operators will be rendered to consume only a small amount of vertical space.

The sum {\textstyle \sum _{i=0}^{\infty }2^{-i}}  converges to 2.

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

The code for the math example reads:

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

The quotation marks around inline are optional and display=inline is also valid.[2]

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. The equation is indented.

The sum

{\displaystyle \sum _{i=0}^{\infty }2^{-i}}

converges to 2.

It was entered as

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

Technical implementation[edit]

Technically the command \displaystyle will be added to the user input (if the user input does not already 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 equation is rendered in the same display style as "block", but without using a new paragraph. If the equation does appear on a line by itself, it is not automatically indented.

The sum {\displaystyle \sum _{i=0}^{\infty }2^{-i}}  converges to 2.

The next line-width is disturbed by large operators.

Or:

The sum

{\displaystyle \sum _{i=0}^{\infty }2^{-i}} 

converges to 2.

In both cases, the math is coded as:

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

Fractions, matrices, multilines[edit]

FeatureSyntaxHow it looks rendered
Fractions\frac{2}{4}=0.5 or {2 \over 4}=0.5{\displaystyle {\frac {2}{4}}=0.5} 
Small fractions (force \textstyle)\tfrac{2}{4} = 0.5{\displaystyle {\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{\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{\displaystyle {\cfrac {2}{c+{\cfrac {2}{d+{\cfrac {2}{4}}}}}}=a} 
Cancellations in fractions\cfrac{x}{1 + \cfrac{\cancel{y}}{\cancel{y}}} = \cfrac{x}{2}{\displaystyle {\cfrac {x}{1+{\cfrac {\cancel {y}}{\cancel {y}}}}}={\cfrac {x}{2}}} 
Binomial coefficients\binom{n}{k}{\displaystyle {\binom {n}{k}}} 
Small binomial coefficients (force \textstyle)\tbinom{n}{k}{\displaystyle {\tbinom {n}{k}}} 
Large (normal) binomial coefficients (force \displaystyle)\dbinom{n}{k}{\displaystyle {\dbinom {n}{k}}} 
Matrices
\begin{matrix}
x & y \\
z & v
\end{matrix}
{\displaystyle {\begin{matrix}x&y\\z&v\end{matrix}}} 
\begin{vmatrix}
x & y \\
z & v
\end{vmatrix}
{\displaystyle {\begin{vmatrix}x&y\\z&v\end{vmatrix}}} 
\begin{Vmatrix}
x & y \\
z & v
\end{Vmatrix}
{\displaystyle {\begin{Vmatrix}x&y\\z&v\end{Vmatrix}}} 
\begin{bmatrix}
0 & \cdots & 0 \\
\vdots & \ddots & \vdots \\
0 & \cdots & 0
\end{bmatrix}
{\displaystyle {\begin{bmatrix}0&\cdots &0\\\vdots &\ddots &\vdots \\0&\cdots &0\end{bmatrix}}} 
\begin{Bmatrix}
x & y \\
z & v
\end{Bmatrix}
{\displaystyle {\begin{Bmatrix}x&y\\z&v\end{Bmatrix}}} 
\begin{pmatrix}
x & y \\
z & v
\end{pmatrix}
{\displaystyle {\begin{pmatrix}x&y\\z&v\end{pmatrix}}} 
\bigl( \begin{smallmatrix}
a&b\\ c&d
\end{smallmatrix} \bigr)
{\displaystyle {\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}
{\displaystyle f(n)={\begin{cases}n/2,&{\text{if }}n{\text{ is even}}\\3n+1,&{\text{if }}n{\text{ is odd}}\end{cases}}} 
Simultaneous equations
\begin{cases}
3x + 5y + z \\
7x - 2y + 4z \\
-6x + 3y + 2z
\end{cases}
{\displaystyle {\begin{cases}3x+5y+z\\7x-2y+4z\\-6x+3y+2z\end{cases}}} 
Multiline equations
\begin{align}
f(x) & = (a+b)^2 \\
& = a^2+2ab+b^2 \\
\end{align}
{\displaystyle {\begin{aligned}f(x)&=(a+b)^{2}\\&=a^{2}+2ab+b^{2}\\\end{aligned}}} 
\begin{alignat}{2}
f(x) & = (a-b)^2 \\
& = a^2-2ab+b^2 \\
\end{alignat}
{\displaystyle {\begin{alignedat}{2}f(x)&=(a-b)^{2}\\&=a^{2}-2ab+b^{2}\\\end{alignedat}}} 
Multiline equations with multiple alignments per row
\begin{align}
f(a,b) & = (a+b)^2 && = (a+b)(a+b) \\
& = a^2+ab+ba+b^2  && = a^2+2ab+b^2 \\
\end{align}
{\displaystyle {\begin{aligned}f(a,b)&=(a+b)^{2}&&=(a+b)(a+b)\\&=a^{2}+ab+ba+b^{2}&&=a^{2}+2ab+b^{2}\\\end{aligned}}} 
\begin{alignat}{3}
f(a,b) & = (a+b)^2 && = (a+b)(a+b) \\
& = a^2+ab+ba+b^2  && = a^2+2ab+b^2 \\
\end{alignat}
{\displaystyle {\begin{alignedat}{3}f(a,b)&=(a+b)^{2}&&=(a+b)(a+b)\\&=a^{2}+ab+ba+b^{2}&&=a^{2}+2ab+b^{2}\\\end{alignedat}}} 
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}
{\displaystyle {\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}
{\displaystyle {\begin{array}{lcr}z&=&a\\f(x,y,z)&=&x+y+z\end{array}}} 
Multiline alignment using & to left align (top example) versus && to right align (bottom example) the last column
\begin{alignat}{4}
F:\; && C(X) && \;\to\;     & C(X) \\
     && g    && \;\mapsto\; & g^2
\end{alignat}
\begin{alignat}{4}
F:\; && C(X) && \;\to\;     && C(X) \\
     && g    && \;\mapsto\; && g^2
\end{alignat}
{\displaystyle {\begin{alignedat}{4}F:\;&&C(X)&&\;\to \;&C(X)\\&&g&&\;\mapsto \;&g^{2}\end{alignedat}}} 
 

{\displaystyle {\begin{alignedat}{4}F:\;&&C(X)&&\;\to \;&&C(X)\\&&g&&\;\mapsto \;&&g^{2}\end{alignedat}}}

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>
{\displaystyle f(x)\,\!} {\displaystyle =\sum _{n=0}^{\infty }a_{n}x^{n}}{\displaystyle =a_{0}+a_{1}x+a_{2}x^{2}+\cdots }
Arrays
\begin{array}{|c|c|c|} a & b & S \\
\hline
0 & 0 & 1 \\
0 & 1 & 1 \\
1 & 0 & 1 \\
1 & 1 & 0 \\
\end{array}
{\displaystyle {\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]

FeatureSyntaxHow it looks rendered
 Bad( \frac{1}{2} )^n{\displaystyle ({\frac {1}{2}})^{n}} 
Good \left ( \frac{1}{2} \right )^n{\displaystyle \left({\frac {1}{2}}\right)^{n}} 

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

FeatureSyntaxHow it looks rendered
Parentheses\left ( \frac{a}{b} \right ){\displaystyle \left({\frac {a}{b}}\right)} 
Brackets\left [ \frac{a}{b} \right ] \quad
\left \lbrack \frac{a}{b} \right \rbrack
{\displaystyle \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
{\displaystyle \left\{{\frac {a}{b}}\right\}\quad \left\lbrace {\frac {a}{b}}\right\rbrace } 
Angle brackets\left \langle \frac{a}{b} \right \rangle{\displaystyle \left\langle {\frac {a}{b}}\right\rangle } 
Bars and double bars\left | \frac{a}{b} \right \vert \quad
\left \Vert \frac{c}{d} \right \|
{\displaystyle \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
{\displaystyle \left\lfloor {\frac {a}{b}}\right\rfloor \quad \left\lceil {\frac {c}{d}}\right\rceil } 
Slashes and backslashes\left / \frac{a}{b} \right \backslash{\displaystyle \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
{\displaystyle \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 |
{\displaystyle \left[0,1\right)} 
{\displaystyle \left\langle \psi \right|}
Use \left. and \right. if you
do not want a delimiter to appear
\left . \frac{A}{B} \right \} \to X{\displaystyle \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] ]{\displaystyle ({\bigl (}{\Bigl (}{\biggl (}{\Biggl (}\dots {\Biggr ]}{\biggr ]}{\Bigr ]}{\bigr ]}]} 
\{ \bigl\{ \Bigl\{ \biggl\{ \Biggl\{ \dots
\Biggr\rangle \biggr\rangle \Bigr\rangle \bigr\rangle \rangle
{\displaystyle \{{\bigl \{}{\Bigl \{}{\biggl \{}{\Biggl \{}\dots {\Biggr \rangle }{\biggr \rangle }{\Bigr \rangle }{\bigr \rangle }\rangle } 
\| \big\| \Big\| \bigg\| \Bigg\| \dots \Bigg| \bigg| \Big| \big| |{\displaystyle \|{\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
{\displaystyle \lfloor {\bigl \lfloor }{\Bigl \lfloor }{\biggl \lfloor }{\Biggl \lfloor }\dots {\Biggr \rceil }{\biggr \rceil }{\Bigr \rceil }{\bigr \rceil }\rceil } 
\uparrow \big\uparrow \Big\uparrow \bigg\uparrow \Bigg\uparrow \dots
\Bigg\Downarrow \bigg\Downarrow \Big\Downarrow \big\Downarrow \Downarrow
{\displaystyle \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
{\displaystyle \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
{\displaystyle /{\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):

{\displaystyle x^{2}+y^{2}+z^{2}=1} 

(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]

See also: Wikipedia:LaTeX symbols § Fonts

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

Mixed text faces[edit]

FeatureSyntaxHow it looks rendered
Italicised characters (spaces are ignored)x y z{\displaystyle xyz} 
Non-italicised characters\text{x y z}{\displaystyle {\text{x y z}}} 
Mixed italics (bad)\text{if} n \text{is even}{\displaystyle {\text{if}}n{\text{is even}}} 
Mixed italics (good)\text{if }n\text{ is even}{\displaystyle {\text{if }}n{\text{ is even}}} 
Mixed italics (alternative: ~ or "\ " forces a space)\text{if}~n\ \text{is even}{\displaystyle {\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}

    {\displaystyle {\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 }

    {\displaystyle 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

    {\displaystyle {\color {Blue}x^{2}}+{\color {Orange}2x}-{\color {LimeGreen}1}} 

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

    {\displaystyle \color {Blue}x^{2}\color {Black}+\color {Orange}2x\color {Black}-\color {LimeGreen}1} 

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

    {\displaystyle \color {Blue}{x^{2}}+\color {Orange}{2x}-\color {LimeGreen}{1}} 

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
{\displaystyle \color {Apricot}{\text{Apricot}}} {\displaystyle \color {Aquamarine}{\text{Aquamarine}}} {\displaystyle \color {Bittersweet}{\text{Bittersweet}}} {\displaystyle \color {Black}{\text{Black}}} 
{\displaystyle \color {Blue}{\text{Blue}}} {\displaystyle \color {BlueGreen}{\text{BlueGreen}}} {\displaystyle \color {BlueViolet}{\text{BlueViolet}}} {\displaystyle \color {BrickRed}{\text{BrickRed}}} 
{\displaystyle \color {Brown}{\text{Brown}}} {\displaystyle \color {BurntOrange}{\text{BurntOrange}}} {\displaystyle \color {CadetBlue}{\text{CadetBlue}}} {\displaystyle \color {CarnationPink}{\text{CarnationPink}}} 
{\displaystyle \color {Cerulean}{\text{Cerulean}}} {\displaystyle \color {CornflowerBlue}{\text{CornflowerBlue}}} {\displaystyle \color {Cyan}{\text{Cyan}}} {\displaystyle \color {Dandelion}{\text{Dandelion}}} 
{\displaystyle \color {DarkOrchid}{\text{DarkOrchid}}} {\displaystyle \color {Emerald}{\text{Emerald}}} {\displaystyle \color {ForestGreen}{\text{ForestGreen}}} {\displaystyle \color {Fuchsia}{\text{Fuchsia}}} 
{\displaystyle \color {Goldenrod}{\text{Goldenrod}}} {\displaystyle \color {Gray}{\text{Gray}}} {\displaystyle \color {Green}{\text{Green}}} {\displaystyle \color {GreenYellow}{\text{GreenYellow}}} 
{\displaystyle \color {JungleGreen}{\text{JungleGreen}}} {\displaystyle \color {Lavender}{\text{Lavender}}} {\displaystyle \color {LimeGreen}{\text{LimeGreen}}} {\displaystyle \color {Magenta}{\text{Magenta}}} 
{\displaystyle \color {Mahogany}{\text{Mahogany}}} {\displaystyle \color {Maroon}{\text{Maroon}}} {\displaystyle \color {Melon}{\text{Melon}}} {\displaystyle \color {MidnightBlue}{\text{MidnightBlue}}} 
{\displaystyle \color {Mulberry}{\text{Mulberry}}} {\displaystyle \color {NavyBlue}{\text{NavyBlue}}} {\displaystyle \color {OliveGreen}{\text{OliveGreen}}} {\displaystyle \color {Orange}{\text{Orange}}} 
{\displaystyle \color {OrangeRed}{\text{OrangeRed}}} {\displaystyle \color {Orchid}{\text{Orchid}}} {\displaystyle \color {Peach}{\text{Peach}}} {\displaystyle \color {Periwinkle}{\text{Periwinkle}}} 
{\displaystyle \color {PineGreen}{\text{PineGreen}}} {\displaystyle \color {Plum}{\text{Plum}}} {\displaystyle \color {ProcessBlue}{\text{ProcessBlue}}} {\displaystyle \color {Purple}{\text{Purple}}} 
{\displaystyle \color {RawSienna}{\text{RawSienna}}} {\displaystyle \color {Red}{\text{Red}}} {\displaystyle \color {RedOrange}{\text{RedOrange}}} {\displaystyle \color {RedViolet}{\text{RedViolet}}} 
{\displaystyle \color {Rhodamine}{\text{Rhodamine}}} {\displaystyle \color {RoyalBlue}{\text{RoyalBlue}}} {\displaystyle \color {RoyalPurple}{\text{RoyalPurple}}} {\displaystyle \color {RubineRed}{\text{RubineRed}}} 
{\displaystyle \color {Salmon}{\text{Salmon}}} {\displaystyle \color {SeaGreen}{\text{SeaGreen}}} {\displaystyle \color {Sepia}{\text{Sepia}}} {\displaystyle \color {SkyBlue}{\text{SkyBlue}}} 
{\displaystyle \color {SpringGreen}{\text{SpringGreen}}} {\displaystyle \color {Tan}{\text{Tan}}} {\displaystyle \color {TealBlue}{\text{TealBlue}}} {\displaystyle \color {Thistle}{\text{Thistle}}} 
{\displaystyle \color {Turquoise}{\text{Turquoise}}} {\displaystyle \color {Violet}{\text{Violet}}} {\displaystyle \color {VioletRed}{\text{VioletRed}}} {\displaystyle {\color {White}{\text{White}}}} 
{\displaystyle \color {WildStrawberry}{\text{WildStrawberry}}} {\displaystyle \color {Yellow}{\text{Yellow}}} {\displaystyle \color {YellowGreen}{\text{YellowGreen}}} {\displaystyle \color {YellowOrange}{\text{YellowOrange}}} 

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:

{\displaystyle x^{2}} {\displaystyle y^{3}} 

Custom colors can be defined using:

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

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

Formatting issues[edit]

Spacing[edit]

See also: Quad (typography)

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

FeatureSyntaxHow it looks rendered
double quad spacea \qquad b{\displaystyle a\qquad b} 
quad spacea \quad b{\displaystyle a\quad b} 
text spacea\ b{\displaystyle a\ b} 
text space in text modea \text{ } b{\displaystyle a{\text{ }}b} 
large spacea\;b{\displaystyle a\;b} 
medium spacea\<bNot supported
small spacea\,b{\displaystyle a\,b} 
tiny space (use for multiplication of factors)ab{\displaystyle ab} 
tiny space (syntax space ignored)a b{\displaystyle ab} 
no space (use for multi-letter variables)\mathit{ab}{\displaystyle {\mathit {ab}}} 
small negative spacea\!b{\displaystyle a\!b} 
zero-width spacea\hspace{0pt}bNot supported

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

{\displaystyle 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}

{\displaystyle {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 {\displaystyle \uparrow }  are employed as ordinary symbols, for example in bra–ket notation, additional spacing may have to be avoided:

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

Alignment with normal text flow[edit]

Because of the default CSS

img.tex { vertical-align: middle; }

an inline expression like {\displaystyle \int _{-N}^{N}e^{x}\,dx}  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]

The current Mathoid–MathJax backend has the following elements unimplemented (see also MathJax's own description of differences):

\oiint and \oiiint[edit]

Elements which are not yet implemented are \oiint, namely a two-fold integral \iint ({\displaystyle \iint } ) with a circular curve through the centre of the two integrals, and similarly \oiiint, a circular curve through three integrals. In contrast, \oint ({\displaystyle \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.

show\oiint and \oiiint using currently implemented symbols

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{{oiint | intsubscpt=<math>\scriptstyle S</math> | integrand=<math>( \nabla \times \mathbf{F} ) \cdot {\mathrm d}\mathbf{S} = \oint_{\partial S} \mathbf{F} \cdot {\mathrm d}\boldsymbol{\ell}</math>}}

 {\displaystyle \scriptstyle S} {\displaystyle (\nabla \times \mathbf {F} )\cdot {\mathrm {d} }\mathbf {S} =\oint _{\partial S}\mathbf {F} \cdot {\mathrm {d} }{\boldsymbol {\ell }}}

  • 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> }}

{\displaystyle \oint _{\partial S}\mathbf {B} \cdot {\mathrm {d} }{\boldsymbol {\ell }}=\mu _{0}}  {\displaystyle {\scriptstyle S}} {\displaystyle \left(\mathbf {J} +\epsilon _{0}{\frac {\partial \mathbf {E} }{\partial t}}\right)\cdot {\mathrm {d} }\mathbf {S} }

  • Continuity of 4-momentum flux (in general relativity):[3]{{oiiint | preintegral=<math>\mathbf{P} = </math> | intsubscpt=<math>\scriptstyle \partial \Omega</math> | integrand=<math>\mathbf{T} \cdot {\mathrm d}^3\boldsymbol{\Sigma}</math> <math>=0</math>}}

{\displaystyle \mathbf {P} =}  {\displaystyle \scriptstyle \partial \Omega } {\displaystyle \mathbf {T} \cdot {\mathrm {d} }^{3}{\boldsymbol {\Sigma }}}
{\displaystyle =0}​​​​​​​

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

{\displaystyle {\overset {\frown }{AB}}} 

Triple dot \dddot[edit]

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

{\displaystyle {\overset {...}{x}}} .

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

{\displaystyle q\!\!\!{\frac {}{\ }},\quad \lambda \!\!\!^{{}^{\underline {\ \ }}}} 

Formatting in \text[edit]

Formatting in \text is not supported. In other words, you can't use:

\text{\textsf{textual description of a variable}}

but have to use:

\mathsf{textual\ description\ of\ a\ variable}

More specifically, in Mathoid's MathJax, no processing is done to the contents of \text at all. The texvcjs component blocks the use of macros, but another way this behavior leaks through is in the processing of quotation marks, where the Unicode version must be used instead of `:

\text{`failed ``ascii'' quotes'},\ \text{‘okay “unicode” quotes’}

{\displaystyle {\text{`failed ``ascii'' quotes'}},\ {\text{‘okay “unicode” quotes’}}} 

It is currently impossible to get straight (typewriter) quotes in MathJax.

Automatic line-breaking[edit]

The current image-based implementation precludes automatic line-breaking of inline formulae after binary operators and "=" as seen in TeX. The only workaround is to not write long formulae inline.

Readers wishing to enable automatic line-breaking can try to have the browser render the MathML itself or to use an alternate in-browser renderer.

Syntax to avoid[edit]

Unicode characters[edit]

Tracked in Phabricator
Task T50032

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 become possible to use these characters.

Unicode is currently possible in \text{} due to Wikipedia's switch to Mathoid (server-side MathJax in SVG/PNG mode). However, Unicode text in math mode is still unavailable due to texvcjs considering it invalid.

Deprecated syntax[edit]

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

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 syntaxSuggested replacementComment
$\$redefinition would involve changing the character code
%\%redefinition would involve changing the character code
\or\lorsee [1]; causes teubner to fail
\and\landcauses normal align environment to fail
\pagecolorremovenot needed and not working anymore, done manually
\part\partialacceptable if the document doesn't use sectioning with \part.
\ang\anglethis only conflicts with siunitx package.
\C\Complexconflicts 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]

Shortcut

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 <math chem>\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.

Wikipedia:Manual of Style/Chemistry advises avoiding the <math>/<chem> markup method when possible.

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 issues 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>

{\displaystyle {\ce {pIC_{50}}}=-\log _{10}{\ce {(IC_{50})}}} 

Molecular and condensed formula[edit]

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

{\displaystyle {\ce {H2O}}} 

<chem>Sb2O3</chem>

{\displaystyle {\ce {Sb2O3}}} 

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

{\displaystyle {\ce {(NH4)2S}}} 

showshowshow

Bonds[edit]

mhchemEquivalent {{chem}} and HTML{{chem2}}
MarkupRenders as
<chem>C6H5-CHO</chem>

{\displaystyle {\ce {C6H5-CHO}}} 

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

{\displaystyle {\ce {A-B=C#D}}} 

showshow

Charges[edit]

mhchem{{chem}}{{chem2}}Equivalent HTML
MarkupRenders as
<chem>H+</chem>

{\displaystyle {\ce {H+}}} 

<chem>NO3-</chem>

{\displaystyle {\ce {NO3-}}} 

<chem>CrO4^2-</chem>

{\displaystyle {\ce {CrO4^2-}}} 

<chem>AgCl2-</chem>

{\displaystyle {\ce {AgCl2-}}} 

<chem>[AgCl2]-</chem>

{\displaystyle {\ce {[AgCl2]-}}} 

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

{\displaystyle {\ce {Y^99+}}} 
{\displaystyle {\ce {Y^{99+}}}}

showshowshow

Addition compounds and stoichiometric numbers[edit]

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

{\displaystyle {\ce {MgSO4.7H2O}}} 

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

{\displaystyle {\ce {KCr(SO4)2*12H2O}}} 

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

{\displaystyle {\ce {CaSO4.1/2H2O + 1\!1/2 H2O -> CaSO4.2H2O}}} 

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

{\displaystyle {\ce {25/2 O2 + C8H18 -> 8 CO2 + 9 H2O}}} 

showshow

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 as25 O2 + 2 C8H18 → 16 CO2 + 18 H2O
{{chem2}}
Markup
{{chem2|25 [[oxygen|O2]] + 2 [[octane|C8H18]] -> 16 [[Carbon dioxide|CO2]] + 18 [[water|H2O]]}}
Renders as25 O2 + 2 C8H18 → 16 CO2 + 18 H2O

(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{\displaystyle {\ce {{C_{\mathit {x}}H_{\mathit {y}}}+{\mathit {z}}O2->{{\mathit {x}}CO2}+{\frac {\mathit {y}}{2}}H2O}}} 
{{chem}}
Markup
{{chem|C|''x''|H|''y''}} + ''z''{{chem|O|2}} → ''x''{{chem|C|O|2}} + {{frac|''y''|2}}{{chem|H|2|O}}
Renders asC
xH
y + zO
2 → xCO
2 + y⁄2H
2O

Oxidation states[edit]

mhchem
Markup
<chem>Fe^{II}Fe^{III}2O4</chem>
Renders as{\displaystyle {\ce {Fe^{II}Fe^{III}2O4}}} 
{{chem}} with <sup>...</sup>
Markup
{{chem|Fe|<sup>II</sup>|Fe|<sup>III</sup>|2|O|4}}
Renders asFeIIFeIII
2O
4
{{chem2}}
Markup
{{chem2|Fe^{II}Fe^{III}2O4}}
Renders asFeII
FeIII

2O
4

Greek characters[edit]

mhchemEquivalent {{chem}} and HTML{{chem2}}
MarkupRenders as
<chem>\mu-Cl</chem>

{\displaystyle {\ce {\mu-Cl}}} 

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

{\displaystyle {\ce {[Fe(\eta^5-C5H5)2]}}} 

showshow

Isotopes[edit]

mhchemEquivalent {{chem}} and HTML
MarkupRenders as
<chem>^{227}_{90}Th+</chem>

{\displaystyle {\ce {^{227}_{90}Th+}}} 

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

{\displaystyle {\ce {^0_{-1}n-}}} 

show

States[edit]

States subscripting is not IUPAC recommendation.

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

{\displaystyle {\ce {H2_{(aq)}}}} 

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

{\displaystyle {\ce {CO3^{2-}(aq)}}} 

show

Precipitate[edit]

mhchem
Markup
<chem>Ba^2+ + SO4^{2-} -> BaSO4(v)</chem>
Renders as{\displaystyle {\ce {Ba^2+ + SO4^{2-}-> BaSO4(v)}}} 
{{chem}}
Markup
{{chem|Ba|2+}} + {{chem|S|O|4|2-}} → {{chem|Ba|S|O|4}}↓
Renders asBa2+
 + SO2−
4 → BaSO
4↓
{{chem2}}
Markup
{{chem2|Ba(2+) + SO4(2-) -> BaSO4↓}}
Renders asBa2+ + 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 asBa2+ + SO42− → BaSO4↓

Reaction arrows[edit]

MarkupRenders as
<chem>A ->B</chem>

{\displaystyle {\ce {A -> B}}} 

<chem>A <- B</chem>

{\displaystyle {\ce {A <- B}}} 

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

{\displaystyle {\ce {A <=> B}}} 

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

{\displaystyle {\ce {A <=>> B}}} 

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

{\displaystyle {\ce {A <<=> B}}} 

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

{\displaystyle {\ce {A->[{} \atop x]B}}} 

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

{\displaystyle {\ce {A->[{\text{text above}}][{\text{text below}}]B}}} 

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

{\displaystyle {\ce {A->[{} \atop {\ce {+H2O}}]B}}} 

Comparison of arrow symbols[edit]

MarkupRenders as
<math>\rightarrow</math>

{\displaystyle \rightarrow } 

<math>\rightleftarrows</math>

{\displaystyle \rightleftarrows } 

<math>\rightleftharpoons</math>

{\displaystyle \rightleftharpoons } 

<math>\leftrightarrow</math>

{\displaystyle \leftrightarrow } 

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

{\displaystyle \longrightarrow } 
{\displaystyle {\ce {->}}}

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

{\displaystyle \rightleftharpoons } 
{\displaystyle {\ce {<=>}}}

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

{\displaystyle \longleftrightarrow } 
{\displaystyle {\ce {<->}}}

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{maghemite}}}\\
\underbrace{\ce{2Fe3O4}}_{\text{magnetite}} + \ce{1/2 O2 ->}\ &{\color{Red}\underbrace{\ce{3(\alpha{-}Fe2O3)}}_{\text{hematite}}}
\end{align}</math>

{\displaystyle {\begin{aligned}\overbrace {{\ce {2Fe3O4}}} ^{\text{magnetite}}+{\ce {1/2 O2 ->}}\ &{\color {Brown}\overbrace {{\ce {3(\lambda{-}Fe2O3)}}} ^{\text{maghemite}}}\\\underbrace {{\ce {2Fe3O4}}} _{\text{magnetite}}+{\ce {1/2 O2 ->}}\ &{\color {BrickRed}\underbrace {{\ce {3(\alpha{-}Fe2O3)}}} _{\text{hematite}}}\end{aligned}}} 

To align the equations or color them, use <math chem> and \ce.

Commutative diagrams[edit]

Quadratic formula[edit]

Markup
<math>x=\frac{-b\pm\sqrt{b^2-4ac}}{2a}</math>
Renders as{\displaystyle x={\frac {-b\pm {\sqrt {b^{2}-4ac}}}{2a}}} 

Tall parentheses and fractions[edit]

Markup
<math>2 = \left( \frac{\left(3-x\right) \times 2}{3-x} \right)</math>
Renders as{\displaystyle 2=\left({\frac {\left(3-x\right)\times 2}{3-x}}\right)} 
Markup
<math>S_{\text{new}} = S_{\text{old}} - \frac{ \left( 5-T \right) ^2} {2}</math>
Renders as{\displaystyle S_{\text{new}}=S_{\text{old}}-{\frac {\left(5-T\right)^{2}}{2}}} 

Integrals[edit]

Markup
<math>\int_a^x \int_a^s f(y)\,dy\,ds = \int_a^x f(y)(x-y)\,dy</math>
Renders as{\displaystyle \int _{a}^{x}\int _{a}^{s}f(y)\,dy\,ds=\int _{a}^{x}f(y)(x-y)\,dy} 
Markup
<math>\int_e^{\infty}\frac {1}{t(\ln t)^2}dt = \left. \frac{-1}{\ln t} \right\vert_e^\infty = 1</math>
Renders as{\displaystyle \int _{e}^{\infty }{\frac {1}{t(\ln t)^{2}}}dt=\left.{\frac {-1}{\ln t}}\right\vert _{e}^{\infty }=1} 

Matrices and determinants[edit]

Markup
<math>\det(\mathsf{A}-\lambda\mathsf{I}) = 0</math>
Renders as{\displaystyle \det({\mathsf {A}}-\lambda {\mathsf {I}})=0} 

Summation[edit]

Markup
<math>\sum_{i=0}^{n-1} i</math>
Renders as{\displaystyle \sum _{i=0}^{n-1}i} 
Markup
<math>\sum_{m=1}^\infty\sum_{n=1}^\infty\frac{m^2 n}{3^m\left(m 3^n + n 3^m\right)}</math>
Renders as{\displaystyle \sum _{m=1}^{\infty }\sum _{n=1}^{\infty }{\frac {m^{2}n}{3^{m}\left(m3^{n}+n3^{m}\right)}}} 

Differential equation[edit]

Markup
<math>u'' + p(x)u' + q(x)u=f(x),\quad x>a</math>
Renders as{\displaystyle u''+p(x)u'+q(x)u=f(x),\quad x>a} 

Complex numbers[edit]

Markup
 
<math>|\bar{z}| = |z|,
|(\bar{z})^n| = |z|^n,
\arg(z^n) = n \arg(z)</math>
Renders as{\displaystyle |{\bar {z}}|=|z|,|({\bar {z}})^{n}|=|z|^{n},\arg(z^{n})=n\arg(z)} 

Limits[edit]

Markup
<math>\lim_{z\to z_0} f(z)=f(z_0)</math>
Renders as{\displaystyle \lim _{z\to z_{0}}f(z)=f(z_{0})} 

Integral equation[edit]

Markup
 
<math>\phi_n(\kappa) =
\frac{1}{4\pi^2\kappa^2} \int_0^\infty
\frac{\sin(\kappa R)}{\kappa R}
\frac{\partial}{\partial R}
\left [ R^2\frac{\partial D_n(R)}{\partial R} \right ] \,dR</math>
Renders as{\displaystyle \phi _{n}(\kappa )={\frac {1}{4\pi ^{2}\kappa ^{2}}}\int _{0}^{\infty }{\frac {\sin(\kappa R)}{\kappa R}}{\frac {\partial }{\partial R}}\left[R^{2}{\frac {\partial D_{n}(R)}{\partial R}}\right]\,dR} 

Example[edit]

Markup
 
<math>\phi_n(\kappa) =
0.033C_n^2\kappa^{-11/3},\quad
\frac{1}{L_0}\ll\kappa\ll\frac{1}{l_0}</math>
Renders as{\displaystyle \phi _{n}(\kappa )=0.033C_{n}^{2}\kappa ^{-11/3},\quad {\frac {1}{L_{0}}}\ll \kappa \ll {\frac {1}{l_{0}}}} 

Continuation and cases[edit]

Markup
 
<math>f(x) =
  \begin{cases}
    1 & -1 \le x < 0 \\
    \frac{1}{2} & x = 0 \\
    1 - x^2 & \text{otherwise}
  \end{cases}</math>
Renders as{\displaystyle f(x)={\begin{cases}1&-1\leq x<0\\{\frac {1}{2}}&x=0\\1-x^{2}&{\text{otherwise}}\end{cases}}} 

Prefixed subscript[edit]

Markup
 
 <math>{}_pF_q(a_1,\dots,a_p;c_1,\dots,c_q;z)
= \sum_{n=0}^\infty
\frac{(a_1)_n\cdots(a_p)_n}{(c_1)_n\cdots(c_q)_n}
\frac{z^n}{n!}</math>
Renders as{\displaystyle {}_{p}F_{q}(a_{1},\dots ,a_{p};c_{1},\dots ,c_{q};z)=\sum _{n=0}^{\infty }{\frac {(a_{1})_{n}\cdots (a_{p})_{n}}{(c_{1})_{n}\cdots (c_{q})_{n}}}{\frac {z^{n}}{n!}}} 

Fraction and small fraction[edit]

Markup
<math>\frac{a}{b}\ \tfrac{a}{b}</math>
Renders as{\displaystyle {\frac {a}{b}}\ {\tfrac {a}{b}}} 

Area of a quadrilateral[edit]

Markup
<math>S=dD\sin\alpha</math>
Renders as{\displaystyle S=dD\sin \alpha } 

Volume of a sphere-stand[edit]

Markup
<math> V = \frac{1}{6} \pi h \left [ 3 \left ( r_1^2 + r_2^2 \right ) + h^2 \right ] </math>
Renders as{\displaystyle V={\frac {1}{6}}\pi h\left[3\left(r_{1}^{2}+r_{2}^{2}\right)+h^{2}\right]} 

Multiple equations[edit]

The altered newline code \\[0.6ex] below adds a vertical space between the two lines of length equal to {\displaystyle 0.6}  times the height of a single 'x' character.

Markup
 
<math>\begin{align}
u & = \tfrac{1}{\sqrt{2}}(x+y) \qquad & x &= \tfrac{1}{\sqrt{2}}(u+v) \\[0.6ex]
v & = \tfrac{1}{\sqrt{2}}(x-y) \qquad & y &= \tfrac{1}{\sqrt{2}}(u-v)
\end{align}</math>
Renders as{\displaystyle {\begin{aligned}u&={\tfrac {1}{\sqrt {2}}}(x+y)\qquad &x&={\tfrac {1}{\sqrt {2}}}(u+v)\\[0.6ex]v&={\tfrac {1}{\sqrt {2}}}(x-y)\qquad &y&={\tfrac {1}{\sqrt {2}}}(u-v)\end{aligned}}} 

See also[edit]

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

大怀特

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值