|
<code><nowiki><math> \hat{} \quad \tilde{} \quad \backslash </math></nowiki></code> gives <math> \hat{} \quad \tilde{} \quad \backslash </math>
=={{TeX}} and HTML==
Before introducing {{TeX}} markup for producing special characters, it should be noted that, as this comparison table shows, sometimes similar results can be achieved in HTML (see [[w:Help:Special characters]]).
{| class="wikitable"
|-
! <!--T:240-->
{{TeX}} Syntax ([[#Forced_PNG_rendering|forcing PNG]])
! <!--T:241-->
{{TeX}} Rendering
! <!--T:242-->
HTML Syntax
! <!--T:243-->
HTML Rendering
|-
| <code><nowiki><math>\alpha</math></nowiki></code>
| <math>\alpha</math>
| <code><nowiki>{{math|<var>&alpha;</var>}}</nowiki></code>
| {{math|<var>α</var>}}
|-
| <code><nowiki><math> f(x) = x^2\,</math></nowiki></code>
| <math> f(x) = x^2\,</math>
| <code><nowiki>{{math|''f''(<var>x</var>) {{=}} <var>x</var><sup>2</sup>}}</nowiki></code>
| {{math|''f''(<var>x</var>) {{=}} <var>x</var><sup>2</sup>}}
|-
| <code><nowiki><math>\sqrt{2}</math></nowiki></code>
| <math>\sqrt{2}</math>
| <code><nowiki>{{math|{{radical|2}}}}</nowiki></code>
| {{math|{{radical|2}}}}
|-
| <code><nowiki><math>\sqrt{1-e^2}</math></nowiki></code>
| <math>\sqrt{1-e^2}</math>
| <code><nowiki>{{math|{{radical|1 &minus; ''e''&sup2;}}}}</nowiki></code>
| {{math|{{radical|1 − ''e''²}}}}
|}
The codes on the left produce the symbols on the right, but the latter can also be put directly in the wikitext, except for ‘=’.
{| class="wikitable"
|-
!
Syntax
!
Rendering
|- valign="top"
|<pre><nowiki>&alpha; &beta; &gamma; &delta; &epsilon; &zeta;
&eta; &theta; &iota; &kappa; &lambda; &mu; &nu;
&xi; &omicron; &pi; &rho; &sigma; &sigmaf;
&tau; &upsilon; &phi; &chi; &psi; &omega;
&Gamma; &Delta; &Theta; &Lambda; &Xi; &Pi;
&Sigma; &Phi; &Psi; &Omega;
</nowiki></pre>
| style="texhtml" |α β γ δ ε ζ<br
/>η θ ι κ λ μ ν<br
/>ξ ο π ρ σ ς<br
/>τ υ φ χ ψ ω<br
/>Γ Δ Θ Λ Ξ Π<br
/>Σ Φ Ψ Ω
|- valign="top"
| valign="middle" | <pre><nowiki>&int; &sum; &prod; &radic; &minus; &plusmn; &infty;
&asymp; &prop; {{=}} &equiv; &ne; &le; &ge;
&times; &sdot; &divide; &part; &prime; &Prime;
&nabla; &permil; &deg; &there4; &Oslash; &oslash;
&isin; &notin;
&cap; &cup; &sub; &sup; &sube; &supe;
&not; &and; &or; &exist; &forall;
&rArr; &hArr; &rarr; &harr; &uarr;
&alefsym; - &ndash; &mdash;
</nowiki></pre>
| style="texhtml" |∫ ∑ ∏ √ − ± ∞<br
/>≈ ∝ = ≡ ≠ ≤ ≥<br
/>× ⋅ ÷ ∂ ′ ″<br
/>∇ ‰ ° ∴ Ø ø<br
/>∈ ∉ ∩ ∪ ⊂ ⊃ ⊆ ⊇<br
/>¬ ∧ ∨ ∃ ∀<br
/>⇒ ⇔ → ↔ ↑<br
/>ℵ - – —
|}
The project has settled on both HTML and TeX because each has advantages in some situations.
===Pros of HTML===
# 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 cut-and-pasted (this is not a problem if {{TeX}} is rendered using [[w:MathJax|MathJax]], and the alignment should not be a problem for PNG rendering once [[bugzilla:32694|bug 32694]] is fixed).
# The formula’s background and font size match the rest of HTML contents (this can be fixed on {{TeX}} formulas by using the commands [[#Color|<code>\pagecolor</code> and <code>\definecolor</code>]]) and the appearance respects CSS and browser settings while the typeface is conveniently altered to help you identify formulae.
# Pages using HTML code for formulae use less data to transmit, which is important to users with slow or capped Internet connections (e.g. those using dialup or mobile Internet connections which are either slow or have a data cap).
# Formulae typeset with HTML code will be accessible to client-side script links (a.k.a. scriptlets).
# 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.
# The HTML code, if entered diligently, will contain all semantic information to transform the equation back to {{TeX}} or any other code as needed. It can even contain differences {{TeX}} does not normally catch, e.g. <code><nowiki>{{math|''i''}}</nowiki></code> for the [[w:imaginary unit|imaginary unit]] and <code><nowiki>{{math|<var>i</var>}}</nowiki></code> for an arbitrary index variable.
# Formulae using HTML code will render as sharp as possible no matter what device is used to render them.
===Pros of {{TeX}}===
# {{TeX}} is semantically more precise than HTML.
## In {{TeX}}, "<code><nowiki><math>x</math></nowiki></code>" means "mathematical variable <math>x</math>", whereas in HTML "<code>x</code>" is generic and somewhat ambiguous.
## On the other hand, if you encode the same formula as "<code><nowiki>{{math|<var>x</var>}}</nowiki></code>", you get the same visual result {{math|<var>x</var>}} 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 [[w:MathJax|MathJax]], which was requested on [[bugzilla:31406|bug 31406]] for use on Wikimedia wikis and [http://www.gossamer-threads.com/lists/wiki/wikitech/260990 is being implemented] on [[mw:Extension:Math|Extension:Math]] as a new rendering option).
# One consequence of point 1 is that {{TeX}} code can be transformed into HTML, but not vice-versa.{{ref|dilHTML}} 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 {{TeX}}. 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 [[#Bug_reports|help improve the situation]].
# Another consequence of point 1 is that {{TeX}} can be converted to [[w:MathML|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.
# {{TeX}} 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 {{TeX}}.
# {{TeX}} 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.
# Once a formula is done correctly in {{TeX}}, 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 ‘ <var>{{IPA|a̅}}</var> ’ and ‘ <var style="font-family: SERIF">a̅</var> ’).
# When writing in {{TeX}}, 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.{{ref|browsupp}}
# {{TeX}} 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.
# While {{TeX}} does not assist you in finding HTML codes or Unicode values (which you can obtain by viewing the HTML source in your browser), cutting and pasting from a {{TeX}} PNG in Wikipedia into simple text will return the LaTeX source.
:<small>{{note|dilHTML}} unless your wikitext follows the style of point 1.2</small>
:<small>{{note|entHTML}} 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. &ndash; for ‘–’ and &minus; for ‘−’).</small>
In some cases it may be the best choice to use neither {{TeX}} nor the html-substitutes, but instead the simple ASCII symbols of a standard keyboard (see below, for an example).
==Functions, symbols, special characters==
|