Hubbry Logo
MathMLMathMLMain
Open search
MathML
Community hub
MathML
logo
7 pages, 0 posts
0 subscribers
Be the first to start a discussion here.
Be the first to start a discussion here.
Contribute something
MathML
MathML
from Wikipedia

MathML
Mathematical Markup Language
AbbreviationMathML
Native name
  • Mathematical Markup Language
  • ISO/IEC 40314[1]
StatusW3C Recommendation[2]
First publishedApril 1998 (1998-04)
Latest version3.0[2]
April 10, 2014; 11 years ago (2014-04-10)[2]
OrganizationW3C, ISO, IEC[1]
Committee
Editors
  • David Carlisle[2]
  • Patrick Ion[2]
  • Robert Miner[2]
  • Frédéric Wang[3]
Authors
Principal authors
    • Ron Ausbrooks
    • Stephen Buswell
    • David Carlisle
    • Giorgi Chavchanidze
    • Stéphane Dalmas
    • Stan Devitt
    • Angel Diaz
    • Sam Dooley
    • Roger Hunter
    • Patrick Ion
    • Michael Kohlhase
    • Azzeddine Lazrek
    • Paul Libbrecht
    • Bruce Miller
    • Robert Miner
    • Chris Rowley
    • Murray Sargent
    • Bruce Smith
    • Neil Soiffer
    • Robert Sutor
    • Stephen Watt
[2]
Base standardsXML
Related standardsOpenMath, OpenDocument, OMDoc
Website

Mathematical Markup Language (MathML) is a pair of mathematical markup languages, an application of XML for describing mathematical notations and capturing both its structure and content. Its aim is to natively integrate mathematical formulae into World Wide Web pages and other documents. It is part of HTML5 and standardised by ISO/IEC since 2015.[1]

History

[edit]

Following some experiments in the Arena browser based on proposals for mathematical markup in HTML,[4] MathML 1 was released as a W3C recommendation in April 1998 as the first XML language to be recommended by the W3C. Version 1.01 of the format was released in July 1999 and version 2.0 appeared in February 2001. Implementations of the specification appeared in Amaya 1.1, Mozilla 1.0 and Opera 9.5.[5][6] In October 2003, the second edition of MathML Version 2.0 was published as the final release by the W3C Math Working Group.

MathML was originally designed before the finalization of XML namespaces. However, it was assigned a namespace immediately after the Namespace Recommendation was completed, and for XML use, the elements should be in the namespace with namespace URL http://www.w3.org/1998/Math/MathML. When MathML is used in HTML (as opposed to XML) this namespace is automatically inferred by the HTML parser and need not be specified in the document.[7]

MathML version 3

[edit]

Version 3 of the MathML specification was released as a W3C recommendation on 20 October 2010. A recommendation of A MathML for CSS Profile was later released on 7 June 2011;[8] this is a subset of MathML suitable for CSS formatting. Another subset, Strict Content MathML, provides a subset of content MathML with a uniform structure and is designed to be compatible with OpenMath. Other content elements are defined in terms of a transformation to the strict subset. New content elements include <bind> which associates bound variables (<bvar>) to expressions, for example a summation index. The new <share> element allows structure sharing.[9]

The development of MathML 3.0 went through a number of stages. In June 2006, the W3C rechartered the MathML Working Group to produce a MathML 3 Recommendation until February 2008, and in November 2008 extended the charter to April 2010. A sixth Working Draft of the MathML 3 revision was published in June 2009. On 10 August 2010 version 3 graduated to become a "Proposed Recommendation" rather than a draft.[9] An implementation of MathML 2 landed in WebKit around this same time,[10] with a Chromium implementation following a couple of years later,[11] although that implementation was removed from Chromium after less than a year.[12]

The Second Edition of MathML 3.0 was published as a W3C Recommendation on 10 April 2014.[2] The specification was approved as an ISO/IEC international standard 40314:2015 on 23 June 2015.[13] Also in 2015, the MathML Association was founded to support the adoption of the MathML standard.[14] At that time, according to a member of the MathJax team, none of the major browser makers paid any of their developers for any MathML-rendering work; whatever support existed was overwhelmingly the result of unpaid volunteer time/work.[15]

MathML Core

[edit]

In August 2021, a new specification called MathML Core was published, described as the "core subset of Mathematical Markup Language, or MathML, that is suitable for browser implementation."[16] MathML Core set itself apart from MathML 3.0 by including detailed rendering rules and integration with CSS, automated browser support testing resources, and focusing on a fundamental subset of MathML. An implementation was added to Chromium at the beginning of 2023.[17]

Presentation and semantics

[edit]
Generic MathML
Filename extension
Internet media type
application/mathml+xml[18]
Type codeMML
Uniform Type Identifier (UTI)public.mathml
UTI conformationpublic.xml
Developed byWorld Wide Web Consortium
Type of formatMathematical markup language
Extended fromXML
Extended to
Standard
Open format?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). JAWS from version 16 onward supports MathML voicing as well as braille output.[20]

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.[21]

A valid MathML document typically consists of the XML declaration, DOCTYPE declaration, and document element. 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-based formats.

Presentation MathML

[edit]
Presentation MathML
Internet media type
application/mathml-presentation+xml[18]
Type codeMMLp
Uniform Type Identifier (UTI)public.mathml.presentation
UTI conformationpublic.mathml
Extended fromGeneric MathML

Presentation MathML focuses on the display of an equation, and has about 30 elements. The elements' names all begin with 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:

  • <mi>x</mi> – identifiers;
  • <mo>+</mo> – operators;
  • <mn>2</mn> – numbers;
  • <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 <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:

  • <mrow> – a horizontal row of items;
  • <msup>, <munderover>, and others – superscripts, limits over and under operators like sums, etc.;
  • <mfrac> – fractions;
  • <msqrt> and <mroot> – roots;
  • <mfenced> – surrounding content with fences, such as parentheses.

