Extension:Math/MathJax testing

From MediaWiki.org
Jump to: navigation, search
When you click a MathJax formula, you get an instantly zoomed version of it for improved readability. MathJax formulas can also copied and pasted, and scaled without loss of quality for printing, higher resolution displays, or better readability.

MathJax is a JavaScript display engine for mathematics. It's an alternative to PNG rendering for Wikimedia sites. MathJax is slower to render, but more scalable (infinite zoom) and manipulable than PNG.

MathJax is currently enabled on this wiki (mediawiki.org), but you have to explicitly enable it in your user preferences (under Appearance -> Math). Otherwise you'll still see the old-school PNG images.

How to test:

Examples and tests[edit]

Following examples copied from English Wikipedia math help page.

Quadratic polynomial[edit]

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

Quadratic polynomial (force PNG rendering)[edit]

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

Quadratic formula[edit]

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

Tall parentheses and fractions[edit]

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

Integrals[edit]

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

Summation[edit]

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

Differential equation[edit]

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

Complex numbers[edit]

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

Limits[edit]

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

Integral equation[edit]

<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[edit]

<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[edit]

<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[edit]

<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[edit]

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

Area of a quadrilateral[edit]

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

Volume of a sphere-stand[edit]

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

Multiple equations[edit]

 
<math>{\begin{aligned}q_{1}&=\cos 
\left({\frac {\phi -\psi }{2}}\right)\sin \left({\frac {\theta 
}{2}}\right)\\q_{2}&=\sin \left({\frac {\phi -\psi }{2}}\right)\sin 
 \left({\frac {\theta }{2}}\right)\\q_{3}&=\sin \left({\frac {\phi 
+\psi }{2}}\right)\cos \left({\frac {\theta 
}{2}}\right)\\q_{4}&=\cos \left({\frac {\phi +\psi }{2}}\right)\cos 
 \left({\frac {\theta }{2}}\right)\end{aligned}}</math>

task T38059[edit]

Failed to parse (unknown function "\upgamma"): {\displaystyle {{\upgamma}_{\text{S}}}={{\uprho}_{\text{S}}}\cdot \text{g}\quad[\text{kN}/\text{m}^\text{3}}

Equation references[edit]

Failed to parse (unknown function "\begin{equation}"): {\displaystyle \begin{equation}\label{eq1} x = \sin(y) \end{equation}}

The above has label Failed to parse (unknown function "\ref"): {\displaystyle \ref{eq1}}

<math>\begin{equation}\label{eq1}
 x = \sin(y)
 \end{equation}</math>
The above has label <math>\ref{eq1}</math>

CJK[edit]

Failed to parse (syntax error): {\displaystyle 中文}
(<math>\text{中文}</math> displays nothing)
Failed to parse (syntax error): {\displaystyle 中\text{文}}

Textstyles[edit]

should render as Failed to parse (unknown function "\tt"): {\displaystyle {\tt teletype\ text}}
should render as Failed to parse (unknown function "\sf"): {\displaystyle {\sf sanserif\ text}}

Also in Latex 2e

Failed to parse (unknown function "\textmd"): {\displaystyle \textmd{midsize text}} should render as Failed to parse (unknown function "\md"): {\displaystyle {\md midsize\ text}}
Failed to parse (unknown function "\textup"): {\displaystyle \textup{upper case text}} should render as Failed to parse (unknown function "\up"): {\displaystyle {\up upper\ case\ text}}
Failed to parse (unknown function "\textsl"): {\displaystyle \textsl{slanted text}} should render as Failed to parse (unknown function "\sl"): {\displaystyle {\sl slanted\ text}}
Failed to parse (unknown function "\textsc"): {\displaystyle \textsc{small cap text}} should render as Failed to parse (unknown function "\sc"): {\displaystyle {\sc small\ cap\ text}}

Nesting

Failed to parse (unknown function "\upgamma"): {\displaystyle \textbf{\upgamma{Mathroman}}}

Math font styles

Failed to parse (unknown function "\mathnormal"): {\displaystyle \mathnormal{normal\ text}}


Sizes

Failed to parse (unknown function "\tiny"): {\displaystyle \tiny tiny}
Failed to parse (unknown function "\scriptsize"): {\displaystyle \scriptsize scriptsize}
Failed to parse (unknown function "\footnotesize"): {\displaystyle \footnotesize footnotesize}
Failed to parse (unknown function "\small"): {\displaystyle \small small}
Failed to parse (unknown function "\normalsize"): {\displaystyle \normalsize normalsize}
Failed to parse (unknown function "\large"): {\displaystyle \large large}
Failed to parse (unknown function "\Large"): {\displaystyle \Large Large}
Failed to parse (unknown function "\LARGE"): {\displaystyle \LARGE LARGE}
Failed to parse (unknown function "\huge"): {\displaystyle \huge huge}
Failed to parse (unknown function "\Huge"): {\displaystyle \Huge Huge}