Extension:Math/CoverageTest

THIS IS TEMPLATE THAT GENERATES THE PHPUNIT COVERAGE TESTS FOR THE MATH EXTENSION The text is ignored only the content of the math tags is used

p

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 PNG images by default. Alternatively the MathJax renderer can be used, this uses a combination of HTML and CSS to display the equation, it can be selected in the user preferences.

Although, in all cases mentioned, is generated by compilation, and not by an interpreter program, there is one essential difference between, e.g., Knuth's TeX or Lamport's LaTeX and the present implementation: whereas in the first two cases the compiler typically generates an all-in-one printable output, which has the quality of a whole book with all chapters, sections and subsections, and where no line is "special", in the present case one has, typically, a mixture of  images (more precisely: PNG images) for the equations, embedded into usual text, and with short  elements usually replaced by HTML parts. As a consequence, in many cases TeX-elements, e.g. vector symbols, "stick out" below (or above) the text line. This "sticking out" is not the case in the above-mentioned original products, and the HTML-substitutes for small  additions to the text are often insufficient in quality for many readers. In spite of these shortcomings, the present product characterized by "many embedded PNG-images" should be preferred for small texts, where the equations do not dominate.

More precisely, MediaWiki filters the markup through Texvc, which in turn passes the commands to or MathJax for the actual rendering. Thus, only a limited part of the full language is supported; see below for details.

To have math rendered in a particular MediaWiki installation, one has to set  in LocalSettings.php.

Basics
Math markup goes inside .

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

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.


 * 1) $ % ^ & _ { } ~ \

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: Environments supported by Wikipedia include matrix, align, etc. See below.

Rendering
The 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 (see bug 32694). The css selector of the images is.

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

Apart from function and operator names, as is customary in mathematics, variables and letters are in italics; digits are not. For other text, (like variable labels) to avoid being rendered in italics like variables, use,  , or. You can also define new function names using. For example,  gives $$\text{abc}$$.

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

vs HTML
Before using markup for producing special characters, it should be noted that, as this comparison table shows, sometimes similar results can be achieved in HTML, with Template:Math or Template:Bigmath (also see: Help:Special characters).

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

The project has settled on using both HTML and because each has advantages in some situations.

Pros of HTML

 * 1) Formulas in HTML behave more like regular text. In-line HTML formulae always align properly with the rest of the HTML text and, to some degree, can be copied-and-pasted (this is not a problem if  is rendered using MathJax, and the alignment should not be a problem for PNG rendering once bug 32694 is fixed).
 * 2) Pages using HTML code for formulae will load faster and they will create less clutter on your hard disk.
 * 3) Formulae typeset with HTML code will be accessible to client-side script links (a.k.a. scriptlets).
 * 4) The display of a formula entered using mathematical templates can be conveniently altered by modifying the templates involved; this modification will affect all relevant formulae without any manual intervention.
 * 5) The HTML code, if entered diligently, will contain all semantic information to transform the equation back to  or any other code as needed. It can even contain differences  does not normally catch, e.g.   for the imaginary unit and   for an arbitrary index variable.
 * 6) Unlike generated bitmaps, HTML is not sensitive to dots per inch variances between viewing platforms.

Pros of

 * 1)  is semantically more precise than HTML.
 * 2) In, " " means "mathematical variable $$x$$", whereas in HTML " " is generic and somewhat ambiguous.
 * 3) On the other hand, if you encode the same formula as " ", you get the same visual result $&alpha;$ 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 if no other rendering options are available (such as MathJax, which is available to logged in users as an preferences opt-in).
 * 4) One consequence of point 1 is that  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 . It is true that the current situation is not ideal, but that is not a good reason to drop information/contents. It is more a reason to help improve the situation.
 * 5) Another consequence of point 1 is that  can be converted to MathML (e.g. by MathJax) for browsers which support it, thus keeping its semantics and allowing the rendering to be better suited for the reader’s graphic device.
 * 6)  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.
 * 7)  has been specifically designed for typesetting formulae, 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.
 * 8) Once a formula is done correctly in, it will render reliably, whereas the success of HTML formulae is somewhat dependent on browsers or versions of browsers. Another aspect of this dependency is fonts: the serif font used for rendering formulae is browser-dependent and it may be missing some important glyphs. While the browser generally capable to substitute a matching glyph from a different font family, it need not be the case for combined glyphs (compare ‘  ’ and ‘ a̅ ’).
 * 9) When writing in, editors need not worry about whether this or that version of this or that browser supports this or that HTML entity. The burden of these decisions is put on the software. This does not hold for HTML formulae, which can easily end up being rendered wrongly or differently from the editor’s intentions on a different browser.
 * 10)  formulae, by default, render larger and are usually more readable than HTML formulae and are not dependent on client-side browser resources, such as fonts, and so the results are more reliably WYSIWYG.
 * 11) While  does not assist you in finding HTML codes or Unicode values (which you can obtain by viewing the HTML source in your browser), copying and pasting from a  PNG image in Wikipedia into simple text will return the LaTeX source.


 * unless your wikitext follows the style of point 1.2
 * The entity support problem is not limited to mathematical formulae though; it can be easily solved by using the corresponding characters instead of entities, as the character repertoire links do, except for cases where the corresponding glyphs are visually indiscernible (e.g. &amp;ndash; for &lsquo;–&rsquo; and &amp;minus; for &lsquo;&minus;&rsquo;).

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