As usual in HTML and XML, many entities are available for specifying special symbols by name, such as &pi; and &RightArrow;. An interesting feature of MathML is that entities also exist to express normally-invisible operators, such as &InvisibleTimes; (or the shorthand &it;) for implicit multiplication. They are:

  • U+2061 FUNCTION APPLICATION (to distinguish from in );
  • U+2062 INVISIBLE TIMES (to distinguish from in );
  • U+2063 INVISIBLE SEPARATOR (vice versa);
  • U+2064 INVISIBLE PLUS (to distinguish from in ).

The full specification of MathML entities[22] is closely coordinated with the corresponding specifications for use with HTML and XML in general.[23]

Thus, the expression 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 (<mi>), operators (<mo>), or numbers (<mn>). Adding the token markup, the full form ends up as

<mrow>
	<mi>a</mi> <mo>&InvisibleTimes;</mo> <msup><mi>x</mi><mn>2</mn></msup>
	<mo>+</mo><mi>b</mi><mo>&InvisibleTimes;</mo><mi>x</mi>
	<mo>+</mo><mi>c</mi>
</mrow>

A complete document that consists of just the MathML example above, is shown here:

<?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>&InvisibleTimes;</mo> <msup><mi>x</mi><mn>2</mn></msup>
		<mo>+</mo><mi>b</mi><mo>&InvisibleTimes;</mo><mi>x</mi>
		<mo>+</mo><mi>c</mi>
	</mrow>
</math>

Content MathML

[edit]
Content MathML
Internet media type
application/mathml-content+xml
Type codeMMLc
Uniform Type Identifier (UTI)public.mathml.content
UTI conformationpublic.mathml
Extended fromGeneric MathML

Content MathML focuses on the semantics, or meaning, of the expression rather than its layout. Central to Content MathML is the <apply> element that represents function application. The function being applied is the first child element under <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 <ci> and <cn>. Rather than being merely another type of token, operators are represented by specific elements, whose mathematical semantics are known to MathML: <times>, <power>, etc. There are over a hundred different elements for different functions and operators.[24]

For example, <apply><sin/><ci>x</ci></apply> represents and <apply><plus/><ci>x</ci><cn>5</cn></apply> represents . The elements representing operators and functions are empty elements, because their operands are the other elements under the containing <apply>.

The expression could be represented as

<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>

Content MathML is nearly isomorphic to expressions in a functional language such as Scheme and other dialects of Lisp. <apply>...</apply> amounts to Scheme's (...), 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:

(plus
  (times a (power x 2))
  (times b x)
  c)

This reflects the long-known close relationship between XML element structures, and LISP or Scheme S-expressions.[25][26]

Wikidata annotation in Content MathML

[edit]

According to the OM Society,[27] OpenMath Content Dictionaries can be employed as collections of symbols and identifiers with declarations of their semantics – names, descriptions and rules. A 2018 paper presented at the SIGIR conference[28] 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

[edit]

The well-known quadratic formula could be represented in Presentation MathML as an expression tree made up from layout elements like <mfrac> or <msqrt>:

<math mode="display" xmlns="http://www.w3.org/1998/Math/MathML">
<semantics>
	<mrow>
		<mi>x</mi>
		<mo>=</mo>
		<mfrac>
			<mrow>
				<mo form="prefix">&minus;</mo>
				<mi>b</mi>
				<mo>&pm;</mo>
				<msqrt>
					<msup><mi>b</mi><mn>2</mn></msup>
					<mo>&minus;</mo>
					<mn>4</mn><mo>&it;</mo><mi>a</mi><mo>&it;</mo><mi>c</mi>
				</msqrt>
			</mrow>
			<mrow>
				<mn>2</mn>
				<mo>&it;</mo>
				<mi>a</mi>
			</mrow>
		</mfrac>
	</mrow>
	<annotation encoding="application/x-tex"><!-- TeX -->
		x = \frac{-b\pm\sqrt{b^2-4ac}}{2a}
	</annotation>
	<annotation encoding="StarMath 5.0">
		x = {-b plusminus sqrt {b^2 - 4 ac}} over {2 a}
	</annotation>
	<!-- More annotations can be written: application/x-troff-eqn for eqn, application/x-asciimath for AsciiMath... -->
	<!-- Semantic MathML go under <annotation-xml encoding="MathML-Content">. -->
</semantics>
</math>

This example uses the <annotation> 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 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 cases.

Although less compact than other formats, the XML structuring of MathML makes its content widely usable and accessible, allows near-instant display in applications such as web browsers, and facilitates an interpretation of its meaning in mathematical software products. MathML is not intended to be written or edited directly by humans.[29]

Embedding MathML in HTML/XHTML files

[edit]

MathML, being XML, can be embedded inside other XML files such as XHTML files using XML namespaces.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN"
	"http://www.w3.org/Math/DTD/mathml2/xhtml-math11-f.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
	<head>
		<title>Example of MathML embedded in an XHTML file</title>
		<meta name="description" content="Example of MathML embedded in an XHTML file"/>
	</head>
	<body>
		<h1>Example of MathML embedded in an XHTML file</h1>
		<p>
			The area of a circle is 
			<math xmlns="http://www.w3.org/1998/Math/MathML">
				<mi>&#x03C0;<!-- π --></mi>
				<mo>&#x2062;<!-- &InvisibleTimes; --></mo>
				<msup>
					<mi>r</mi>
					<mn>2</mn>
				</msup>
			</math>.
		</p>
	</body>
</html>
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. There is no need to specify namespaces as there was in XHTML.

<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="utf-8">
		<title>Example of MathML embedded in an HTML5 file</title>
	</head>
	<body>
		<h1>Example of MathML embedded in an HTML5 file</h1>
		<p>
			The area of a circle is 
			<math>
				<mi>&pi;</mi>
				<mo>&InvisibleTimes;</mo>
				<msup>
					<mi>r</mi>
					<mn>2</mn>
				</msup>
			</math>.
		</p>
	</body>
</html>


Embedding MathML in OpenDocument Office Suite files

