From Wikibooks, open books for an open world
Jump to navigation Jump to search

MediaWiki uses a subset of AMS-LaTeX markup, a superset of LaTeX markup which is in turn a superset of TeX markup, for mathematical formulae. It generates either PNG images or simple HTML markup, depending on user preferences and the complexity of the expression. In the future, as more browsers become smarter, it will be able to generate enhanced HTML or even MathML in many cases.



Math markup goes inside <math> ... </math>. The edit toolbar has a button for this.

Similar to HTML, in TeX extra spaces and newlines are ignored.

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.


The PNG colors, as well as 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.

The alt text of the PNG images, which is displayed to visually impaired and other readers who cannot see the images, 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 <math alt="square root of pi">\sqrt{\pi}</math> whose alt text is "Square root of 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. For example, <math>\text{abc}</math> gives <math>\text{abc}</math>. This does not work for special characters; they are ignored unless the whole <math> expression is rendered in HTML:

  • <math>\text {abcdefghijklmnopqrstuvwxyzàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ}</math>
  • <math>\text {abcdefghijklmnopqrstuvwxyzàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ}\,\!</math>


  • <math>\text {abcdefghijklmnopqrstuvwxyzàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ}</math>
  • <math>\text {abcdefghijklmnopqrstuvwxyzàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ}\,\!</math>


Before introducing TeX markup for producing special characters, it should be noted that, as this comparison table shows, sometimes similar results can be achieved in HTML.

TeX syntax (forcing PNG) TeX rendering HTML syntax HTML rendering
<math>\alpha\,\!</math> <math>\alpha\,\!</math> {{math|<var>&alpha;</var>}} α
<math>\sqrt{2}</math> <math>\sqrt{2}</math> {{math|{{radical|2}}}} 2
<math>\sqrt{1-e^2}</math> <math>\sqrt{1-e^2}\!</math> {{math|{{radical|1 − ''e''²}}}} 1 − e²

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

&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; &divide; &part; &prime; &Prime; &nabla; &permil; &deg; &there4; &Oslash; &oslash; &isin; &notin; &cap; &cup; &sub; &sup; &sube; &supe; &not; &and; &or; &exist; &forall; &rArr; &hArr; &rarr; &harr; &uarr; &alefsym; - &ndash; &mdash;

∫ ∑ ∏ √ − ± ∞
≈ ∝ = ≡ ≠ ≤ ≥
× · ÷ ∂ ′ ″
∇ ‰ ° ∴ Ø ø
∈ ∉ ∩ ∪ ⊂ ⊃ ⊆ ⊇
¬ ∧ ∨ ∃ ∀
⇒ ⇔ → ↔ ↑
ℵ - – —

Both HTML and TeX have advantages in some situations.

Pros of HTML

  1. Formulas in HTML behave more like regular text. In-line HTML formulas always align properly with the rest of the HTML text and, to some degree, can be cut-and-pasted. The formula's background and font size match the rest of HTML contents and the appearance respects CSS and browser settings while the typeface is conveniently altered to help you identify formulas. The display of a formula entered using mathematical templates can be conveniently altered by modifying the templates involved; this modification will affect all relevant formulas without any manual intervention. Formulas typeset with HTML code will be accessible to client-side script links (a.k.a. scriptlets).
  2. Pages using HTML code for formulas will load faster.
  3. The HTML code, if entered diligently, will contain all semantic information to transform the equation back to TeX or any other code as needed. It can even contain differences TeX does not normally catch, e.g. {{math|''i''}} for the imaginary unit and {{math|<var>i</var>}} for an arbitrary index variable.

Pros of TeX

  1. TeX is semantically more precise than HTML.
    1. In TeX, "<math>x</math>" means "mathematical variable <math>x</math>", whereas in HTML "x" is generic and somewhat ambiguous.
    2. On the other hand, if you encode the same formula as "{{math|<var>x</var>}}", you get the same visual result x and no information is lost. This requires diligence and more typing that could make the formula harder to understand as you type it. However, since there are far more readers than editors, this effort is worth considering.
    One consequence of this is that TeX code can be transformed into HTML, but not vice-versa. This means that on the server side we can always transform a formula, based on its complexity and location within the text, user preferences, type of browser, etc. Therefore, where possible, all the benefits of HTML can be retained, together with the benefits of TeX. It is true that the current situation is not ideal, but that is not a good reason to drop information/contents. Another consequence of this is that TeX can be converted to MathML for browsers which support it, thus keeping its semantics and allowing the rendering to be better suited for the reader's graphic device.
  2. TeX is the preferred text formatting language of most professional mathematicians, scientists, and engineers. It is easier to persuade them to contribute if they can write in TeX. TeX has been specifically designed for typesetting formulas, so input is easier and more natural if you are accustomed to it, and output is more aesthetically pleasing if you focus on a single formula rather than on the whole containing page. Once a formula is done correctly in TeX, it will render reliably, whereas the success of HTML formulas is somewhat dependent on browsers or versions of browsers. Another aspect of this dependency is fonts: the serif font used for rendering formulas is browser-dependent and it may be missing some important glyphs. While browsers are generally able to substitute a matching glyph from a different font family, this may not work for combined glyphs (compare ‘  ’ and ‘  ’).[1]
  3. TeX formulas, by default, render larger and are usually more readable than HTML formula and are not dependent on client-side browser resources, such as fonts, and so the results are more reliably WYSIWYG.
  4. While TeX does not assist you in finding HTML codes or Unicode values (which you can obtain by viewing the HTML source in your browser), cutting and pasting from a TeX PNG in Wikipedia into simple text will return the LaTeX source.

In some cases it may be the best choice to use neither TeX nor the html-substitutes, but instead the simple ASCII symbols of a standard keyboard (see below, for an example).

Functions, symbols, special characters