Math Jax
The MathJax renderer, selectable through My Preferences - Appearance - Math, uses a very different system to the standard texvc renderer. Rather than rendering a static image on the server side a combination of JavaScript, HTML and CSS is used to locally construct the formula. This allows high-quality typesetting, and other problems such as font sizes not matching your browser settings or wrong baselines are fixed as well. MathJax may also reduce the download time of images but entails a small delay as the JavaScript interpreter runs to render the formulas.

Alternatively to the preferences option, MathJax can also be selected using the mathJax user script. It is the basis for the global option, and hence more experimental but also more up to date. Bug reports are taken care of at the script's talk page.

The quality of font rendering is dependent on your browser and operating system. Speed and appearance can be improved by installing the STIX fonts; for installation details see the MathJax font help page. Further information is also available at this page.

= Formatting using =

Functions, symbols, special characters
{| class="wikitable" !colspan="2"|

Accents/diacritics
!colspan="2"|
 * $$\dot{a}, \ddot{a}, \acute{a}, \grave{a} \!$$
 * $$\check{a}, \breve{a}, \tilde{a}, \bar{a} \!$$
 * $$\hat{a}, \widehat{a}, \vec{a} \!$$
 * $$\check{a}, \breve{a}, \tilde{a}, \bar{a} \!$$
 * $$\hat{a}, \widehat{a}, \vec{a} \!$$
 * $$\check{a}, \breve{a}, \tilde{a}, \bar{a} \!$$
 * $$\hat{a}, \widehat{a}, \vec{a} \!$$
 * $$\hat{a}, \widehat{a}, \vec{a} \!$$
 * $$\hat{a}, \widehat{a}, \vec{a} \!$$

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

Bounds
!colspan="2"|
 * $$\min x, \max y, \inf s, \sup t \!$$
 * $$\lim u, \liminf v, \limsup w \!$$
 * $$\dim p, \deg q, \det m, \ker\phi \!$$
 * $$\lim u, \liminf v, \limsup w \!$$
 * $$\dim p, \deg q, \det m, \ker\phi \!$$
 * $$\lim u, \liminf v, \limsup w \!$$
 * $$\dim p, \deg q, \det m, \ker\phi \!$$
 * $$\dim p, \deg q, \det m, \ker\phi \!$$
 * $$\dim p, \deg q, \det m, \ker\phi \!$$

Projections
!colspan="2"|
 * $$\Pr j, \hom l, \lVert z \rVert, \arg z \!$$
 * $$\Pr j, \hom l, \lVert z \rVert, \arg z \!$$
 * $$\Pr j, \hom l, \lVert z \rVert, \arg z \!$$

Differentials and derivatives
!colspan="2"|
 * $$dt, \operatorname{d}\!t, \partial t, \nabla\psi\!$$
 * $$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 \!$$
 * $$\prime, \backprime, f^\prime, f', f'', f^{(3)} \!, \dot y, \ddot y$$
 * $$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 \!$$
 * $$\prime, \backprime, f^\prime, f', f'', f^{(3)} \!, \dot y, \ddot y$$
 * $$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 \!$$
 * $$\prime, \backprime, f^\prime, f', f'', f^{(3)} \!, \dot y, \ddot y$$
 * $$\prime, \backprime, f^\prime, f', f'', f^{(3)} \!, \dot y, \ddot y$$
 * $$\prime, \backprime, f^\prime, f', f'', f^{(3)} \!, \dot y, \ddot y$$

Letter-like symbols or constants
!colspan="2"|
 * $$\infty, \aleph, \complement, \backepsilon, \eth, \Finv, \hbar \!$$
 * $$\Im, \imath, \jmath, \Bbbk, \ell, \mho, \wp, \Re, \circledS \!$$
 * $$\infty, \aleph, \complement, \backepsilon, \eth, \Finv, \hbar \!$$
 * $$\Im, \imath, \jmath, \Bbbk, \ell, \mho, \wp, \Re, \circledS \!$$
 * $$\Im, \imath, \jmath, \Bbbk, \ell, \mho, \wp, \Re, \circledS \!$$
 * $$\Im, \imath, \jmath, \Bbbk, \ell, \mho, \wp, \Re, \circledS \!$$

Modular arithmetic
!colspan="2"|
 * $$s_k \equiv 0 \pmod{m} \!$$
 * $$a\,\bmod\,b \!$$
 * $$\gcd(m, n), \operatorname{lcm}(m, n)$$
 * $$\mid, \nmid, \shortmid, \nshortmid \!$$
 * $$a\,\bmod\,b \!$$
 * $$\gcd(m, n), \operatorname{lcm}(m, n)$$
 * $$\mid, \nmid, \shortmid, \nshortmid \!$$
 * $$\gcd(m, n), \operatorname{lcm}(m, n)$$
 * $$\mid, \nmid, \shortmid, \nshortmid \!$$
 * $$\mid, \nmid, \shortmid, \nshortmid \!$$
 * $$\mid, \nmid, \shortmid, \nshortmid \!$$
 * $$\mid, \nmid, \shortmid, \nshortmid \!$$

Radicals
!colspan="2"|
 * $$\surd, \sqrt{2}, \sqrt[n]{}, \sqrt[3]{x^3+y^3 \over 2} \!$$
 * $$\surd, \sqrt{2}, \sqrt[n]{}, \sqrt[3]{x^3+y^3 \over 2} \!$$
 * $$\surd, \sqrt{2}, \sqrt[n]{}, \sqrt[3]{x^3+y^3 \over 2} \!$$

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

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

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

Geometric
!colspan="2"|
 * $$\parallel, \nparallel, \shortparallel, \nshortparallel \!$$
 * $$\perp, \angle, \sphericalangle, \measuredangle, 45^\circ \!$$
 * $$\Box, \blacksquare, \diamond, \Diamond \lozenge, \blacklozenge, \bigstar \!$$
 * $$\bigcirc, \triangle \bigtriangleup, \bigtriangledown \!$$
 * $$\vartriangle, \triangledown\!$$
 * $$\blacktriangle, \blacktriangledown, \blacktriangleleft, \blacktriangleright \!$$
 * $$\Box, \blacksquare, \diamond, \Diamond \lozenge, \blacklozenge, \bigstar \!$$
 * $$\bigcirc, \triangle \bigtriangleup, \bigtriangledown \!$$
 * $$\vartriangle, \triangledown\!$$
 * $$\blacktriangle, \blacktriangledown, \blacktriangleleft, \blacktriangleright \!$$
 * $$\bigcirc, \triangle \bigtriangleup, \bigtriangledown \!$$
 * $$\vartriangle, \triangledown\!$$
 * $$\blacktriangle, \blacktriangledown, \blacktriangleleft, \blacktriangleright \!$$
 * $$\vartriangle, \triangledown\!$$
 * $$\blacktriangle, \blacktriangledown, \blacktriangleleft, \blacktriangleright \!$$
 * $$\blacktriangle, \blacktriangledown, \blacktriangleleft, \blacktriangleright \!$$
 * $$\blacktriangle, \blacktriangledown, \blacktriangleleft, \blacktriangleright \!$$
 * $$\blacktriangle, \blacktriangledown, \blacktriangleleft, \blacktriangleright \!$$

Logic

 * $$\forall, \exists, \nexists \!$$
 * $$\therefore, \because, \And \!$$
 * $$\or \lor \vee, \curlyvee, \bigvee \!$$
 * $$\and \land \wedge, \curlywedge, \bigwedge \!$$
 * $$\therefore, \because, \And \!$$
 * $$\or \lor \vee, \curlyvee, \bigvee \!$$
 * $$\and \land \wedge, \curlywedge, \bigwedge \!$$
 * $$\or \lor \vee, \curlyvee, \bigvee \!$$
 * $$\and \land \wedge, \curlywedge, \bigwedge \!$$
 * $$\and \land \wedge, \curlywedge, \bigwedge \!$$
 * $$\and \land \wedge, \curlywedge, \bigwedge \!$$
 * $$\and \land \wedge, \curlywedge, \bigwedge \!$$


 * $$\bar{q}, \bar{abc}, \overline{q}, \overline{abc}, \!$$

$$\lnot \neg, \not\operatorname{R}, \bot, \top \!$$ !colspan="2"|
 * $$\vdash \dashv, \vDash, \Vdash, \models \!$$
 * $$\Vvdash \nvdash \nVdash \nvDash \nVDash \!$$
 * $$\ulcorner \urcorner \llcorner \lrcorner \,$$
 * $$\Vvdash \nvdash \nVdash \nvDash \nVDash \!$$
 * $$\ulcorner \urcorner \llcorner \lrcorner \,$$
 * $$\Vvdash \nvdash \nVdash \nvDash \nVDash \!$$
 * $$\ulcorner \urcorner \llcorner \lrcorner \,$$
 * $$\ulcorner \urcorner \llcorner \lrcorner \,$$
 * $$\ulcorner \urcorner \llcorner \lrcorner \,$$

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

Special
!colspan="2"|
 * $$\amalg \P \S \% \dagger \ddagger \ldots \cdots \!$$
 * $$\smile \frown \wr \triangleleft \triangleright\!$$
 * $$\diamondsuit, \heartsuit, \clubsuit, \spadesuit, \Game, \flat, \natural, \sharp \!$$
 * $$\smile \frown \wr \triangleleft \triangleright\!$$
 * $$\diamondsuit, \heartsuit, \clubsuit, \spadesuit, \Game, \flat, \natural, \sharp \!$$
 * $$\smile \frown \wr \triangleleft \triangleright\!$$
 * $$\diamondsuit, \heartsuit, \clubsuit, \spadesuit, \Game, \flat, \natural, \sharp \!$$
 * $$\diamondsuit, \heartsuit, \clubsuit, \spadesuit, \Game, \flat, \natural, \sharp \!$$
 * $$\diamondsuit, \heartsuit, \clubsuit, \spadesuit, \Game, \flat, \natural, \sharp \!$$

Unsorted (new stuff)

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

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

Parenthesizing big expressions, brackets, bars
You can use various delimiters with \left and \right:

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



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

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



The result looks like this:


 * As seen in equation ($$), blah blah blah...

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

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.

Color
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}$$
 * $$x_{1,2}=\frac{-b\pm\sqrt{\color{Red}b^2-4ac}}{2a}$$
 * $$x_{1,2}=\frac{-b\pm\sqrt{\color{Red}b^2-4ac}}{2a}$$

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.

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 Manual of Style (accessibility).

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

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


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

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


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