[edit]

MathML is natively supported within the ISO standardised OpenDocument Format, which is the default office suite file format used in LibreOffice, Collabora Online and others, these have the filename extensions .odt, .ods, and .odp. The specific XML element <math:math> serves as a container for the MathML content, ensuring it is correctly interpreted within the OpenDocument framework.

Microsoft Office does not support MathML natively within its default proprietary XML file formats .docx, .xlsx, .pptx, instead it defines a different XML math syntax derived from older Microsoft Office products. When Microsoft Office saves equations in the OpenDocument Format, it may save equations as uneditable images, losing the ability for the equation to be edited in the future and causing loss of information. This is a Microsoft Office issue, workarounds exist, including: Updating Word, ensuring equations are in the latest format, disabling AutoSave and using the "Save as MathML" option.

Other standards

[edit]

Another standard called OpenMath that has been more specifically designed (largely by the same people who devised Content MathML) for storing formulae semantically can be used to complement MathML. OpenMath data can be embedded in MathML using the <annotation-xml encoding="OpenMath"> element. OpenMath content dictionaries can be used to define the meaning of <csymbol> elements. The following would define P1(x) to be the first Legendre polynomial:

<apply>
	<csymbol encoding="OpenMath" definitionURL="http://www.openmath.org/cd/contrib/cd/orthpoly1.xhtml#legendreP">
		<msub><mi>P</mi><mn>1</mn></msub>
	</csymbol>
	<ci>x</ci>
</apply>

OpenMath support is part of the OpenDocument office suite specification, which explicitly allows embedding OpenMath objects alongside MathML. Such that MathML renders the equation and an OpenMath is a semantic representation so that software can compute with it. Office suites that default to using the OpenDocument standard, such as LibreOffice and Collabora Online currently stick to the MathML standard for interoperability, comparatively, OpenMath is not defined in Microsoft's proprietary document formats for docx, pptx, and xlsx.

The OMDoc format has been created for markup of larger mathematical structures than formulae, from statements like definitions, theorems, proofs, and examples, to complete theories and even entire text books. Formulae in OMDoc documents can either be written in Content MathML or in OpenMath; for presentation, they are converted to Presentation MathML.

See also

[edit]

References

[edit]

Further reading

[edit]
[edit]
Revisions and contributorsEdit on WikipediaRead on Wikipedia
from Grokipedia
Mathematical Markup Language (MathML) is an XML-based designed for describing and capturing both its structure and content, enabling the rendering, editing, and reuse of mathematical expressions across the web and other digital platforms. Developed by the (W3C), MathML addresses the limitations of in representing complex mathematics by providing a standardized format that supports both visual presentation and semantic meaning, facilitating applications in browsers, educational tools, scientific publishing, and computational systems. MathML consists of two primary components: Presentation MathML, which focuses on the visual layout and display of mathematical expressions using elements like <mrow> for grouping and <mo> for operators, and Content MathML, which encodes the underlying semantics and logical structure for machine interpretation, such as using <apply> to represent operations like or integration. These can be combined through parallel markup annotations to link visual and semantic forms, enhancing accessibility for screen readers and enabling features like copy-paste of meaningful math in documents. The language includes approximately 38 elements for presentation and around 170 for content, with support for attributes that control spacing, alignment, and scripting integration. Initiated in the late , MathML's development began with Version 1.0 as a W3C Recommendation in April 1998, followed by in 2003, which expanded compatibility with style sheets and plug-ins, and Version 3.0 in 2010 (second edition 2014), introducing improvements in content markup and . The latest iteration, MathML Version 4.0, first published as a W3C Working Draft in September 2022 and updated to a Working Draft on October 23, 2025, builds on a subset called MathML Core for streamlined web implementation, adding features like enhanced linebreaking, elementary math layouts, and better operator dictionaries while maintaining with prior versions. This evolution reflects ongoing efforts to integrate MathML natively into web standards, with native support for MathML Core achieved in major browsers like , Chrome, and as of 2023, though full feature support varies by engine. In practice, MathML is generated by equation editors, conversion tools from formats like , or authoring software, and rendered via CSS, libraries, or built-in browser capabilities, making it essential for inclusive web content in STEM fields. Its adoption promotes interoperability between diverse systems, from print typesetting to voice synthesis, ensuring mathematical expressions remain editable and computable without loss of fidelity.

Introduction

Definition and Purpose

MathML (Mathematical Markup Language) is an XML-based markup language designed for describing mathematical notation and capturing both its structure and content. As a W3C Recommendation first published in April 1998, it represents the initial application of XML to mathematical expressions on the web. MathML consists of two primary components: Presentation MathML, which focuses on the visual layout and rendering of mathematical formulas, and Content MathML, which encodes the semantic meaning and logical structure of the mathematics. The primary purpose of MathML is to enable the inclusion of mathematical expressions in digital documents, such as web pages, ebooks, and scientific publications, while facilitating their reuse across different platforms and applications. It improves by allowing screen readers and assistive technologies to interpret and vocalize mathematical content meaningfully, rather than treating it as unstructured images or text. Additionally, MathML supports the interchange of mathematical data between software systems, including tools and authoring environments, promoting interoperability in scientific computing. In a broader historical context, MathML emerged as a specialized application of XML to address the limitations of earlier methods for representing mathematics digitally, such as proprietary formats or scanned images. It has been standardized within the ISO/IEC 26300 specification for Open Document Format (ODF), ensuring its integration into office productivity suites for embedding formulas in word processing and spreadsheet files. Key benefits include device-independent rendering, which allows consistent display across browsers and devices without relying on plugins, and robust support for complex equations, such as integrals, matrices, and multiline displays.

Design Goals and Principles