\dot{a}, \ddot{a}, \acute{a}, \grave{a} <math>\dot{a}, \ddot{a}, \acute{a}, \grave{a} \!</math>
\check{a}, \breve{a}, \tilde{a}, \bar{a} <math>\check{a}, \breve{a}, \tilde{a}, \bar{a} \!</math>
\hat{a}, \widehat{a}, \vec{a} <math>\hat{a}, \widehat{a}, \vec{a} \!</math>

Standard functions

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


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


\Pr j, \hom l, \lVert z \rVert, \arg z <math>\Pr j, \hom l, \lVert z \rVert, \arg z \!</math>

Differentials and derivatives

dt, \operatorname{d}t, \partial t, \nabla\psi <math>dt, \operatorname{d}t, \partial t, \nabla\psi\!</math>
\operatorname{d}y/\operatorname{d}x, {\operatorname{d}y\over\operatorname{d}x}, {\partial^2\over\partial x_1\partial x_2}y <math>\operatorname{d}y/\operatorname{d}x,{\operatorname{d}y\over\operatorname{d}x}, {\partial^2\over\partial x_1\partial x_2}y \!</math>
\prime, \backprime, f^\prime, f', f'', f^{(3)}, \dot y, \ddot y <math>\prime, \backprime, f^\prime, f', f, f^{(3)} \!, \dot y, \ddot y</math>

Letter-like symbols or constants

\infty, \alef, \complement, \backepsilon, \eth, \Finv, \hbar <math>\infty, \alef, \complement, \backepsilon, \eth, \Finv, \hbar \!</math>
\Im, \imath, \jmath, \Bbbk, \ell, \mho, \wp, \Re, \circledS <math>\Im, \imath, \jmath, \Bbbk, \ell, \mho, \wp, \Re, \circledS \!</math>

Modular arithmetic

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


\surd, \sqrt{2}, \sqrt[n]{}, \sqrt[3]{x^3+y^3 \over 2} <math>\surd, \sqrt{2}, \sqrt[n]{}, \sqrt[3]{x^3+y^3 \over 2} \!</math>


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


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


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


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


\forall, \exists, \nexists <math>\forall, \exists, \nexists \!</math>
\therefore, \because, \And <math>\therefore, \because, \And \!</math>
\or \lor \vee, \curlyvee, \bigvee <math>\or \lor \vee, \curlyvee, \bigvee \!</math>
\and \land \wedge, \curlywedge, \bigwedge <math>\and \land \wedge, \curlywedge, \bigwedge \!</math>
\bar{q}, \overline{q}, \lnot \neg, \not\operatorname{R}, \bot, \top <math>\bar{q}, \overline{q}, \lnot \neg, \not\operatorname{R}, \bot, \top\!</math>
\vdash \dashv, \vDash, \Vdash, \models <math>\vdash \dashv, \vDash, \Vdash, \models \!</math>
\Vvdash \nvdash \nVdash \nvDash \nVDash <math>\Vvdash \nvdash \nVdash \nvDash \nVDash \!</math>
\ulcorner \urcorner \llcorner \lrcorner <math>\ulcorner \urcorner \llcorner \lrcorner \,</math>


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


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

Unsorted (new stuff)

\diagup \diagdown \centerdot \ltimes \rtimes \leftthreetimes \rightthreetimes <math>\diagup \diagdown \centerdot \ltimes \rtimes \leftthreetimes \rightthreetimes \!</math>
\eqcirc \circeq \triangleq \bumpeq \Bumpeq \doteqdot \risingdotseq \fallingdotseq <math>\eqcirc \circeq \triangleq \bumpeq \Bumpeq \doteqdot \risingdotseq \fallingdotseq \!</math>
\intercal \barwedge \veebar \doublebarwedge \between \pitchfork <math>\intercal \barwedge \veebar \doublebarwedge \between \pitchfork \!</math>
\vartriangleleft \ntriangleleft \vartriangleright \ntriangleright <math>\vartriangleleft \ntriangleleft \vartriangleright \ntriangleright \!</math>
\trianglelefteq \ntrianglelefteq \trianglerighteq \ntrianglerighteq <math>\trianglelefteq \ntrianglelefteq \trianglerighteq \ntrianglerighteq \!</math>
\Coppa\coppa\varcoppa\Digamma\Koppa\koppa\Sampi\sampi\Stigma\stigma\varstigma <math>\Coppa\coppa\varcoppa\Digamma\Koppa\koppa\Sampi\sampi\Stigma\stigma\varstigma</math>

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

Larger expressions

Subscripts, superscripts, integrals

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

Fractions, matrices, multilines

Feature Syntax How it looks rendered
Fractions \frac{2}{4}=0.5 or {2 \over 4}=0.5 <math>\frac{2}{4}=0.5</math>
Small fractions \tfrac{2}{4} = 0.5 <math>\tfrac{2}{4} = 0.5</math>
Large (normal) fractions \dfrac{2}{4} = 0.5 \qquad \dfrac{2}{c + \dfrac{2}{d + \dfrac{2}{4}}} = a <math>\dfrac{2}{4} = 0.5 \qquad \dfrac{2}{c + \dfrac{2}{d + \dfrac{2}{4}}} = a</math>
Large (nested) fractions \cfrac{2}{c + \cfrac{2}{d + \cfrac{2}{4}}} = a <math>\cfrac{2}{c + \cfrac{2}{d + \cfrac{2}{4}}} = a</math>
Binomial coefficients \binom{n}{k} <math>\binom{n}{k}</math>
Small binomial coefficients \tbinom{n}{k} <math>\tbinom{n}{k}</math>
Large (normal) binomial coefficients \dbinom{n}{k} <math>\dbinom{n}{k}</math>
 x & y \\
 z & v
<math>\begin{matrix} x & y \\ z & v \end{matrix}</math>
 x & y \\
 z & v
<math>\begin{vmatrix} x & y \\ z & v \end{vmatrix}</math>
 x & y \\
 z & v
<math>\begin{Vmatrix} x & y \\ z & v \end{Vmatrix}</math>
 0 & \cdots & 0 \\
 \vdots & \ddots & \vdots \\
 0 & \cdots & 0
