Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
MathML
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== {{anchor|Generic MathML}}Presentation and semantics == {{Infobox file format | name = Generic MathML | extension = .mml<ref name="mathml-media-types"/><ref name="w3c-mathml2-ch7">{{Cite web | url = https://www.w3.org/TR/MathML2/chapter7.html#id.7.1.3 | title = The MathML Interface | quote = The W3C Math Working Group recommends the standard file extension <code>.mml</code> used for browser registry. | publisher = W3C | publication-date = 2003-10-21 | access-date = 2023-09-02 }}</ref> | mime = application/mathml+xml<ref name="mathml-media-types">{{Cite web | url = https://w3c.github.io/mathml-docs/mathml-media-types/#media-types-mathml | title = MathML Media-type Declarations | first = Paul | last = Libbrecht | publisher = W3C | publication-date = 2023-09-01 | access-date = 2023-09-02 }}</ref> | type code = <code>MML </code> | uniform type = {{mono|public.mathml}} | conforms to = {{mono|public.xml}} | owner = [[World Wide Web Consortium]] | type = [[Mathematical markup language]] | extended from = [[XML]] | extended to = {{ubl | [[#Presentation MathML | Presentation MathML]] | [[#Content MathML | Content MathML]] }} | standard = {{ubl | {{URL|https://www.w3.org/Math/|W3C MathML}}<ref name="V3"/> | {{URL|https://www.iso.org/standard/58439.html|ISO/IEC 40314}}<ref name="iso-iec-standard"/> }} | open = Yes }} 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 [[VoiceOver]] in [[Safari (web browser)|Safari]]). [[JAWS (screen reader)|JAWS]] from version 16 onward supports MathML voicing as well as braille output.<ref>{{cite web | title = JAWS Version 16 | url = https://support.freedomscientific.com/downloads/jaws/JAWSWhatsNew?version=16 | access-date = 2023-09-07 }}</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 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 = 2011-04-13 | 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 {{tag|math|o|link=yes}} elements as needed in the document. Often, MathML will be embedded in more general documents, such as [[HTML]], [[DocBook]], or other [[XML]]-based formats. === Presentation MathML === {{Infobox file format | name = Presentation MathML | mime = application/mathml-presentation+xml<ref name="mathml-media-types"/> | type code = <code>MMLp</code> | uniform type = {{mono|public.mathml.presentation}} | conforms to = {{mono|public.mathml}} | extended from = [[#Generic MathML|Generic 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. Finer details of presentation are affected by close to 50 attributes. Token elements generally only contain characters (not other elements). They include: * {{code|lang=XML|<mi>x</mi>}} β identifiers; * {{code|lang=XML|<mo>+</mo>}} β operators; * {{code|lang=XML|<mn>2</mn>}} β numbers; * {{code|lang=XML|<mtext>suchΒ that</mtext>}} β text. Note, however, that these token elements may be used as extension points, allowing markup in host languages. MathML in [[HTML5]] allows most inline HTML markup in mtext, and {{code|lang=XML|<mtext><b>non</b> zero</mtext>}} is conforming, with the HTML markup being used within the MathML to mark up the embedded text (making the first word bold in this example). These are combined using layout elements, that generally contain only elements. They include: * {{code|lang=XML|<mrow>}} β a horizontal row of items; * {{code|lang=XML|<msup>}}, {{code|lang=XML|<munderover>}}, and others β superscripts, limits over and under operators like sums, etc.; * {{code|lang=XML|<mfrac>}} β fractions; * {{code|lang=XML|<msqrt>}} and {{code|lang=XML|<mroot>}} β roots; * {{code|lang=XML|<mfenced>}} β surrounding content with fences, such as parentheses. As usual in HTML and XML, many [[character entity reference|entities]] are available for specifying special symbols by name, such as {{code|lang=HTML|π}} and {{code|lang=HTML|→}}. An interesting feature of MathML is that entities also exist to express normally-invisible operators, such as {{code|lang=HTML|⁢}} (or the shorthand {{code|lang=HTML|⁢}}) for implicit multiplication. They are: * {{unichar|2061|FUNCTION APPLICATION}} (to distinguish <math>\sin(x)</math> from <math>\sin\cdot x</math> in <math>\sin{x}</math>); * {{unichar|2062|INVISIBLE TIMES}} (to distinguish <math>a_{m\times n}</math> from <math>a_{m,n}</math> in <math>a_{mn}</math>); * {{unichar|2063|INVISIBLE SEPARATOR}} (vice versa); * {{unichar|2064|INVISIBLE PLUS}} (to distinguish <math>2 + \frac{1}{3}</math> from <math>2 \cdot \frac{1}{3}</math> in <math>2\tfrac{1}{3}</math>). The full specification of MathML entities<ref>{{cite web | url = http://www.w3.org/TR/MathML3/chapter7.html | title = Characters, Entities and Fonts | website = 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 = W3.org }}</ref> Thus, the expression <math>a x^2+b x+c</math> requires two layout elements: one to create the overall horizontal row and one for the superscripted exponent. However, the individual tokens also have to be identified as identifiers ({{code|lang=XML|<mi>}}), operators ({{code|lang=XML|<mo>}}), or numbers ({{code|lang=XML|<mn>}}). Adding the token markup, the full form ends up as <syntaxhighlight lang="xml"> <mrow> <mi>a</mi> <mo>⁢</mo> <msup><mi>x</mi><mn>2</mn></msup> <mo>+</mo><mi>b</mi><mo>⁢</mo><mi>x</mi> <mo>+</mo><mi>c</mi> </mrow> </syntaxhighlight> A complete document that consists of just the MathML example above, is shown here: <syntaxhighlight lang="xml"> <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE math PUBLIC "-//W3C//DTD MathML 2.0//EN" "http://www.w3.org/Math/DTD/mathml2/mathml2.dtd"> <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> <mi>a</mi> <mo>⁢</mo> <msup><mi>x</mi><mn>2</mn></msup> <mo>+</mo><mi>b</mi><mo>⁢</mo><mi>x</mi> <mo>+</mo><mi>c</mi> </mrow> </math> </syntaxhighlight> === Content MathML === {{Infobox file format | name = Content MathML | mime = application/mathml-content+xml | type code = <code>MMLc</code> | uniform type = {{mono|public.mathml.content}} | conforms to = {{mono|public.mathml}} | extended from = [[#Generic MathML|Generic MathML]] }} Content MathML focuses on the semantics, or meaning, of the expression rather than its layout. Central to Content MathML is the {{code|lang=XML|<apply>}} element that represents function application. The function being applied is the first child element under {{code|lang=XML|<apply>}}, and its operands or parameters are the remaining child elements. Content MathML uses only a few attributes. Tokens such as identifiers and numbers are individually marked up, much as for Presentation MathML, but with elements such as {{code|lang=XML|<ci>}} and {{code|lang=XML|<cn>}}. Rather than being merely another type of token, operators are represented by specific elements, whose mathematical semantics are known to MathML: {{code|lang=XML|<times>}}, {{code|lang=XML|<power>}}, etc. There are over a hundred different elements for different functions and operators.<ref>{{cite web | url = http://www.w3.org/TR/MathML3/chapter4.html#contm.opel | title = Content Markup | website = W3.org }}</ref> For example, {{code|lang=XML|<apply><sin/><ci>x</ci></apply>}} represents <math>\sin(x)</math> and {{code|lang=XML|<apply><plus/><ci>x</ci><cn>5</cn></apply>}} represents <math>x+5</math>. The elements representing operators and functions are empty elements, because their operands are the other elements under the containing {{code|lang=XML|<apply>}}. The expression <math>a x^2+b x+c</math> could be represented as <syntaxhighlight lang="xml"> <math> <apply> <plus/> <apply> <times/> <ci>a</ci> <apply> <power/> <ci>x</ci> <cn>2</cn> </apply> </apply> <apply> <times/> <ci>b</ci> <ci>x</ci> </apply> <ci>c</ci> </apply> </math> </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]]. {{code|lang=XML|<apply>...</apply>}} amounts to Scheme's {{code|lang=Scheme|(...)}}, 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 (times a (power x 2)) (times b x) c) </syntaxhighlight> This reflects the long-known close relationship between XML element structures, and [[Lisp (programming language)|LISP]] or Scheme [[S-expressions]].<ref>Steven DeRose. The SGML FAQ Book: Understanding the Relationship of SGML and XML, Kluwer Academic Publishers, 1997. {{isbn|978-0-7923-9943-8}}.</ref><ref>[[Canonical S-expressions#cite note-0]]</ref> ==== Wikidata annotation in Content MathML ==== 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 | first1 = Moritz | last1 = Schubotz | first2 = Philipp | last2 = Scharpf | first3 = Bela | last3 = 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.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)