MathML was designed with the primary goal of enabling and content to be served, received, and processed on the in a manner analogous to for text. This encompasses capturing both the visual of mathematical expressions and their underlying semantics, allowing for diverse applications such as rendering, , and into other formats. A key objective is to support extensibility, ensuring the language can evolve to accommodate new mathematical needs without disrupting existing implementations. Furthermore, MathML integrates seamlessly with web standards, functioning as an XML application that embeds within , , and for enhanced interoperability. The architectural principles of MathML emphasize modularity through parallel markup systems for presentation, which focuses on visual layout, and content, which encodes mathematical meaning, allowing users to choose or combine approaches as needed. Internationalization is a core principle, with support for bidirectional text and global character encoding via Unicode to facilitate worldwide adoption. Backward compatibility is prioritized by designing conversion pathways from legacy systems, ensuring that existing mathematical documents can transition smoothly. Influenced by for its precise notation rendering and OpenMath for semantic encoding, MathML aims to produce human-readable source code while maintaining a structure that is readily processable by machines. This balance supports authoring by mathematicians and automated handling by software tools. forms a foundational , with semantic markup enabling assistive technologies to navigate and interpret mathematical content through , output, and structured exploration, thereby making inclusive for users with disabilities.

Development History

Versions 1.0 and 2.0

MathML 1.0 was issued as a W3C Recommendation on , 1998, marking the first XML-based vocabulary for mathematical markup on the web. This initial version introduced fundamental presentation elements to describe the visual layout of , including <mi> for identifiers such as variables and <mo> for operators like or equality symbols. It also provided limited content markup capabilities, featuring approximately 75 elements dedicated to encoding the semantic meaning of mathematical expressions and 28 elements focused on notational structures. Among its key innovations were token elements, exemplified by <mi> and <mo>, which formed the basic building blocks for rendering , along with style attributes that enabled rudimentary formatting options such as font size and color adjustments. However, scripting support was not explicitly included in this release, limiting to static rendering. Building on this foundation, MathML 2.0 was published as a W3C Recommendation on February 21, 2001, with a second edition released on October 21, 2003, to incorporate errata and minor clarifications. This version expanded bidirectional content MathML, increasing the number of content elements to around 150 to better capture mathematical semantics in both directions—from structure to meaning and vice versa. It introduced support for elementary math layouts through enhanced presentation schemata, including new elements for scripts, limits, tables, and general layouts, while improving integration with for embedding mathematical expressions in broader web documents. Additionally, MathML 2.0 initiated ISO standardization efforts by aligning its character encodings and structures with emerging international standards, such as those from ISO for . The innovations in MathML 2.0 further developed token elements with expansions for more nuanced notational control, refined style attributes to support basic visual customizations, and provided initial scripting support through a dedicated (DOM) interface, enabling dynamic manipulation of mathematical content in web applications. Despite these progresses, both versions 1.0 and 2.0 encountered significant limitations, including poor browser adoption—where native rendering was confined to early Mozilla-based browsers and required third-party plugins for widespread use in tools like —and insufficient advanced semantics, which hindered precise mathematical interpretation beyond basic expressions. Native CSS styling was also absent, relying instead on attribute-based formatting and external fonts, leading to inconsistent rendering across implementations. These foundational releases of MathML 1.0 and 2.0 established essential token-based and layout mechanisms that influenced subsequent versions of the standard.

Version 3.0

MathML 3.0 was published as a W3C Recommendation on , 2010, marking a significant evolution from prior versions by emphasizing semantic precision and broader applicability. A second edition followed on April 10, 2014, incorporating errata corrections, clarifications, and alignment with parsing rules to enhance compatibility with modern web standards. This version addressed key limitations of MathML 2.0, such as inconsistent semantic encoding and limited support for diverse notations, through refined error handling mechanisms that define processing behaviors for invalid markup, ensuring more robust implementations across tools and platforms. Major features of MathML 3.0 include substantial enhancements to Content MathML, which introduces a strict subset with well-defined semantics inspired by the OpenMath standard for representing mathematical objects. This OpenMath-based approach uses elements like <apply>, <bind>, and <csymbol> to encode expression trees with precise meaning, facilitating with systems and enabling unambiguous mathematical communication. Additionally, support for was added via new presentation elements such as <mstack> for aligned columnar layouts (e.g., with carry marks) and <mlongdiv> for , simplifying the markup of basic arithmetic operations commonly used in educational contexts. handling was improved to accommodate right-to-left scripts in formulas, with attributes like dir on <math> elements controlling layout directionality. Key additions in MathML 3.0 encompass the <semantics> element, which serves as a container to associate markup with content expressions or alternative annotations, thereby bridging visual rendering and underlying meaning for more versatile applications. was bolstered through expanded attributes (e.g., alttext and role) and semantic structures that aid screen readers in interpreting complex expressions. Integration with was formalized, allowing MathML to embed for diagrams like geometric figures within mathematical contexts via the <foreignObject> mechanism. In 2016, MathML 3.0 achieved international standardization as ISO/IEC 40314:2016, affirming its as a global reference for mathematical markup. This specification provided the foundational elements later refined in subsets like MathML Core.

MathML Core

MathML Core is a specification developed by the W3C Math Working Group that defines a minimal, implementable subset of the MathML 3.0 standard, specifically targeting essential Presentation MathML elements to facilitate native rendering in web browsers. It was initially published as a First Public Working Draft in August 2021 and advanced to Candidate Recommendation status on June 24, 2025, with further updates and refinements continuing through 2025 to gather implementation feedback. As of November 2025, MathML Core remains in Candidate Recommendation status, with ongoing implementation testing. This subset builds briefly on the semantics of MathML 3.0 while prioritizing browser compatibility over comprehensive features. The core features of MathML Core include 30 essential elements for rendering , such as the top-level <math> container, <mrow> for grouping expressions, and <msup> for superscripts. It integrates deeply with CSS for styling and layout, supporting properties like display: block math or inline math to control rendering behavior, along with math-specific extensions such as math-style and math-shift for adjusting script positioning and depth. The <mstyle> element is included for compatibility but authors targeting MathML Core are encouraged to use CSS for styling instead. The primary goals of MathML Core are to enhance native browser support for mathematical content by reducing the specification's complexity and aligning it with modern web platform technologies like , , and the DOM. This focus enables easier adoption by browser engines, promotes interoperability through automated testing, and allows for future extensions via mechanisms such as shadow DOM or custom elements. Additionally, it incorporates attributes and event handlers to improve , ensuring that mathematical expressions can be navigated and announced by assistive technologies in line with HTML focus management. Recent developments in 2025 include ongoing interoperability initiatives coordinated by the W3C Math Working Group, such as the Interop 2025 project, which aims to boost consistent rendering across browser engines like , Blink, and through comprehensive test suites and cross-team collaboration. These efforts track progress via public issues and Web Platform Tests (WPT), with a emphasis on increasing interop scores to solidify MathML Core as a reliable web standard.

