Content deleted Content added
→Browser support: Chrome now supports it and so does Edge |
EricAMeyer (talk | contribs) Overhaul of Presentation and semantics and Example sections, with some other adjustments throughout |
||
Line 107:
==Presentation and semantics==
MathML deals not only with the ''presentation'' but also the ''meaning'' of formula components (the latter part of MathML is known as "Content MathML"). Because the meaning of the equation is preserved separate from the presentation, how the content is communicated can be left up to the user. For example, web pages with MathML embedded in them can be viewed as normal web pages with many browsers, but visually impaired users can also have the same MathML read to them through the use of [[screen readers]] (e.g. using the [[MathPlayer]] [[Plug-in (computing)|plugin]] for [[Internet Explorer]] or [[Firefox]], [[Opera (web browser)|Opera]] 9.50 build 9656+ or the Fire Vox extension for Firefox). Newer versions of [[JAWS (screen reader)|JAWS]] support MathML voicing as well as braille output.<ref>{{Cite web|title=JAWS Version 16|url=https://support.freedomscientific.com/downloads/jaws/JAWSWhatsNew?version=16|url-status=live}}</ref>
The quality of rendering of MathML in a browser depends on the installed fonts. The [[STIX Fonts project]] have released a comprehensive set of mathematical fonts under an open license. The [[Cambria Math]] font supplied with Microsoft Windows had a slightly more limited support.<ref name="Vismor">{{Citation|url=https://vismor.com/documents/site_implementation/viewing_mathematics/viewing_mathematics.php|title=Viewing Mathematics on the Internet|access-date=13 April 2011|first=Timothy|last=Vismor}}</ref>▼
A valid MathML document typically consists of the XML declaration, [[Document type declaration|DOCTYPE]] declaration, and document element.
The document body then contains MathML expressions which appear in
===Presentation MathML===
Presentation MathML focuses on the display of an equation, and has about 30 elements. The elements' names all begin with {{code|m}}. A Presentation MathML expression is built up out of ''tokens'' that are combined using higher-level elements, which control their layout.
Token elements generally only contain characters (not other elements). They include:
Line 115 ⟶ 120:
* {{code|<mo>+</mo>}} – operators;
* {{code|<mn>2</mn>}} – numbers.
* {{code|<mtext>
Note, however, that these token elements may be used as extension points, allowing markup in host languages.
Line 135 ⟶ 140:
The full specification of MathML entities<ref>{{Cite web|url=http://www.w3.org/TR/MathML3/chapter7.html|title=Characters, Entities and Fonts|website=www.w3.org}}</ref> is closely coordinated with the corresponding specifications for use with HTML and XML in general.<ref>{{Cite web|url=http://www.w3.org/TR/xml-entity-names/Overview.html|title=XML Entity Definitions for Characters (2nd Edition)|website=www.w3.org}}</ref>
Thus, the expression <math forcemathmode=mathml>a x^2+b x+c</math> requires two layout elements: one to create the overall horizontal row and one for the superscripted exponent.
<syntaxhighlight lang="xml">
Line 155 ⟶ 150:
</syntaxhighlight>
A
▲The document body then contains MathML expressions which appear in <math> elements as needed in the document. Often, MathML will be embedded in more general documents, such as [[HTML]], [[DocBook]], or other [[XML]] schemas. A complete document that consists of just the MathML example above, is shown here:
<syntaxhighlight lang="xml">
Line 203 ⟶ 197:
</syntaxhighlight>
Content MathML is nearly [[isomorphic]] to [[Binary expression tree|expressions]] in a [[Functional programming|functional language]] such as [[Scheme (programming language)|Scheme]] and other dialects of [[Lisp (programming language)|Lisp]]. {{tag|apply}} amounts to Scheme's {{code|(...)}}, and the many operator and function elements amount to Scheme functions. With this trivial literal transformation, plus un-tagging the individual tokens, the example above becomes:
<syntaxhighlight lang="scheme">
(plus
Line 216 ⟶ 210:
According to the OM Society,<ref name="OpenMath">{{Cite web|url=https://www.openmath.org/|title=OpenMath Home · OpenMath|website=www.openmath.org}}</ref> OpenMath Content Dictionaries can be employed as collections of symbols and identifiers with declarations of their semantics{{snd}}names, descriptions and rules. A 2018 paper presented at the [[Special Interest Group on Information Retrieval|SIGIR]] conference<ref name="SchubotzScharpfGipp2018">{{cite journal|author1=Moritz Schubotz|author2=Philipp Scharpf|author3=Bela Gipp|title=Representing Mathematical Formulae in Content MathML using Wikidata.|url=http://ceur-ws.org/Vol-2132/paper5.pdf|date=2018|journal=Birndl@sigir}}</ref> proposed that the semantic knowledge base [[Wikidata]] could be used as an OpenMath Content Dictionary to link semantic elements of a mathematical formula to unique and language-independent Wikidata items.
==Example
The well-known [[quadratic formula]] could be represented in Presentation MathML as an expression tree made up from layout elements like ''mfrac'' or ''msqrt'' elements:
<syntaxhighlight lang="xml">
<math mode="display" xmlns="http://www.w3.org/1998/Math/MathML">
Line 271 ⟶ 251:
This example uses the {{tag|annotation|open}} element, which can be used to embed a semantic annotation in non-XML format, for example to store the formula in the format used by an equation editor such as [[StarMath]] or the markup using [[LaTeX]] syntax. The {{code|encoding}} field is usually a [[MIME type]], although most of the equation encodings don't have such a registration; freeform text may be used in such case.
Although less compact than
| url = http://www.w3.org/TR/REC-MathML/#abstract
| title = Mathematical Markup Language (MathML) 1.01 Specification (Abstract)
Line 316 ⟶ 296:
[[File:MathMLxhtml.png|thumb|435px|A rendering of the formula for a circle in MathML+XHTML using Firefox 22 on Mac OS X]]
Inline MathML is also supported in [[HTML5]] files
{{clear}}
Line 356 ⟶ 336:
The [[KHTML]]-based [[Konqueror]] currently does not provide support for MathML.<ref>{{citation |url=http://bugs.kde.org/show_bug.cgi?id=30526 |title=Bug 30526 – MathML support for Konqi}}</ref>
▲The quality of rendering of MathML in a browser depends on the installed fonts. The [[STIX Fonts project]] have released a comprehensive set of mathematical fonts under an open license. The [[Cambria Math]] font supplied with Microsoft Windows had a slightly more limited support.<ref name="Vismor">{{Citation|url=https://vismor.com/documents/site_implementation/viewing_mathematics/viewing_mathematics.php|title=Viewing Mathematics on the Internet|access-date=13 April 2011|first=Timothy|last=Vismor}}</ref>
Line 509 ⟶ 486:
==Other standards==
Another standard called [[OpenMath]] that has been more specifically designed (largely by the same people who devised Content MathML)
<syntaxhighlight lang="xml">
<apply>
Line 519 ⟶ 496:
</syntaxhighlight>
The [[OMDoc]] format has been created for markup of larger mathematical structures than formulae, from statements like definitions, theorems, proofs,
The [[International Organization for Standardization|ISO]]/[[International Electrotechnical Commission|IEC]] standard [[Office Open XML]] (OOXML) defines a different XML math syntax, derived from [[Microsoft Office]] products. However, it is partially compatible<ref>{{Citation| url=http://dpcarlisle.blogspot.com/2007/04/xhtml-and-mathml-from-office-20007.html
Line 527 ⟶ 504:
| date=9 May 2007
| access-date=20 September 2007
}}</ref> through
== See also ==
|