Help:Math

From ASN Wiki
Jump to navigationJump to search

This is a ShoutWiki help page, hosted at ShoutWiki Hub. If you want to suggest changes, leave a message on its talk page. If you want to replace this page with a custom help page for your wiki, click the create button above.

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. By default, ShoutWiki uses the MathJax renderer, which uses a combination of HTML and CSS to display the equation. Alternatively, you can select it to generate PNG images or display as TeX for text browsers through your user preferences.

Basics

Math markup goes inside <math></math>.

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.

LaTeX commands

LaTeX commands are case-sensitive, and take one of the following two formats:

  • They start with a backslash \ and then have a name consisting of letters only. Command names are terminated by a space, a number or any other "non-letter".
  • They consist of a backslash \ and exactly one non-letter.

Some commands need an argument, which has to be given between curly braces { } after the command name. Some commands support optional parameters, which are added after the command name in square brackets []. The general syntax is:

\commandname[option1,option2,...]{argument1}{argument2}...

Special characters

The following symbols are reserved characters that either have a special meaning under LaTeX or are unavailable in all the fonts. If you enter them directly in your text, they will normally not render, but rather do things you did not intend.

# $ % ^ & _ { } ~ \

These characters can be entered by adding a prefix backslash:

\# \$ \% \textasciicircum{} \& \_ \{ \} \~{} \textbackslash{}

The other symbols and many more can be rendered with special commands in mathematical formulae or as accents.

The backslash character \ can not be entered by adding another backslash in front of it (\\); this sequence is used for line breaking. For introducing a backslash in math mode, you can use \backslash instead.

The command \~ produces a tilde which is placed over the next letter. For example \~n gives ñ. To produce just the character ~, use \~{} which places a ~ over an empty box. Alternatively \sim produces a large centred ~ which may be more appropriate in some situations, but may not render properly in simple expressions which are converted to HTML.

Similarly, the command \^ produces a hat over the next character, for example \^{o} produces ô. If you need in text to display the ^ symbol you have to use \textasciicircum.

Spaces

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

LaTeX environments

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

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

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

Formatting using TeX

Functions, symbols, special characters

Accents/diacritics

\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 numerical 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,y), \max(x,y) <math>\min(x,y), \max(x,y) \!</math>

Bounds

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

Projections

\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>
dy/dx, \operatorname{d}\!y/\operatorname{d}\!x, {dy \over dx}, {\operatorname{d}\!y\over\operatorname{d}\!x}, {\partial^2\over\partial x_1\partial x_2}y <math>dy/dx, \operatorname{d}\!y/\operatorname{d}\!x, {dy \over dx}, {\operatorname{d}\!y\over\operatorname{d}\!x}, {\partial^2\over\partial x_1\partial x_2}y \!</math>
\prime, \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, \aleph, \complement, \backepsilon, \eth, \Finv, \hbar <math>\infty, \aleph, \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>

Radicals

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

Operators

+, -, \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>

Sets

\{ \}, \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 <math>\cap, \Cap, \sqcap, \bigcap \!</math>
\cup, \Cup, \sqcup, \bigcup, \bigsqcup, \uplus, \biguplus <math>\cup, \Cup, \sqcup, \bigcup, \bigsqcup, \uplus, \biguplus \!</math>
\setminus, \smallsetminus, \times <math>\setminus, \smallsetminus, \times \!</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>

Relations

=, \ne, \neq, \equiv, \not\equiv <math>=, \ne, \neq, \equiv, \not\equiv \!</math>
\doteq, \doteqdot, \overset{\underset{\mathrm{def}}{}}{=}, := <math>\doteq, \doteqdot, \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>

Geometric

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

Logic

\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}, \bar{abc}, \overline{q}, \overline{abc},

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

<math>\bar{q}, \bar{abc}, \overline{q}, \overline{abc}, \!</math>

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

Arrows

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