Version 4.0 and Recent Developments

MathML 4.0 builds upon MathML Core by integrating its foundational subset while introducing extensions that enhance semantic expression and rendering capabilities. As of October 23, 2025, the specification remains in Working Draft status, published by the W3C Math Working Group, with updates including advanced attributes for operator stretching and linebreaking controls in Presentation MathML, as well as refined Content MathML elements for capturing mathematical intent and structure. These extensions aim to support more precise mathematical notation, such as improved handling of accents and symmetric operators, while maintaining compatibility with browser implementations. In 2025, significant ecosystem integrations have advanced MathML adoption. , through the Math extension, completed its transition to native MathML rendering as the default mode, replacing reliance on external services like Mathoid for formula display, which improves performance and accessibility across supported browsers. Similarly, 2025 introduced a dedicated MathML panel, enabling users to create, edit, and style mathematical expressions directly within the application by inputting MathML code, which is then rendered as SVG for print and digital layouts. Further updates in 2025 have addressed rendering and interoperability challenges. As part of the Interop 2025 initiative, browser vendors prioritized enhancements to CSS styling over MathML Core elements, tackling inconsistencies in property support like font rendering and layout adjustments to ensure more uniform cross-browser behavior. Accessibility improvements have also progressed, with MathML 4.0 drafts incorporating the intent attribute to resolve conflicts between visual presentation and semantic meaning, facilitating better navigation in tools like NVDA and enabling richer STEM content in Tagged PDFs.

Technical Specifications

Presentation MathML

Presentation MathML provides a mechanism for describing the visual layout of mathematical expressions using XML elements, emphasizing structural arrangement over mathematical meaning. It enables the rendering of notation similar to traditional systems, such as those in printed , by combining basic into hierarchical layouts. This approach allows for precise control over spacing, alignment, and sizing without embedding semantic interpretations of the content. The foundation of Presentation MathML consists of token elements, which represent atomic components of expressions. The <mi> element denotes mathematical identifiers, such as variables, typically rendered in italic font to distinguish them from text. The <mn> element specifies numeric values, including integers, decimals, or , ensuring accurate display of quantities. The <mo> element handles operators, relation symbols, fences (like parentheses), and accents, with attributes that influence their behavior, such as spacing or stretchability. These tokens form the leaves of the expression tree, upon which layout elements build visual structures. Layout schemata organize token elements into common mathematical constructs. The <mrow> element groups subexpressions horizontally, maintaining baseline alignment to create sequences like sums or products. The <mfrac> element constructs fractions, dividing a numerator from a denominator with an optional line thickness controlled by its linethickness attribute, allowing for solid, dashed, or invisible bars. The <msqrt> element renders square roots, enclosing its content under a , while related elements like <mroot> extend this to roots with explicit indices. These schemata ensure consistent and predictable rendering across implementations. Additional key structures support advanced notations. Script elements include <msup> for superscripts, positioning content above and to the right of a base, and <msub> for subscripts, placed below and to the right. The <mtable> element, along with <mtr> for rows and <mtd> for cells, facilitates tabular layouts such as matrices or arrays, with attributes for alignment and column widths. For overscript and underscript attachments, <mover> places an accent or limit above a base, while <munder> does so below, commonly used for integrals or summations. These elements enable the representation of complex expressions like limits or stacked relations. Global attributes like displaystyle and scriptlevel fine-tune rendering. The displaystyle attribute, when set to true, renders expressions in full display style with larger symbols and limits positioned away from the base; false uses a compact inline style suitable for embedded formulas. The scriptlevel attribute adjusts font size and positioning in nested scripts—incrementing it shrinks subsequent elements, while decrementing enlarges them—to maintain readability in exponents or indices. A representative example is the markup for the x2+bx+c=0x^{2} + b x + c = 0:

xml

<math> <msup><mi>x</mi><mn>2</mn></msup> <mo>+</mo> <mi>b</mi> <mi>x</mi> <mo>+</mo> <mi>c</mi> <mo>=</mo> <mn>0</mn> </math>

<math> <msup><mi>x</mi><mn>2</mn></msup> <mo>+</mo> <mi>b</mi> <mi>x</mi> <mo>+</mo> <mi>c</mi> <mo>=</mo> <mn>0</mn> </math>

Here, <msup> attaches the exponent <mn>2</mn> to the variable <mi>x</mi>, <mo> elements provide operators with appropriate spacing, and <mi> and <mn> distinguish variables and constants; an implicit or explicit <mrow> would group the terms if needed for explicit sequencing. Rendering in Presentation MathML follows principles derived from mathematical conventions. Certain <mo> elements, such as stretchy fences (e.g., parentheses), automatically adjust their height and depth to enclose surrounding content, ensuring balanced enclosure. In MathML Core, line breaking within expressions is not supported, as the white-space property is treated as nowrap on all elements, preventing automatic wrapping to maintain formula integrity.

Content MathML