Alignment with normal text flow
Due to the default CSS

an inline expression like $$\int_{-N}^{N} e^x\, dx$$ should look good.

If you need to align it otherwise, use  and play with the   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.

Centering
We introduce the new attribute display with the two options "inline" and "block".

Inline
If the the value of the display attribute is inline the render will render math in inline mode, i.e. there will be no new paragraph for the equation and the operators will be rendered consuming only little vertical space.

Example
The sum $\sum_{i=0}^\infty 2^{-i}$ converges to 2.

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

The code for the math example reads:

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

Remark
The convention https://en.wikipedia.org/wiki/Wikipedia:Manual_of_Style_(mathematics)#Using_HTML is really annoying. I'd prefer to use inline math for that, since it helps to differentiate between math and other elements.

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

Example
The equation $$\text{geometric series:}\quad \begin{align} \sum_{i=0}^\infty 2^{-i}=2 \end{align}$$ is used in a joke about mathematicians entering a bar and ordering beer.

It was entered as

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

Discussion
Fréderic Wang would prefer that displaystyle is always added in depended of the fact if \displaystlye is already in the equation. He remarks that it has to be checked if that works if the equation starts with \begin.

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

Example
The sum $$\sum_{i=0}^\infty 2^{-i}$$ converges to 2.

The next line-width is disturbed by large operators.

