Wikipedia:Rendering math

From Wikipedia, the free encyclopedia
  (Redirected from Wikipedia:«math»)
Jump to: navigation, search
For the help page, see Help:Displaying a formula. For the WikiProject, see WP: WikiProject Mathematics. For Wikipedia's mathematics style manual, see WP: Manual of Style/Mathematics.

This essay offers a comparison of different encodings and presentation of mathematical formulae. The three principal ones are the <math> tag, raw wiki (or HTML) code and "texhtml" templates. The <math> and "texhtml" encoding may have different presentations for registered users, depending on user preferences and personal styles.

Comparison of encodings[edit]

Encoding Advantages Disadvantages
<math> Well-known and standardized.
Portable to/from scientific papers.
Clearly distinguishes semantics from appearance.
Can handle all formulae.
Requires knowledge of LaTeX markup language.
Lacks some characters (such as Cyrillic script).
Unable to place wikilinks on parts of formulae.
Raw wiki or HTML code Flexible and easy to learn.
Same markup as the rest of wiki.
Encodes the appearance of a formula rather than its semantics.
Unable to handle square roots, vertical fractions, and other common formula types.
Proper use (italic variables, protected spaces around operators) requires care and is a frequent source of mistakes.
"texhtml" templates, such as {{math}} Simplifies many of the problematic and failure-prone parts of raw wiki markup.
Distinguishes semantics from appearance.
More polished appearance than wiki/HTML code and faster rendering than mathJax.
Vulnerable to changes in templates and styles.
The ubiquitous = symbol requires special care.
Unable to handle complex formulae such as those involving summations and limits.

Comparison of presentations[edit]

Encoding Presentation Advantages Disadvantages
<math> LaTeX renderer
(Wikipedia’s default)
Robust.
Little overhead in a browser.
A bitmap image format that does not match article text in size and cannot be copied and pasted.
MathML with SVG fallback Robust.
Easy for registered users to use.
Little overhead in a browser.
Not usable by unregistered readers. Requires modern browsers. Has minor formatting bugs (e.g. mismatched baselines)
MathJax The best look. Easy for registered users to use. Text-friendly (except for hyperlinks). Uses very little server-side computation. Not usable by unregistered readers. Uses more client-side (in-browser) computation. Causes errors in vertical position after jumping to a #-link. Requires a modern browser. Slow to fix reported bugs. Fonts are invariably downloaded from server.
Raw wiki or HTML code Avoids switching font families in running text.
Minimal overhead.
Appearance does not depend on user (account) preferences.
Does not distinguish a formula from the running text.
The kerning often looks ugly and even illegible (such as in F−1), which is difficult to rectify.
In articles mixing raw wiki with <math> formulae, the appearance of the same variable in the two types of formula does not match (serif vs sans-serif).
{{math}} ('texhtml' class) Distinguishes a formula from the running text.
Close match to the appearance of inline <math>.
Mixing of font families (sans-serif for English, serif for math), in running text, can be jarring.
Specific templates
{{mvar}}: x A shorthand for variables like {{math|''x''}}.
Clean semantics.
Cannot be used for vectors.
{{sqrt}}: 2 Clean semantics. The vinculum is slightly interrupted.
Does not look well under {{math}} or so, itself.
{{radic}}: 32 Clean semantics. Same as above.
{{sfrac}}: 1/2 Clean semantics. Occupies too much vertical space in a running text. Embedded sub- and superscript causes vertical misalignment.
{{frac}}: 12 Clean semantics. Discouraged by WP:MOSMATH.
{{open-open}}: (−∞, +∞)
{{open-closed}}: (−∞, 0]
{{closed-open}}: [0, +∞)
{{closed-closed}}: [0,1]
Semantically distinguishes intervals from other types of formula. Because the interval endpoints are coded as a single parameter, the semantics is a bit obscure.
Bra–ket notation:
{{ket}} |ψ
{{bra}} ψ|
{{bra-ket}} ψ|ξ
Semantically distinguishes bra–ket notation from other types of formula. Avoids complex html coding for angular bracket characters ⟨ &#amp;x27E8; or {{langle}}, ⟩ &#x27E9; or {{rangle}}, and vertical bar | &#124; and prevents incorrect usage of less-than/greater-than signs for these characters. Angular brackets may not render on all browsers.
{{vec}}: A Clean semantics. The arrow may not be precisely centered over certain letters
{{intmath}}: +∞
0
Clean semantics. Name differs from math/LaTeX coding conventions.
{{overset}}: A, ~A

{{underset}}: A, A~

Clean semantics. Produces bad spacing when combined with fraction templates.

Discussions[edit]

See also[edit]