Content MathML, part of MathML Full, is designed to encode the semantic structure and meaning of mathematical expressions, enabling computational processing and interchange between systems. It adopts a functional approach based on an apply/relation model inspired by the OpenMath standard, which emphasizes the representation of mathematical objects through operators applied to arguments. This model treats mathematical expressions as trees, where nodes represent functions or relations, and leaves denote basic entities like numbers or identifiers, facilitating unambiguous interpretation by software tools such as computer algebra systems. While Presentation MathML is supported in MathML Core for native browser rendering, Content MathML is primarily used in authoring tools and systems requiring semantic processing, with browser support via JavaScript polyfills as of 2025. Central to Content MathML is the <apply> element, which encapsulates the application of an operator or function to one or more arguments, forming the backbone of expression trees. For instance, declared identifiers—such as variables or function names—are marked with the <ci> element, while numeric constants use the <cn> element to specify values like integers, reals, or rationals. These token elements combine within <apply> to build complex expressions; for example, the sum x+5x + 5 is rendered as <apply><plus/><ci>x</ci><cn>5</cn></apply>, where <plus/> acts as the operator node. Key features of Content MathML include qualifiers, bindings, and mechanisms for referencing external semantics to support advanced constructs. Qualifiers such as <lowlimit> and <uplimit> attach bounds to operators like integrals or sums, specifying limits without altering the core application structure. Bindings are handled by the <lambda> element, which declares variables for , as in defining a function f(x)=x2f(x) = x^2 via <lambda><bvar><ci>x</ci></bvar><apply><power/><ci>x</ci><cn>2</cn></apply></lambda>. For error handling and extensibility, the <cs> element denotes content symbols that reference predefined or external dictionaries, allowing systems to resolve ambiguities by consulting sources like OpenMath content dictionaries. A representative example of Content MathML's semantic markup is the definite integral 01x2dx\int_0^1 x^2 \, dx, expressed as follows:

xml

<apply> <int/> <bvar><ci>x</ci></bvar> <lowlimit><cn>0</cn></lowlimit> <uplimit><cn>1</cn></uplimit> <apply><power/><ci>x</ci><cn>2</cn></apply> </apply>

<apply> <int/> <bvar><ci>x</ci></bvar> <lowlimit><cn>0</cn></lowlimit> <uplimit><cn>1</cn></uplimit> <apply><power/><ci>x</ci><cn>2</cn></apply> </apply>

This has <apply> as the root, applying the definite integral operator <int/> to the bound variable <bvar><ci>x</ci></bvar>, the lower limit <lowlimit><cn>0</cn></lowlimit>, the upper limit <uplimit><cn>1</cn></uplimit>, and the integrand <apply><power/><ci>x</ci><cn>2</cn></apply>, capturing the full mathematical intent for computation. Content MathML supports integration with external knowledge bases through annotations, such as using <annotation-xml encoding="application/wikidata"> to link identifiers to Wikidata items via qualified identifiers (QIDs). This mechanism grounds symbols in a shared ontology; for example, in Einstein's equation E=mc2E = mc^2, the identifier E can be annotated with Q11379 for "energy," enabling semantic disambiguation and interoperability across languages and systems. Such annotations are typically embedded within <semantics> or <csymbol> elements, referencing Wikidata as a content dictionary via the cd attribute. Content MathML expressions can be paired with presentation markup using the <semantics> element to associate meaning with visual rendering in a single document.

Annotations and Extensions

The <semantics> element in MathML serves as a container that associates semantic annotations with a primary mathematical expression, typically presentation MathML, to provide additional meaning without altering the visual rendering. It encapsulates one or more child elements, where the first child represents the core expression and subsequent children offer annotations for enhanced processing or accessibility. This mechanism enables dual representation, linking surface notation to underlying structure, such as wrapping presentation markup with content equivalents for better machine readability. Annotations within <semantics> are provided via the <annotation> and <annotation-xml> elements, which supply alternative or supplementary data in various formats. The <annotation> element holds non-XML content, such as or source, encoded as plain text to facilitate conversion or editing in familiar notations. In contrast, <annotation-xml> accommodates structured XML-based annotations, including Content MathML for semantic encoding or OpenMath for standardized mathematical objects, with the encoding attribute specifying the format (e.g., "application/mathml+xml" or "OpenMath"). For instance, identifiers can be integrated as OpenMath content dictionaries within <annotation-xml> to ground mathematical entities in a . These annotations support interoperability across tools and formats. Extensions in MathML allow customization through XML namespaces, enabling the definition of domain-specific elements while preserving compatibility with standard processors. Custom elements are declared using namespace prefixes (e.g., m:custom bound to a user-defined URI), which renderers may interpret or ignore as needed. Additionally, foreign elements from other namespaces, such as for graphical diagrams, can be embedded within MathML contexts like <mtext> or <math>, enhancing expressions with vector illustrations. For example:

xml

<mtext> <svg xmlns="http://www.w3.org/2000/svg" width="4cm" height="4cm"> <rect x="1" y="1" width="398" height="398"/> </svg> </mtext>

<mtext> <svg xmlns="http://www.w3.org/2000/svg" width="4cm" height="4cm"> <rect x="1" y="1" width="398" height="398"/> </svg> </mtext>

This supports advanced visualizations without disrupting the mathematical structure. Use cases for these features prominently include improvements, where annotations provide semantic context for assistive technologies, such as screen readers interpreting Content MathML or annotations aligned with practices to describe mathematical roles. They also enable tool-specific metadata, like attributes for enhanced navigation, ensuring expressions are both visually and programmatically accessible.

Implementation and Usage

Markup Examples

MathML markup examples illustrate how to encode mathematical expressions using its elements for presentation, content, and parallel representations. These snippets demonstrate practical usage within a <math> element, typically embedded in XML or HTML documents. A simple presentation MathML example encodes the summation formula k=1nk2\sum_{k=1}^{n} k^2, which renders as a summation operator with lower limit k=1k=1, upper limit nn, and the term k2k^2.

xml

<math xmlns="http://www.w3.org/1998/Math/MathML"> <munderover> <mo></mo> <mrow><mi>k</mi><mo>=</mo><mn>1</mn></mrow> <mi>n</mi> </munderover> <msup><mi>k</mi><mn>2</mn></msup> </math>