The code for the math example reads:

The equation
 * $$\text{geometric series:}\quad \sum_{i=0}^\infty 2^{-i}=2 $$

is used in a joke about mathematicians entering a bar and ordering beer.

It was entered as

Commutative diagrams
To make a commutative diagram, there are three steps:


 * 1) write the diagram in TeX
 * 2) convert to SVG
 * 3) upload the file to Wikimedia Commons

Diagrams in
Xy-pic (online manual) is the most powerful and general-purpose diagram package in TeX. Diagrams created using it can be found at Commons: Category:Xy-pic diagrams.

Simpler packages include:


 * AMS's amscd
 * Paul Taylor's diagrams
 * François Borceux Diagrams

The following is a template for Xy-pic, together with a hack to increase the margins in dvips, so that the diagram is not truncated by over-eager cropping (suggested in TUGboat: TUGboat, Volume 17 1996, No. 3):

Convert to SVG
Once you have produced your diagram in LaTeX (or TeX), you can convert it to an SVG file using the following sequence of commands:

The pdfcrop and pdf2svg utilities are needed for this procedure. You can alternatively use pdf2svg from PDFTron for the last step.

If you do not have pdfTeX (which is unlikely) you can use the following commands to replace the first step (TeX → PDF):

In general, you will not be able to get anywhere with diagrams without and Ghostscript, and the   program is a useful tool for creating or modifying your diagrams by hand. There is also a utility  which supports direct conversion from Postscript files to many vector graphics formats, but it requires a non-free plugin to convert to SVG, and regardless of the format, this editor has not been successful in using it to convert diagrams with diagonal arrows from TeX-created files.

