W3C

Mathematical Markup Language (MathML) Version 2.0 (Second Edition)

W3C Recommendation 21 October 2003, superseded 7 March 2023

This version:
https://www.w3.org/TR/2023/SPSD-MathML2-20230307/
Latest MathML 2 version:
https://www.w3.org/TR/MathML2/
Latest MathML Recommendation:
https://www.w3.org/TR/MathML/
Previous version:
http://www.w3.org/TR/2003/REC-MathML2-20031021/
Editors:
David Carlisle, NAG
Patrick Ion, Mathematical Reviews, American Mathematical Society
Robert Miner, Design Science, Inc.
Nico Poppelier, Penta Scope
Principal Authors:
Ron Ausbrooks, Stephen Buswell, David Carlisle, Stéphane Dalmas, Stan Devitt, Angel Diaz, Max Froumentin, Roger Hunter, Patrick Ion, Michael Kohlhase, Robert Miner, Nico Poppelier, Bruce Smith, Neil Soiffer, Robert Sutor, Stephen Watt

Please refer to the errata for this document, which may include some normative corrections.

In addition to the HTML version, this document is also available in these non-normative formats: diff marked HTML version, XHTML+MathML version, PDF (paper formatted) version, PDF (screen formatted) version, zip archive of XML sources and stylesheets, and zip archive of (X)HTML documents.

See also translations.


Abstract

This specification defines the Mathematical Markup Language, or MathML. MathML is an XML application for describing mathematical notation and capturing both its structure and content. The goal of MathML is to enable mathematics to be served, received, and processed on the World Wide Web, just as HTML has enabled this functionality for text.

This specification of the markup language MathML is intended primarily for a readership consisting of those who will be developing or implementing renderers or editors using it, or software that will communicate using MathML as a protocol for input or output. It is not a User's Guide but rather a reference document.

This document begins with background information on mathematical notation, the problems it poses, and the philosophy underlying the solutions MathML 2.0 proposes. MathML can be used to encode both mathematical notation and mathematical content. About thirty of the MathML tags describe abstract notational structures, while another about one hundred and fifty provide a way of unambiguously specifying the intended meaning of an expression. Additional chapters discuss how the MathML content and presentation elements interact, and how MathML renderers might be implemented and should interact with browsers. Finally, this document addresses the issue of MathML characters and their relation to fonts.

While MathML is human-readable, it is anticipated that, in all but the simplest cases, authors will use equation editors, conversion programs, and other specialized software tools to generate MathML. Several versions of such MathML tools already exist, and a number of others, both freely available software and commercial products, are under development.

Status of this Document

This section describes the status of this document at the time of its publication. Other documents may supersede this document. A list of current W3C publications and the latest revision of this technical report can be found in the W3C technical reports index at http://www.w3.org/TR/.

This specification is a Superseded Recommendation. A newer specification exists that is recommended for new adoption in place of this specification.

