This site is supported by donations to The OEIS Foundation.
Template:Math
[⧼Purge⧽ Template:Math]
MS Edge chops the LaTeX PNG’s, whether we use the {{math}} template or the <math>...</math> tags. |
NOTE: The {{math}} [experimental] OEIS Wiki utility template typesets [simple enough] mathematical expressions and/or their numerical results in either HTML+CSS or LaTeX, using MediaWiki templates (this template and mathematical formatting templates/mathematical function templates) without any JavaScript whatsoever [neither client-side nor server-side] (since the OEIS Wiki [MediaWiki] server currently supports neither client-side MathJax nor server-side MathJax) which avoids the “Flash Of Unstyled Content” issue that affects the client-side JavaScript based [client-side] MathJax. |
Currently, the OEIS Wiki server is configured to render mathematical expressions typeset in TeX (LaTeX) into raster (bitmap) images (usually PNG format, file extension .png) generated by Extension:Math installed on the MediaWiki server. Those raster images put an extra load on the MediaWiki server, take extra bandwith, slow down the page rendering, don't scale nicely from a small handheld display to a large monitor/projector display, as do vector images (e.g. SVG format, file extension .svg).
The raster images for inline math also don't usually align properly when used with LaTeX \textstyle
(which we should be using if the font size of the rendered .png images matched with the font size of the surrounding text) or the \scriptstyle
kludge (which we [unfortunately and inappropriately] have to resort using to get a closer match of font sizes, with the caveat that we don't get the proper spacing around binary operators and/or relations). The raster images for standalone math look great with LaTeX \displaystyle
though. (The font size of \textstyle
and \displaystyle
are the same and should match the font size of the surrounding text as one observes in any mathematics book. The difference is, for example, in the use of subscript/superscript notation for text style large operators (e.g. sum, product, integral) instead of underscript/overscript notation for display style).
Usage
-
{{math|HTML+CSS markup (mathematical expression)|tex = LaTeX code (mathematical expression)|format}}
where format is among
-
$
: LaTeX code (inline text style); -
$$
: LaTeX code (display style); -
&
: HTML+CSS markup (inline text style); -
&&
: HTML+CSS markup (display style).
Contents
- 1 Usage
- 2 Maintenance categories for the {{math}} template or the <math>...</math> tag
- 3 Enforcing (or not) HTML+CSS or LaTeX
- 4 Baseline alignment with inline style
- 5 Examples
- 5.1 1.3688081078532235\ldots
- 5.2 −1.3688081078532235\ldots
- 5.3 { }_2 F_3
- 5.4 x^3 + 2x^2 + 10x - 20
- 5.5 1 + \frac{22}{60} + \frac{7}{60^2} + \frac{42}{60^3} + \frac{33}{60^4} + \frac{4}{60^5} + \frac{40}{60^6}
- 5.6 \sqrt[7]{2}
- 5.7 Value of \sqrt[7]{2}
- 5.8 \sqrt[7]{2} = value of \sqrt[7]{2}
- 5.9 (x^2 + 1)(y^3 - 1)^2
- 5.10 (x - h)^2 / a^2 - (y - k)^2 / b^2 = 1
- 5.11 \frac{x^2 + 1}{y^3 - 1}
- 5.12 \frac{x^2 + xy + 1}{y^3 - 1}
- 5.13 \frac{x^2 + \sqrt{xy} + 1}{y^3 - 1}
- 5.14 \frac{x^2 + \sqrt{\tfrac{x - 1}{y}} + 1}{y^3 - 1}
- 5.15 \sqrt[31]{x^2 - \left( \tfrac{x + 1}{z - 1} \right) + 1}
- 5.16 Examples with boxes
- 5.17 Examples with color
- 5.18 Examples with wiki links
- 5.19 More examples
- 6 Tests
- 7 Alternatives
- 8 Comparison of math renderings for MathML (Firefox) vs MathJax (Firefox) vs PNG (Firefox) vs Chrome Server Side SVG
- 9 See also
- 10 Notes
- 11 References
- 12 External links
Maintenance categories for the {{math}}
template or the <math>...</math>
tag
- Category:Pages using the math template without HTML+CSS as first argument
- Category:Pages using the math template without the tex argument
- Category:Pages with math errors (lists pages with LaTeX syntax errors)
- Category:Pages with math render errors (lists pages where a temporary error occurred in the mathematics LaTeX rendering process)
Enforcing (or not) HTML+CSS or LaTeX
Eventually, the OEIS administrators might decide to enforce LaTeX for inline [textstyle] math and/or standalone [displaystyle] math, to show PNG's or to support either server-side or client-side MathJax to get HTML+CSS or MathML or SVG's. Another possibility would be to let the user choose between the HTML+CSS obtained from the templates or LaTeX to be used by MathJax.
Enforcing (or not) HTML+CSS or LaTeX for inline [textstyle] math
To enforce (or not) HTML+CSS or LaTeX for inline [textstyle] math: {{math/textstyle}} with one of only 3 options: htm
, tex
or <blank>.
htm
or tex
to tell the {{math}} template how to render text style throughout OEIS Wiki, <blank> (empty string) to let {{math}} choose from &
or $
argument.
NOTE: TO USE OPTIONS htm
or tex
ALL {{math|...|&}} AND {{math|...|$}} TEMPLATE CALLS THROUGHOUT OEIS WIKI MUST BE PROVIDED WITH HTML+CSS as {{{1}}}
and LaTeX as {{{tex}}}
!
Enforcing (or not) HTML+CSS or LaTeX for standalone [displaystyle] math
To enforce (or not) HTML+CSS or LaTeX for standalone [displaystyle] math: {{math/displaystyle}} with one of only 3 options: htm
, tex
or <blank>.
htm
or tex
to tell the {{math}} template how to render text style throughout OEIS Wiki, <blank> (empty string) to let {{math}} choose from &&
or $$
argument.
NOTE: TO USE OPTIONS htm
or tex
ALL {{math|...|&&}} AND {{math|...|$$}} TEMPLATE CALLS THROUGHOUT OEIS WIKI MUST BE PROVIDED WITH HTML+CSS as {{{1}}}
and LaTeX as {{{tex}}}
!
Baseline alignment with inline style
The following compares (for LaTeX rendered .png images and HTML+CSS) how good/bad is the baseline alignment with inline style:
- the polynomials <math>\scriptstyle ax + b </math> and <math>\scriptstyle x^3 + x^2 + 1 </math> render as: the polynomials and (see how LaTeX uses vertical-align: middle; by default for the rendered images)
- the polynomials <math style="vertical-align: baseline;">\scriptstyle ax + b </math> and <math style="vertical-align: baseline;">\scriptstyle x^3 + x^2 + 1 </math> render as: the polynomials and (using vertical-align: baseline; the baselines [sort of] align properly in this case; although vertical-align: middle; is what's needed if we have e.g. fractions)
- the polynomials {{math| ''ax'' + ''b'' |&}} and {{math| ''x''{{^|3}} + ''x''{{^|2}} + 1 |&}} render as: the polynomials
andax + b
(see how the baselines of the polynomials align properly with the surrounding text, at least when the tweaking of the {{math}} template is completed...).x 3 + x 2 + 1
LaTeX has the four style commands:
- \displaystyle (display style is the default style; LaTeX uses Computer Modern 10 point font; big operators, e.g. sum, product and integral, use underscript/overscript notation; vertical-align: middle; used as default for the rendered .png images).
- \textstyle (LaTeX uses Computer Modern 10 point font; big operators, e.g. sum, product and integral, use subscript/superscript notation; unfortunately this font is larger than the surrounding text font used in OEIS Wiki, and the baseline often doesn't align properly because of the use of vertical-align: middle; as default for the rendered .png images);
- \scriptstyle (for subscripts or superscripts; LaTeX uses Computer Modern 7 point font; unfortunately, this is not that good a substitute for \textstyle since this font is somewhat smaller than the surrounding text font used in OEIS Wiki, and the baseline often doesn't align properly because of the use of vertical-align: middle; as default for the rendered .png images);
- \scriptscriptstyle (for subscripts/superscripts of subscripts/superscripts of ..., i.e. second order and higher; LaTeX uses Computer Modern 5 point font);
Examples (since the font size of \textstyle is much larger than for the surrounding HTML text, while the font size of \scriptstyle almost matches, albeit a bit too small, we [unfortunately and inappropriately] have to resort to the use of \scriptstyle for inline formulas):
- default style (\displaystyle): (...) where
- For block formulas, not for inline formulas, operators use underscripts and overscripts.
- \displaystyle: (...) where
- For block formulas, not for inline formulas, operators use underscripts and overscripts.
- \textstyle: (...) where and are (...); (...) we have since (...);
- For inline formulas, not for block formulas, operators use subscripts and superscripts, baselines should align but they don't because the PNG images have the vertical align: middle; (which works best for multiple row expressions, e.g. rational expressions, sums, products, and integrals) as default CSS attribute, instead of vertical align: baseline; (which works best for single row expressions, e.g. polynomial expressions); font size is larger than for the surrounding HTML text.
- \scriptstyle: (...) where and are (...); (...) we have since (...);
- For first level of subscripts, superscripts, underscripts and overscripts.
- \scriptscriptstyle: (...) where and are (...); (...) we have since (...);
- For second (and higher) level of subscripts, superscripts, underscripts and overscripts.
\textstyle
vs \scriptstyle
Note: If we can figure out how to reduce the width of the math element by 75% (when we scale it down by 75%) we could use \textstyle
instead of the \scriptstyle
kludge for inline LaTeX with the {{math}} template.
The code
-
lorem ipsum <math>\textstyle ax + b, \text{ and } x^3 + x^2 + 1</math> lorem ipsum
yields the text style inline LaTeX
- lorem ipsum lorem ipsum
The code
-
lorem ipsum <math height="75%" width="75%">\textstyle ax + b, \text{ and } x^3 + x^2 + 1</math> lorem ipsum
yields the text style inline LaTeX (can't resize this way!)
- lorem ipsum lorem ipsum
The code
-
lorem ipsum <math style="height: 75%; width: 75%;">\textstyle ax + b, \text{ and } x^3 + x^2 + 1</math> lorem ipsum
yields the text style inline LaTeX (you get 75% of the window width this way, not what we want!)
- lorem ipsum lorem ipsum
The code
-
lorem ipsum <span style="{{transform-scale|0.75|0.75}}"><math>\textstyle ax + b</math></span> lorem ipsum
yields the scaled down 75% text style inline LaTeX (unfortunately, we have to figure out how to reduce the width of the math element by 75%)
- lorem ipsum lorem ipsum
The code
-
lorem ipsum <span style="margin: 0 -0.5em 0 -0.5em;<!-- trbl --> {{transform-scale|0.75|0.75}}"><math>\textstyle ax + b</math></span> lorem ipsum
yields the scaled down 75% text style inline LaTeX (unfortunately, we have to figure out how to reduce the width of the math element by 75%)
- lorem ipsum lorem ipsum
The code
-
lorem ipsum <span style="margin: 0 -0.6em 0 -0.6em;<!-- trbl --> {{transform-scale|0.7|0.7}}"><math>\textstyle ax + b</math></span> lorem ipsum
yields the scaled down 70% text style inline LaTeX (unfortunately, we have to figure out how to reduce the width of the math element by 70%)
- lorem ipsum lorem ipsum
The code
-
lorem ipsum <span style="margin: 0 -2em 0 -2em;<!-- trbl --> {{transform-scale|0.75|0.75}}"><math>\textstyle ax + b, \text{ and } x^3 + x^2 + 1</math></span> lorem ipsum
yields the scaled down 75% text style inline LaTeX (unfortunately, we have to figure out how to reduce the width of the math element by 75%)
- lorem ipsum lorem ipsum
The code
-
lorem ipsum <span style="margin: 0 -2.4em 0 -2.4em;<!-- trbl --> {{transform-scale|0.7|0.7}}"><math>\textstyle ax + b, \text{ and } x^3 + x^2 + 1</math></span> lorem ipsum
yields the scaled down 70% text style inline LaTeX (unfortunately, we have to figure out how to reduce the width of the math element by 70%)
- lorem ipsum lorem ipsum
The code
-
lorem ipsum <math>\scriptstyle ax + b, \text{ and } x^3 + x^2 + 1</math> lorem ipsum
yields the script style inline LaTeX (the \scriptstyle
kludge doesn't give the spacings we need around binary operators and/or relations)
- lorem ipsum lorem ipsum
Examples
The following examples are shown on a light grey background, i.e. , to insure that the HTML+CSS and LaTeX renderings have a transparent background.
Note how the [single row] inline mathematical expressions have proper baseline alignment with the surrounding text (it should, once the tweaking is done...) when using &
(inline style HTML+CSS markup) format, as opposed to $
(inline style LaTeX markup) format.
1.3688081078532235\ldots
The code : {{repeat|2|{{repeat|5|yadda{{nbsp}}}}{{nl}}}}before {{math|1.3688081078532235{{...|ldots}}|&}} after{{repeat|2|{{nl}}{{repeat|5|yadda{{nbsp}}}}}}
yields the text style HTML+CSS
- yadda yadda yadda yadda yadda
yadda yadda yadda yadda yadda
before
after1.3688081078532235…
yadda yadda yadda yadda yadda
yadda yadda yadda yadda yadda
The code : {{repeat|2|{{repeat|5|yadda{{nbsp}}}}{{nl}}}}before {{math|1.3688081078532235{{...|ldots|tex}}|$}} after{{repeat|2|{{nl}}{{repeat|5|yadda{{nbsp}}}}}}
yields the text style LaTeX
- yadda yadda yadda yadda yadda
yadda yadda yadda yadda yadda
before after
yadda yadda yadda yadda yadda
yadda yadda yadda yadda yadda
The code : before {{math|1.3688081078532235{{...|ldots}}|&&}} after
yields the display style HTML+CSS
1.3688081078532235…
The code : before {{math| 1.3688081078532235{{...|ldots|tex}} |$$}} after
yields the display style LaTeX
−1.3688081078532235\ldots
The code : {{repeat|2|{{repeat|5|yadda{{nbsp}}}}{{nl}}}}before {{math|{{op|-}}1.3688081078532235{{...|ldots}}|&}} after{{repeat|2|{{nl}}{{repeat|5|yadda{{nbsp}}}}}}
yields the text style HTML+CSS
- yadda yadda yadda yadda yadda
yadda yadda yadda yadda yadda
before
after− 1.3688081078532235…
yadda yadda yadda yadda yadda
yadda yadda yadda yadda yadda
The code : {{repeat|2|{{repeat|5|yadda{{nbsp}}}}{{nl}}}}before {{math|-1.3688081078532235{{...|ldots|tex}}|$}} after{{repeat|2|{{nl}}{{repeat|5|yadda{{nbsp}}}}}}
yields the text style LaTeX
- yadda yadda yadda yadda yadda
yadda yadda yadda yadda yadda
before after
yadda yadda yadda yadda yadda
yadda yadda yadda yadda yadda
The code : before {{math|{{op|-}}1.3688081078532235{{...|ldots}}|&&}} after
yields the display style HTML+CSS
−1.3688081078532235…
The code : before {{math|-1.3688081078532235{{...|ldots|tex}}|$$}} after
yields the display style LaTeX
{ }_2 F_3
The code : {{repeat|2|{{repeat|5|yadda{{nbsp}}}}{{nl}}}}before {{math|{{sub|2}}{{sp|1}}''F''{{sp|-1}}{{sub|3}}|&}} after{{repeat|2|{{nl}}{{repeat|5|yadda{{nbsp}}}}}}
yields the text style HTML+CSS
- yadda yadda yadda yadda yadda
yadda yadda yadda yadda yadda
before
after2 F3
yadda yadda yadda yadda yadda
yadda yadda yadda yadda yadda
The code : {{repeat|2|{{repeat|5|yadda{{nbsp}}}}{{nl}}}}before {{math|{ }_2 F_3|$}} after{{repeat|2|{{nl}}{{repeat|5|yadda{{nbsp}}}}}}
yields the text style LaTeX
- yadda yadda yadda yadda yadda
yadda yadda yadda yadda yadda
before after
yadda yadda yadda yadda yadda
yadda yadda yadda yadda yadda
The code : before {{math|{{sub|2}}{{sp|1}}''F''{{sp|-1}}{{sub|3}}|&&}} after
yields the display style HTML+CSS
2 F3
The code : before {{math|{ }_2 F_3|$$}} after
yields the display style LaTeX
x^3 + 2x^2 + 10x - 20
The code : {{repeat|2|{{repeat|5|yadda{{nbsp}}}}{{nl}}}}before {{math|''x''{{^|3}} {{op|+}} 2''x''{{^|2}} {{op|+}} 10''x'' {{op|-}} 20|&}} after{{repeat|2|{{nl}}{{repeat|5|yadda{{nbsp}}}}}}
yields the text style HTML+CSS
- yadda yadda yadda yadda yadda
yadda yadda yadda yadda yadda
before
afterx 3 + 2x 2 + 10x − 20
yadda yadda yadda yadda yadda
yadda yadda yadda yadda yadda
The code : {{repeat|2|{{repeat|5|yadda{{nbsp}}}}{{nl}}}}before {{math|''x''{{^|3|tex}} {{op|+}} 2''x''{{^|2|tex}} {{op|+}} 10''x'' {{op|-}} 20|$}} after{{repeat|2|{{nl}}{{repeat|5|yadda{{nbsp}}}}}}
yields the text style LaTeX
- yadda yadda yadda yadda yadda
yadda yadda yadda yadda yadda
before after
yadda yadda yadda yadda yadda
yadda yadda yadda yadda yadda
The code : {{math|''x''{{^|3}} {{op|+}} 2''x''{{^|2}} {{op|+}} 10''x'' {{op|-}} 20|&&}}
yields the display style HTML+CSS
x 3 + 2x 2 + 10x − 20
The code : {{math|''x''{{^|3|tex}} {{op|+}} 2''x''{{^|2|tex}} {{op|+}} 10''x'' {{op|-}} 20|$$}}
yields the display style LaTeX
1 + \frac{22}{60} + \frac{7}{60^2} + \frac{42}{60^3} + \frac{33}{60^4} + \frac{4}{60^5} + \frac{40}{60^6}
The code : {{repeat|2|{{repeat|5|yadda{{nbsp}}}}{{nl}}}}before {{math|1 + {{tfrac|22|60}} + {{tfrac|7|60{{^|2}}}} + {{tfrac|42|60{{^|3}}}} + {{tfrac|33|60{{^|4}}}} + {{tfrac|4|60{{^|5}}}} + {{tfrac|40|60{{^|6}}}}|&}} after{{repeat|2|{{nl}}{{repeat|5|yadda{{nbsp}}}}}}
yields the text style HTML+CSS
- yadda yadda yadda yadda yadda
yadda yadda yadda yadda yadda
before
after1 +
+22 60
+7 60 2
+42 60 3
+33 60 4
+4 60 5 40 60 6
yadda yadda yadda yadda yadda
yadda yadda yadda yadda yadda
The code : {{repeat|2|{{repeat|5|yadda{{nbsp}}}}{{nl}}}}before {{math|1 + {{frac|22|60|tex}} + {{frac|7|60{{^|2|tex}}|tex}} + {{frac|42|60{{^|3|tex}}|tex}} + {{frac|33|60{{^|4|tex}}|tex}} + {{frac|4|60{{^|5|tex}}|tex}} + {{frac|40|60{{^|6|tex}}|tex}}|$}} after{{repeat|2|{{nl}}{{repeat|5|yadda{{nbsp}}}}}}
yields the text style LaTeX
- yadda yadda yadda yadda yadda
yadda yadda yadda yadda yadda
before after
yadda yadda yadda yadda yadda
yadda yadda yadda yadda yadda
The code : {{math|1 + {{frac|22|60}} + {{frac|7|60{{^|2}}}} + {{frac|42|60{{^|3}}}} + {{frac|33|60{{^|4}}}} + {{frac|4|60{{^|5}}}} + {{frac|40|60{{^|6}}}}|&&}}
yields the display style HTML+CSS
1 +
+22 60
+7 60 2
+42 60 3
+33 60 4
+4 60 5 40 60 6
The code : {{math|1 + {{frac|22|60|tex}} + {{frac|7|60{{^|2|tex}}|tex}} + {{frac|42|60{{^|3|tex}}|tex}} + {{frac|33|60{{^|4|tex}}|tex}} + {{frac|4|60{{^|5|tex}}|tex}} + {{frac|40|60{{^|6|tex}}|tex}}|$$}}
yields the display style LaTeX
\sqrt[7]{2}
The code : {{repeat|2|{{repeat|5|yadda{{nbsp}}}}{{nl}}}}before {{math|{{root|2|7}}|&}} after{{repeat|2|{{nl}}{{repeat|5|yadda{{nbsp}}}}}}
yields the text style HTML+CSS
- yadda yadda yadda yadda yadda
yadda yadda yadda yadda yadda
before
after7√ 2
yadda yadda yadda yadda yadda
yadda yadda yadda yadda yadda
The code : {{repeat|2|{{repeat|5|yadda{{nbsp}}}}{{nl}}}}before {{math|{{root|2|7|tex}}|$}} after{{repeat|2|{{nl}}{{repeat|5|yadda{{nbsp}}}}}}
yields the text style LaTeX
- yadda yadda yadda yadda yadda
yadda yadda yadda yadda yadda
before after
yadda yadda yadda yadda yadda
yadda yadda yadda yadda yadda
The code : {{math|{{root|2|7}}|&&}}
yields the display style HTML+CSS
- 7√ 2
The code : {{math|{{root|2|7|tex}}|$$}}
yields the display style LaTeX
Value of \sqrt[7]{2}
The code : before {{math|{{root|2|7|#}}{{...|ldots}}|&}} after
yields the text style HTML+CSS
- before
after1.1040895136738…
The code : before {{math|{{root|2|7|#}}{{...|ldots|tex}}|$}} after
yields the text style LaTeX
- before after
The code : {{math|{{root|2|7|#}}{{...|ldots}}|&&}}
yields the display style HTML+CSS
1.1040895136738…
The code : {{math|{{root|2|7|#}}{{...|ldots|tex}}|$$}}
yields the display style LaTeX
\sqrt[7]{2} = value of \sqrt[7]{2}
The code : before {{math|{{root|2|7}} {{=}} {{root|2|7|#}}{{...|ldots}}|&}} after
yields the text style HTML+CSS
- before
after7√ 2= 1.1040895136738…
The code : before {{math|{{root|2|7|tex}} {{=}} {{root|2|7|#}}{{...|ldots|tex}}|$}} after
yields the text style LaTeX
- before after
The code : {{math|{{root|2|7}} {{=}} {{root|2|7|#}}{{...|ldots}}|&&}}
yields the display style HTML+CSS
- 7√ 2= 1.1040895136738…
The code : {{math|{{root|2|7|tex}} {{=}} {{root|2|7|#}}{{...|ldots|tex}}|$$}}
yields the display style LaTeX
(x^2 + 1)(y^3 - 1)^2
The code : before {{math|({{sp|1}}''x''{{^|2}} {{op|+}} 1){{sp|1}}({{sp|2}}''y''{{^|3}} {{op|-}} 1){{^|2}}|&}} after
yields the text style HTML+CSS
- before
after( x 2 + 1) ( y 3 − 1) 2
The code : before {{math|(''x''{{^|2|tex}} {{op|+}} 1) (''y''{{^|3|tex}} {{op|-}} 1){{^|2|tex}}|$}} after
yields the text style LaTeX
- before after
The code : {{math|({{sp|1}}''x''{{^|2}} {{op|+}} 1){{sp|1}}({{sp|2}}''y''{{^|3}} {{op|-}} 1){{^|2}}|&&}}
yields the display style HTML+CSS
( x 2 + 1) ( y 3 − 1) 2
The code : {{math|(''x''{{^|2|tex}} {{op|+}} 1) (''y''{{^|3|tex}} {{op|-}} 1){{^|2|tex}}|$$}}
yields the display style LaTeX
(x - h)^2 / a^2 - (y - k)^2 / b^2 = 1
The code : before {{math|{{frac|({{sp|1}}''x'' {{op|-}} ''h''{{sp|1}}){{^|2}}|''a''{{^|2}}}} {{op|-}} {{frac|({{sp|2}}''y'' {{op|-}} ''k''{{sp|1}}){{^|2}}|''b''{{^|2}}}} {{=}} 1|&}} after
yields the text style HTML+CSS
- before
after
−( x − h ) 2 a 2
= 1( y − k ) 2 b 2
The code : before {{math|{{frac|(''x'' {{op|-}} ''h''){{^|2|tex}}|''a''{{^|2|tex}}|tex}} {{op|-}} {{frac|(''y'' {{op|-}} ''k''){{^|2|tex}}|''b''{{^|2|tex}}|tex}} {{=}} 1|$}} after
yields the text style LaTeX
- before after
The code : {{math|{{frac|({{sp|1}}''x'' {{op|-}} ''h''{{sp|1}}){{^|2}}|''a''{{^|2}}}} {{op|-}} {{frac|({{sp|2}}''y'' {{op|-}} ''k''{{sp|1}}){{^|2}}|''b''{{^|2}}}} {{=}} 1|&&}}
yields the display style HTML+CSS
−( x − h ) 2 a 2
= 1( y − k ) 2 b 2
The code : {{math|{{frac|(''x'' {{op|-}} ''h''){{^|2|tex}}|''a''{{^|2|tex}}|tex}} {{op|-}} {{frac|(''y'' {{op|-}} ''k''){{^|2|tex}}|''b''{{^|2|tex}}|tex}} {{=}} 1|$$}}
yields the display style LaTeX
\frac{x^2 + 1}{y^3 - 1}
The code : before {{math|{{frac|''x''{{^|2}} {{op|+}} 1|''y''{{^|3}} {{op|-}} 1|htm}}|&}} after
yields the text style HTML+CSS
- before
afterx 2 + 1 y 3 − 1
The code : before {{math|{{frac|''x''{{^|2|tex}} {{op|+}} 1|''y''{{^|3|tex}} {{op|-}} 1|tex}}|$}} after
yields the text style LaTeX
- before after
The code : {{math|{{frac|''x''{{^|2}} {{op|+}} 1|''y''{{^|3}} {{op|-}} 1|HTM}}|&&}}
yields the display style HTML+CSS
x 2 + 1 y 3 − 1
The code : {{math|{{frac|''x''{{^|2|tex}} {{op|+}} 1|''y''{{^|3|tex}} {{op|-}} 1|tex}}|$$}}
yields the display style LaTeX
\frac{x^2 + xy + 1}{y^3 - 1}
The code : before {{math|{{frac|''x''{{^|2}} {{op|+}} ''xy'' {{op|+}} 1|''y''{{^|3}} {{op|-}} 1}}|&}} after
yields the text style HTML+CSS
- before
afterx 2 + xy + 1 y 3 − 1
The code : before {{math|{{frac|''x''{{^|2|tex}} {{op|+}} ''xy'' {{op|+}} 1|''y''{{^|3|tex}} {{op|-}} 1|tex}}|$}} after
yields the text style LaTeX
- before after
The code : {{math|{{frac|''x''{{^|2}} {{op|+}} ''xy'' {{op|+}} 1|''y''{{^|3}} {{op|-}} 1|HTM}}|&&}}
yields the display style HTML+CSS
x 2 + xy + 1 y 3 − 1
The code : {{math|{{frac|''x''{{^|2|tex}} {{op|+}} ''xy'' {{op|+}} 1|''y''{{^|3|tex}} {{op|-}} 1|tex}}|$$}}
yields the display style LaTeX
\frac{x^2 + \sqrt{xy} + 1}{y^3 - 1}
The code : before {{math|{{frac|''x''{{^|2}} {{op|+}} {{sqrt|''xy''}} {{op|+}} 1|''y''{{^|3}} {{op|-}} 1}}|&}} after
yields the text style HTML+CSS
- before
afterx 2 + √ xy+ 1y 3 − 1
The code : before {{math|{{frac|''x''{{^|2|tex}} {{op|+}} {{sqrt|''xy''|tex}} {{op|+}} 1|''y''{{^|3|tex}} {{op|-}} 1|tex}}|$}} after
yields the text style LaTeX
- before after
The code : {{math|{{frac|''x''{{^|2}} {{op|+}} {{sqrt|''xy''}} {{op|+}} 1|''y''{{^|3}} {{op|-}} 1|HTM}}|&&}}
yields the display style HTML+CSS
x 2 + √ xy+ 1y 3 − 1
The code : {{math|{{frac|''x''{{^|2|tex}} {{op|+}} {{sqrt|''xy''|tex}} {{op|+}} 1|''y''{{^|3|tex}} {{op|-}} 1|tex}}|$$}}
yields the display style LaTeX
\frac{x^2 + \sqrt{\tfrac{x - 1}{y}} + 1}{y^3 - 1}
The code : before {{math|{{frac|''x''{{^|2}} {{op|+}} {{sqrt|{{tfrac|''x'' {{op|-}} 1|''y''}}|HTM}} {{op|+}} 1|''y''{{^|3}} {{op|-}} 1}}|&}} after
yields the text style HTML+CSS
- before
afterx 2 + √+ 1x − 1 y y 3 − 1
The code : before {{math|{{frac|''x''{{^|2|tex}} + {{sqrt|{{tfrac|''x'' - 1|''y''|tex}}|tex}} + 1|''y''{{^|3|tex}} - 1|tex}}|$}} after
yields the text style LaTeX
- before after
The code : {{math|{{frac|''x''{{^|2}} {{op|+}} {{sqrt|{{tfrac|''x'' {{op|-}} 1|''y''}}|HTM}} {{op|+}} 1|''y''{{^|3}} {{op|-}} 1|HTM}}|&&}}
yields the display style HTML+CSS
x 2 + √+ 1x − 1 y y 3 − 1
The code : {{math|{{frac|''x''{{^|2|tex}} + {{sqrt|{{tfrac|''x'' - 1|''y''|tex}}|tex}} + 1|''y''{{^|3|tex}} - 1|tex}}|$$}}
yields the display style LaTeX
\sqrt[31]{x^2 - \left( \tfrac{x + 1}{z - 1} \right) + 1}
The code : before {{math|{{root|''x''{{^|2}} {{op|-}} {{paren|l}}{{tfrac|''x'' {{op|+}} 1|''z'' {{op|-}} 1}}{{paren|r}} {{op|+}} 1|31|HTM}}|&}} after
yields the text style HTML+CSS
- before
after31√ x 2 −( x + 1 z − 1
+ 1)
The code : before {{math|{{root|''x''{{^|2|tex}} {{op|-}} {{paren|l|tex}}{{tfrac|''x'' {{op|+}} 1|''z'' {{op|-}} 1|tex}}{{paren|r|tex}} {{op|+}} 1|31|TEX}}|$}} after
yields the text style LaTeX
- before after
The code : {{math|{{root|''x''{{^|2}} {{op|-}} {{paren|l}}{{tfrac|''x'' {{op|+}} 1|''z'' {{op|-}} 1}}{{paren|r}} {{op|+}} 1|31|HTM}}|&&}}
yields the display style HTML+CSS
- 31√ x 2 −
( x + 1 z − 1
+ 1)
The code : {{math|{{root|''x''{{^|2|tex}} {{op|-}} {{paren|l|tex}}{{tfrac|''x'' {{op|+}} 1|''z'' {{op|-}} 1|tex}}{{paren|r|tex}} {{op|+}} 1|31|TEX}}|$$}}
yields the display style LaTeX
Examples with boxes
The code
: <table style="background: white; border: 1px solid black; padding: 0px;"><tr><td>{{math|{{frac|''x''{{^|2}} {{op|+}} {{sqrt|''xy''}} {{op|+}} 1|''y''{{^|3}} {{op|-}} 1|HTM}}|&&}}</td></tr></table>
yields the display style HTML+CSS
-
x 2 + √ xy+ 1y 3 − 1
The code
: <table style="background: white; border: 1px solid black; padding: 0px;"><tr><td>{{math|{{frac|''x''{{^|2|tex}} {{op|+}} {{sqrt|''xy''|tex}} {{op|+}} 1|''y''{{^|3|tex}} {{op|-}} 1|tex}}|$$}}</td></tr></table>
yields the display style LaTeX (transparent background LaTeX within HTML+CSS table)
Examples with color
The code
: before <table style="display: inline-table; vertical-align: middle; background: yellow;"><tr><td>{{math|<div style{{=}}"color: red;">{{frac|({{sp|1}}''x'' {{op|-}} ''h''{{sp|1}}){{^|2}}|''a''{{^|2}}}} {{op|-}} {{frac|({{sp|2}}''y'' {{op|-}} ''k''{{sp|1}}){{^|2}}|''b''{{^|2}}}} {{=}} 1</div>|&}}</td></tr></table> after
yields the text style HTML+CSS
- before
after
−( x − h ) 2 a 2
= 1( y − k ) 2 b 2
The code
: before <table style="display: inline-table; vertical-align: middle; background: yellow;"><tr><td>{{math|{\color{red} {{frac|(''x'' {{op|-}} ''h''){{^|2|tex}}|''a''{{^|2|tex}}|tex}} {{op|-}} {{frac|(''y'' {{op|-}} ''k''){{^|2|tex}}|''b''{{^|2|tex}}|tex}} {{=}} 1 }|$}}</td></tr></table> after
yields the text style LaTeX (transparent background LaTeX within HTML+CSS table)
- before
after
The code
: <table style="background: yellow;"><tr><td>{{math|<div style{{=}}"color: red;">{{frac|({{sp|1}}''x'' {{op|-}} ''h''{{sp|1}}){{^|2}}|''a''{{^|2}}}} {{op|-}} {{frac|({{sp|2}}''y'' {{op|-}} ''k''{{sp|1}}){{^|2}}|''b''{{^|2}}}} {{=}} 1</div>|&&}}</td></tr></table>
yields the display style HTML+CSS
-
−( x − h ) 2 a 2
= 1( y − k ) 2 b 2
The code
: <table style="background: yellow;"><tr><td>{{math|{\color{red} {{frac|(''x'' {{op|-}} ''h''){{^|2|tex}}|''a''{{^|2|tex}}|tex}} {{op|-}} {{frac|(''y'' {{op|-}} ''k''){{^|2|tex}}|''b''{{^|2|tex}}|tex}} {{=}} 1 }|$$}}</td></tr></table>
yields the display style LaTeX (transparent background LaTeX within HTML+CSS table)
Examples with wiki links
Bekenstein–Hawking equation for the entropy of a black hole.
The code : before {{math|{{Wikipedia|Bekenstein-Hawking entropy|''S''{{sub|BH}}}} {{=}} {{frac|{{Wikipedia|Boltzmann's constant|''k''}}{{sp|1}}{{Wikipedia|Speed of light|''c''}}{{^|3}}|4{{sp|1}}{{Wikipedia|Reduced Planck constant|''{{sym|hbar}}''}}{{sp|1}}''{{Wikipedia|Gravitational constant|G}}''}} {{abbr|Area of event horizon|''A''}}|tex = S_{\rm BH} {{=}} \frac{k c^3}{4 \hbar G} A|&}} after
yields the text style HTML+CSS
The code : before {{math|S_{\rm BH} {{=}} \frac{k c^3}{4 \hbar G} A|$}} after
yields the text style LaTeX (unfortunately, no links... unless we can overlay an invisible table with invisible text with links...)
- before after
The code : {{math|{{Wikipedia|Bekenstein-Hawking entropy|''S''{{sub|BH}}}} {{=}} {{frac|{{Wikipedia|Boltzmann's constant|''k''}}{{sp|1}}{{Wikipedia|Speed of light|''c''}}{{^|3}}|4{{sp|1}}{{Wikipedia|Reduced Planck constant|''{{sym|hbar}}''}}{{sp|1}}''{{Wikipedia|Gravitational constant|G}}''}} {{abbr|Area of event horizon|''A''}}|tex = S_{\rm BH} {{=}} \frac{k c^3}{4 \hbar G} A|&&}}
yields the display style HTML+CSS
The code : {{math|S_{\rm BH} {{=}} \frac{k c^3}{4 \hbar G} A|$$}}
yields the display style LaTeX (unfortunately, no links... unless we can overlay an invisible table with invisible text with links...)
More examples
For more examples, see {{math/tests}}.
For examples of the following:
- groupings (parentheses, [square] brackets, [curly] braces): see {{(|...|)}}
- sets and multisets (bags): see {{set}} and {{multiset}} ({{bag}})
- fractions: see {{frac}} and {{tfrac}}
- continued fractions: see {{cfrac}}
- roots (with root index) or square roots (without root index): see {{root}} and {{sqrt}}
- nested radicals: see {{nroot}}
- summations and products: see {{sum}} and {{prod}}
- ordinary differentials and partial differentials: see {{d}}
- ordinary derivatives and partial derivatives: see ? and {{partial}}
- simple integrals: see {{int}}
- double integrals, triple integrals, quadruple integrals, multiple integrals: see {{integral}}
- [closed] loop integrals, clockwise [closed] path integrals, counterclockwise [closed] path integrals, [closed] surface integrals, [closed] hypersurface integrals: see {{integral}}
- math environments (e.g. align, cases): see {{begin}} and {{end}}
- align environment: see {{align}}
- cases environment: see {{cases}}
Tests
10,000 character limit for template arguments
Tests pertaining to: “Error: String exceeds 10,000 character limit.”
Trying to determine whether the following count:
- comments (do I need to wrap comments within
<noinclude>...</noinclude>
in all mathematical typesetting templates?) - spaces and newlines (I use a lot of spaces to indent the code to make it readable: in Wikipedia the code is often collapsed in one big lump with minimal use of spaces, which I'm afraid means that spaces probably count, even though browsers treat consecutive spaces and/or newlines as a single space when rendering HTML!)
The code (each group of ten lines with comments has 1000 = 10 x 100 chars, not including new line characters)
{{indent}}{{math| 0000000000 <!-- 0 --> <!-- 0 --><!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --><!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --><!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --><!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --><!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --><!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --><!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --><!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --><!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --><!-- 0 --> <!-- 0 --> <!-- 0 --> 1111111111 <!-- 0 --> <!-- 0 --><!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --><!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --><!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --><!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --><!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --><!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --><!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --><!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --><!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --><!-- 0 --> <!-- 0 --> <!-- 0 --> 2222222222 <!-- 0 --> <!-- 0 --><!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --><!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --><!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --><!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --><!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --><!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --><!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --><!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --><!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --><!-- 0 --> <!-- 0 --> <!-- 0 --> 3333333333 <!-- 0 --> <!-- 0 --><!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --><!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --><!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --><!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --><!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --><!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --><!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --><!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --><!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --><!-- 0 --> <!-- 0 --> <!-- 0 --> 4444444444 <!-- 0 --> <!-- 0 --><!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --><!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --><!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --><!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --><!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --><!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --><!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --><!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --><!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --><!-- 0 --> <!-- 0 --> <!-- 0 --> 5555555555 <!-- 0 --> <!-- 0 --><!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --><!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --><!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --><!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --><!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --><!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --><!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --><!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --><!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --><!-- 0 --> <!-- 0 --> <!-- 0 --> 6666666666 <!-- 0 --> <!-- 0 --><!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --><!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --><!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --><!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --><!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --><!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --><!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --><!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --><!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --><!-- 0 --> <!-- 0 --> <!-- 0 --> 7777777777 <!-- 0 --> <!-- 0 --><!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --><!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --><!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --><!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --><!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --><!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --><!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --><!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --><!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --><!-- 0 --> <!-- 0 --> <!-- 0 --> 8888888888 <!-- 0 --> <!-- 0 --><!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --><!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --><!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --><!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --><!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --><!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --><!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --><!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --><!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --><!-- 0 --> <!-- 0 --> <!-- 0 --> 9999999999 <!-- 0 --> <!-- 0 --><!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --><!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --><!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --><!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --><!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --><!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --><!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --><!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --><!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --> <!-- 0 --><!-- 0 --> <!-- 0 --> <!-- 0 --> |&&}}
yields
0000000000
1111111111 2222222222 3333333333 4444444444 5555555555 6666666666 7777777777 8888888888 9999999999 |
Alternatives
MathJax
- Main article page: MathJax
MathJax[1] is an open-source JavaScript display engine for mathematics which takes either MathML, LaTeX or ASCIIMathML[2] as input to get either HTML+CSS, MathML or SVG as output, that works in all modern browsers (with JavaScript enabled, that is). (It is the successor of jsMath.)
Examples with MathJax
The Lorenz equations:
[ begin{matrix} dot{x} & = & sigma(y-x) \ dot{y} & = & rho x - y - xz \ dot{z} & = & -beta z + xy end{matrix} ]
The Cauchy-Schwarz inequality:
[ left( sum_{k=1}^n a_k b_k right)^2 leq left( sum_{k=1}^n a_k^2 right) left( sum_{k=1}^n b_k^2 right) ]
A cross product formula:
[ mathbf{V}_1 times mathbf{V}_2 = begin{vmatrix} mathbf{i} & mathbf{j} & mathbf{k} \ frac{partial X}{partial u} & frac{partial Y}{partial u} & 0 \ frac{partial X}{partial v} & frac{partial Y}{partial v} & 0 end{vmatrix} ]
Probability of getting (k) heads when flipping (n) coins:
[ P(E) = {n choose k} p^k (1-p)^{ n-k} ]
An identity of Ramanujan:
[ frac{1}{(sqrt{phi sqrt{5}}-phi) e^{frac25 pi}} = 1 + frac{e^{-2 pi}} {1 + frac{e^{-4 pi}} {1 + frac{e^{-6 pi}} {1+frac{e^{-8pi}} {1+ldots} } } } ]
STIX fonts
MathJax uses STIX fonts, which are [scalable] Web fonts. (Web fonts allow Web designers to use fonts that are not installed on the viewer's computer.)
jsMath
- Main article page: jsMath
jsMath.js is an Ajax-based math rendering system developed by Davide Cervone in 2004. (It has been superseded by MathJax, its successor.)
Examples with jsMath
Using the "jsMath HTML" option in
the mathematical formulae are rendered with jsMath.js.
Note that in the examples below, some LaTeX has already been converted into HTML character entities, e.g. < instead of < and & instead of &, since the contents of an HTML element cannot be < or & because they are respectively the start of a closing HTML tag and the start of an HTML entity.
Inline display examples:
<span class="math">$D$</span> <span class="math">$X$</span> <span class="math">$x \in X$</span> <span class="math">$y \in D$</span> <span class="math">$d(x,y) < \varepsilon$</span> <span class="math">$\mathbb{Q}$</span> <span class="math">$\mathbb{R} \setminus \mathbb{Q}$</span> <span class="math">$\aleph_0$</span> <span class="math">$d(X)$</span> <span class="math">$|X| \le 2^{2^{d(X)}}$</span>
Block display examples:
<div class="math"> \int^1_\kappa \left[ \bigl( 1 - w^2 \bigr) \bigl( \kappa^2 - w^2 \bigr) \right]^{-1/2} dw = \frac{4}{\left( 1 + \sqrt{\kappa} \, \right)^2} K \left( \left( \frac{1 - \sqrt{\kappa}}{1 + \sqrt{\kappa}} \right)^{\!\!2} \right) </div> <div class="math"> \mathop{\rm grd} \phi(z) = \left( a + \frac{2d}{\pi} \right) v_\infty \, \overline{f'(z)} = v_\infty \left[ \pi a + \frac{2d}{\pi a + 2dw^{-1/2}(w-1)^{1/2}} \right]^- </div> <div class="math"> - \sum^n_{m=1} \left( \, \sum^\infty_{k=1} \frac{ h^{k-1} }{\left( w_m - z_0 \right)^2} \right) = \sum^\infty_{k=1} s_k \, h^{k-1} </div>
tex2math
The tex2math.js plugin converts
- $ ... $ or \( ... \) into <span class="math"> ... </span> for inline math, and
- $$ ... $$ or \[ ... \] into <div class="math"> ... </div> for display math.
TeX fonts
jsMath.js uses TeX fonts.
MathML
- Main article page: MathML
MathML has two halves:
- a presentation language, and
- a content language.
With MathML, users are responsible for installing the appropriate fonts.
ASCIIMathML.js
Noncommercial translation program: ASCIIMathML.
TeX/LaTeX
- Main article page: LaTeX
The math [server-side] processor for the MediaWiki server is a program called texvc, which generates PNG images for complex expressions but outputs HTML for simple ones.
The best known mathematical browser (client-side) plug-in is techexplorer.
Examples
\nabla \times \mathbf{E} = -\frac{\partial \mathbf{B}} {\partial{t}}
Comparison of math renderings for MathML (Firefox) vs MathJax (Firefox) vs PNG (Firefox) vs Chrome Server Side SVG
See also
- {{math/font}} (which yields
font-size: 1.15em; font-family: 'Computer Modern', STIXGeneral, 'Times New Roman';
to be used withinstyle=""
) - {{mathfont}} (for HTML+CSS typesetting of very simple mathematical expressions/numbers in section labels, labels of wikilinks and labels of external links) (for mathematical numbers only: NOT for dates, times, chapters, book sections, pages, ...)
- {{math}} (for typesetting of mathematical expressions in either HTML+CSS or LaTeX)
- {{intseq}} (for integer sequences)
- jsMath (uses TeX fonts)
- MathJax (uses STIX fonts, which are scalable Web fonts)
Notes
References
- Donald Knuth, The TeXbook.
External links
- Hayes, Brian (2009), “Writing Math on the Web: The Web would make a dandy blackboard if only we could scribble an equation”, American Scientist 92 (2): 98, doi:10.1511/2009.77.98.
- JsMath/MathJax (TeX for Web) — Wiki of the Department of Mathematics of the University of Toronto.
- Jukka “Yucca” Korpela. Math in HTML (and CSS) — Section Mathematics & physics and IT of the free information site IT and communication.
jsMath (links)
- jsMath: A Method of Including Mathematics in Web Pages
- The tex2math.js plugin
- jsMath Sample Page
- Examples of jsMath
- Download jsMath (for web-page authors)
- How to use jsMath with org-mode
- Browser Support for jsMath
- jsMath—Wikipedia.org.
MathJax (links)
- MathJax
- What is MathJax?
- MathJax v2.0 TeX and LaTeX Support
- MathJax v1.1 TeX and LaTeX Support
- Supported LaTeX commands
- TEX Commands available in MathJax
- MathJax Documentation
- MathJax TeX and LaTeX Support
- MathJax MathML Support
- Converting to MathJax from jsMath
- The jsMath2jax Preprocessor (jsMath2jax.js)
- Browser Compatibility
- MathJax Users Forum
- MathJax—Wikipedia.org.
- MathJax—MediaWiki.org.
- Extension:MathJax—MediaWiki.org.
- Extension:SimpleMathJax—MediaWiki.org.
- Extension:Math—MediaWiki.org. (Math extension provides support for rendering mathematical formulas on-wiki via texvc.)
Mathoid (links)
- Moritz Schubotz, Gabriel Wicke, Mathoid: Robust, Scalable, Fast and Accessible Math Rendering for Wikipedia, 2014. arXiv:1404.6179
Web fonts (links)
- STIX fonts (The Scientific and Technical Information eXchange font package. A comprehensive set of scientific glyphs.)
- Fonts.com Web Fonts
- Google web fonts
- W3C, CSS Fonts Module Level 3
- Extension:WebFonts—MediaWiki.org.
- Web typography—Wikipedia.org.
SVG (links)
- SVG—Wikipedia.org. (MathJax v2.0-beta introduced SVG rendering)
TeX fonts (links)
MathML (links)
TeX/LaTeX (links)
- http://www.latex-project.org/
- http://en.wikibooks.org/wiki/LaTeX
- TeX—Wikipedia.org.
- LaTeX—Wikipedia.org.
- AMS-LaTeX—Wikipedia.org.
- Manual:Enable TeX—MediaWiki.org.
- Texvc—MediaWiki.org.
- Wikipedia:texvc—Wikipedia.org. (The program texvc (TeX validator and converter) validates (AMS) LaTeX mathematical expressions and converts them to HTML, MathML, or PNG graphics.)
- http://khan.github.io/KaTeX/
- http://www.intmath.com/cg5/katex-mathjax-comparison.php