<math xmlns="http://www.w3.org/1998/Math/MathML"> <munderover> <mo></mo> <mrow><mi>k</mi><mo>=</mo><mn>1</mn></mrow> <mi>n</mi> </munderover> <msup><mi>k</mi><mn>2</mn></msup> </math>

This uses <munderover> for the limits on the summation symbol and <msup> for the squared term, producing a visually structured notation suitable for display. For parallel markup, MathML combines presentation and content forms using the <semantics> element to associate a visual rendering with its semantic structure, such as for the derivative of f(x)f(x) with respect to xx, which renders as f(x)f'(x) while encoding the differentiation operation.

xml

<math xmlns="http://www.w3.org/1998/Math/MathML"> <semantics> <mrow> <mi>f</mi> <mo>&#x2032;</mo> <mrow> <mo>(</mo> <mi>x</mi> <mo>)</mo> </mrow> </mrow> <annotation-xml encoding="MathML-Content"> <apply> <diff/> <bvar><ci>x</ci></bvar> <apply><ci>f</ci><ci>x</ci></apply> </apply> </annotation-xml> </semantics> </math>

<math xmlns="http://www.w3.org/1998/Math/MathML"> <semantics> <mrow> <mi>f</mi> <mo>&#x2032;</mo> <mrow> <mo>(</mo> <mi>x</mi> <mo>)</mo> </mrow> </mrow> <annotation-xml encoding="MathML-Content"> <apply> <diff/> <bvar><ci>x</ci></bvar> <apply><ci>f</ci><ci>x</ci></apply> </apply> </annotation-xml> </semantics> </math>

The presentation child provides the prime notation for visual output, while the content annotation uses <apply> and <diff/> to express the mathematical intent for processing by tools like computer algebra systems. A more complex example encodes a 2x2 matrix , such as (1234)\begin{pmatrix} 1 & 2 \\ 3 & 4 \end{pmatrix}, with semantics linking to content and a annotation for fallback rendering in incompatible environments.

xml

<math xmlns="http://www.w3.org/1998/Math/MathML"> <semantics> <mtable> <mtr><mtd><mn>1</mn></mtd><mtd><mn>2</mn></mtd></mtr> <mtr><mtd><mn>3</mn></mtd><mtd><mn>4</mn></mtd></mtr> </mtable> <annotation-xml encoding="MathML-Content"> <matrix> <row><cn>1</cn><cn>2</cn></row> <row><cn>3</cn><cn>4</cn></row> </matrix> </annotation-xml> <annotation encoding="LaTeX">\begin{pmatrix} 1 & 2 \\ 3 & 4 \end{pmatrix}</annotation> </semantics> </math>

<math xmlns="http://www.w3.org/1998/Math/MathML"> <semantics> <mtable> <mtr><mtd><mn>1</mn></mtd><mtd><mn>2</mn></mtd></mtr> <mtr><mtd><mn>3</mn></mtd><mtd><mn>4</mn></mtd></mtr> </mtable> <annotation-xml encoding="MathML-Content"> <matrix> <row><cn>1</cn><cn>2</cn></row> <row><cn>3</cn><cn>4</cn></row> </matrix> </annotation-xml> <annotation encoding="LaTeX">\begin{pmatrix} 1 & 2 \\ 3 & 4 \end{pmatrix}</annotation> </semantics> </math>

Here, <mtable> structures the visual matrix rows and columns, the content annotation uses <matrix> for semantic representation, and the annotation ensures accessibility via alternative parsers. To validate and test MathML markup, developers can use the W3C Markup Validation Service, which checks conformance to the MathML schema, or the MathML Test Suite for rendering consistency across implementations. These tools help identify syntax errors and ensure compatibility by parsing against the RelaxNG schema defined in the specification.

Embedding in Documents

MathML can be embedded directly into HTML5 and XHTML documents using the <math> root element, which encapsulates mathematical expressions as flow or phrasing content. In HTML5, served with the text/html MIME type, MathML elements are recognized without namespace prefixes, allowing seamless integration within the document body, such as <math><mi>x</mi><mo>=</mo><mn>2</mn></math>. For XHTML, served as application/xhtml+xml, the namespace must be declared on the <math> element, e.g., <math xmlns="http://www.w3.org/1998/Math/MathML">, to ensure XML compliance and validation. To handle browsers with limited native support, fallbacks include the altimg attribute on <math> for linking to image representations (e.g., PNG or SVG) or JavaScript polyfills like MathJax, which dynamically render MathML via client-side processing. In the OpenDocument Format (ODF), used by applications like , MathML serves as the underlying representation for mathematical formulas, embedded within drawing frames such as <draw:frame> elements containing a <math> child from the MathML namespace. integrates this via its Math module, where formulas created in the are stored as MathML in ODF files (.odt, .ods, etc.), enabling interoperability across ODF-compliant software. Export workflows involve saving individual formulas as standalone MathML files (.mml) through File > Save As or right-click options, while import supports pasting MathML code via Tools > Import MathML from Clipboard, converting it directly into editable objects; Microsoft Office formats can also be imported with OLE-to-MathML conversion enabled in preferences. EPUB 3 publications support MathML embedding within content documents, treating it as native markup for mathematical content in reflowable or fixed-layout ebooks. Presentation MathML is required for direct rendering, with Content MathML permitted only in annotations like <semantics> or <annotation-xml>, and the mathml property must be added to the <item> element to signal its presence for reading systems. For graphical contexts, MathML can be wrapped in using the <foreignObject> element, e.g., <foreignObject><math xmlns="http://www.w3.org/1998/Math/MathML">...</math></foreignObject>, allowing mathematical expressions to be treated as vector graphics while preserving scalability and interactivity in formats like + profiles. Best practices for embedding MathML emphasize proper namespace declarations to avoid parsing errors, using xmlns="http://www.w3.org/1998/Math/MathML" on the <math> for XML documents or omitting it in for broader compatibility. Accessibility is enhanced by attributes like alttext on <math> for textual descriptions readable by screen readers, and the <semantics> element to pair visual MathML with alternative encodings (e.g., speech-friendly content), ensuring compliance with standards like WCAG for non-visual users.