For purposes of the W3C Patent Policy, this Superseded Recommendation has the same status as an active Recommendation; it retains licensing commitments and remains available as a reference for old – and possibly still deployed – implementations, but is not recommended for future implementation. New implementations should follow the latest version of the MathML specification. (This is further explained in Obsoleting and Rescinding W3C Specifications.

This is a revised edition of a document that has been reviewed by W3C Members and other interested parties and has been endorsed by the Director as a W3C Recommendation.

This document has been produced by the W3C Math Working Group as part of W3C Math Activity. The goals of the W3C Math Working Group are discussed in the W3C Math WG Charter (revised February 2000 and June 2001 from the original of 11 June 1998). A list of participants in the W3C Math Working Group is available.

The MathML 2.0 (Second Edition) specification was reviewed extensively during its development, as provided by the W3C Process. During that period the W3C Math Working Group participants encouraged implementation using the specification and comment on it; a report on Implementation and Interoperability experiences and issues has been made public. It is intended that this will be updated from time to time by the continuing work of the W3C that oversees the MathML 2.0 Recommendation. The W3C Math Activity maintains a public Web page http://www.w3.org/Math/ which contains further background information.

The preparation of a Second Edition of the MathML 2.0 Specification allows the revision of that document to provide a coherent whole containing corrections to all the known errata and clarifications of some smaller issues that proved problematic. It is not the occasion for any fundamental changes in the language MathML 2.0. To clarify this a diff-marked HTML version of this Second Edition is made available.

Public discussion of MathML and issues of support through the W3C for mathematics on the Web takes place on the public mailing list of the Math Working Group (list archives). To subscribe send an email to www-math-request@w3.org with the word subscribe in the subject line.

Please report errors in this document to www-math@w3.org.

Patent disclosures relevant to this specification may be found on the Math Working Group's patent disclosure page.

The basic structure of this document is the same as that of the earlier MathML 2.0 Recommendation [MathML2], with the addition of an index in the new Appendix L. MathML 2.0 itself was a revision of the earlier W3C Recommendation MathML 1.01 [MathML1]. It differed from it in that all chapters were updated and two new ones and some appendices were added.

Since MathML 1.01, Chapters 1 and 2, which are introductory material, have been revised to reflect the changes elsewhere in the document, and in the rapidly evolving Web environment. Chapters 3 and 4 have been extended to describe new functionalities added as well as smaller improvements of material already proposed. Chapter 5 has been newly written to reflect changes in the technology available. The major tables in Chapter 6 have been regenerated and reorganized to reflect an improved list of characters useful for mathematics, and the text revised to reflect the new situation in regard to Unicode. Chapter 7 has been completely revised since Web technology has changed. A new Chapter 8 on the DOM for MathML 2.0 has been added; the latter points to new appendices D and E for detailed listings.

The appendices have been reorganized into normative and non-normative groups. The material in Appendices D, E, G and L was not present in MathML 1.01.

Table of Contents

1 Introduction
    1.1 Mathematics and its Notation
    1.2 Origins and Goals
        1.2.1 The History of MathML
        1.2.2 Limitations of HTML
        1.2.3 Requirements for Mathematics Markup
        1.2.4 Design Goals of MathML
    1.3 The Role of MathML on the Web
        1.3.1 Layered Design of Mathematical Web Services
        1.3.2 Relation to Other Web Technology
2 MathML Fundamentals
    2.1 MathML Overview
        2.1.1 Taxonomy of MathML Elements
        2.1.2 Presentation Markup
        2.1.3 Content Markup
        2.1.4 Mixing Presentation and Content
    2.2 MathML in a Document
    2.3 Some MathML Examples
        2.3.1 Presentation Examples
        2.3.2 Content Examples
        2.3.3 Mixed Markup Examples
    2.4 MathML Syntax and Grammar
        2.4.1 MathML Syntax and Grammar
        2.4.2 An XML Syntax Primer
        2.4.3 Children versus Arguments
        2.4.4 MathML Attribute Values
        2.4.5 Attributes Shared by all MathML Elements
        2.4.6 Collapsing Whitespace in Input
3 Presentation Markup
    3.1 Introduction
        3.1.1 What Presentation Elements Represent
        3.1.2 Terminology Used In This Chapter
        3.1.3 Required Arguments
        3.1.4 Elements with Special Behaviors
        3.1.5 Bidirectional Layout
        3.1.6 Summary of Presentation Elements
    3.2 Token Elements
        3.2.1 MathML characters in token elements
        3.2.2 Mathematics style attributes common to token elements
        3.2.3 Identifier (mi)
        3.2.4 Number (mn)
        3.2.5 Operator, Fence, Separator or Accent (mo)
        3.2.6 Text (mtext)
        3.2.7 Space (mspace)
        3.2.8 String Literal (ms)
        3.2.9 Accessing glyphs for characters from MathML (mglyph)
    3.3 General Layout Schemata
        3.3.1 Horizontally Group Sub-Expressions (mrow)
        3.3.2 Fractions (mfrac)
        3.3.3 Radicals (msqrt, mroot)
        3.3.4 Style Change (mstyle)
        3.3.5 Error Message (merror)
        3.3.6 Adjust Space Around Content (mpadded)
        3.3.7 Making Sub-Expressions Invisible (mphantom)
        3.3.8 Expression Inside Pair of Fences (mfenced)
        3.3.9 Enclose Expression Inside Notation (menclose)
    3.4 Script and Limit Schemata
        3.4.1 Subscript (msub)
        3.4.2 Superscript (msup)
        3.4.3 Subscript-superscript Pair (msubsup)
        3.4.4 Underscript (munder)
        3.4.5 Overscript (mover)
        3.4.6 Underscript-overscript Pair (munderover)
        3.4.7 Prescripts and Tensor Indices (mmultiscripts)
    3.5 Tables and Matrices
        3.5.1 Table or Matrix (mtable)
        3.5.2 Row in Table or Matrix (mtr)
        3.5.3 Labeled Row in Table or Matrix (mlabeledtr)
        3.5.4 Entry in Table or Matrix (mtd)
        3.5.5 Alignment Markers
    3.6 Enlivening Expressions
        3.6.1 Bind Action to Sub-Expression (maction)
4 Content Markup
    4.1 Introduction
        4.1.1 The Intent of Content Markup
        4.1.2 The Scope of Content Markup
        4.1.3 Basic Concepts of Content Markup
    4.2 Content Element Usage Guide
        4.2.1 Overview of Syntax and Usage
        4.2.2 Containers
        4.2.3 Functions, Operators and Qualifiers
        4.2.4 Relations
        4.2.5 Conditions
        4.2.6 Syntax and Semantics
        4.2.7 Semantic Mappings
        4.2.8 Constants and Symbols
        4.2.9 MathML element types
    4.3 Content Element Attributes
        4.3.1 Content Element Attribute Values
        4.3.2 Attributes Modifying Content Markup Semantics
        4.3.3 Attributes Modifying Content Markup Rendering
    4.4 The Content Markup Elements
        4.4.1 Token Elements
        4.4.2 Basic Content Elements
        4.4.3 Arithmetic, Algebra and Logic
        4.4.4 Relations
        4.4.5 Calculus and Vector Calculus
        4.4.6 Theory of Sets
        4.4.7 Sequences and Series
        4.4.8 Elementary classical functions
        4.4.9 Statistics
        4.4.10 Linear Algebra
        4.4.11 Semantic Mapping Elements
        4.4.12 Constant and Symbol Elements
5 Combining Presentation and Content Markup
    5.1 Why Two Different Kinds of Markup?
    5.2 Mixed Markup
        5.2.1 Reasons to Mix Markup
        5.2.2 Combinations that are prohibited
        5.2.3 Presentation Markup Contained in Content Markup
        5.2.4 Content Markup Contained in Presentation Markup
    5.3 Parallel Markup
        5.3.1 Top-level Parallel Markup
        5.3.2 Fine-grained Parallel Markup
        5.3.3 Parallel Markup via Cross-References: id and xref
        5.3.4 Annotation Cross-References using XLink: id and href
    5.4 Tools, Style Sheets and Macros for Combined Markup
        5.4.1 Notational Style Sheets
        5.4.2 Content-Faithful Transformations
        5.4.3 Style Sheets for Extensions
6 Characters, Entities and Fonts
    6.1 Introduction
    6.2 MathML Characters
        6.2.1 Unicode Character Data
        6.2.2 Special Characters Not in Unicode
        6.2.3 Mathematical Alphanumeric Symbols Characters
        6.2.4 Non-Marking Characters
    6.3 Character Symbol Listings
        6.3.1 Special Constants
        6.3.2 Character Tables (ASCII format)
        6.3.3 Tables arranged by Unicode block
        6.3.4 Negated Mathematical Characters
        6.3.5 Variant Mathematical Characters
        6.3.6 Mathematical Alphanumeric Symbols
        6.3.7 MathML Character Names
    6.4 Differences from Characters in MathML 1
        6.4.1 Coverage
        6.4.2 Fewer Non-marking Characters
        6.4.3 ISO Tables
        6.4.4 Status of Character Encodings
7 The MathML Interface
    7.1 Embedding MathML in other Documents
        7.1.1 MathML and Namespaces
        7.1.2 The Top-Level math Element
        7.1.3 Invoking MathML Processors
        7.1.4 Mixing and Linking MathML and HTML
        7.1.5 MathML and Graphical Markup
        7.1.6 Using CSS with MathML
    7.2 Conformance
        7.2.1 MathML Conformance
        7.2.2 Handling of Errors
        7.2.3 Attributes for unspecified data
    7.3 Future Extensions
        7.3.1 Macros and Style Sheets
        7.3.2 XML Extensions to MathML
8 Document Object Model for MathML
    8.1 Introduction
        8.1.1 hasFeature String
        8.1.2 MathML DOM Extensions

Appendices

A Parsing MathML
    A.1 Use of MathML as Well-Formed XML
    A.2 Using the MathML DTD
        A.2.1 DOCTYPE declaration for MathML
        A.2.2 DTD Parameters
        A.2.3 MathML as a DTD Module
        A.2.4 SGML
        A.2.5 The MathML DTD
    A.3 Using the MathML XML Schema
        A.3.1 Associating the MathML schema with MathML fragments
        A.3.2 Character entity references
B Content Markup Validation Grammar
C Content Element Definitions
    C.1 About Content Markup Elements
        C.1.1 The Default Definitions
        C.1.2 The Structure of an MMLdefinition.
    C.2 Definitions of MathML Content Elements
        C.2.1 Token Elements
        C.2.2 Basic Content Elements
        C.2.3 Arithmetic Algebra and Logic
        C.2.4 Relations
        C.2.5 Calculus and Vector Calculus
        C.2.6 Theory of Sets
        C.2.7 Sequences and Series
        C.2.8 Elementary Classical Functions
        C.2.9 Statistics
        C.2.10 Linear Algebra
        C.2.11 Constants and Symbol Elements
D Document Object Model for MathML
    D.1 IDL Interfaces
        D.1.1 Miscellaneous Object Definitions
        D.1.2 Generic MathML Elements
        D.1.3 Presentation Elements
        D.1.4 Content Elements
    D.2 MathML DOM Tables
        D.2.1 Chart of MathML DOM Inheritance
        D.2.2 Table of Elements and MathML DOM Representations
E MathML Document Object Model Bindings (Non-Normative)
    E.1 MathML Document Object Model IDL Binding
    E.2 MathML Document Object Model Java Binding
    E.3 MathML Document Object Model ECMAScript Binding
F Operator Dictionary (Non-Normative)
    F.1 Format of operator dictionary entries
    F.2 Indexing of operator dictionary
    F.3 Choice of entity names
    F.4 Notes on lspace and rspace attributes
    F.5 Operator dictionary entries
G Sample CSS Style Sheet for MathML (Non-Normative)
H Glossary (Non-Normative)
I Working Group Membership and Acknowledgments (Non-Normative)
    I.1 The Math Working Group Membership
    I.2 Acknowledgments
J Changes (Non-Normative)
    J.1 Changes between MathML 2.0 and MathML 2.0 Second Edition
    J.2 Changes between MathML 1.01 and MathML 2.0
K References (Non-Normative)
L Index (Non-Normative)
    L.1 MathML Elements
    L.2 MathML Attributes