These programs are:


 * a working distribution, such as TeX Live
 * Ghostscript
 * pstoedit
 * Inkscape

Upload the file
As the diagram is your own work, upload it to Wikimedia Commons, so that all projects (notably, all languages) can use it without having to copy it to their language's Wiki. (If you've previously uploaded a file to somewhere other than Commons, to Commons.)


 * Check size: Before uploading, check that the default size of the image is neither too large nor too small by opening in an SVG application and viewing at default size (100% scaling), otherwise adjust the  option to.
 * Name: Make sure the file has a meaningful name.
 * Upload: Login to Wikimedia Commons, then upload the file ; for the Summary, give a brief description.

Now go to the image page and add a description, including the source code, using this template:

==TeX source== &lt;source lang=latex> % TeX source here &lt;/source>


 * Source code:
 * Include the source code in the image page, in the  section of the   template, so that the diagram can be edited in future.
 * Include the complete  file, not just the fragment, so future editors do not need to reconstruct a compilable file.
 * You may optionally make the source code section collapsible, using the /  templates.
 * (Don't include it in the Summary section, which is just supposed to be a summary.)
 * License: The most common license for commutative diagrams is ; some use , especially for simple diagrams, or other licenses. Please do not use the GFDL, as it requires the entire text of the GFDL to be attached to any document that uses the diagram.
 * Description: If possible, link to a Wikipedia page relevant to the diagram. (The  is necessary if you use nest templates within the description, and harmless otherwise.)
 * Category: Include, so that it appears in commons:Category:Commutative diagrams. There are also subcategories, which you may choose to use.
 * Include image: Now include the image on the original page via

Examples
A sample conforming diagram is.

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

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


 * {| class="toccolours collapsible collapsed" width="80%" style="text-align:left"

! and   using currently implemented symbols
 * looks like:
 * looks like:


 * $$\iint\limits_{S}\!\!\!\!\!\!\!\!\!\!\!\subset\!\supset \mathbf D \cdot \mathrm{d}\mathbf A$$, which uses  along with   and   (overdrawn after backspacing):


 * $$\int\!\!\!\!\int_{\partial V}\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\;\;\;\bigcirc\,\,\mathbf D\cdot\mathrm{d}\mathbf A$$, which uses  twice (with some backward kerning) along with   (also overdrawn after backpacing) to produce a more consistent circle:

(should also be preferably more tightly kerned) looks more or less like:


 * $$\int\!\!\!\!\!\int\!\!\!\!\!\int_{\partial V}\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\;\;\;\subset\!\supset \mathbf D\cdot\mathrm{d}\mathbf A$$ which uses three \int symbols (with more backward kerning) with \subset and \supset (overdrawn after backspacing):


 * $$\int\!\!\!\!\!\int\!\!\!\!\!\int_{\partial V}\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\;\;\;\bigcirc\,\,\mathbf D\;\cdot\mathrm{d}\mathbf A$$, which uses three  symbols (with more backward kerning) along with   (also overdrawn after backspacing):


 * }

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

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

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

The templates have three parameters:


 * preintegral: the text or formula immediately before the integral
 * intsubscpt: the subscript below the integral
 * integrand: the text or formula immediately after the integral

Examples

 * Stokes' theorem:




 * Ampère's law + correction:




 * Continuity of 4-momentum flux (in general relativity):



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

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

Quadratic polynomial
$$ax^2 + bx + c = 0$$

Quadratic formula
$$x={-b\pm\sqrt{b^2-4ac} \over 2a}$$

Tall parentheses and fractions
$$2 = \left( \frac{\left(3-x\right) \times 2}{3-x} \right)$$

$$S_{\text{new}} = S_{\text{old}} - \frac{ \left( 5-T \right) ^2} {2}$$

Integrals
$$\int_a^x \!\!\!\int_a^s f(y)\,dy\,ds = \int_a^x f(y)(x-y)\,dy$$

Matrices and determinants
$$\det(\mathsf{A}-\lambda\mathsf{I}) = 0$$

Summation
$$\sum_{i=0}^{n-1} i$$

$$\sum_{m=1}^\infty\sum_{n=1}^\infty\frac{m^2\,n}{3^m\left(m\,3^n+n\,3^m\right)}$$

Differential equation
$$u'' + p(x)u' + q(x)u=f(x),\quad x>a$$

Complex numbers
$$|\bar{z}| = |z|, |(\bar{z})^n| = |z|^n, \arg(z^n) = n \arg(z)$$

Limits
$$\lim_{z\rightarrow z_0} f(z)=f(z_0)$$

Integral equation
$$\phi_n(\kappa) = \frac{1}{4\pi^2\kappa^2} \int_0^\infty \frac{\sin(\kappa R)}{\kappa R} \frac{\partial}{\partial R} \left[R^2\frac{\partial D_n(R)}{\partial R}\right]\,dR$$

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

Continuation and cases
$$f(x) = \begin{cases}1 & -1 \le x < 0 \\ \frac{1}{2} & x = 0 \\ 1 - x^2 & \text{otherwise}\end{cases}$$

Prefixed subscript
$${}_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!}$$

