Help:MathTestNative
This page aims to cover a wide range of mathematical expressions and was generated from the documentation of the English Wikipedia [1]. Please refer to phab:T346795 for further information and to Help:MathTest for a version of this page that uses the configured rendering mode.
This page forces rendering using the new native MathML mode.
Test-Tables
[edit]Functions, symbols, special characters
[edit]
Accents/diacritics[edit] | |
---|---|
\dot{a}, \ddot{a}, \acute{a}, \grave{a}
|
|
\check{a}, \breve{a}, \tilde{a}, \bar{a}
|
|
\hat{a}, \widehat{a}, \vec{a}
|
|
Standard numerical functions[edit] | |
\exp_a b = a^b, \exp b = e^b, 10^m
|
|
\ln c, \lg d = \log e, \log_{10} f
|
|
\sin a, \cos b, \tan c, \cot d, \sec e, \csc f
|
|
\arcsin h, \arccos i, \arctan j
|
|
\sinh k, \cosh l, \tanh m, \coth n
|
|
\operatorname{sh}\,k, \operatorname{ch}\,l, \operatorname{th}\,m, \operatorname{coth}\,n
|
|
\operatorname{argsh}\,o, \operatorname{argch}\,p, \operatorname{argth}\,q
|
|
\sgn r, \left\vert s \right\vert
|
|
\min(x,y), \max(x,y)
|
|
Bounds[edit] | |
\min x, \max y, \inf s, \sup t
|
|
\lim u, \liminf v, \limsup w
|
|
\dim p, \deg q, \det m, \ker\phi
|
|
Projections[edit] | |
\Pr j, \hom l, \lVert z \rVert, \arg z
|
|
Differentials and derivatives[edit] | |
dt, \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
|
|
Letter-like symbols or constants[edit] | |
\infty, \aleph, \complement, \backepsilon, \eth, \Finv, \hbar
|
|
\Im, \imath, \jmath, \Bbbk, \ell, \mho, \wp, \Re, \circledS
|
|
Modular arithmetic[edit] | |
s_k \equiv 0 \pmod{m}
|
|
a\,\bmod\,b
|
|
\gcd(m, n), \operatorname{lcm}(m, n)
|
|
\mid, \nmid, \shortmid, \nshortmid
|
|
Radicals[edit] | |
\surd, \sqrt{2}, \sqrt[n]{}, \sqrt[3]{x^3+y^3 \over 2}
|
|
Operators[edit] | |
+, -, \pm, \mp, \dotplus
|
|
\times, \div, \divideontimes, /, \backslash
|
|
\cdot, * \ast, \star, \circ, \bullet
|
|
\boxplus, \boxminus, \boxtimes, \boxdot
|
|
\oplus, \ominus, \otimes, \oslash, \odot
|
|
\circleddash, \circledcirc, \circledast
|
|
\bigoplus, \bigotimes, \bigodot
|
|
Sets[edit] | |
\{ \}, \O \empty \emptyset, \varnothing
|
|
\in, \notin \not\in, \ni, \not\ni
|
|
\cap, \Cap, \sqcap, \bigcap
|
|
\cup, \Cup, \sqcup, \bigcup, \bigsqcup, \uplus, \biguplus
|
|
\setminus, \smallsetminus, \times
|
|
\subset, \Subset, \sqsubset
|
|
\supset, \Supset, \sqsupset
|
|
\subseteq, \nsubseteq, \subsetneq, \varsubsetneq, \sqsubseteq
|
|
\supseteq, \nsupseteq, \supsetneq, \varsupsetneq, \sqsupseteq
|
|
\subseteqq, \nsubseteqq, \subsetneqq, \varsubsetneqq
|
|
\supseteqq, \nsupseteqq, \supsetneqq, \varsupsetneqq
|
|
Relations[edit] | |
=, \ne, \neq, \equiv, \not\equiv
|
|
\doteq, \doteqdot, \overset{\underset{\mathrm{def}}{}}{=}, :=
|
|
\sim, \nsim, \backsim, \thicksim, \simeq, \backsimeq, \eqsim, \cong, \ncong
|
|
\approx, \thickapprox, \approxeq, \asymp, \propto, \varpropto
|
|
<, \nless, \ll, \not\ll, \lll, \not\lll, \lessdot
|
|
>, \ngtr, \gg, \not\gg, \ggg, \not\ggg, \gtrdot
|
|
\le \leq, \lneq, \leqq, \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
|
|
Geometric[edit] | |
\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
|
|
Logic[edit] | |
\forall, \exists, \nexists
|
|
\therefore, \because, \And
|
|
\or \lor \vee, \curlyvee, \bigvee
|
|
\and \land \wedge, \curlywedge, \bigwedge
|
|
\bar{q}, \bar{abc}, \overline{q}, \overline{abc},
|
|
\vdash \dashv, \vDash, \Vdash, \models
|
|
\Vvdash \nvdash \nVdash \nvDash \nVDash
|
|
\ulcorner \urcorner \llcorner \lrcorner
|
|
Arrows[edit] | |
\Rrightarrow, \Lleftarrow
|
|
\Rightarrow, \nRightarrow, \Longrightarrow \implies
|
|
\Leftarrow, \nLeftarrow, \Longleftarrow
|
|
\Leftrightarrow, \nLeftrightarrow, \Longleftrightarrow \iff
|
|
\Uparrow, \Downarrow, \Updownarrow
|
|
\rightarrow \to, \nrightarrow, \longrightarrow
|
|
\leftarrow \gets, \nleftarrow, \longleftarrow
|
|
\leftrightarrow, \nleftrightarrow, \longleftrightarrow
|
|
\uparrow, \downarrow, \updownarrow
|
|
\nearrow, \swarrow, \nwarrow, \searrow
|
|
\mapsto, \longmapsto
|
|
\rightharpoonup \rightharpoondown \leftharpoonup \leftharpoondown \upharpoonleft \upharpoonright \downharpoonleft \downharpoonright \rightleftharpoons \leftrightharpoons
|
|
\curvearrowleft \circlearrowleft \Lsh \upuparrows \rightrightarrows \rightleftarrows \rightarrowtail \looparrowright
|
|
\curvearrowright \circlearrowright \Rsh \downdownarrows \leftleftarrows \leftrightarrows \leftarrowtail \looparrowleft
|
|
\hookrightarrow \hookleftarrow \multimap \leftrightsquigarrow \rightsquigarrow \twoheadrightarrow \twoheadleftarrow
|
|
Special[edit] | |
\amalg \P \S \% \dagger \ddagger \ldots \cdots
|
|
\smile \frown \wr \triangleleft \triangleright
|
|
\diamondsuit, \heartsuit, \clubsuit, \spadesuit, \Game, \flat, \natural, \sharp
|
|
Unsorted (new stuff)[edit] | |
\diagup \diagdown \centerdot \ltimes \rtimes \leftthreetimes \rightthreetimes
|
|
\eqcirc \circeq \triangleq \bumpeq \Bumpeq \doteqdot \risingdotseq \fallingdotseq
|
|
\intercal \barwedge \veebar \doublebarwedge \between \pitchfork
|
|
\vartriangleleft \ntriangleleft \vartriangleright \ntriangleright
|
|
\trianglelefteq \ntrianglelefteq \trianglerighteq \ntrianglerighteq
|
For a little more semantics on these symbols, see the brief TeX Cookbook.
Larger expressions
[edit]Subscripts, superscripts, integrals
[edit]Feature | Syntax | How it looks rendered |
---|---|---|
Superscript | a^2 |
|
Subscript | a_2 |
|
Grouping | 10^{30} a^{2+2} |
|
a_{i,j} b_{f'} |
||
Combining sub & super without and with horizontal separation | x_2^3 |
|
{x_2}^3 |
||
Super super | 10^{10^{8}} |
|
Preceding and/or additional sub & super | \sideset{_1^2}{_3^4}\prod_a^b |
|
{}_1^2\!\Omega_3^4 |
||
Stacking | \overset{\alpha}{\omega} |
|
\underset{\alpha}{\omega} |
||
\overset{\alpha}{\underset{\gamma}{\omega}} |
||
\stackrel{\alpha}{\omega} |
||
Derivatives | x', y'', f', f'' |
|
x^\prime, y^{\prime\prime} |
||
Derivative dots | \dot{x}, \ddot{x} |
|
Underlines, overlines, vectors | \hat a \ \bar b \ \vec c |
|
\overrightarrow{a b} \ \overleftarrow{c d} \ \widehat{d e f} |
||
\overline{g h i} \ \underline{j k l} |
||
Arc (workaround) | \overset{\frown} {AB} |
|
Arrows | A \xleftarrow{n+\mu-1} B \xrightarrow[T]{n\pm i-1} C |
|
Overbraces | \overbrace{ 1+2+\cdots+100 }^{5050} |
|
Underbraces | \underbrace{ a+b+\cdots+z }_{26} |
|
Sum | \sum_{k=1}^N k^2 |
|
Sum (force \textstyle )
|
\textstyle \sum_{k=1}^N k^2 |
|
Sum in a fraction (default \textstyle )
|
\frac{\sum_{k=1}^N k^2}{a} |
|
Sum in a fraction (force \displaystyle )
|
\frac{\displaystyle \sum_{k=1}^N k^2}{a} |
|
Sum in a fraction (alternative limits style) | \frac{\sum\limits^{^N}_{k=1} k^2}{a} |
|
Product | \prod_{i=1}^N x_i |
|
Product (force \textstyle )
|
\textstyle \prod_{i=1}^N x_i |
|
Coproduct | \coprod_{i=1}^N x_i |
|
Coproduct (force \textstyle )
|
\textstyle \coprod_{i=1}^N x_i |
|
Limit | \lim_{n \to \infty}x_n |
|
Limit (force \textstyle )
|
\textstyle \lim_{n \to \infty}x_n |
|
Integral | \int\limits_{1}^{3}\frac{e^3/x}{x^2}\, dx |
|
Integral (alternative limits style) | \int_{1}^{3}\frac{e^3/x}{x^2}\, dx |
|
Integral (force \textstyle )
|
\textstyle \int\limits_{-N}^{N} e^x\, dx |
|
Integral (force \textstyle , alternative limits style)
|
\textstyle \int_{-N}^{N} e^x\, dx |
|
Double integral | \iint\limits_D \, dx\,dy |
|
Triple integral | \iiint\limits_E \, dx\,dy\,dz |
|
Quadruple integral | \iiiint\limits_F \, dx\,dy\,dz\,dt |
|
Line or path integral | \int_{(x,y)\in C} x^3\, dx + 4y^2\, dy |
|
Closed line or path integral | \oint_{(x,y)\in C} x^3\, dx + 4y^2\, dy |
|
Intersections | \bigcap_{i=_1}^n E_i |
|
Unions | \bigcup_{i=_1}^n E_i |
Fractions, matrices, multilines
[edit]Feature | Syntax | How it looks rendered |
---|---|---|
Fractions | \frac{2}{4}=0.5 or {2 \over 4}=0.5
|
|
Small fractions | \tfrac{2}{4} = 0.5
|
|
Large (normal) fractions | \dfrac{2}{4} = 0.5 \qquad \dfrac{2}{c + \dfrac{2}{d + \dfrac{2}{4}}} = a
|
|
Large (nested) fractions | \cfrac{2}{c + \cfrac{2}{d + \cfrac{2}{4}}} = a
|
|
Cancellations in fractions | \cfrac{x}{1 + \cfrac{\cancel{y}}{\cancel{y}}} = \cfrac{x}{2}
|
|
Binomial coefficients | \binom{n}{k}
|
|
Small binomial coefficients | \tbinom{n}{k}
|
|
Large (normal) binomial coefficients | \dbinom{n}{k}
|
|
Matrices | \begin{matrix}
x & y \\
z & v
\end{matrix}
|
|
\begin{vmatrix}
x & y \\
z & v
\end{vmatrix}
|
||
\begin{Vmatrix}
x & y \\
z & v
\end{Vmatrix}
|
||
\begin{bmatrix}
0 & \cdots & 0 \\
\vdots & \ddots & \vdots \\
0 & \cdots & 0
\end{bmatrix}
|
||
\begin{Bmatrix}
x & y \\
z & v
\end{Bmatrix}
|
||
\begin{pmatrix}
x & y \\
z & v
\end{pmatrix}
|
||
\bigl( \begin{smallmatrix}
a&b\\ c&d
\end{smallmatrix} \bigr)
|
||
Case distinctions | f(n) =
\begin{cases}
n/2, & \text{if }n\text{ is even} \\
3n+1, & \text{if }n\text{ is odd}
\end{cases}
|
|
Multiline equations | \begin{align}
f(x) & = (a+b)^2 \\
& = a^2+2ab+b^2 \\
\end{align}
|
|
\begin{alignat}{2}
f(x) & = (a-b)^2 \\
& = a^2-2ab+b^2 \\
\end{alignat}
|
||
Multiline equations (must define number of columns used ({lcr}) (should not be used unless needed) | \begin{array}{lcl}
z & = & a \\
f(x,y,z) & = & x + y + z
\end{array}
|
|
Multiline equations (more) | \begin{array}{lcr}
z & = & a \\
f(x,y,z) & = & x + y + z
\end{array}
|
|
Breaking up a long expression so that it wraps when necessary, at the expense of destroying correct spacing | <nowiki>
<math forcemathmode='native'>f(x) \,\!</math>
<math forcemathmode='native'>= \sum_{n=0}^\infty a_n x^n </math>
<math forcemathmode='native'>= a_0+a_1x+a_2x^2+\cdots</math>
</nowiki>
|
|
Simultaneous equations | \begin{cases}
3x + 5y + z \\
7x - 2y + 4z \\
-6x + 3y + 2z
\end{cases}
|
|
Arrays | \begin{array}{|c|c||c|} a & b & S \\
\hline
0&0&1\\
0&1&1\\
1&0&1\\
1&1&0\\
\end{array}
|
Parenthesizing big expressions, brackets, bars
[edit]Feature | Syntax | How it looks rendered |
---|---|---|
Bad | ( \frac{1}{2} )
|
|
Good | \left ( \frac{1}{2} \right )
|
You can use various delimiters with \left and \right:
Feature | Syntax | How it looks rendered |
---|---|---|
Parentheses | \left ( \frac{a}{b} \right )
|
|
Brackets | \left [ \frac{a}{b} \right ] \quad \left \lbrack \frac{a}{b} \right \rbrack
|
|
Braces | \left \{ \frac{a}{b} \right \} \quad \left \lbrace \frac{a}{b} \right \rbrace
|
|
Angle brackets | \left \langle \frac{a}{b} \right \rangle
|
|
Bars and double bars | \left | \frac{a}{b} \right \vert \quad \left \Vert \frac{c}{d} \right \|
|
|
Floor and ceiling functions: | \left \lfloor \frac{a}{b} \right \rfloor \quad \left \lceil \frac{c}{d} \right \rceil
|
|
Slashes and backslashes | \left / \frac{a}{b} \right \backslash
|
|
Up, down, and up-down arrows | \left \uparrow \frac{a}{b} \right \downarrow \quad \left \Uparrow \frac{a}{b} \right \Downarrow \quad \left \updownarrow \frac{a}{b} \right \Updownarrow
|
|
Delimiters can be mixed, as long as \left and \right match |
\left [ 0,1 \right ) \left \langle \psi \right |
|
|
Use \left. and \right. if you do not want a delimiter to appear |
\left . \frac{A}{B} \right \} \to X
|
|
Size of the delimiters | \big( \Big( \bigg( \Bigg( \dots \Bigg] \bigg] \Big] \big]
|
|
\big\{ \Big\{ \bigg\{ \Bigg\{ \dots \Bigg\rangle \bigg\rangle \Big\rangle \big\rangle
|
||
\big\| \Big\| \bigg\| \Bigg\| \dots \Bigg| \bigg| \Big| \big|
|
||
\big\lfloor \Big\lfloor \bigg\lfloor \Bigg\lfloor \dots \Bigg\rceil \bigg\rceil \Big\rceil \big\rceil
|
||
\big\uparrow \Big\uparrow \bigg\uparrow \Bigg\uparrow \dots \Bigg\Downarrow \bigg\Downarrow \Big\Downarrow \big\Downarrow
|
||
\big\updownarrow \Big\updownarrow \bigg\updownarrow \Bigg\updownarrow \dots \Bigg\Updownarrow \bigg\Updownarrow \Big\Updownarrow \big\Updownarrow
|
||
\big / \Big / \bigg / \Bigg / \dots \Bigg\backslash \bigg\backslash \Big\backslash \big\backslash
|
Equation numbering
[edit]The templates {{NumBlk}} and {{EquationRef}} can be used to number equations. The template {{EquationNote}} can be used to refer to a numbered equation from surrounding text. For example, the following syntax:
{{NumBlk|:|<math forcemathmode='native'>x^2 + y^2 + z^2 = 1 \,</math>|{{EquationRef|1}}}}
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:
As seen in equation ({{EquationNote|1}}), blah blah blah...
The result looks like this:
- As seen in equation (1), 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
[edit]Texvc cannot render arbitrary Unicode characters. Those it can handle can be entered by the expressions below. For others, such as Cyrillic, they can be entered as Unicode or HTML entities in running text, but cannot be used in displayed formulas.
Greek alphabet | |
---|---|
\Alpha \Beta \Gamma \Delta \Epsilon \Zeta \Eta \Theta
|
|
\Iota \Kappa \Lambda \Mu \Nu \Xi \Pi \Rho
|
|
\Sigma \Tau \Upsilon \Phi \Chi \Psi \Omega
|
|
\alpha \beta \gamma \delta \epsilon \zeta \eta \theta
|
|
\iota \kappa \lambda \mu \nu \xi \pi \rho
|
|
\sigma \tau \upsilon \phi \chi \psi \omega
|
|
\varepsilon \digamma \varkappa \varpi
|
|
\varrho \varsigma \vartheta \varphi
|
|
Hebrew symbols | |
\aleph \beth \gimel \daleth
|
|
Blackboard bold/scripts | |
\mathbb{ABCDEFGHI}
|
|
\mathbb{JKLMNOPQR}
|
|
\mathbb{STUVWXYZ}
|
|
Boldface | |
\mathbf{ABCDEFGHI}
|
|
\mathbf{JKLMNOPQR}
|
|
\mathbf{STUVWXYZ}
|
|
\mathbf{abcdefghijklm}
|
|
\mathbf{nopqrstuvwxyz}
|
|
\mathbf{0123456789}
|
|
Boldface (Greek) | |
\boldsymbol{\Alpha\Beta\Gamma\Delta\Epsilon\Zeta\Eta\Theta}
|
|
\boldsymbol{\Iota\Kappa\Lambda\Mu\Nu\Xi\Pi\Rho}
|
|
\boldsymbol{\Sigma\Tau\Upsilon\Phi\Chi\Psi\Omega}
|
|
\boldsymbol{\alpha\beta\gamma\delta\epsilon\zeta\eta\theta}
|
|
\boldsymbol{\iota\kappa\lambda\mu\nu\xi\pi\rho}
|
|
\boldsymbol{\sigma\tau\upsilon\phi\chi\psi\omega}
|
|
\boldsymbol{\varepsilon\digamma\varkappa\varpi}
|
|
\boldsymbol{\varrho\varsigma\vartheta\varphi}
|
|
Italics (default for Latin alphabet) | |
\mathit{0123456789}
|
|
Greek italics (default for lowercase Greek) | |
\mathit{\Alpha\Beta\Gamma\Delta\Epsilon\Zeta\Eta\Theta}
|
|
\mathit{\Iota\Kappa\Lambda\Mu\Nu\Xi\Pi\Rho}
|
|
\mathit{\Sigma\Tau\Upsilon\Phi\Chi\Psi\Omega}
|
|
Roman typeface | |
\mathrm{ABCDEFGHI}
|
|
\mathrm{JKLMNOPQR}
|
|
\mathrm{STUVWXYZ}
|
|
\mathrm{abcdefghijklm}
|
|
\mathrm{nopqrstuvwxyz}
|
|
\mathrm{0123456789}
|
|
Sans serif | |
\mathsf{ABCDEFGHI}
|
|
\mathsf{JKLMNOPQR}
|
|
\mathsf{STUVWXYZ}
|
|
\mathsf{abcdefghijklm}
|
|
\mathsf{nopqrstuvwxyz}
|
|
\mathsf{0123456789}
|
|
Sans serif Greek (capital only) | |
\mathsf{\Alpha \Beta \Gamma \Delta \Epsilon \Zeta \Eta \Theta}
|
|
\mathsf{\Iota \Kappa \Lambda \Mu \Nu \Xi \Pi \Rho}
|
|
\mathsf{\Sigma \Tau \Upsilon \Phi \Chi \Psi \Omega}
|
|
Calligraphy/script | |
\mathcal{ABCDEFGHI}
|
|
\mathcal{JKLMNOPQR}
|
|
\mathcal{STUVWXYZ}
|
|
Fraktur typeface | |
\mathfrak{ABCDEFGHI}
|
|
\mathfrak{JKLMNOPQR}
|
|
\mathfrak{STUVWXYZ}
|
|
\mathfrak{abcdefghijklm}
|
|
\mathfrak{nopqrstuvwxyz}
|
|
\mathfrak{0123456789}
|
Mixed text faces
[edit]Feature | Syntax | How it looks rendered |
---|---|---|
Italicised characters (spaces are ignored) | x y z
|
|
Non-italicised characters | \text{x y z}
|
|
Mixed italics (bad) | \text{if} n \text{is even}
|
|
Mixed italics (good) | \text{if }n\text{ is even}
|
|
Mixed italics (alternative: ~ or "\ " forces a space) | \text{if}~n\ \text{is even}
|
Color
[edit]Equations can use color:
{\color{Blue}x^2}+{\color{YellowOrange}2x}-{\color{OliveGreen}1}
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 Wikipedia:Manual of Style (accessibility)#Color.
Formatting issues
[edit]Spacing
[edit]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
|
|
quad space | a \quad b
|
|
text space | a\ b
|
|
text space without PNG conversion | a \mbox{ } b
|
|
large space | a\;b
|
|
medium space | a\>b
|
[not supported] |
small space | a\,b
|
|
tiny space (use for multiplication of factors) | ab
|
|
no space (use for multi-letter variables) | \mathit{ab}
|
|
small negative space | a\!b
|
Automatic spacing may be broken in very long expressions (because they produce an overfull hbox in TeX):
0+1+2+3+4+5+6+7+8+9+10+11+12+13+14+15+16+17+18+19+20+\cdots
This can be remedied by putting a pair of braces { } around the whole expression:
{0+1+2+3+4+5+6+7+8+9+10+11+12+13+14+15+16+17+18+19+20+\cdots}
Alignment with normal text flow
[edit]Due to the default CSS
img.tex { vertical-align: middle; }
an inline expression like 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.
Centering
[edit]We introduce the new attribute display with the two options "inline" and "block".
Inline
[edit]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
[edit]The sum converges to 2.
The next line-width is not disturbed by large operators.
The code for the math example reads:
<math forcemathmode='native' display="inline">\sum_{i=0}^\infty 2^{-i}</math>
Technical implementation
[edit]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
[edit]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
[edit]In block-style the equation is rendered in its own paragraph and the operator are rendered consuming less horizontal space.
Example
[edit]The equation is used in a joke about mathematicians entering a bar and ordering beer.
It was entered as
<math forcemathmode='native' display="block">\text{geometric series:}\quad \sum_{i=0}^\infty 2^{-i}=2 </math>
Technical implementation
[edit]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
[edit]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
[edit]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
[edit]The sum converges to 2.
The next line-width is disturbed by large operators.
The code for the math example reads:
<math forcemathmode='native'>\sum_{i=0}^\infty 2^{-i}</math>
The equation
is used in a joke about mathematicians entering a bar and ordering beer.
It was entered as
<math forcemathmode='native'>\text{geometric series:}\quad \sum_{i=0}^\infty 2^{-i}=2 </math>
Examples of implemented TeX formulas
[edit]Quadratic polynomial
[edit]
<math forcemathmode='native'>ax^2 + bx + c = 0</math>
Quadratic formula
[edit]
<math forcemathmode='native'>x={-b\pm\sqrt{b^2-4ac} \over 2a}</math>
Tall parentheses and fractions
[edit]
<math forcemathmode='native'>2 = \left(
\frac{\left(3-x\right) \times 2}{3-x}
\right)</math>
<math forcemathmode='native'>S_{\text{new}} = S_{\text{old}} - \frac{ \left( 5-T \right) ^2} {2}</math>
Integrals
[edit]
<math forcemathmode='native'>\int_a^x \!\!\!\int_a^s f(y)\,dy\,ds
= \int_a^x f(y)(x-y)\,dy</math>
Matrices and determinants
[edit]
<math forcemathmode='native'>\det(\mathsf{A}-\lambda\mathsf{I}) = 0</math>
Summation
[edit]
<math forcemathmode='native'>\sum_{i=0}^{n-1} i</math>
<math forcemathmode='native'>\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
[edit]
<math forcemathmode='native'>u'' + p(x)u' + q(x)u=f(x),\quad x>a</math>
Complex numbers
[edit]
<math forcemathmode='native'>|\bar{z}| = |z|,
|(\bar{z})^n| = |z|^n,
\arg(z^n) = n \arg(z)</math>
Limits
[edit]
<math forcemathmode='native'>\lim_{z\rightarrow z_0} f(z)=f(z_0)</math>
Integral equation
[edit]
<math forcemathmode='native'>\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
[edit]
<math forcemathmode='native'>\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
[edit]
<math forcemathmode='native'>
f(x) =
\begin{cases}
1 & -1 \le x < 0 \\
\frac{1}{2} & x = 0 \\
1 - x^2 & \text{otherwise}
\end{cases}
</math>
Prefixed subscript
[edit]
<math forcemathmode='native'>{}_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
[edit]
<math forcemathmode='native'>\frac{a}{b}\ \tfrac{a}{b}</math>
Area of a quadrilateral
[edit]
<math forcemathmode='native'>S=dD\,\sin\alpha\!</math>
Volume of a sphere-stand
[edit]
<math forcemathmode='native'>V=\frac16\pi h\left[3\left(r_1^2+r_2^2\right)+h^2\right]</math>
Multiple equations
[edit]
Test cases from parserTests
[edit]- pre-save transform: comment containing math
- BUG 1887: A
<math>
with a thumbnail- we don't render math in the parsertests by default, so math is not stripped and turns up as escaped <math> tags. - BUG 1887, part 2: A
<math>
with a thumbnail- math enabled - Math section safety when disabled
- BUG 26380: Add \widetilde support to match \widehat
- BUG 27324: Euro symbol for math
- BUG 27754: Archaic Greek letters for math (may require texlive-lang-greek)
- BUG 19547: Apostrophe / single quotes in math \text{...}
- BUG 6722: Spacing fix for functions in math HTML output:
- BUG 18912: Add \sen function for Spanish sin to math
- BUG 18912: \operatorname{sen} x gets wrong spacing in math:
- BUG 31442: Multiple math accents without braces fails to parse:
- BUG 31442: Math accents with math font fail to parse if braces not used:
- BUG 31824: Empty math tag returns uniq:
- BUG 31824: Empty math tag returns uniq:
Additional tests
[edit]