<math>\begin{bmatrix} 0 & \cdots & 0 \\ \vdots

& \ddots & \vdots \\ 0 & \cdots &

0\end{bmatrix} </math>
 x & y \\
 z & v
<math>\begin{Bmatrix} x & y \\ z & v \end{Bmatrix}</math>
 x & y \\
 z & v
<math>\begin{pmatrix} x & y \\ z & v \end{pmatrix}</math>
\bigl( \begin{smallmatrix}
 a&b\\ c&d
\end{smallmatrix} \bigr)

\bigl( \begin{smallmatrix}

a&b\\ c&d

\end{smallmatrix} \bigr)

Case distinctions
f(n) =
 n/2, & \text{if }n\text{ is even} \\
 3n+1, & \text{if }n\text{ is odd}
<math>f(n) =


n/2, & \text{if }n\text{ is even} \\
3n+1, & \text{if }n\text{ is odd}
\end{cases} </math>
Multiline equations
 f(x) & = (a+b)^2 \\
 & = a^2+2ab+b^2 \\


f(x) & = (a+b)^2 \\
& = a^2+2ab+b^2 \\


 f(x) & = (a-b)^2 \\
 & = a^2-2ab+b^2 \\


f(x) & = (a-b)^2 \\
& = a^2-2ab+b^2 \\