Special

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

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>
Subscript a_2 <math>a_2</math>
Grouping 10^{30} a^{2+2} <math>10^{30} a^{2+2}</math>
a_{i,j} b_{f'} <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>
Derivatives x', y'', f', f'' <math>x', y, f', f</math>
x^\prime, y^{\prime\prime} <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>
Arc (workaround) \overset{\frown} {AB} <math>\overset{\frown} {AB}</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>
Sum in a fraction (alternative limits style) \frac{\sum\limits^{^N}_{k=1} k^2}{a} <math>\frac{\sum\limits^{^N}_{k=1} 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 (alternative 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, alternative 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>
Cancellations in fractions
Note does not work with MathJax
\cfrac{x}{1 + \cfrac{\cancel{y}}{\cancel{y}}} = \cfrac{x}{2} <math>\cfrac{x}{1 + \cfrac{\cancel{y}}{\cancel{y}}} = \cfrac{x}{2}</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>
Matrices
\begin{matrix}
x & y \\
z & v
\end{matrix}
<math>\begin{matrix} x & y \\ z & v

\end{matrix}</math>

\begin{vmatrix}
x & y \\
z & v
\end{vmatrix}
<math>\begin{vmatrix} x & y \\ z & v

\end{vmatrix}</math>

\begin{Vmatrix}
x & y \\
z & v
\end{Vmatrix}
<math>\begin{Vmatrix} x & y \\ z & v

\end{Vmatrix}</math>

\begin{bmatrix}
0 & \cdots & 0 \\
\vdots & \ddots & \vdots \\
0 & \cdots & 0
\end{bmatrix}
<math>\begin{bmatrix} 0 & \cdots & 0 \\ \vdots

& \ddots & \vdots \\ 0 & \cdots & 0\end{bmatrix} </math>

\begin{Bmatrix}
x & y \\
z & v
\end{Bmatrix}
<math>\begin{Bmatrix} x & y \\ z & v

\end{Bmatrix}</math>

\begin{pmatrix}
x & y \\
z & v
\end{pmatrix}
<math>\begin{pmatrix} x & y \\ z & v

\end{pmatrix}</math>

\bigl( \begin{smallmatrix}
a&b\\ c&d
\end{smallmatrix} \bigr)
<math>

\bigl( \begin{smallmatrix} a&b\\ c&d \end{smallmatrix} \bigr) </math>

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

\begin{cases} n/2, & \text{if }n\text{ is even} \\ 3n+1, & \text{if }n\text{ is odd} \end{cases} </math>

Multiline equations
\begin{align}
f(x) & = (a+b)^2 \\
& = a^2+2ab+b^2 \\
\end{align}
<math>

\begin{align} f(x) & = (a+b)^2 \\ & = a^2+2ab+b^2 \\ \end{align} </math>

\begin{alignat}{2}
f(x) & = (a-b)^2 \\
& = a^2-2ab+b^2 \\
\end{alignat}
<math>

\begin{alignat}{2} f(x) & = (a-b)^2 \\ & = a^2-2ab+b^2 \\ \end{alignat} </math>

Multiline equations (must define number of columns used ({lcr}) (should not be used unless needed)
\begin{array}{lcl}
z & = & a \\
f(x,y,z) & = & x + y + z
\end{array}
<math>\begin{array}{lcl}

z & = & a \\ f(x,y,z) & = & x + y + z \end{array}</math>

Multiline equations (more)
\begin{array}{lcr}
z & = & a \\
f(x,y,z) & = & x + y + z
\end{array}
<math>\begin{array}{lcr}

z & = & a \\ f(x,y,z) & = & x + y + z \end{array}</math>

Breaking up a long expression so that it wraps when necessary, at the expense of destroying correct spacing
<nowiki>
<math>f(x) \,\!</math>
<math>= \sum_{n=0}^\infty a_n x^n </math>
<math>= a_0+a_1x+a_2x^2+\cdots</math>
</nowiki>
<math>f(x) \,\!</math><math>= \sum_{n=0}^\infty a_n x^n </math><math>= a_0 +a_1x+a_2x^2+\cdots</math>
Simultaneous equations
\begin{cases}
3x + 5y + z \\
7x - 2y + 4z \\
-6x + 3y + 2z
\end{cases}
<math>\begin{cases} 3x + 5y + z \\ 7x - 2y + 4z \\ -6x + 3y + 2z \end{cases}</math>
Arrays
\begin{array}{|c|c||c|} a & b & S \\
\hline
0&0&1\\
0&1&1\\
1&0&1\\
1&1&0\\
\end{array}
<math>

\begin{array}{|c|c||c|} a & b & S \\ \hline 0&0&1\\ 0&1&1\\ 1&0&1\\ 1&1&0\\ \end{array} </math>

Parenthesizing big expressions, brackets, bars

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 \quad
\left \Vert \frac{c}{d} \right \|
\frac{a}{b} \right \vert \quad \left \Vert \frac{c}{d} \right \|</math>
Floor and ceiling functions: \left \lfloor \frac{a}{b} \right \rfloor \quad
\left \lceil \frac{c}{d} \right \rceil
<math>\left \lfloor \frac{a}{b} \right \rfloor \quad \left \lceil \frac{c}{d} \right \rceil</math>
Slashes and backslashes \left / \frac{a}{b} \right \backslash <math>\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 |
</math>
Use \left. and \right. if you
do not 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 (add "l" or "r" to indicate the side for proper spacing) ( \bigl( \Bigl( \biggl( \Biggl( \dots \Biggr] \biggr] \Bigr] \bigr] ] <math>( \bigl( \Bigl( \biggl( \Biggl( \dots \Biggr] \biggr] \Bigr] \bigr] ]</math>
\{ \bigl\{ \Bigl\{ \biggl\{ \Biggl\{ \dots
\Biggr\rangle \biggr\rangle \Bigr\rangle \bigr\rangle \rangle
<math>\{ \bigl\{ \Bigl\{ \biggl\{ \Biggl\{ \dots \Biggr\rangle \biggr\rangle \Bigr\rangle \bigr\rangle \rangle</math>
\| \big\| \Big\| \bigg\| \Bigg\| \dots \Bigg| \bigg| \Big| \big| | \big\| \Big\| \bigg\| \Bigg\| \dots \Bigg| \bigg| \Big| \big| |</math>
\lfloor \bigl\lfloor \Bigl\lfloor \biggl\lfloor \Biggl\lfloor \dots
\Biggr\rceil \biggr\rceil \Bigr\rceil \bigr\rceil \ceil
<math>\lfloor \bigl\lfloor \Bigl\lfloor \biggl\lfloor \Biggl\lfloor \dots \Biggr\rceil \biggr\rceil \Bigr\rceil \bigr\rceil \rceil</math>
\uparrow \big\uparrow \Big\uparrow \bigg\uparrow \Bigg\uparrow \dots
\Bigg\Downarrow \bigg\Downarrow \Big\Downarrow \big\Downarrow \Downarrow
<math>\uparrow \big\uparrow \Big\uparrow \bigg\uparrow \Bigg\uparrow \dots \Bigg\Downarrow \bigg\Downarrow \Big\Downarrow \big\Downarrow \Downarrow</math>
\updownarrow \big\updownarrow \Big\updownarrow \bigg\updownarrow \Bigg\updownarrow \dots
\Bigg\Updownarrow \bigg\Updownarrow \Big\Updownarrow \big\Updownarrow \Updownarrow
<math>\updownarrow \big\updownarrow \Big\updownarrow \bigg\updownarrow \Bigg\updownarrow \dots \Bigg\Updownarrow \bigg\Updownarrow \Big\Updownarrow \big\Updownarrow \Updownarrow</math>
/ \big/ \Big/ \bigg/ \Bigg/ \dots
\Bigg\backslash \bigg\backslash \Big\backslash \big\backslash \backslash
<math>/ \big/ \Big/ \bigg/ \Bigg/ \dots \Bigg\backslash \bigg\backslash \Big\backslash \big\backslash \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 \Eta \Theta <math>\Alpha \Beta \Gamma \Delta \Epsilon \Zeta \Eta \Theta \!</math>
\Iota \Kappa \Lambda \Mu \Nu \Xi \Pi \Rho <math>\Iota \Kappa \Lambda \Mu \Nu \Xi \Pi \Rho \!</math>
\Sigma \Tau \Upsilon \Phi \Chi \Psi \Omega <math>\Sigma \Tau \Upsilon \Phi \Chi \Psi \Omega \!</math>
\alpha \beta \gamma \delta \epsilon \zeta \eta \theta <math>\alpha \beta \gamma \delta \epsilon \zeta \eta \theta \!</math>
\iota \kappa \lambda \mu \nu \xi \pi \rho <math>\iota \kappa \lambda \mu \nu \xi \pi \rho \!</math>
\sigma \tau \upsilon \phi \chi \psi \omega <math>\sigma \tau \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>
Hebrew symbols
\aleph \beth \gimel \daleth <math>\aleph \beth \gimel \daleth \!</math>
Blackboard bold/scripts
\mathbb{ABCDEFGHI} <math>\mathbb{ABCDEFGHI} \!</math>
\mathbb{JKLMNOPQR} <math>\mathbb{JKLMNOPQR} \!</math>
\mathbb{STUVWXYZ} <math>\mathbb{STUVWXYZ} \!</math>
Boldface
\mathbf{ABCDEFGHI} <math>\mathbf{ABCDEFGHI} \!</math>
\mathbf{JKLMNOPQR} <math>\mathbf{JKLMNOPQR} \!</math>
\mathbf{STUVWXYZ} <math>\mathbf{STUVWXYZ} \!</math>
\mathbf{abcdefghijklm} <math>\mathbf{abcdefghijklm} \!</math>
\mathbf{nopqrstuvwxyz} <math>\mathbf{nopqrstuvwxyz} \!</math>
\mathbf{0123456789} <math>\mathbf{0123456789} \!</math>
Boldface (Greek)
\boldsymbol{\Alpha\Beta\Gamma\Delta\Epsilon\Zeta\Eta\Theta} <math>\boldsymbol{\Alpha\Beta\Gamma\Delta\Epsilon\Zeta\Eta\Theta} \!</math>
\boldsymbol{\Iota\Kappa\Lambda\Mu\Nu\Xi\Pi\Rho} <math>\boldsymbol{\Iota\Kappa\Lambda\Mu\Nu\Xi\Pi\Rho} \!</math>
\boldsymbol{\Sigma\Tau\Upsilon\Phi\Chi\Psi\Omega} <math>\boldsymbol{\Sigma\Tau\Upsilon\Phi\Chi\Psi\Omega} \!</math>
\boldsymbol{\alpha\beta\gamma\delta\epsilon\zeta\eta\theta} <math>\boldsymbol{\alpha\beta\gamma\delta\epsilon\zeta\eta\theta} \!</math>
\boldsymbol{\iota\kappa\lambda\mu\nu\xi\pi\rho} <math>\boldsymbol{\iota\kappa\lambda\mu\nu\xi\pi\rho} \!</math>
\boldsymbol{\sigma\tau\upsilon\phi\chi\psi\omega} <math>\boldsymbol{\sigma\tau\upsilon\phi\chi\psi\omega} \!</math>
\boldsymbol{\varepsilon\digamma\varkappa\varpi} <math>\boldsymbol{\varepsilon\digamma\varkappa\varpi} \!</math>
\boldsymbol{\varrho\varsigma\vartheta\varphi} <math>\boldsymbol{\varrho\varsigma\vartheta\varphi} \!</math>
Italics (default for Latin alphabet)
\mathit{0123456789} <math>\mathit{0123456789} \!</math>
Greek italics (default for lowercase Greek)
\mathit{\Alpha\Beta\Gamma\Delta\Epsilon\Zeta\Eta\Theta} <math>\mathit{\Alpha\Beta\Gamma\Delta\Epsilon\Zeta\Eta\Theta} \!</math>
\mathit{\Iota\Kappa\Lambda\Mu\Nu\Xi\Pi\Rho} <math>\mathit{\Iota\Kappa\Lambda\Mu\Nu\Xi\Pi\Rho} \!</math>
\mathit{\Sigma\Tau\Upsilon\Phi\Chi\Psi\Omega} <math>\mathit{\Sigma\Tau\Upsilon\Phi\Chi\Psi\Omega} \!</math>
Roman typeface
\mathrm{ABCDEFGHI} <math>\mathrm{ABCDEFGHI} \!</math>
\mathrm{JKLMNOPQR} <math>\mathrm{JKLMNOPQR} \!</math>
\mathrm{STUVWXYZ} <math>\mathrm{STUVWXYZ} \!</math>
\mathrm{abcdefghijklm} <math>\mathrm{abcdefghijklm} \!</math>
\mathrm{nopqrstuvwxyz} <math>\mathrm{nopqrstuvwxyz} \!</math>
\mathrm{0123456789} <math>\mathrm{0123456789} \!</math>
Sans serif
\mathsf{ABCDEFGHI} <math>\mathsf{ABCDEFGHI} \!</math>
\mathsf{JKLMNOPQR} <math>\mathsf{JKLMNOPQR} \!</math>
\mathsf{STUVWXYZ} <math>\mathsf{STUVWXYZ} \!</math>
\mathsf{abcdefghijklm} <math>\mathsf{abcdefghijklm} \!</math>
\mathsf{nopqrstuvwxyz} <math>\mathsf{nopqrstuvwxyz} \!</math>
\mathsf{0123456789} <math>\mathsf{0123456789} \!</math>
Sans serif Greek (capital only)
\mathsf{\Alpha \Beta \Gamma \Delta \Epsilon \Zeta \Eta \Theta} <math>\mathsf{\Alpha \Beta \Gamma \Delta \Epsilon \Zeta \Eta \Theta} \!</math>
\mathsf{\Iota \Kappa \Lambda \Mu \Nu \Xi \Pi \Rho} <math>\mathsf{\Iota \Kappa \Lambda \Mu \Nu \Xi \Pi \Rho} \!</math>
\mathsf{\Sigma \Tau \Upsilon \Phi \Chi \Psi \Omega} <math>\mathsf{\Sigma \Tau \Upsilon \Phi \Chi \Psi \Omega}\!</math>
Calligraphy/script
\mathcal{ABCDEFGHI} <math>\mathcal{ABCDEFGHI} \!</math>
\mathcal{JKLMNOPQR} <math>\mathcal{JKLMNOPQR} \!</math>
\mathcal{STUVWXYZ} <math>\mathcal{STUVWXYZ} \!</math>
Fraktur typeface
\mathfrak{ABCDEFGHI} <math>\mathfrak{ABCDEFGHI} \!</math>
\mathfrak{JKLMNOPQR} <math>\mathfrak{JKLMNOPQR} \!</math>
\mathfrak{STUVWXYZ} <math>\mathfrak{STUVWXYZ} \!</math>
\mathfrak{abcdefghijklm} <math>\mathfrak{abcdefghijklm} \!</math>
\mathfrak{nopqrstuvwxyz} <math>\mathfrak{nopqrstuvwxyz} \!</math>
\mathfrak{0123456789} <math>\mathfrak{0123456789} \!</math>
Small scriptstyle text
{\scriptstyle\text{abcdefghijklm}} <math>{\scriptstyle\text{abcdefghijklm}}</math>

Mixed text faces

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

Color

Equations can use color with the \color command. The default Texvc renderer and the MathJax renderers have different syntaxes to support both use {\color{Blue}{text}}. For example

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

Other methods only work with one renderer and will not work for readers with the other renderer

  • {\color{Blue}x^2}+{\color{Orange}2x}-{\color{LimeGreen}1} works with Texvc but not MathJax
    <math>{\color{Blue}x^2}+{\color{Orange}2x}-{\color{LimeGreen}1}</math>
  • \color{Blue}x^2\color{Black}+\color{Orange}2x\color{Black}-\color{LimeGreen}1 works with Texvc but not MathJax
    <math>\color{Blue}x^2\color{Black}+\color{Orange}2x\color{Black}-\color{LimeGreen}1</math>
  • \color{Blue}{x^2}+\color{Orange}{2x}-\color{LimeGreen}{1} works with MathJax but not Texvc
    <math>\color{Blue}{x^2}+\color{Orange}{2x}-\color{LimeGreen}{1}</math>

Some color names are predeclared according to the following table, you can use them directly for the rendering of formulas (or for declaring the intended color of the page background).

Colors supported
<math>\color{Apricot}{\text{Apricot}}</math> <math>\pagecolor{Gray}\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>\pagecolor{Gray}\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>\pagecolor{Gray}\color{GreenYellow}{\text{GreenYellow}}</math>
<math>\color{JungleGreen}{\text{JungleGreen}}</math> <math>\pagecolor{Gray}\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>\pagecolor{Gray}\color{Thistle}{\text{Thistle}}</math>
<math>\color{Turquoise}{\text{Turquoise}}</math> <math>\color{Violet}{\text{Violet}}</math> <math>\color{VioletRed}{\text{VioletRed}}</math> <math>\pagecolor{Gray}{\color{White}{\text{White}}}</math>
<math>\color{WildStrawberry}{\text{WildStrawberry}}</math> <math>\pagecolor{Gray}\color{Yellow}{\text{Yellow}}</math> <math>\color{YellowGreen}{\text{YellowGreen}}</math> <math>\color{YellowOrange}{\text{YellowOrange}}</math>

: These colors do not work with the MathJax renderer and should generally be avoided.

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

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

{| class="wikitable"
|-
| style="background: gray" | <math>\pagecolor{Gray}x^2</math> || style="background: Goldenrod" | <math>\pagecolor{Goldenrod}y^3</math>
|}

Rendered as

<math>\pagecolor{Gray}x^2</math> <math>\pagecolor{Goldenrod}y^3</math>

The \pagecolor{Goldenrod} command is necessary for the Texvc renderer to use the correct anti-aliasing around the edges of the semi-transparent images.

Custom colours can be defined using

\definecolor{mycolor}{RGB}{255,165,100}\pagecolor{mycolor} e^{i \pi} + 1 = 0.

This should be avoided as it does not work with the MathJax renderer.

Formatting issues

Spacing

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 a\ b <math>a\ b</math>
text space without PNG conversion a \mbox{ } b <math>a \mbox{ } b</math>
large space a\;b <math>a\;b</math>
medium space a\<b [not supported]
small space a\,b <math>a\,b</math>
tiny space (use for multiplication of factors) ab <math>ab</math>
no space (use for multi-letter variables) \mathit{ab} <math>\mathit{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):

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

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}
<math>{0+1+2+3+4+5+6+7+8+9+10+11+12+13+14+15+16+17+18+19+20+\cdots}</math>

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 style="vertical-align:-100%;">... 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.

Examples

A sample conforming diagram is commons:Image:PSU-PU.svg.

Examples of implemented TeX formulas

Quadratic polynomial

<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}
\right)</math>

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

Integrals

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

Matrices and determinants

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

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

Summation

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

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

<math>\sum_{m=1}^\infty\sum_{n=1}^\infty\frac{m^2\,n}{3^m\left(m\,3^n+n\,3^m\right)}</math>

<math>\sum_{m=1}^\infty\sum_{n=1}^\infty\frac{m^2\,n}
{3^m\left(m\,3^n+n\,3^m\right)}</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>

Limits

<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

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

Example

<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) =
0.033C_n^2\kappa^{-11/3},\quad
\frac{1}{L_0}\ll\kappa\ll\frac{1}{l_0}</math>

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>

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

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>

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

Fraction and small fraction

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

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

Area of a quadrilateral

<math>S=dD\,\sin\alpha\!</math>

<math>S=dD\,\sin\alpha\!</math>

Volume of a sphere-stand

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

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

Multiple equations

<math>\begin{align} u & = \tfrac{1}{\sqrt{2}}(x+y) \qquad & x &= \tfrac{1}{\sqrt{2}}(u+v)\\ v & = \tfrac{1}{\sqrt{2}}(x-y) \qquad & y &= \tfrac{1}{\sqrt{2}}(u-v) \end{align}</math>  

<math>\begin{align}
u & = \tfrac{1}{\sqrt{2}}(x+y) \qquad & x &= \tfrac{1}{\sqrt{2}}(u+v) \\
v & = \tfrac{1}{\sqrt{2}}(x-y) \qquad & y &= \tfrac{1}{\sqrt{2}}(u-v)
\end{align}</math>

External links