Browser and Software Support

MathML enjoys varying levels of native support across major web browsers as of 2025. Firefox has provided full native rendering of MathML since version 1.0, enabling direct display of mathematical expressions without additional plugins. Safari and WebKit-based browsers offer partial support, covering core presentation features but with limitations in advanced styling and content markup. Chromium-based browsers, including Chrome and Edge, support MathML Core since version 109, but full implementation remains experimental or requires enabling flags for broader compatibility; polyfills like MathJax and Mathoid are commonly used as fallbacks to ensure consistent rendering across these environments. In professional software, MathML integration has advanced significantly by 2025. InDesign's 2025 release introduces a dedicated MathML panel for creating, editing, and styling mathematical expressions directly within documents, supporting import as for print and digital workflows. 2025 continues to offer robust export capabilities to MathML, allowing users to convert symbolic computations into encoded text for web or document integration via commands like and ExportContent. completed its rollout of native MathML rendering in late 2024, with ongoing refinements in 2025 to replace legacy Mathoid services and improve formula accessibility across wikis. Despite these advancements, challenges persist in MathML adoption, particularly with incomplete implementation of MathML Core features across browsers, which limits support to a subset of the full specification and complicates cross-platform consistency. Accessibility remains a notable gap, as screen readers like NVDA do not natively interpret MathML without add-ons such as Access8Math or MathCAT, hindering navigation and verbalization of complex equations for visually impaired users. Recent trends indicate progress toward better interoperability, with the Interop 2025 initiative addressing key issues in CSS styling over MathML Core and overall mathematical rendering to achieve more uniform behavior across engines.

Other Mathematical Formats

, developed by in the late 1970s, is a typesetting system and programming language optimized for producing high-quality printed output, with particular emphasis on through its precise control over spacing, fonts, and glyphs. , introduced by in 1985 as a macro package atop , simplifies document preparation by providing a for structured content, including extensive support for mathematical equations via commands like \frac{a}{b} that generate professional-looking formulas. Widely adopted in scientific publishing, and excel in visual typesetting but operate as procedural systems without inherent XML structure or semantic markup, relying instead on user-defined commands for rendering. OpenMath, standardized since the early 2000s, defines an XML-based content encoding for mathematical objects, capturing their semantic meaning—such as the intent behind an or sum—independent of display. This allows for unambiguous exchange of mathematical data between software tools, with content dictionaries specifying symbol semantics to ensure interoperability. As a purely semantic format, OpenMath serves as a complement to Content MathML, often integrated via annotations for enhanced expressiveness in hybrid systems. ASCIIMath offers a simple, text-based notation for mathematics using standard keyboard characters, such as x^2 for x2x^2 or int_0^oo e^(-x) dx for the integral 0exdx\int_0^\infty e^{-x} \, dx, making it suitable for quick entry in plain-text contexts like emails or wikis. It is designed for conversion to richer formats like MathML during rendering, prioritizing ease of authoring over complex structure. Unicode, through blocks like Mathematical Operators (U+2200–U+22FF) and (U+1D400–U+1D7FF), encodes thousands of symbols for direct use in text, supporting lightweight math representation without additional markup, though it requires conventions for layout in plain text. Office Math Markup Language (OMML), introduced by in Office 2007, is an for encoding mathematical expressions in applications like Word, emphasizing linear and professional layouts with elements for fractions, matrices, and scripts akin to presentation-oriented systems. It enables native editing and rendering within Office documents, focusing on accessibility and integration with linear input methods like UnicodeMath.

Comparisons and Integrations

MathML offers distinct advantages over in semantic encoding for web-based applications, where Content MathML captures the mathematical structure and meaning beyond mere visual presentation, facilitating features like navigation that LaTeX's primarily typesetting-oriented syntax does not natively support. In contrast, excels in print-focused document preparation with its concise, author-friendly syntax resembling traditional , but it requires conversion for web integration. Tools such as LaTeXML, which emulates processing to generate XML/HTML/ output, and the pure Python library latex2mathml enable bidirectional or one-way conversions between the formats, bridging LaTeX workflows with web standards. Compared to Math Markup Language (OMML), developed by for equation representation in applications, MathML shares overlaps in presentation markup for rendering mathematical expressions but emphasizes web standardization through W3C specifications, ensuring broader interoperability across browsers and non-proprietary tools. OMML's structure is optimized for 's in-memory format and linear editing, leading to limited direct compatibility with web environments without conversion, whereas MathML's XML-based design supports seamless embedding in documents. MathML integrates effectively with web technologies for enhanced functionality and styling. Cascading Style Sheets (CSS) can be applied to MathML elements via the MathML for CSS Profile, allowing precise control over layout, fonts, and spacing in browsers that support it, such as through rules targeting elements like <mrow> or <mi>. JavaScript libraries like provide dynamic rendering of MathML (alongside or ASCII Math inputs), enabling real-time typesetting and interaction in web pages by processing <math> tags and outputting HTML/CSS or representations. For diagrams, MathML combines with through modular +MathML+ profiles, permitting mathematical annotations within for scalable, interactive illustrations like commutative diagrams. Among MathML's strengths is its superior , as the semantic structure in Content MathML allows assistive technologies to interpret and vocalize equations meaningfully, outperforming image-based or simple text alternatives in formats like math, which often rely on delimited snippets without inherent structure. However, MathML's verbose XML syntax imposes a steeper compared to Markdown's lightweight inline math delimiters (e.g., $...$), making it less intuitive for quick web authoring despite its long-term benefits in reusability and machine readability.

References

  1. https://www.mediawiki.org/wiki/Extension:Math
  2. https://www.mediawiki.org/wiki/Extension:Math/Native_MathML_rollout_%282024%29
Add your contribution
Related Hubs
Contribute something
User Avatar
No comments yet.