Multiline equations (must define number of colums used ({lcr}) (should not be used unless needed)
 z & = & a \\
 f(x,y,z) & = & x + y + z
z & = & a \\
f(x,y,z) & = & x + y + z
Multiline equations (more)
 z & = & a \\
 f(x,y,z) & = & x + y + z
z & = & a \\
f(x,y,z) & = & x + y + z
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>

<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
 3x + 5y + z \\
 7x - 2y + 4z \\
 -6x + 3y + 2z
<math>\begin{cases} 3x + 5y + z \\ 7x - 2y + 4z \\ -6x + 3y + 2z \end{cases}</math>
\begin{array}{|c|c||c|} a & b & S \\

\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

Feature Syntax How it looks rendered
Bad ( \frac{1}{2} ) <math>( \frac{1}{2} )</math>
Good \left ( \frac{1}{2} \right ) <math>\left ( \frac{1}{2} \right )</math>

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

Feature Syntax How it looks rendered
Parentheses \left ( \frac{a}{b} \right ) <math>\left ( \frac{a}{b} \right )</math>
Brackets \left [ \frac{a}{b} \right ] \quad \left \lbrack \frac{a}{b} \right \rbrack <math>\left [ \frac{a}{b} \right ] \quad \left \lbrack \frac{a}{b} \right \rbrack</math>
Braces \left \{ \frac{a}{b} \right \} \quad \left \lbrace \frac{a}{b} \right \rbrace <math>\left \{ \frac{a}{b} \right \} \quad \left \lbrace \frac{a}{b} \right \rbrace</math>
Angle brackets \left \langle \frac{a}{b} \right \rangle <math>\left \langle \frac{a}{b} \right \rangle</math>
Bars and double bars \left | \frac{a}{b} \right \vert \left \Vert \frac{c}{d} \right \| \frac{a}{b} \right \vert \left \Vert \frac{c}{d} \right \|</math>
Floor and ceiling functions: \left \lfloor \frac{a}{b} \right \rfloor \left \lceil \frac{c}{d} \right \rceil <math>\left \lfloor \frac{a}{b} \right \rfloor \left \lceil \frac{c}{d} \right \rceil</math>
Slashes and backslashes \left / \frac{a}{b} \right \backslash <math>\left / \frac{a}{b} \right \backslash</math>
Up, down and up-down arrows \left \uparrow \frac{a}{b} \right \downarrow \quad \left \Uparrow \frac{a}{b} \right \Downarrow \quad \left \updownarrow \frac{a}{b} \right \Updownarrow <math>\left \uparrow \frac{a}{b} \right \downarrow \quad \left \Uparrow \frac{a}{b} \right \Downarrow \quad \left \updownarrow \frac{a}{b} \right \Updownarrow</math>
Delimiters can be mixed,
as long as \left and \right match
\left [ 0,1 \right )
\left \langle \psi \right |
Use \left. and \right. if you don't
want a delimiter to appear:
\left . \frac{A}{B} \right \} \to X <math>\left . \frac{A}{B} \right \} \to X</math>
Size of the delimiters \big( \Big( \bigg( \Bigg( \dots \Bigg] \bigg] \Big] \big]/ <math>\big( \Big( \bigg( \Bigg( \dots \Bigg] \bigg] \Big] \big]</math>
\big\{ \Big\{ \bigg\{ \Bigg\{ \dots \Bigg\rangle \bigg\rangle \Big\rangle \big\rangle <math>\big\{ \Big\{ \bigg\{ \Bigg\{ \dots \Bigg\rangle \bigg\rangle \Big\rangle \big\rangle</math>
\big\| \Big\| \bigg\| \Bigg\| \dots \Bigg| \bigg| \Big| \big| \Big\| \bigg\| \Bigg\| \dots \Bigg| \bigg| \Big| \big|</math>
\big\lfloor \Big\lfloor \bigg\lfloor \Bigg\lfloor \dots \Bigg\rceil \bigg\rceil \Big\rceil \big\rceil <math>\big\lfloor \Big\lfloor \bigg\lfloor \Bigg\lfloor \dots \Bigg\rceil \bigg\rceil \Big\rceil \big\rceil</math>
\big\uparrow \Big\uparrow \bigg\uparrow \Bigg\uparrow \dots \Bigg\Downarrow \bigg\Downarrow \Big\Downarrow \big\Downarrow <math>\big\uparrow \Big\uparrow \bigg\uparrow \Bigg\uparrow \dots \Bigg\Downarrow \bigg\Downarrow \Big\Downarrow \big\Downarrow</math>
\big\updownarrow \Big\updownarrow \bigg\updownarrow \Bigg\updownarrow \dots \Bigg\Updownarrow \bigg\Updownarrow \Big\Updownarrow \big\Updownarrow <math>\big\updownarrow \Big\updownarrow \bigg\updownarrow \Bigg\updownarrow \dots \Bigg\Updownarrow \bigg\Updownarrow \Big\Updownarrow \big\Updownarrow</math>
\big / \Big / \bigg / \Bigg / \dots \Bigg\backslash \bigg\backslash \Big\backslash \big\backslash <math>\big / \Big / \bigg / \Bigg / \dots \Bigg\backslash \bigg\backslash \Big\backslash \big\backslash</math>

Alphabets and typefaces

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 <math>\Alpha \Beta \Gamma \Delta \Epsilon \Zeta \!</math>
\Eta \Theta \Iota \Kappa \Lambda \Mu <math>\Eta \Theta \Iota \Kappa \Lambda \Mu \!</math>
\Nu \Xi \Pi \Rho \Sigma \Tau <math>\Nu \Xi \Pi \Rho \Sigma \Tau \!</math>
\Upsilon \Phi \Chi \Psi \Omega <math>\Upsilon \Phi \Chi \Psi \Omega \!</math>
\alpha \beta \gamma \delta \epsilon \zeta <math>\alpha \beta \gamma \delta \epsilon \zeta \!</math>
\eta \theta \iota \kappa \lambda \mu <math>\eta \theta \iota \kappa \lambda \mu \!</math>
\nu \xi \pi \rho \sigma \tau <math>\nu \xi \pi \rho \sigma \tau \!</math>
\upsilon \phi \chi \psi \omega <math>\upsilon \phi \chi \psi \omega \!</math>
\varepsilon \digamma \varkappa \varpi <math>\varepsilon \digamma \varkappa \varpi \!</math>
\varrho \varsigma \vartheta \varphi <math>\varrho \varsigma \vartheta \varphi \!</math>
Blackboard bold/scripts
\mathbb{A} \mathbb{B} \mathbb{C} \mathbb{D} \mathbb{E} \mathbb{F} \mathbb{G} <math>\mathbb{A} \mathbb{B} \mathbb{C} \mathbb{D} \mathbb{E} \mathbb{F} \mathbb{G} \!</math>
\mathbb{H} \mathbb{I} \mathbb{J} \mathbb{K} \mathbb{L} \mathbb{M} <math>\mathbb{H} \mathbb{I} \mathbb{J} \mathbb{K} \mathbb{L} \mathbb{M} \!</math>
\mathbb{N} \mathbb{O} \mathbb{P} \mathbb{Q} \mathbb{R} \mathbb{S} \mathbb{T} <math>\mathbb{N} \mathbb{O} \mathbb{P} \mathbb{Q} \mathbb{R} \mathbb{S} \mathbb{T} \!</math>
\mathbb{U} \mathbb{V} \mathbb{W} \mathbb{X} \mathbb{Y} \mathbb{Z} <math>\mathbb{U} \mathbb{V} \mathbb{W} \mathbb{X} \mathbb{Y} \mathbb{Z} \!</math>
Boldface (vectors)
\mathbf{A} \mathbf{B} \mathbf{C} \mathbf{D} \mathbf{E} \mathbf{F} \mathbf{G} <math>\mathbf{A} \mathbf{B} \mathbf{C} \mathbf{D} \mathbf{E} \mathbf{F} \mathbf{G} \!</math>
\mathbf{H} \mathbf{I} \mathbf{J} \mathbf{K} \mathbf{L} \mathbf{M} <math>\mathbf{H} \mathbf{I} \mathbf{J} \mathbf{K} \mathbf{L} \mathbf{M} \!</math>
\mathbf{N} \mathbf{O} \mathbf{P} \mathbf{Q} \mathbf{R} \mathbf{S} \mathbf{T} <math>\mathbf{N} \mathbf{O} \mathbf{P} \mathbf{Q} \mathbf{R} \mathbf{S} \mathbf{T} \!</math>
\mathbf{U} \mathbf{V} \mathbf{W} \mathbf{X} \mathbf{Y} \mathbf{Z} <math>\mathbf{U} \mathbf{V} \mathbf{W} \mathbf{X} \mathbf{Y} \mathbf{Z} \!</math>
\mathbf{a} \mathbf{b} \mathbf{c} \mathbf{d} \mathbf{e} \mathbf{f} \mathbf{g} <math>\mathbf{a} \mathbf{b} \mathbf{c} \mathbf{d} \mathbf{e} \mathbf{f} \mathbf{g} \!</math>
\mathbf{h} \mathbf{i} \mathbf{j} \mathbf{k} \mathbf{l} \mathbf{m} <math>\mathbf{h} \mathbf{i} \mathbf{j} \mathbf{k} \mathbf{l} \mathbf{m} \!</math>
\mathbf{n} \mathbf{o} \mathbf{p} \mathbf{q} \mathbf{r} \mathbf{s} \mathbf{t} <math>\mathbf{n} \mathbf{o} \mathbf{p} \mathbf{q} \mathbf{r} \mathbf{s} \mathbf{t} \!</math>
\mathbf{u} \mathbf{v} \mathbf{w} \mathbf{x} \mathbf{y} \mathbf{z} <math>\mathbf{u} \mathbf{v} \mathbf{w} \mathbf{x} \mathbf{y} \mathbf{z} \!</math>
\mathbf{0} \mathbf{1} \mathbf{2} \mathbf{3} \mathbf{4} <math>\mathbf{0} \mathbf{1} \mathbf{2} \mathbf{3} \mathbf{4} \!</math>
\mathbf{5} \mathbf{6} \mathbf{7} \mathbf{8} \mathbf{9} <math>\mathbf{5} \mathbf{6} \mathbf{7} \mathbf{8} \mathbf{9} \!</math>
Boldface (Greek)
\boldsymbol{\Alpha} \boldsymbol{\Beta} \boldsymbol{\Gamma} \boldsymbol{\Delta} \boldsymbol{\Epsilon} \boldsymbol{\Zeta} <math>\boldsymbol{\Alpha} \boldsymbol{\Beta} \boldsymbol{\Gamma} \boldsymbol{\Delta} \boldsymbol{\Epsilon} \boldsymbol{\Zeta} \!</math>
\boldsymbol{\Eta} \boldsymbol{\Theta} \boldsymbol{\Iota} \boldsymbol{\Kappa} \boldsymbol{\Lambda} \boldsymbol{\Mu} <math>\boldsymbol{\Eta} \boldsymbol{\Theta} \boldsymbol{\Iota} \boldsymbol{\Kappa} \boldsymbol{\Lambda} \boldsymbol{\Mu} \!</math>
\boldsymbol{\Nu} \boldsymbol{\Xi} \boldsymbol{\Pi} \boldsymbol{\Rho} \boldsymbol{\Sigma} \boldsymbol{\Tau} <math>\boldsymbol{\Nu} \boldsymbol{\Xi} \boldsymbol{\Pi} \boldsymbol{\Rho} \boldsymbol{\Sigma} \boldsymbol{\Tau} \!</math>
\boldsymbol{\Upsilon} \boldsymbol{\Phi} \boldsymbol{\Chi} \boldsymbol{\Psi} \boldsymbol{\Omega} <math>\boldsymbol{\Upsilon} \boldsymbol{\Phi} \boldsymbol{\Chi} \boldsymbol{\Psi} \boldsymbol{\Omega} \!</math>
\boldsymbol{\alpha} \boldsymbol{\beta} \boldsymbol{\gamma} \boldsymbol{\delta} \boldsymbol{\epsilon} \boldsymbol{\zeta} <math>\boldsymbol{\alpha} \boldsymbol{\beta} \boldsymbol{\gamma} \boldsymbol{\delta} \boldsymbol{\epsilon} \boldsymbol{\zeta} \!</math>
\boldsymbol{\eta} \boldsymbol{\theta} \boldsymbol{\iota} \boldsymbol{\kappa} \boldsymbol{\lambda} \boldsymbol{\mu} <math>\boldsymbol{\eta} \boldsymbol{\theta} \boldsymbol{\iota} \boldsymbol{\kappa} \boldsymbol{\lambda} \boldsymbol{\mu} \!</math>
\boldsymbol{\nu} \boldsymbol{\xi} \boldsymbol{\pi} \boldsymbol{\rho} \boldsymbol{\sigma} \boldsymbol{\tau} <math>\boldsymbol{\nu} \boldsymbol{\xi} \boldsymbol{\pi} \boldsymbol{\rho} \boldsymbol{\sigma} \boldsymbol{\tau} \!</math>
\boldsymbol{\upsilon} \boldsymbol{\phi} \boldsymbol{\chi} \boldsymbol{\psi} \boldsymbol{\omega} <math>\boldsymbol{\upsilon} \boldsymbol{\phi} \boldsymbol{\chi} \boldsymbol{\psi} \boldsymbol{\omega} \!</math>
\boldsymbol{\varepsilon} \boldsymbol{\digamma} \boldsymbol{\varkappa} \boldsymbol{\varpi} <math>\boldsymbol{\varepsilon} \boldsymbol{\digamma} \boldsymbol{\varkappa} \boldsymbol{\varpi} \!</math>
\boldsymbol{\varrho} \boldsymbol{\varsigma} \boldsymbol{\vartheta} \boldsymbol{\varphi} <math>\boldsymbol{\varrho} \boldsymbol{\varsigma} \boldsymbol{\vartheta} \boldsymbol{\varphi} \!</math>
\mathit{A} \mathit{B} \mathit{C} \mathit{D} \mathit{E} \mathit{F} \mathit{G} <math>\mathit{A} \mathit{B} \mathit{C} \mathit{D} \mathit{E} \mathit{F} \mathit{G} \!</math>
\mathit{H} \mathit{I} \mathit{J} \mathit{K} \mathit{L} \mathit{M} <math>\mathit{H} \mathit{I} \mathit{J} \mathit{K} \mathit{L} \mathit{M} \!</math>
\mathit{N} \mathit{O} \mathit{P} \mathit{Q} \mathit{R} \mathit{S} \mathit{T} <math>\mathit{N} \mathit{O} \mathit{P} \mathit{Q} \mathit{R} \mathit{S} \mathit{T} \!</math>
\mathit{U} \mathit{V} \mathit{W} \mathit{X} \mathit{Y} \mathit{Z} <math>\mathit{U} \mathit{V} \mathit{W} \mathit{X} \mathit{Y} \mathit{Z} \!</math>
\mathit{a} \mathit{b} \mathit{c} \mathit{d} \mathit{e} \mathit{f} \mathit{g} <math>\mathit{a} \mathit{b} \mathit{c} \mathit{d} \mathit{e} \mathit{f} \mathit{g} \!</math>
\mathit{h} \mathit{i} \mathit{j} \mathit{k} \mathit{l} \mathit{m} <math>\mathit{h} \mathit{i} \mathit{j} \mathit{k} \mathit{l} \mathit{m} \!</math>
\mathit{n} \mathit{o} \mathit{p} \mathit{q} \mathit{r} \mathit{s} \mathit{t} <math>\mathit{n} \mathit{o} \mathit{p} \mathit{q} \mathit{r} \mathit{s} \mathit{t} \!</math>
\mathit{u} \mathit{v} \mathit{w} \mathit{x} \mathit{y} \mathit{z} <math>\mathit{u} \mathit{v} \mathit{w} \mathit{x} \mathit{y} \mathit{z} \!</math>
\mathit{0} \mathit{1} \mathit{2} \mathit{3} \mathit{4} <math>\mathit{0} \mathit{1} \mathit{2} \mathit{3} \mathit{4} \!</math>
\mathit{5} \mathit{6} \mathit{7} \mathit{8} \mathit{9} <math>\mathit{5} \mathit{6} \mathit{7} \mathit{8} \mathit{9} \!</math>
Roman typeface
\mathrm{A} \mathrm{B} \mathrm{C} \mathrm{D} \mathrm{E} \mathrm{F} \mathrm{G} <math>\mathrm{A} \mathrm{B} \mathrm{C} \mathrm{D} \mathrm{E} \mathrm{F} \mathrm{G} \!</math>
\mathrm{H} \mathrm{I} \mathrm{J} \mathrm{K} \mathrm{L} \mathrm{M} <math>\mathrm{H} \mathrm{I} \mathrm{J} \mathrm{K} \mathrm{L} \mathrm{M} \!</math>
\mathrm{N} \mathrm{O} \mathrm{P} \mathrm{Q} \mathrm{R} \mathrm{S} \mathrm{T} <math>\mathrm{N} \mathrm{O} \mathrm{P} \mathrm{Q} \mathrm{R} \mathrm{S} \mathrm{T} \!</math>
\mathrm{U} \mathrm{V} \mathrm{W} \mathrm{X} \mathrm{Y} \mathrm{Z} <math>\mathrm{U} \mathrm{V} \mathrm{W} \mathrm{X} \mathrm{Y} \mathrm{Z} \!</math>
\mathrm{a} \mathrm{b} \mathrm{c} \mathrm{d} \mathrm{e} \mathrm{f} \mathrm{g} <math>\mathrm{a} \mathrm{b} \mathrm{c} \mathrm{d} \mathrm{e} \mathrm{f} \mathrm{g} \!</math>
\mathrm{h} \mathrm{i} \mathrm{j} \mathrm{k} \mathrm{l} \mathrm{m} <math>\mathrm{h} \mathrm{i} \mathrm{j} \mathrm{k} \mathrm{l} \mathrm{m} \!</math>
\mathrm{n} \mathrm{o} \mathrm{p} \mathrm{q} \mathrm{r} \mathrm{s} \mathrm{t} <math>\mathrm{n} \mathrm{o} \mathrm{p} \mathrm{q} \mathrm{r} \mathrm{s} \mathrm{t} \!</math>
\mathrm{u} \mathrm{v} \mathrm{w} \mathrm{x} \mathrm{y} \mathrm{z} <math>\mathrm{u} \mathrm{v} \mathrm{w} \mathrm{x} \mathrm{y} \mathrm{z} \!</math>
\mathrm{0} \mathrm{1} \mathrm{2} \mathrm{3} \mathrm{4} <math>\mathrm{0} \mathrm{1} \mathrm{2} \mathrm{3} \mathrm{4} \!</math>
\mathrm{5} \mathrm{6} \mathrm{7} \mathrm{8} \mathrm{9} <math>\mathrm{5} \mathrm{6} \mathrm{7} \mathrm{8} \mathrm{9} \!</math>
Fraktur typeface
\mathfrak{A} \mathfrak{B} \mathfrak{C} \mathfrak{D} \mathfrak{E} \mathfrak{F} \mathfrak{G} <math>\mathfrak{A} \mathfrak{B} \mathfrak{C} \mathfrak{D} \mathfrak{E} \mathfrak{F} \mathfrak{G} \!</math>
\mathfrak{H} \mathfrak{I} \mathfrak{J} \mathfrak{K} \mathfrak{L} \mathfrak{M} <math>\mathfrak{H} \mathfrak{I} \mathfrak{J} \mathfrak{K} \mathfrak{L} \mathfrak{M} \!</math>
\mathfrak{N} \mathfrak{O} \mathfrak{P} \mathfrak{Q} \mathfrak{R} \mathfrak{S} \mathfrak{T} <math>\mathfrak{N} \mathfrak{O} \mathfrak{P} \mathfrak{Q} \mathfrak{R} \mathfrak{S} \mathfrak{T} \!</math>
\mathfrak{U} \mathfrak{V} \mathfrak{W} \mathfrak{X} \mathfrak{Y} \mathfrak{Z} <math>\mathfrak{U} \mathfrak{V} \mathfrak{W} \mathfrak{X} \mathfrak{Y} \mathfrak{Z} \!</math>
\mathfrak{a} \mathfrak{b} \mathfrak{c} \mathfrak{d} \mathfrak{e} \mathfrak{f} \mathfrak{g} <math>\mathfrak{a} \mathfrak{b} \mathfrak{c} \mathfrak{d} \mathfrak{e} \mathfrak{f} \mathfrak{g} \!</math>
\mathfrak{h} \mathfrak{i} \mathfrak{j} \mathfrak{k} \mathfrak{l} \mathfrak{m} <math>\mathfrak{h} \mathfrak{i} \mathfrak{j} \mathfrak{k} \mathfrak{l} \mathfrak{m} \!</math>
\mathfrak{n} \mathfrak{o} \mathfrak{p} \mathfrak{q} \mathfrak{r} \mathfrak{s} \mathfrak{t} <math>\mathfrak{n} \mathfrak{o} \mathfrak{p} \mathfrak{q} \mathfrak{r} \mathfrak{s} \mathfrak{t} \!</math>
\mathfrak{u} \mathfrak{v} \mathfrak{w} \mathfrak{x} \mathfrak{y} \mathfrak{z} <math>\mathfrak{u} \mathfrak{v} \mathfrak{w} \mathfrak{x} \mathfrak{y} \mathfrak{z} \!</math>
\mathfrak{0} \mathfrak{1} \mathfrak{2} \mathfrak{3} \mathfrak{4} <math>\mathfrak{0} \mathfrak{1} \mathfrak{2} \mathfrak{3} \mathfrak{4} \!</math>
\mathfrak{5} \mathfrak{6} \mathfrak{7} \mathfrak{8} \mathfrak{9} <math>\mathfrak{5} \mathfrak{6} \mathfrak{7} \mathfrak{8} \mathfrak{9} \!</math>
\mathcal{A} \mathcal{B} \mathcal{C} \mathcal{D} \mathcal{E} \mathcal{F} \mathcal{G} <math>\mathcal{A} \mathcal{B} \mathcal{C} \mathcal{D} \mathcal{E} \mathcal{F} \mathcal{G} \!</math>
\mathcal{H} \mathcal{I} \mathcal{J} \mathcal{K} \mathcal{L} \mathcal{M} <math>\mathcal{H} \mathcal{I} \mathcal{J} \mathcal{K} \mathcal{L} \mathcal{M} \!</math>
\mathcal{N} \mathcal{O} \mathcal{P} \mathcal{Q} \mathcal{R} \mathcal{S} \mathcal{T} <math>\mathcal{N} \mathcal{O} \mathcal{P} \mathcal{Q} \mathcal{R} \mathcal{S} \mathcal{T} \!</math>
\mathcal{U} \mathcal{V} \mathcal{W} \mathcal{X} \mathcal{Y} \mathcal{Z} <math>\mathcal{U} \mathcal{V} \mathcal{W} \mathcal{X} \mathcal{Y} \mathcal{Z} \!</math>
Hebrew symbols
\aleph \beth \gimel \daleth <math>\aleph \beth \gimel \daleth \!</math>

Mixed text faces

Feature Syntax How it looks rendered
Non-italicised characters \text{xyz} <math>\text{xyz}</math> <math>\text{xyz}\!</math>
Mixed italics (bad) \text{if} n \text{is even} <math>\text{if} n \text{is even} </math> <math>\text{if} n \text{is even} \!</math>
Mixed italics (good) \text{if }n\text{ is even} <math>\text{if }n\text{ is even}</math> <math>\text{if }n\text{ is even}\!</math>
Mixed italics (alternative: ~ or "\ " forces a space) \text{if}~n\ \text{is even} <math>\text{if}~n\ \text{is even} </math> <math>\text{if}~n\ \text{is even} \!</math>


Equations can use color:

  • {\color{Blue}x^2}+{\color{YellowOrange}2x}-{\color{OliveGreen}1}
  • x_{1,2}=\frac{-b\pm\sqrt{\color{Red}b^2-4ac}}{2a}
Colors supported
<math>\color{Apricot}\text{Apricot}</math> <math>\color{Aquamarine}\text{Aquamarine}</math> <math>\color{Bittersweet}\text{Bittersweet}</math> <math>\color{Black}\text{Black}</math>
<math>\color{Blue}\text{Blue}</math> <math>\color{BlueGreen}\text{BlueGreen}</math> <math>\color{BlueViolet}\text{BlueViolet}</math> <math>\color{BrickRed}\text{BrickRed}</math>
<math>\color{Brown}\text{Brown}</math> <math>\color{BurntOrange}\text{BurntOrange}</math> <math>\color{CadetBlue}\text{CadetBlue}</math> <math>\color{CarnationPink}\text{CarnationPink}</math>
<math>\color{Cerulean}\text{Cerulean}</math> <math>\color{CornflowerBlue}\text{CornflowerBlue}</math> <math>\color{Cyan}\text{Cyan}</math> <math>\color{Dandelion}\text{Dandelion}</math>
<math>\color{DarkOrchid}\text{DarkOrchid}</math> <math>\color{Emerald}\text{Emerald}</math> <math>\color{ForestGreen}\text{ForestGreen}</math> <math>\color{Fuchsia}\text{Fuchsia}</math>
<math>\color{Goldenrod}\text{Goldenrod}</math> <math>\color{Gray}\text{Gray}</math> <math>\color{Green}\text{Green}</math> <math>\color{GreenYellow}\text{GreenYellow}</math>
<math>\color{JungleGreen}\text{JungleGreen}</math> <math>\color{Lavender}\text{Lavender}</math> <math>\color{LimeGreen}\text{LimeGreen}</math> <math>\color{Magenta}\text{Magenta}</math>
<math>\color{Mahogany}\text{Mahogany}</math> <math>\color{Maroon}\text{Maroon}</math> <math>\color{Melon}\text{Melon}</math> <math>\color{MidnightBlue}\text{MidnightBlue}</math>
<math>\color{Mulberry}\text{Mulberry}</math> <math>\color{NavyBlue}\text{NavyBlue}</math> <math>\color{OliveGreen}\text{OliveGreen}</math> <math>\color{Orange}\text{Orange}</math>
<math>\color{OrangeRed}\text{OrangeRed}</math> <math>\color{Orchid}\text{Orchid}</math> <math>\color{Peach}\text{Peach}</math> <math>\color{Periwinkle}\text{Periwinkle}</math>
<math>\color{PineGreen}\text{PineGreen}</math> <math>\color{Plum}\text{Plum}</math> <math>\color{ProcessBlue}\text{ProcessBlue}</math> <math>\color{Purple}\text{Purple}</math>
<math>\color{RawSienna}\text{RawSienna}</math> <math>\color{Red}\text{Red}</math> <math>\color{RedOrange}\text{RedOrange}</math> <math>\color{RedViolet}\text{RedViolet}</math>
<math>\color{Rhodamine}\text{Rhodamine}</math> <math>\color{RoyalBlue}\text{RoyalBlue}</math> <math>\color{RoyalPurple}\text{RoyalPurple}</math> <math>\color{RubineRed}\text{RubineRed}</math>
<math>\color{Salmon}\text{Salmon}</math> <math>\color{SeaGreen}\text{SeaGreen}</math> <math>\color{Sepia}\text{Sepia}</math> <math>\color{SkyBlue}\text{SkyBlue}</math>
<math>\color{SpringGreen}\text{SpringGreen}</math> <math>\color{Tan}\text{Tan}</math> <math>\color{TealBlue}\text{TealBlue}</math> <math>\color{Thistle}\text{Thistle}</math>
<math>\color{Turquoise}\text{Turquoise}</math> <math>\color{Violet}\text{Violet}</math> <math>\color{VioletRed}\text{VioletRed}</math> <math style="background:black">\color{White}\text{White}</math>
<math>\color{WildStrawberry}\text{WildStrawberry}</math> <math>\color{Yellow}\text{Yellow}</math> <math>\color{YellowGreen}\text{YellowGreen}</math> <math>\color{YellowOrange}\text{YellowOrange}</math>

Note that color should not be used as the only way to identify something, because it will become meaningless on black-and-white media or for color-blind people.

Formatting issues


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

Feature Syntax How it looks rendered
Double quad space a \qquad b <math>a \qquad b</math>
Quad space a \quad b <math>a \quad b</math>
Text space, forced space a\ b
<math>a\ b</math>
Text space without PNG conversion a \text{ } b <math>a \text{ } b</math>
Large space a\;b <math>a\;b</math>
Medium space a\>b [not supported]
Small space a\,b <math>a\,b</math>
No space ab <math>ab\,</math>
Small negative space a\!b <math>a\!b</math>

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


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


Alignment with normal text flow

Due to the default CSS

img.tex { vertical-align: middle; }

an inline expression like <math>\int_{-N}^{N} e^x\, dx</math> 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.

Also note that if you rely on this workaround, if/when the rendering on the server gets fixed in future releases, as a result of this extra manual offset your formulae will suddenly be aligned incorrectly. So use it sparingly, if at all.

Forced PNG rendering

To force the formula to render as PNG, add \, (small space) at the end of the formula (where it is not rendered). This will force PNG if the user is in "HTML if simple" mode, but not for "HTML if possible" mode (math rendering settings in preferences).

You can also use \! at the end of a formula to force PNG even in "HTML if possible" mode, unlike \,. If it is understandable to have \! at the end of a formula for some reason, it may also be used at the beginning or the combinations \,\! and \!\, (a negative and positive space which cancel out) may appear anywhere within the math expression to force PNG.

Forcing PNG can be useful to keep the rendering of formulas in a proof consistent, for example, or to fix formulas that render incorrectly in HTML (at one time, a^{2+2} rendered with an extra underscore), or to demonstrate how something is rendered when it would normally show up as HTML (as in the examples above).

For instance:

Syntax How it looks rendered
a^{c+2} <math>a^{c+2}</math>
a^{c+2} \, <math>a^{c+2} \,</math>
a^{\,\!c+2} <math>a^{\,\!c+2}</math> (this example uses \,\! in the middle of the expression.)
a^{b^{c+2}} <math>a^{b^{c+2}}</math> (WRONG with option "HTML if possible or else PNG"!)
a^{b^{c+2}} \, <math>a^{b^{c+2}} \,</math> (WRONG with option "HTML if possible or else PNG"!)
a^{b^{c+2}}\approx 5 <math>a^{b^{c+2}}\approx 5</math> (due to "<math>\approx</math>" correctly displayed, no code "\!" needed)
a^{b^{c+2}}\! <math>a^{b^{c+2}}\!</math>
\int_{-N}^{N} e^x\, dx <math>\int_{-N}^{N} e^x\, dx</math>

This has been tested with most of the formulas on this page, and seems to work perfectly.

You might want to include a comment in the HTML so people don't "correct" the formula by removing it:

<!-- The \! is to keep the formula rendered as PNG instead of HTML. Please don't remove it.-->

Examples of implemented TeX formulas

Quadratic polynomial

<math>ax^2 + bx + c = 0</math>

<math>ax^2 + bx + c = 0</math>

Quadratic polynomial (force PNG rendering)

<math>ax^2 + bx + c = 0\,\!</math>

<math>ax^2 + bx + c = 0\,\!</math>

Quadratic formula

<math>x={-b\pm\sqrt{b^2-4ac} \over 2a}</math>

<math>x={-b\pm\sqrt{b^2-4ac} \over 2a}</math>

Tall parentheses and fractions

<math>2 = \left( \frac{\left(3-x\right) \times 2}{3-x} \right)</math>

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

 <math>S_{\text{new}} = S_{\text{old}} - \frac{ \left( 5-T \right) ^2} {2}</math>


<math>\int_a^x \!\!\!\int_a^s f(y)\,dy\,ds = \int_a^x f(y)(x-y)\,dy</math>

<math>\int_a^x \!\!\!\int_a^s f(y)\,dy\,ds
 = \int_a^x f(y)(x-y)\,dy</math>


<math>\sum_{i=0}^{n-1} i</math>

<math>\sum_{i=0}^{n-1} i</math>


Differential equation

<math>u + p(x)u' + q(x)u=f(x),\quad x>a</math>

<math>u'' + p(x)u' + q(x)u=f(x),\quad x>a</math>

Complex numbers

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

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


<math>\lim_{z\rightarrow z_0} f(z)=f(z_0)</math>

<math>\lim_{z\rightarrow z_0} f(z)=f(z_0)</math>

Integral equation

= \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>

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


<math>\phi_n(\kappa) = 0.033C_n^2\kappa^{-11/3},\quad \frac{1}{L_0}\ll\kappa\ll\frac{1}{l_0}</math>

<math>\phi_n(\kappa) = 

Continuation and cases

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

 f(x) =
 1 & -1 \le x < 0 \\
 \frac{1}{2} & x = 0 \\
 1 - x^2 & \text{otherwise}

Prefixed subscript

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

 = \sum_{n=0}^\infty

Fraction and small fraction

<math>\frac{a}{b}\ \tfrac{a}{b}</math>
<math>\frac{a}{b}\ \tfrac{a}{b}</math>

Repeating fraction


Area of a quadrilateral


Volume of a sphere-stand

<math>V=\tfrac16\pi h\left[3\left(r_1^2+r_2^2\right)+h^2\right]</math>
<math>V=\tfrac16\pi h\left[3\left(r_1^2+r_2^2\right)+h^2\right]</math>