Fraction and small fraction
$$\frac{a}{b}\ \tfrac{a}{b}$$

Area of a quadrilateral
$$S=dD\,\sin\alpha\!$$

Volume of a sphere-stand
$$V=\frac16\pi h\left[3\left(r_1^2+r_2^2\right)+h^2\right]$$

Multiple equations
$$\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}$$

Test cases from parserTests

 * pre-save transform: comment containing math
 * BUG 1887: A with a thumbnail- we don't render math in the parsertests by default, so math is not stripped and turns up as escaped &lt;math&gt; tags. [[Image:foobar.jpg|thumb|$$2+2$$]]
 * BUG 1887, part 2: A with a thumbnail- math enabled [[Image:foobar.jpg|thumb|$$2+2$$]]
 * Math section safety when disabled $$ alert(document.cookies); $$
 * BUG 26380: Add \widetilde support to match \widehat
 * $$\widehat{x}$$
 * $$\widetilde{x}$$
 * BUG 27324: Euro symbol for math
 * $$\euro 200$$
 * $$\geneuro$$
 * $$\geneuronarrow$$
 * $$\geneurowide$$
 * $$\officialeuro$$
 * BUG 27754: Archaic Greek letters for math (may require texlive-lang-greek)
 * $$\digamma$$
 * $$\Coppa\coppa\varcoppa$$
 * $$\Digamma$$
 * $$\Koppa\koppa$$
 * $$\Sampi\sampi$$
 * $$\Stigma\stigma\varstigma$$
 * BUG 19547: Apostrophe / single quotes in math \text{...}
 * $$\text{next years}$$
 * $$\text{next year's}$$
 * $$\text{`next' year}$$
 * BUG 6722: Spacing fix for functions in math HTML output:
 * $$\sin x$$
 * $$\sin(x)$$
 * $$\sin{x}$$
 * $$\sin x \,$$
 * $$\sin(x) \,$$
 * $$\sin{x} \,$$
 * BUG 18912: Add \sen function for Spanish sin to math
 * $$\sen x$$
 * $$\sen(x)$$
 * $$\sen{x}$$
 * $$\sen x \,$$
 * $$\sen(x) \,$$
 * $$\sen{x} \,$$
 * BUG 18912: \operatorname{sen} x gets wrong spacing in math: $$\operatorname{sen}$$
 * BUG 31442: Multiple math accents without braces fails to parse: $$\dot \vec B$$
 * BUG 31442: Math accents with math font fail to parse if braces not used:$$\tilde \mathcal{M}$$
 * BUG 31824: Empty math tag returns uniq:$$$$
 * BUG 31824: Empty math tag returns uniq:$$ $$

Additional tests
$$\left(\begin{smallmatrix}a & b\\ c & d\end{smallmatrix}\right)$$ $$\AA$$