CARVIEW |
MathML Core
W3C First Public Working Draft
- This version:
- https://www.w3.org/TR/2021/WD-mathml-core-20210810/
- Latest published version:
- https://www.w3.org/TR/mathml-core/
- Latest editor's draft:
- https://w3c.github.io/mathml-core/
- Test suite:
- https://github.com/web-platform-tests/wpt/tree/master/mathml/
- Implementation report:
- https://w3c.github.io/mathml-core/implementation-report.html
- Editors:
- David Carlisle (NAG)
- Frédéric Wang (Igalia)
- Former editors:
- Patrick Ion (Mathematical Reviews, American Mathematical Society)
- Robert Miner (deceased) (Design Science, Inc.)
- Participate:
- GitHub w3c/mathml-core
- File an issue
- Commit history
- Pull requests
Copyright © 2021 W3C® (MIT, ERCIM, Keio, Beihang). W3C liability, trademark and permissive document license rules apply.
Abstract
This specification defines a core subset of Mathematical Markup Language, or MathML, that is suitable for browser implementation. MathML is a markup language 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.
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 https://www.w3.org/TR/.
This document was published by the Math Working Group as a First Public Working Draft. This document is intended to become a W3C Recommendation.
GitHub Issues are preferred for discussion of this specification.
Publication as a First Public Working Draft does not imply endorsement by the W3C Membership.
This is a draft document and may be updated, replaced or obsoleted by other documents at any time. It is inappropriate to cite this document as other than work in progress.
This document was produced by a group operating under the W3C Patent Policy. W3C maintains a public list of any patent disclosures made in connection with the deliverables of the group; that page also includes instructions for disclosing a patent. An individual who has actual knowledge of a patent which the individual believes contains Essential Claim(s) must disclose the information in accordance with section 6 of the W3C Patent Policy.
This document is governed by the 15 September 2020 W3C Process Document.
1. Introduction
This section is non-normative.
The [MATHML3] specification has several shortcomings that make it hard to implement consistently across web rendering engines or to extend with user-defined constructions e.g.
- It is a huge and standalone specification.
- It does not contain any detailed rendering rules.
- It is not driven by browser-implementation.
- It lacks automated testing.
This MathML Core specification intends to address these issues by being as accurate as possible on the visual rendering of mathematical formulas using additional rules from the TeXBook’s Appendix G [TEXBOOK] and from the Open Font Format [OPEN-FONT-FORMAT], [OPEN-TYPE-MATH-ILLUMINATED]. It also relies on modern browser implementations and web technologies [HTML] clarifying interactions with them when needed or introducing new low-level primitives to improve the web platform layering.
Parts of MathML3 that do not fit well in this framework or are less fundamental have been omitted. Instead, they are described in a separate and larger [MATHML4] specification. The details of which math feature will be included in future versions of MathML Core or implemented as polyfills is still open. This question and other potential improvements are tracked on GitHub.
By increasing the level of implementation details, focusing on a workable subset, following a browser-driven design and relying on automated web platform tests, this specification is expected to greatly improve MathML interoperability. Moreover, effort on MathML layering will enable users to implement the rest of the MathML 4 specification, or more generally to extend MathML Core, using modern web technologies such as shadow DOM, custom elements, CSS layout API or other Houdini APIs.
2. MathML Fundamentals
2.1 Elements and attributes
The term MathML element refers to any element in the MathML namespace. The MathML element defined in this specification are called the MathML Core elements and are listed below. Any MathML element that is not listed below is called an Unknown MathML element.
<annotation>
<annotation-xml>
<maction>
<math>
<merror>
<mfrac>
<mi>
<mmultiscripts>
<mn>
<mo>
<mover>
<mpadded>
<mphantom>
<mprescripts>
<mroot>
<mrow>
<ms>
<mspace>
<msqrt>
<mstyle>
<msub>
<msubsup>
<msup>
<mtable>
<mtd>
<mtext>
<mtr>
<munder>
<munderover>
<none>
<semantics>
The grouping elements are
<maction>
,
<math>
,
<merror>
<mphantom>
,
<mprescripts>
,
<mrow>
,
<mstyle>
,
<none>
,
<semantics>
and unknown MathML elements.
The scripted elements are
<mmultiscripts>
,
<mover>
,
<msub>
,
<msubsup>
,
<msup>
,
<munder>
and
<munderover>
.
The radical elements are
<mroot>
and <msqrt>
.
The attributes defined in this specification have no namespace and are called MathML attributes:
- Global attributes
- Legacy
maction
attributes mo
attributesmpadded
attributesmspace
attributesmunderover
attributesmtd
attributesencoding
display
linethickness
2.1.1 The Top-Level <math>
Element
MathML specifies a single top-level or root
<math>
element, which encapsulates each
instance of MathML markup within a document. All other MathML content
must be contained in a <math>
element.
The <math>
element accepts the attributes described
in § 2.1.3 Global Attributes as well as the
following attribute:
The
display
attribute, if present,
must be an
ASCII case-insensitive
match
to block
or inline
.
The user agent stylesheet
described in § A. User Agent Stylesheet
contains rules for this attribute that affect the
default values for the
(display
block math
or inline math
)
and
(math-style
normal
or compact
) properties.
If the display
attribute is absent or has an invalid value, the User Agent
stylesheet treats it the same as inline
.
If the element does not have its computed
display
property equal to
block math
or inline math
then it is laid out according to the CSS specification where
the corresponding value is described.
Otherwise the layout algorithm of the
element is used to produce a
box. That MathML box is used as the content for the layout of
the element, as described by CSS for <mrow>
display: block
(if the computed value is block math
) or
display: inline
(if the computed value is inline math
).
Additionally, if the computed
display
property is equal to
block math
then that MathML box is rendered
horizontally centered within the content box.
$$...$$
and inline mode $...$
correspond to
display="block"
and display="inline"
respectively.
In the following example, a <math>
formula
is rendered in display mode on a new line and taking full width,
with the math content centered within the container:

As a comparison, the same formula would look as follows in
inline mode. The formula is embedded in the paragraph of text
without forced line breaking.
The baselines specified by the layout algorithm of the
are used for vertical
alignement. Note that
the middle of sum and equal symbols or fractions are all aligned,
but not with the alphabetical baseline of the surrounding
text.<mrow>

Because good mathematical rendering requires use of mathematical
fonts, the
user agent stylesheet
should set the
font-family
to the
math
value on the <math>
element instead of inheriting
it. Additionally, several CSS properties that can be set on
a parent container such as
font-style
, font-weight
,
direction
or text-indent
etc
are not expected to apply to the math formula and so the
user agent stylesheet
has rules to reset them by default.
2.1.2 Types for MathML Attribute Values
- unsigned-integer
- An
<integer>
value as defined in [CSS-VALUES-3], whose first character is neither U+002D HYPHEN-MINUS character (-) nor U+002B PLUS SIGN (+). - length-percentage
- A
<length-percentage>
value as defined in [CSS-VALUES-3] - color
- A
<color>
value as defined in [CSS-COLOR-3] - boolean
- A string that is an
ASCII case-insensitive
match to
true
orfalse
.
2.1.3 Global Attributes
The following attributes are common to and may be specified on all MathML elements:
2.1.4 Attributes common to HTML and MathML elements
The
id
,
class
,
style
,
data-*
,
nonce
and
tabindex
attributes have the same syntax and semantic as defined for
id,
class,
style,
data-*,
nonce and
tabindex
attributes on HTML elements.
The
dir
attribute, if present,
must be an
ASCII case-insensitive match
to ltr
or rtl
.
In that case, the user agent is expected to treat the attribute as a
presentational hint setting the element's
direction
property to the corresponding value.
More precisely, an
ASCII case-insensitive match
to rtl
is mapped to rtl
while
an ASCII case-insensitive match to ltr
is mapped to ltr
.
dir
attribute is used to set the directionality of math
formulas, which is often rtl
in Arabic speaking world.
However, languages written from right to left often embed math
written from left to right and so the
user agent stylesheet resets
the
direction
property accordingly on the <math>
elements.
In the following example, the dir
attribute
is used to render "𞸎 plus 𞸑 raised to the power of
(٢ over, 𞸟 plus ١)" from right-to-left.

All MathML elements support event handler content attributes, as described in event handler content attributes in HTML.
All event handler content attributes noted by HTML as being supported by all HTMLElements are supported by all MathML elements as well, as defined in the MathMLElement IDL.
2.1.5 Legacy MathML Style Attributes
The
mathcolor
and
mathbackground
attributes, if present, must
have a value that is a color.
In that case, the user agent is expected to treat these attributes as a
presentational hint setting the element's
color
and
background-color
properties to the corresponding values.
The mathcolor
attribute describes the foreground fill
color of MathML text, bars etc
while the mathbackground
attribute describes the background color of an element.
The
mathsize
attribute, if present, must
have a value that is a valid length-percentage.
In that case, the user agent is expected to treat the attribute as a
presentational hint setting the element's
property to the corresponding value.
The font-size
mathsize
property indicates indicates the desired height
of glyphs in math formulas but also scale other parts (spacing, shifts,
line thickness of bars etc) accordingly.
2.1.6 The mathvariant
attribute
The
mathvariant
attribute,
if present, must be an
ASCII case-insensitive
match to one of:
normal
,
bold
,
italic
,
bold-italic
,
double-struck
,
bold-fraktur
,
script
,
bold-script
,
fraktur
,
sans-serif
,
bold-sans-serif
,
sans-serif-italic
,
sans-serif-bold-italic
,
monospace
,
initial
,
tailed
,
looped
, or
stretched
.
In that case, the user agent is expected to treat the attribute as a
presentational hint setting the element's
property to the corresponding value.
More precisely, an
ASCII case-insensitive match
to text-transform
normal
is mapped to none
while any other valid value is mapped to its
ASCII lowercased value,
prefixed with math-
.
The mathvariant
attribute defines logical classes of token
elements. Each class provides a collection of typographically-related
symbolic tokens with specific meaning within a given mathematical
expression.
For mathvariant
values other than normal
,
this is done by using glyphs of
Unicode's Mathematical Alphanumeric Symbols.
In the following example, the mathvariant
attribute
is used to render different A letters. Note that by default
variables use mathematical italic.

mathvariant
values other than normal
are implemented for compatibility with full MathML and legacy editors that can't access characters in Plane 1 of Unicode. Authors are encouraged to use the corresponding Unicode characters.
The normal
value is still important to cancel automatic
italic of the <mi>
element.
salt
or
ssXY
properties from [OPEN-FONT-FORMAT]
to provide both styles. Page authors may use the
font-variant-alternates
property with corresponding OpenType font features
to access these glyphs.
2.1.7 The displaystyle
and scriptlevel
attributes
The
displaystyle
attribute, if present, must have a value that is a boolean.
In that case, the user agent is expected to treat the attribute as a
presentational hint setting the element's
property to the corresponding value.
More precisely, an
ASCII case-insensitive match
to math-style
true
is mapped to normal
while
an ASCII case-insensitive match to false
is mapped to compact
.
This attribute indicates whether formulas should try to minimize
the logical height (value is false
) or not
(value is true
) e.g. by changing the size of content or
the layout of scripts.
The
scriptlevel
attribute, if present, must have value
+<U>
, -<U>
or <U>
where <U>
is an
unsigned-integer.
In that case
the user agent is expected to treat the scriptlevel
attribute as a
presentational hint setting the element's
property to the corresponding value.
More precisely,
math-depth
+<U>
, -<U>
and
<U>
are respectively mapped to
add(<U>)
add(<-U>)
and <U>
.
and displaystyle
values
are automatically adjusted within MathML elements.
To fully implement these attributes, additional CSS properties must be
specified in the user agent stylesheet
as described in § A. User Agent Stylesheet.
In particular, for all MathML elements a default
scriptlevel
font-size: math
is specified to ensure that
scriptlevel
changes are taken into account.
In this example, a <munder>
element is used to attach a
script "A" to a base "∑". By default, the summation
symbol is rendered with the font-size inherited from its
parent and the A as a scaled down subscript.
If displaystyle
is true, the summation symbol is drawn
bigger and the "A" becomes an underscript.
If scriptlevel
is reset to 0 on the "A", then it will
use the same font-size as the top-level math
root.

\displaystyle
, \textstyle
,
\scriptstyle
, and \scriptscriptstyle
correspond
to displaystyle
and scriptlevel
as
true
and 0
,
false
and 0
,
false
and 1
,
and false
and 2, respectively.
2.2 Integration in the Web Platform
2.2.1 HTML and SVG
When parsing HTML documents user agents must treat any tag name corresponding to a MathML Core Element as belonging to the MathML namespace.
Users agents must allow mixing HTML, SVG and MathML elements as allowed by sections HTML integration point, MathML integration point, tree construction dispatcher, MathML and SVG from [HTML].
When evaluating the SVG
requiredExtensions
attribute, user agents must claim support for the language extension
identified by the
MathML namespace.
In this example, inline MathML and SVG elements are used inside
a HTML document. SVG elements <switch>
and
<foreignObject>
(with
proper <requiredExtensions>
) are used to
embed a MathML formula with a text fallback, inside a diagram.
HTML input
element is used within the
<mtext>
include an interactive input field inside a mathematical
formula.

-
The
<math>
element can be used at position permitted for flow content (e.g. a<foreignObject>
element) or phrasing content. -
Any
phrasing content
can be used inside
,<mi>
,<mo>
,<mn>
and<ms>
elements.<mtext>
-
The
<svg>
element can be used inside
elements.<annotation-xml>
-
Any flow content
can be used inside
elements with encoding<annotation-xml>
application/xhtml+xml
ortext/html
.
2.2.2 CSS styling
User agents must support various CSS features mentioned in this specification, including new ones described in § 4. CSS Extensions for Math Layout. They must follow the computation rule for display: contents.
In this example, the MathML formula inherits the CSS color of its
parent and uses the font-family
specified via the
style
attribute.

All documents containing MathML Core elements must include CSS rules described in § A. User Agent Stylesheet as part of user-agent level style sheet defaults.
The following CSS features are not supported and must be ignored:
- Vertical math layout:
writing-mode
is treated ashorizontal-tb
on all MathML elements. -
Line breaking inside math formulas:
white-space
is treated asnowrap
on all MathML elements. -
Sizes:
width
,height
,inline-size
andblock-size
are treated asauto
on elements with computed display valueblock math
orinline math
. -
Floats:
float
andclear
are treated asnone
on all MathML elements. -
Alignment properties:
align-content
,justify-content
,align-self
,justify-self
have no effect on MathML elements.
2.2.3 DOM and Javascript
User agents supporting Web application APIs must ensure that they keep the visual rendering of MathML synchronized with the [DOM] tree.
All the nodes representing MathML elements in the DOM
must implement, and expose to scripts, the following
MathMLElement
interface.
WebIDL
The
GlobalEventHandlers
,
DocumentAndElementEventHandlers
and
HTMLOrForeignElement
interfaces are defined in
[HTML].
Each IDL attribute of the
interface
reflects the
corresponding MathML
content attribute.
MathMLElement
In the following example, a MathML formula is used to render the fraction "α over 2". When clicking the red α, it is changed into a blue β.

2.2.4 Text layout
Because math fonts generally contain very tall glyphs such as big integrals, using typographic metrics is important to avoid excessive line spacing of text. As a consequence, user agents must take into account the USE_TYPO_METRICS flag from the OS/2 table [OPEN-FONT-FORMAT] when performing text layout.
2.2.5 Focus
MathML provides the ability for authors to allow for
interactivity in supporting interactive user agents
using the same concepts, approach and guidance to
Focus
as described in HTML, with modifications or
clarifications regarding application
for MathML as described in this section.
When an element is focused, all applicable CSS focus-related pseudo-classes as defined in Selectors Level 3 apply, as defined in that specification.
The contents of embedded
elements
(including HTML elements inside token elements),
contribute to the sequential focus order of the containing owner HTML
document (combined sequential focus order).
<math>
3. Presentation Markup
3.1 Visual formatting model
3.1.1 Box Model
The default display
property
is described in § A. User Agent Stylesheet:
-
For the
<math>
root, it is equal toinline math
orblock math
according to the value of thedisplay
attribute. -
For Tabular MathML elements
,<mtable>
,<mtr>
it is respectively equal to<mtd>
inline-table
,table-row
andtable-cell
. - For the all but the first children of the
<maction>
and<semantics>
elements, it is equal tonone
. -
For all the other MathML elements it is equal
to
block math
.
In order to specify math layout in different writing modes, this specification uses concepts from [CSS-WRITING-MODES-3]:
- abstract dimensions: block dimension, inline dimension, block axis, inline axis, block size, inline size.
- flow-relative directions: inline-start, inline-end, block-start, block-end.
- line-relative directions: line-left, line-right, line-over, line-under.
horizontal-lr
and ltr
.
See Figure 4,
Figure 5 and
Figure 6 for examples of other
writing modes that are sometimes used for math layout.
MathML boxes have several parameters in order to perform layout in a way that is compatible with CSS but also to take into account very accurate positions and spacing within math formulas. Each math box has the following parameters:
- Inline metrics.
min-content inline size,
max-content inline size and
inline size
from CSS. See Figure 1.
Figure 1 Generic Box Model for MathML elements -
Block metrics. The block size, first baseline set and last baseline set. The following baselines are defined for MathML boxes:
- The alphabetic baseline which typically aligns with the bottom of uppercase Latin glyphs. The algebric distance from the alphabetic baseline to the line-over edge of the box is the called line-ascent. The algebric distance from the line-under edge to the alphabetic baseline of the box is the called line-descent.
- The mathematical baseline also called math axis which typically aligns with the fraction bar, middle of fences and binary operators. It is shifted away from the alphabetic baseline by AxisHeight towards the line-over.
- The ink-over baseline, indicating the line-over theorical limit of the content drawn, excluding any extra space. If not specified, it is aligned with the line-over edge. The algebric distance from the alphabetic baseline to the ink-over baseline is called the ink line-ascent.
- The ink-under baseline, indicating the line-under theorical limit of the content drawn, excluding any extra space. If not specified, it is aligned with the line-under edge. The algebric distance from the ink-under baseline to the alphabetic baseline is called the ink line-descent.
Unless specified otherwise, the last baseline set is equal to the first baseline set for MathML boxes.NoteFor math layout, it is very important to rely on the ink extent when positioning text. This is not the case for more complex notations (e.g. square root). Although ink-ascent and ink-descent are defined for all MathML elements they are really only used for the token elements. In other cases, they just match normal ascent and descent. -
An optional italic correction
which provides a measure of how much the text of a box is
slanted along the inline axis.
See Figure 2.
Figure 2 Examples of italic correction for italic f and large integral -
An optional top accent attachment
which provides a reference offset on the
inline axis of a box that should be used when
positioning that box as an accent.
See Figure 3.
Figure 3 Example of top accent attachment for a circumflex accent
Given a MathML box, the inline offset of a child box is the distance between the inline-start edge of the parent box and the inline-start edge of the child box. The block offset of a child box is the offset between block-start edge of the parent box and the block-start edge of the child box.
The line-left offset, line-right offset, line-over offset and line-under offset are defined similarly as offsets between the corresponding parent and child edges.
horizontal-tb
and rtl
that may be used in e.g. Arabic math.vertical-lr
and ltr
that may be used in e.g. Mongolian math.vertical-rl
and ltr
that may be used in e.g. Japanese math.Here are examples of offsets obtained from line-relative metrics:
-
The inline offset of a child box is
the line-left offset if the CSS property
direction
is
ltr
and is the inline size of the box − (line-left offset + inline size of the child box) otherwise. -
The block offset of the alphabetic baseline of a box
is the line-ascent
if the CSS property
writing-mode
is
horizontal-lr
,vertical-rl
orsideways-rl
and is the line-descent otherwise.
3.1.2 Layout Algorithms
The layout algorithms described in this chapter for MathML boxes have the following structure:
- Calculation of min-content inline size and max-content inline size of the content.
-
Box layout:
- Layout of in-flow child boxes.
- Calculation of inline size, ink line-ascent, ink line-descent, line-ascent and line-ascent of the content.
- Calculation of offsets of child boxes within the content box as well as sizes and offsets of extra graphical items (bars, radical symbol, etc).
- Layout and positioning of out-of-flow child boxes.
During box layout, the following extra steps must be performed:
- After calculating the line-ascent and line-descent the block size is set to their sum.
- The box metrics, offsets, baselines, italic correction and top accent attachment of the content box are set to the one calculated for the content.
-
The box metrics and offsets of the padding box are obtained from the content box by taking into account the corresponding
padding
properties as described in CSS.The baselines of the padding box are the same as the one of the content box.
If the content box has a top accent attachment then the padding box has the same property, increased by the inline-start padding. If the content box has an italic correction then the padding box has the same property, increased by the inline-end padding.
-
The box metrics and offsets of the border box are obtained from the padding box by taking into account the corresponding
border-width
property as described in CSS.In general, the baselines of the border box are the same as the one of the padding box. However, if the line-over border is positive then the ink-over baseline is set to the line-over edge of the border box and if the line-under border is positive then the ink-under baseline is set to the line-under edge of the border box.
If the padding box has a top accent attachment then the border box has the same property, increased by the border-width of its inline-start egde. If the padding box has an italic correction then the border box has the same property, increased by the border-width of its inline-end egde.
-
The box metrics and offsets of the margin box are obtained from the border box by taking into account the corresponding
margin
properties as described in CSS.The baselines of the margin box are the same as the one of the border box.
If the padding box has a top accent attachment then the margin box has the same property, increased by the inline-start margin. If the padding box has an italic correction then the margin box has the same property, increased by the inline-end margin.
During box layout, optional inline stretch size constraint and block stretch size constraint parameters may be used on embellished operators. The former indicates a target size that a core operator stretched along the inline axis should cover. The latter indicates an ink line-ascent and ink line-descent that a core operator stretched along the block axis should cover. Unless specified otherwise, these parameters are ignored during box layout and child boxes are laid out without any stretch size constraint.
3.1.3 Stacking contexts
MathML elements can overlap due to various spacing rules. They
can as well contain extra graphical items
(bars, radical symbol, etc).
A MathML element with computed style
display: block math
or display: inline math
generates a new stacking
context. The painting order
of in-flow children of such a MathML element
is exactly the same as block elements. The extra graphical
items are painted after text and background (right after
step 7.2.4 for display: inline math
and right after
step 7.2 for display: block math
).
3.2 Token Elements
Token elements in presentation markup are broadly intended to represent the smallest units of mathematical notation which carry meaning. Tokens are roughly analogous to words in text. However, because of the precise, symbolic nature of mathematical notation, the various categories and properties of token elements figure prominently in MathML markup. By contrast, in textual data, individual words rarely need to be marked up or styled specially.
3.2.1 Text <mtext>
The
<mtext>
element is used to represent arbitrary text
that should be rendered as itself. In general, the
<mtext>
element is intended to denote
commentary text.
The <mtext>
element accepts the attributes described
in § 2.1.3 Global Attributes.
In the following example, <mtext>
is used
to put conditional words in a definition:

3.2.1.1 Layout of <mtext>
If the element does not have its computed
display
property equal to
block math
or inline math
then it is laid out according to the CSS specification where
the corresponding value is described.
Otherwise, the layout below is performed.
The mtext
element is laid out as a
block box
and the min-content inline size,
max-content inline size,
inline size, block size,
first baseline set and last baseline set are determined
accordingly.
If the <mtext>
element contains only text
content without
forced line break
or
soft wrap opportunity
then in addition:
- The ink-over baseline (respectively and ink-under baseline) is set to align with the line-over edge (respectively and ink-under baseline) of the ink bounding box of the text.
- If the text content is made of a single glyph and this glyph has an entry an entry in the MathItalicsCorrectionInfo table then the specified value is used as the italic correction.
-
If the text content is made of a single glyph and this glyph
has an entry in the MathTopAccentAttachment table
then the specified value is used as the top accent attachment of
the
<mtext>
element.
3.2.2 Identifier <mi>
The
<mi>
element represents a symbolic name or
arbitrary text
that should be rendered as an identifier. Identifiers can include
variables, function names, and symbolic constants.
The <mi>
element accepts the attributes described
in § 2.1.3 Global Attributes. Its layout algorithm is
the same as the <mtext>
element.
The
user agent stylesheet
must contain the following property in order to implement automatic
italic:
In the following example, <mi>
is used to render
variables and function names. Note that identifiers containing a
single letter are italic by default.

3.2.3 Number <mn>
The
<mn>
element represents a "numeric literal" or
other data that should be rendered as a numeric literal. Generally
speaking, a numeric literal is a sequence of digits, perhaps including a
decimal point, representing an unsigned integer or real number.
The <mn>
element accepts the attributes described
in § 2.1.3 Global Attributes. Its layout algorithm is
the same as the
element.
<mtext>
In the following example, <mn>
is used to
write a decimal number.

3.2.4 Operator, Fence, Separator or Accent <mo>
The
<mo>
element represents an
operator or anything that should be rendered as an operator.
In general, the notational conventions for mathematical operators
are quite complicated, and therefore MathML provides a relatively
sophisticated mechanism for specifying the rendering behavior of an
<mo>
element.
As a consequence, in MathML the list of things that should "render as an operator" includes a number of notations that are not mathematical operators in the ordinary sense. Besides ordinary operators with infix, prefix, or postfix forms, these include fence characters such as braces, parentheses, and "absolute value" bars; separators such as comma and semicolon; and mathematical accents such as a bar or tilde over a symbol. This chapter uses the term "operator" to refer to operators in this broad sense.
The <mo>
element accepts the attributes described
in § 2.1.3 Global Attributes as well as the following
attributes:
This specification does not define any observable behavior that is specific to the fence and separator attributes.
fence
and separator
to describe specific semantics of operators.
The default values may be determined from the
Operators_fence
and Operators_separator
tables, or equivalently
the human-readable version
of the operator dictionary.
In the following example, the <mo>
element
is used for the binary operator +. Default spacing is symmetric
around that operator. A tigher spacing is used if you rely
on the
attribute to force it to be
treated as a prefix operator.
Spacing can also be specified explicitly using the
form
and
lspace
attributes.
rspace

Another use case is for big operator such as summation.
When displaystyle
is true, such an operator are drawn
larger but one can change that with the largeop
attribute.
When displaystyle
is false, underscript are actually
rendered as subscript but one can change that with the
movablelimits
attribute.

Operators are also used for stretchy symbols such as fences,
accents, arrows etc. In the following example, the vertical arrow
stretches to the height of the <mspace>
element.
One can override default stretch behavior with the
stretchy
attribute e.g. to force an unstretched arrow.
The symmetric
attribute allows to indicate whether
the operator
should stretchy symmetrically above and below the baseline.
Finally the minsize
and maxsize
attributes add
additional constraints over the stretch size.

Note that the default properties of operators are dictionary-based, as explained in § 3.2.4.2 Dictionary-based attributes. For example a binary operator typically has default symmetric spacing around it while a fence is generally stretchy by default.
3.2.4.1 Embellished operators
A MathML Core element is an embellished operator if it is:
- An
element;<mo>
-
A scripted element or an
, whose first in-flow child exists and is an embellished operator;<mfrac>
-
A grouping element or
<mpadded>
, whose in-flow children consist (in any order) of one embellished operator and zero or more space-like elements.
The core operator of an embellished operator
is the <mo>
element defined recursively as
follows:
- The core operator of an
element; is the element itself.<mo>
-
The core operator of an embellished
scripted element or
element is the core operator of its first in-flow child.<mfrac>
-
The core operator of an embellished
grouping element or
<mpadded>
is the core operator of its unique embellished operator in-flow child.
The stretch axis of an embellished operator
is inline if its
core operator contains only text content
made of a unique character c
and that
character has stretch axis inline per
§ B.2 Stretchy Operator Axis.
Otherwise, stretch axis of the embellished operator
is block.
3.2.4.2 Dictionary-based attributes
The form
property of an embellished operator is either
infix
, prefix
or
postfix
.
The corresponding form
attribute on the
element, if present, must be an
ASCII case-insensitive
match to one of these values.
<mo>
The algorithm for determining the form
of an embellished operator is as follows:
- If the
form
attribute is present and valid on the core operator, then its ASCII lowercased value is used; - If the embellished operator is the first in-flow child of a
grouping element,
<mpadded>
or<msqrt>
with more than one in-flow child (ignoring all space-like children) then it has formprefix
; - Or, if the embellished operator is the last in-flow child of
a
grouping element,
or<mpadded>
with more than one in-flow child (ignoring all space-like children) then it has form<msqrt>
postfix
; - Or, if the embellished operator is an in-flow child of a
scripted element, other than the first in-flow
child, then it has form
postfix
; -
Otherwise, the embellished operator has form
infix
.
The
stretchy
,
symmetric
,
largeop
,
movablelimits
,
properties of an embellished operator are
either false
or true
. In the latter
case, it
is said that the embellished operator has the
property.
The corresponding attributes on the
element, if present, must be a
boolean.
<mo>
The
lspace
,
rspace
,
minsize
properties of an embellished operator are
length-percentage.
The maxsize
property
of an embellished operator is either a
length-percentage or ∞.
The
lspace
,
rspace
,
minsize
and
maxsize
attributes on the
element, if present,
must be a length-percentage.
<mo>
The algorithm for determining the properties of an embellished operator is as follows:
- If the corresponding
stretchy
,symmetric
,largeop
,movablelimits
,lspace
,rspace
,maxsize
orminsize
attribute is present and valid on the core operator, then the ASCII lowercased value of this property is used; -
Otherwise, if the core operator contains only text
content T, the corresponding property from the
Operator Dictionary
is retrieved by looking for
Content=T,Form=F
whereF
is the
of the embellished operator;form
-
If no entry is found and the
of embellished operator was not explicitly specified as an attribute on its core operator, then user agents must try other dictionary entries for different values ofform
F
in the following order:infix
,prefix
,postfix
; -
Otherwise, use the value
false
forstretchy
,symmetric
,largeop
andmovablelimits
properties ;0.2777777777777778em
forlspace
andrspace
properties ;1em
for theminsize
property and ∞ for themaxsize
property.
Percentage values for lspace
,
rspace
properties of an embellished operator
are interpreted relative to the value read from the dictionary
or to the fallback value above.
Interpretation of percentage values for minsize
and maxsize
are described in
§ 3.2.4.3 Layout of operators.
Font-relative lengths for
lspace
, rspace
,
minsize
and maxsize
rely on the
font style of the core operator, not the one of the
embellished operator.
3.2.4.3 Layout of operators
If the <mo>
element does not have its computed
display
property equal to
block math
or inline math
then it is laid out according to the CSS specification where
the corresponding value is described.
Otherwise, the layout below is performed.
The text of the operator must only be painted if the
visibility
of
the <mo>
element is visible
.
In that case, it must be painted with the
color
of the <mo>
element.
Operators are laid out as follows:
-
If the content of the
<mo>
element is not made of a single characterc
then fallback to the layout algorithm of § 3.2.1.1 Layout of<mtext>
. -
If the operator has the
stretchy
property:-
If the stretch axis of the operator is inline
then
-
If it is not possible to shape a stretchy glyph
corresponding to
c
in the inline direction with the first available font then fallback to the layout algorithm of § 3.2.1.1 Layout of<mtext>
. -
The min-content inline size and
max-content inline size of the content
are set to the one obtained by the layout algorithm of
§ 3.2.1.1 Layout of
<mtext>
. -
If there is not any
inline stretch size constraint
Tinline
then fallback to the layout algorithm of § 3.2.1.1 Layout of<mtext>
. -
The inline size and (ink) block metrics of the content
are given by algorithm to
shape a stretchy glyph to inline dimension
Tinline
. -
The painting of the operator is performed by the
algorithm
to shape a stretchy glyph
stretched to inline dimension
Tinline
and at position determined by the previous box metrics.
-
If it is not possible to shape a stretchy glyph
corresponding to
-
Otherwise, the stretch axis of the operator is
block. The following steps are performed:
-
If it is not possible to shape a stretchy glyph
corresponding to
c
in the block direction with the first available font then fallback to the layout algorithm of § 3.2.1.1 Layout of<mtext>
. - The min-content inline size and max-content inline size of the content are set to the preferred inline size of a glyph stretched along the block axis.
-
If there is not any
block stretch size constraint
(Uascent, Udescent)
then fallback to the layout algorithm of § 3.2.1.1 Layout of<mtext>
. - If the operator has the
symmetric
property then set the target sizesTascent
andTdescent
toSascent
andSdescent
respectively:-
Sascent
= max(Uascent
− AxisHeight,Udescent
+ AxisHeight ) + AxisHeight -
Sdescent
= max(Uascent
− AxisHeight,Udescent
+ AxisHeight ) − AxisHeight
Uascent
andUdescent
respectively. -
-
Let
minsize
andmaxsize
be theminsize
andmaxsize
properties on the operator. Percentage values are intepreted relative toT
=Tascent
+Tdescent
. Ifminsize
< 0 then setminsize
to 0. Ifmaxsize
<minsize
then setmaxsize
tominsize
. Then 0 ≤minsize
≤maxsize
:-
If
T
≤ 0 then setTascent
tominsize
/ 2 and then setTdescent
tominsize
−Tascent
-
Otherwise, if
0 <
T
<minsize
then first multiplyTascent
byminsize
/T
and then setTdescent
tominsize
-Tascent
. -
Otherwise, if
maxsize
<T
then first multiplyTascent
bymaxsize
/T
and then setTdescent
tomaxsize
−Tascent
.
-
If
-
The inline size,
ink line-ascent,
ink line-descent,
line-ascent and
line-descent
of the content
are obtained by the algorithm to
shape a stretchy glyph
to block dimension
Tascent
+Tdescent
. The inline size of the content is the width of the stretchy glyph. The stretchy glyph is shifted towards the line-under by a value Δ so that its center aligns with the center of the target: the ink ascent of the content is the ascent of the stretchy glyph − Δ and the ink descent of the content is the descent of the stretchy glyph + Δ. These centers have coordinates "½(ascent − descent)" so Δ = [(ascent of stretchy glyph − descent of stretchy glyph) − (Tascent
−Tdescent
)] / 2. -
The painting of the operator is performed by the
algorithm to shape a stretchy glyph
stretched to block dimension
Tascent
+Tdescent
and at position determined by the previous box metrics shifted by Δ towards the line-over.
Figure 7 Base size, size variants and glyph assembly for the left brace -
If it is not possible to shape a stretchy glyph
corresponding to
-
If the stretch axis of the operator is inline
then
-
If the operator has the
largeop
property and if
on themath-style
<mo>
element isnormal
, then:-
Use the
MathVariants
table to try and find a glyph of height at least DisplayOperatorMinHeight If none is found, fallback to the largest non-base glyph. If none is found, fallback to the layout algorithm of § 3.2.1.1 Layout of<mtext>
. - The min-content inline size, max-content inline size, inline size and block metrics of the content are given by the glyph found.
- Paint the glyph.
Figure 8 Base and displaystyle sizes of the summation symbol -
-
Other fallback to the
layout algorithm of § 3.2.1.1 Layout of
<mtext>
.
If the algorithm to shape a stretchy glyph has been used for one of the step above, then the italic correction of the content is set to the value returned by that algorithm.
maxsize
is equal to its default value ∞
then minsize ≤ maxsize
is satisfied but
maxsize < T
is not.
3.2.5 Space <mspace>
The
<mspace>
empty element represents a blank space of any
desired size, as set by its attributes.
The <mspace>
element accepts the attributes described
in § 2.1.3 Global Attributes as well as the following
attributes:
The
mspace@width
,
mspace@height
,
mspace@depth
, if present, must
have a value that is a valid length-percentage.
An unspecified attribute, a percentage value, or an invalid value
is interpreted as 0
.
If one of the requested values calculated is negative then it is
treated as 0
.
In the following example, <mspace>
is used to
force spacing within the formula (a 1px blue border is
added to easily visualize the space):

If the <mspace>
element does not have its
computed
display
property equal to
block math
or inline math
then it is laid out according to the CSS specification where
the corresponding value is described.
Otherwise,
the <mspace>
element is laid out as shown on
Figure 9.
The min-content inline size and
max-content inline size of the content are
equal to the requested inline size.
The inline size, line-ascent and line-descent of the content
are respectively
the requested inline size, line-ascent and line-descent.
<mspace>
element3.2.5.1 Definition of space-like elements
A number of MathML presentation elements are "space-like" in the sense that they typically render as whitespace, and do not affect the mathematical meaning of the expressions in which they appear. As a consequence, these elements often function in somewhat exceptional ways in other MathML expressions.
A MathML Core element is a space-like element if it is:
- An
or<mtext>
;<mspace>
- Or a
grouping element or
<mpadded>
all of whose in-flow children are space-like.
<mphantom>
is not
automatically defined to be space-like, unless its content is
space-like. This is because operator spacing is affected by
whether adjacent elements are space-like.
Since the <mphantom>
element is
primarily intended as an aid in aligning expressions, operators
adjacent to an <mphantom>
should behave
as if they were adjacent to the contents of the
<mphantom>
, rather than to an equivalently
sized area of whitespace.
3.2.6 String Literal <ms>
<ms>
element is used to represent
"string literals" in expressions meant to be interpreted by computer
algebra systems or other systems containing "programming languages".
The <ms>
element accepts the attributes described
in § 2.1.3 Global Attributes. Its layout algorithm is
the same as the
element.
<mtext>
In the following example, <ms>
is used to
write a literal string of characters:

lquote
and
rquote
attributes to respectively specify the strings
to use as opening and closing quotes. These are no longer supported
and the quotes must instead be specified as part of the text of the
<ms>
element. One can add CSS rules to legacy
documents in order to preserve visual rendering. For example,
in left-to-right direction:
3.3 General Layout Schemata
Besides tokens there are several families of MathML presentation elements. One family of elements deals with various "scripting" notations, such as subscript and superscript. Another family is concerned with matrices and tables. The remainder of the elements, discussed in this section, describe other basic notations such as fractions and radicals, or deal with general functions such as setting style properties and error handling.
3.3.1 Group Sub-Expressions <mrow>
The
<mrow>
element is used to group together any number of sub-expressions, usually
consisting of one or more <mo>
elements acting as
"operators" on one or more other expressions that are their "operands".
In the following example, <mrow>
is used to
group a sum "1 + 2/3" as a fraction numerator (first child
of <mfrac>
) and to construct a fenced expression
(first child of <msup>
) that is raised to the power of 5.
Note that <mrow>
alone does not add visual fences
around its grouped content, one has to explicitly specify them
using the <mo>
element.
Within the <mrow>
elements, one can see that
vertical alignment of children (according to the
alphabetic baseline or the mathematical baseline)
is properly performed, fences are vertically stretched and
spacing around the binary + operator automatically calculated.

The <mrow>
element accepts the attributes described
in § 2.1.3 Global Attributes. An <mrow>
element with in-flow children
child1, child2, … childN
is laid out as show on Figure 10. The child boxes
are put in a row one after the other with all their
alphabetic baselines
aligned.
<mrow>
element3.3.1.1 Algorithm for stretching operators along the block axis
The algorithm for stretching operators along the block axis consists in the following steps:
- If there is a block stretch size constraint or an inline stretch size constraint then the element being laid out is an embellished operator. Layout the one in-flow child that is an embellished operator with the same stretch size constraint and all the other in-flow children without any stretch size constraint and stop.
- Otherwise,
split the list of in-flow children into a first list
LToStretch
containing embellished operators with astretchy
property and block stretch axis ; and a second listLNotToStretch
. -
Perform layout without any stretch size constraint on
all the items of
LNotToStretch
. IfLToStretch
is empty then stop. IfLNotToStretch
is empty, perform layout with stretch size constraint 0 on all the items ofLToStretch
. -
Calculate the unconstrained target sizes
Uascent
andUdescent
as respectively the maximum ink ascent and maximum ink descent of the margin boxes of in-flow children that have been laid out in the previous step. -
Layout or relayout all the elements of
LToStretch
with block stretch size constraint(Uascent, Udescent)
.
3.3.1.2 Layout of <mrow>
If the element does not have its computed
display
property equal to
block math
or inline math
then it is laid out according to the CSS specification where
the corresponding value is described.
Otherwise, the layout below is performed.
A child box is slanted if it is not an embellished operator and has nonzero italic correction.
lspace
and
rspace
.
The min-content inline size (respectively max-content inline size) are calculated using the following algorithm:
-
Set
add-space
to true if the element is a<math>
or is not an embellished operator; and to false otherwise. - Set
inline-offset
to 0. - Set
previous-italic-correction
to 0. -
For each in-flow child:
-
If the child is not slanted, then increment
inline-offset
byprevious-italic-correction
. -
If the child is an embellished operators
and
add-space
is true then incrementinline-offset
by its
property.lspace
-
Increment
inline-offset
by the min-content inline size (respectively max-content inline size) of the child's margin box. -
If the child is slanted then
set
previous-italic-correction
to its italic correction. Otherwise set it to 0. -
If the child is an embellished operators
and
add-space
is true then incrementinline-offset
by its
property.rspace
-
If the child is not slanted, then increment
-
Increment
inline-offset
byprevious-italic-correction
. -
Return
inline-offset
.
The in-flow children are laid out using the algorithm for stretching operators along the block axis.
The inline size of the content is calculated like the min-content inline size and max-content inline size of the content, using the inline size of the in-flow children's margin boxes instead.
The ink line-ascent (respectively line-ascent) of the content is the maximum of the ink line-ascents (respectively line-ascents) of all the in-flow children's margin boxes. Similarly, the ink line-descent (respectively line-descent) of the content is the maximum of the ink line-descents (respectively ink line-ascents) of all the in-flow children's margin boxes.
The in-flow children are positioned using the following algorithm:
-
Set
add-space
to true if the element is a<math>
or is not an embellished operator; and to false otherwise. - Set
inline-offset
to 0. - Set
previous-italic-correction
to 0. - For each in-flow child:
-
If the child is not slanted, then increment
inline-offset
byprevious-italic-correction
. -
If the child is an embellished operators
and
add-space
is true then incrementinline-offset
by its
property.lspace
-
Set the inline offset of the child
to
inline-offset
and its block offset such that the alphabetic baseline of the child is aligned with the alphabetic baseline. -
Increment
inline-offset
by the inline size of the child's margin box. -
If the child is slanted then
set
previous-italic-correction
to its italic correction. Otherwise set it to 0. -
If the child is an embellished operators
and
add-space
is true then incrementinline-offset
by its
property.rspace
-
If the child is not slanted, then increment
The italic correction of the content is set to the italic
correction of the last in-flow child, which is
the final value of previous-italic-correction
.
3.3.2 Fractions <mfrac>
The
<mfrac>
element is used for fractions. It can also be used to mark up
fraction-like objects such as binomial coefficients and Legendre symbols.
If the <mfrac>
element does not have its computed
display
property equal to block math
or inline math
then it is laid out according to the CSS specification where
the corresponding value is described.
Otherwise, the layout below is performed.
The <mfrac>
element accepts the attributes described
in § 2.1.3 Global Attributes as well as the
following attribute:
The
linethickness
attribute indicates the fraction line thickness
to use for the fraction bar.
If present, it must
have a value that is a valid length-percentage.
If the attribute is absent or has an invalid value,
FractionRuleThickness is used as the default
value. A percentage is interpreted relative to that default value.
A negative value is interpreted as 0.
The following example contains four fractions
with different linethickness
values. The bars are always
aligned with the middle of plus and minus signs.
The numerator and denominator are horizontally centered.
The fractions that are not in displaystyle
use smaller gaps and font-size.

The <mfrac>
element sets
to displaystyle
false
,
or if it was already false
increments
by 1, within its children.
It sets scriptlevel
math-shift
to
compact
within its second child.
To avoid visual confusion between the fraction bar and another
adjacent items (e.g. minus sign or another fraction's bar),
a default 1-pixel space is added around the element.
The user agent stylesheet
must contain the following rules:
If the <mfrac>
element
has less or more than two in-flow children, its layout algorithm
is the same as the
element.
Otherwise, the first in-flow child is called
numerator, the second in-flow child is called
denominator and the layout algorithm is explained below.
<mrow>
<mfrac>
element has two children
that are in-flow. Hence the CSS rules basically performs
scriptlevel
, displaystyle
and math-shift
changes for the numerator and
denominator.
3.3.2.1 Fraction with nonzero line thickness
If the fraction line thickness is nonzero, the
<mfrac>
element is laid out as shown on Figure 12.
The fraction bar must only be painted if the
visibility
of
the <mfrac>
element is visible
.
In that case, the fraction bar must be painted with the
color
of the <mfrac>
element.
<mfrac>
elementThe min-content inline size (respectively max-content inline size) of content is the maximum between the min-content inline size (respectively max-content inline size) of the numerator's margin box and the min-content inline size (respectively max-content inline size) of the denominator's margin box.
If there is an inline stretch size constraint or a block stretch size constraint then the numerator is also laid out with the same stretch size constraint otherwise it is laid out without any stretch size constraint. The denominator is always laid out without any stretch size constraint.
The inline size of the content is the maximum between the inline size of the numerator's margin box and the inline size of the denominator's margin box.
NumeratorShift
is the maximum between:
-
FractionNumeratorShiftUp (respectively
FractionNumeratorDisplayStyleShiftUp) if
the
math-style
iscompact
(respectivelynormal
). -
The AxisHeight + half the
fraction line thickness +
FractionNumeratorGapMin
(respectively FractionNumDisplayStyleGapMin)
if the
math-style
iscompact
(respectivelynormal
) + the ink line-descent of the numerator's margin box.
DenominatorShift
is the maximum between:
-
FractionDenominatorShiftDown (respectively
FractionDenominatorDisplayStyleShiftDown) if
the
math-style
iscompact
(respectivelynormal
). -
Half the fraction line thickness +
FractionDenominatorGapMin
(respectively FractionDenomDisplayStyleGapMin)
if the
math-style
iscompact
(respectivelynormal
) + the ink line-ascent of the denominator's margin box − the AxisHeight.
The line-ascent of the content is the maximum between:
-
Numerator Shift
+ the line-ascent of the numerator's margin box. -
−
Denominator Shift
+ the line-ascent of the denominator's margin box - AxisHeight plus half the fraction line thickness.
The line-descent of the content is the maximum between:
-
−
Numerator Shift
+ the line-descent of the numerator's margin box. -
Denominator Shift
+ the line-descent of the denominator's margin box. - −AxisHeight plus half the fraction line thickness.
- 0
The inline offset of the numerator (respectively denominator) is the half the inline size of the content − half the inline size of the numerator's margin box (respectively denominator's margin box).
The alphabetic baseline of the numerator (respectively denominator)
is shifted away from the alphabetic baseline by a distance of
NumeratorShift
(respectively
DenominatorShift
)
towards the line-over (respectively line-under).
The inline size of the fraction bar is the inline size of the content and its inline offset is 0. The center of the fraction bar is shifted away from the alphabetic baseline by a distance of AxisHeight towards the line-over. Its block size is the fraction line thickness.
3.3.2.2 Fraction with zero line thickness
If the fraction line thickness is zero,
the <mfrac>
element is instead laid out as
shown on Figure 13.
<mfrac>
element without barThe min-content inline size, max-content inline size and inline size of the content are calculated the same as in § 3.3.2.1 Fraction with nonzero line thickness.
If there is an inline stretch size constraint or a block stretch size constraint then the numerator is also laid out with the same stretch size constraint and otherwise it is laid out without any stretch size constraint. The denominator is always laid out without any stretch size constraint.
If the math-style
is compact
then
TopShift
and
BottomShift
are respectively
set to StackTopShiftUp and StackBottomShiftDown.
Otherwise math-style
is normal
and
they are respectively set to StackTopDisplayStyleShiftUp
and StackBottomDisplayStyleShiftDown.
The Gap
is defined to be
(BottomShift
−
the ink line-ascent of the denominator's margin box) +
(TopShift
−
the ink line-descent of the numerator's margin box).
If math-style
is compact
then GapMin
is StackGapMin
otherwise math-style
is normal
and it is StackDisplayStyleGapMin.
If Δ = GapMin
− Gap
is positive then
TopShift
and BottomShift
are respectively increased by Δ/2 and Δ − Δ/2.
The line-ascent of the content is the maximum between:
-
TopShift
+ the line-ascent of the numerator's margin box. -
−
BottomShift
+ the line-ascent of the denominator's margin box.
The line-descent of the content is the maximum between:
-
−
TopShift
+ the line-descent of the numerator's margin box. -
BottomShift
+ the line-descent of the denominator's margin box. - 0
The inline offsets of the numerator and denominator are calculated the same as in § 3.3.2.1 Fraction with nonzero line thickness.
The alphabetic baseline of the numerator (respectively denominator) is
shifted away from the alphabetic baseline by a distance of
TopShift
(respectively −
BottomShift
) towards the
line-over (respectively line-under).
3.3.3 Radicals <msqrt>
, <mroot>
The
<msqrt>
and
<mroot>
elements construct radicals. The <msqrt>
element is
used for square roots, while the <mroot>
element is
used to draw radicals with indices, e.g. a cube root.
The <msqrt>
and <mroot>
elements accept the attributes described
in § 2.1.3 Global Attributes.
The following example contains a square root
written with <msqrt>
and a cube root written
with <mroot>
.
Note that <msqrt>
has several children and the
square root applies to all of them.
<mroot>
has exactly two children: it is a
root of index the second child (the number 3), applied to the
the first child (the square root).
Also note these elements only change the font-size within the
<mroot>
index, but it is scaled down more than
within the numerator and denumerator of the fraction.

The <msqrt>
and <mroot>
elements sets math-shift
to
compact
.
The <mroot>
element sets
increments
by 2, and sets scriptlevel
to "false" in all
but its first child.
The user agent stylesheet
must contain the following rule in order to implement that behavior:
displaystyle
If the <msqrt>
or <mroot>
element do not have their computed
display
property equal to block math
or inline math
then they are laid out according to the CSS specification where
the corresponding value is described.
Otherwise, the layout below is performed.
If the <mroot>
has less or more than two
in-flow children,
its layout algorithm
is the same as the
element.
Otherwise, the first in-flow child is called
mroot base and
the second in-flow child is called
mroot index
and its layout algorithm is explained below.
<mrow>
<mroot>
element has two children
that are in-flow. Hence the CSS rules basically performs
scriptlevel
and displaystyle
changes for the index.
The children of the
<msqrt>
element are laid out
using the algorithm of the
element
to produce a box that is also called the msqrt base.
In particular, the
algorithm for stretching operators along the block axis is used.
<mrow>
3.3.3.1 Radical symbol
The radical symbol must only be painted if the
visibility
of
the <msqrt>
or <mroot>
element is visible
.
In that case, the radical symbol must be painted with the
color
of that element.
The radical glyph is the glyph obtained for the character U+221A SQUARE ROOT.
The radical gap is given by
RadicalVerticalGap
if the math-style
is compact
and
RadicalDisplayStyleVerticalGap
if the math-style
is normal
.
The radical target size for the stretchy radical glyph is the sum of RadicalRuleThickness, radical gap and the ink height of the base.
The box metrics of the radical glyph and painting of the surd are given by the algorithm to shape a stretchy glyph to block dimension the target size for the radical glyph.
3.3.3.2 Square root
The <msqrt>
element is laid out as shown on
Figure 14.
<msqrt>
elementThe min-content inline size (respectively max-content inline size) of the content is the sum of the preferred inline size of a glyph stretched along the block axis for the radical glyph and of the min-content inline size (respectively max-content inline size) of the base's margin box.
The inline size of the content is the sum of the advance width of the box metrics of the radical glyph and of the inline size of the base's margin's box.
The line-ascent of the content is the maximum between:
- The line-ascent of the base's margin box.
- The sum of the ink line-ascent of the base, the radical gap, the RadicalRuleThickness and RadicalExtraAscender.
The line-descent of the content is the maximum between:
- The line-descent of the base's margin box.
- The sum of the line-ascent and line-descent for the box metrics of the radical glyph and of the RadicalExtraAscender, minus the line-ascent of the content.
The inline size of the overbar is the inline size of the base's margin's box. The inline offsets of the base and overbar are also the same and equal to the width of the box metrics of the radical glyph.
The alphabetic baseline of the base is aligned with the alphabetic baseline. The block size of the overbar is RadicalRuleThickness. Its vertical center is shifted away from the alphabetic baseline by a distance towards the line-over equal to the line-ascent of the content, minus the RadicalExtraAscender, minus half the RadicalRuleThickness.
Finally, the painting of the surd is performed:
- At inline offset 0.
- At block offset shifted away from the line-over edge of the overbar towards the line-under by a distance given by the ascent of the box metrics of the radical glyph.
3.3.3.3 Root with index
The <mroot>
element is laid out as shown on
Figure 15.
The root index is first ignored and the base and
radical glyph are laid out as
shown on figure Figure 14
using the same algorithm as in
§ 3.3.3.2 Square root
in order to produce a margin box B (represented in green).
<mroot>
elementThe min-content inline size (respectively max-content inline size) of the content is the sum of max(0, RadicalKernBeforeDegree), the index's min-content inline size (respectively max-content inline size) of the index's margin box, max(−min-content inline size, RadicalKernAfterDegree) (respectively max(−max-content inline size, RadicalKernAfterDegree)) and of the min-content inline size (respectively max-content inline size) of B.
Using the same clamping, AdjustedRadicalKernBeforeDegree and AdjustedRadicalKernAfterDegree are respectively defined as max(0, RadicalKernBeforeDegree) and is max(−inline size of the index's margin box, RadicalKernAfterDegree).
The inline size of the content is the sum of AdjustedRadicalKernBeforeDegree, the inline size of the index's margin box, AdjustedRadicalKernAfterDegree and of the inline size of B.
The line-ascent of the content is the maximum between:
- −the line-descent of B + RadicalDegreeBottomRaisePercent × the block size of B + the line-ascent of the index's margin box
- The line-ascent of B
The line-descent of the content is the maximum between:
- the line-descent of B − RadicalDegreeBottomRaisePercent × the block size of B + the line-ascent of the index's margin box
- The line-descent of B
The inline offset of the index is AdjustedRadicalKernBeforeDegree. The inline-offset of the base is the same + the inline size of the index's margin box.
The alphabetic baseline of B is aligned with the alphabetic baseline. The alphabetic baseline of the index is shifted away from the line-under edge by a distance of RadicalDegreeBottomRaisePercent × the block size of B + the line-descent of the index's margin box.
3.3.4 Style Change <mstyle>
Historically, the
<mstyle>
element was introduced to make
style changes that affect the rendering of its contents.
The <mstyle>
element accepts the attributes described in
§ 2.1.3 Global Attributes. Its layout algorithm is the
same as the
element.
<mrow>
<mstyle>
is implemented for compatibility with full MathML. Authors whose only target is MathML Core are encouraged to use CSS for styling.
In the following example,
<mstyle>
is used to set the scriptlevel
and displaystyle
.
Observe this is respectively affecting the
font-size and placement of subscripts of their
descendants. In MathML Core, one could just have used
<mrow>
elements instead.

3.3.5 Error Message <merror>
The
<merror>
element displays its contents as an
”error message”. The intent of this element is to provide a standard way
for programs that generate MathML from other input to report syntax errors
in their input.
In the following example,
<merror>
is used to indicate a parsing error
for some LaTeX-like input:

The <merror>
element accepts the attributes described in
§ 2.1.3 Global Attributes. Its layout algorithm is the
same as the
element.
The user agent stylesheet
must contain the following rule in order to visually highlight the error
message:
<mrow>
3.3.6 Adjust Space Around Content <mpadded>
The
<mpadded>
element renders the same as its in-flow child content, but with the
size and relative positioning point of its
content modified according to <mpadded>
’s attributes.
The <mpadded>
element accepts the attributes described
in § 2.1.3 Global Attributes as well as the following
attributes:
The
mpadded@width
,
mpadded@height
,
mpadded@depth
,
mpadded@lspace
and
mpadded@voffset
if present, must
have a value that is a valid length-percentage.
In the following example, <mpadded>
is used to
tweak spacing around a fraction
(a blue background is used to visualize it).
Without attributes, it behaves like an <mrow>
but
the attributes allow to specify the size of the box
(width, height, depth) and position of the fraction within that
box (lspace and voffset).

3.3.6.1 Inner box and requested parameters
In-flow children
of the <mpadded>
element are laid out
using the algorithm of the
element
to produce the
mpadded inner box for the content with parameters called
inner inline size, inner line-ascent and inner line-descent.
The requested <mrow>
<mpadded>
parameters are determined as follows:
- If the
width
(respectivelyheight
,depth
,lspace
,voffset
) attribute is absent, invalid or alength-percentage
then the requested width (respectively height, depth, lspace, voffset) is the inner inline size (respectively inner line-ascent, inner line-descent,0
,0
). - Otherwise the requested width
(respectively height, depth, lspace, voffset) is the resolved
value of the
width
attribute (respectivelyheight
,depth
,lspace
,voffset
attributes). If one of the requested width, depth, height or lspace values is negative then it is treated as0
.
voffset
values are not clamped to
0
.
3.3.6.2 Layout of <mpadded>
If the <mpadded>
element does not have its
computed
display
property equal to block math
or inline math
then it is laid out according to the CSS specification where
the corresponding value is described.
Otherwise, it is laid out as shown on
Figure 16.
<mpadded>
elementThe min-content inline size (respectively max-content inline size) of the content is the requested width calculated in § 3.3.6.1 Inner box and requested parameters but using the min-content inline size (respectively max-content inline size) of the mpadded inner box instead of the "inner inline size".
The inline size of the content is the requested width calculated in § 3.3.6.1 Inner box and requested parameters.
The line-ascent of the content is the requested height. The line-descent of the content is the requested depth.
The mpadded inner box is placed so that its alphabetic baseline is shifted away from the alphabetic baseline by the requested voffset towards the line-over.
3.3.7 Making Sub-Expressions Invisible <mphantom>
Historically, the
<mphantom>
element was introduced to render
its content invisibly, but with the same metrics size and other dimensions,
including alphabetic baseline position that its contents would have if they were
rendered normally.
In the following example,
<mphantom>
is used to ensure alignment of
corresponding parts of the numerator and denominator of a
fraction:

The <mphantom>
element accepts the attributes described
in § 2.1.3 Global Attributes. Its layout algorithm is
the same as the
element.
The user agent stylesheet
must contain the following rule in order to hide the content:
<mrow>
<mphantom>
is implemented for compatibility with full MathML. Authors whose only target is MathML Core are encouraged to use CSS for styling.
3.4 Script and Limit Schemata
The elements described in this section position one or more scripts around a base. Attaching various kinds of scripts and embellishments to symbols is a very common notational device in mathematics. For purely visual layout, a single general-purpose element could suffice for positioning scripts and embellishments in any of the traditional script locations around a given base. However, in order to capture the abstract structure of common notation better, MathML provides several more specialized scripting elements.
In addition to sub/superscript elements, MathML has overscript and underscript elements that place scripts above and below the base. These elements can be used to place limits on large operators, or for placing accents and lines above or below the base.
3.4.1 Subscripts and Superscripts <msub>
, <msup>
, <msubsup>
The <msub>
,
<msup>
and
<msubsup>
elements are used to attach
subscript and superscript to a MathML expression.
They accept the attributes described in
§ 2.1.3 Global Attributes.
The following example, shows basic use of subscripts and superscripts. The font-size is automatically scaled down within the scripts.

If the
<msub>
,
<msup>
or
<msubsup>
elements do not have their
computed
display
property equal to block math
or inline math
then they are laid out according to the CSS specification where
the corresponding value is described.
Otherwise, the layout below is performed.
3.4.1.1 Children of <msub>
,
<msup>
, <msubsup>
If the <msub>
element
has less or more than two in-flow children, its layout algorithm
is the same as the
element.
Otherwise, the first in-flow child is called the
msub base, the second in-flow child is called the
msub subscript and the layout algorithm is explained
in § 3.4.1.2 Base with subscript.
<mrow>
If the <msup>
element
has less or more than two in-flow children, its layout algorithm
is the same as the
element.
Otherwise, the first in-flow child is called the
msup base, the second in-flow child is called the
msup superscript and the layout algorithm is explained
in § 3.4.1.3 Base with superscript.
<mrow>
If the <msubsup>
element
has less or more than three in-flow children, its layout algorithm
is the same as the
element.
Otherwise, the first in-flow child is called the
msubsup base, the second in-flow child
is called the msubsup subscript,
its third in-flow child is called
the msupsup superscript and the layout algorithm is explained
in § 3.4.1.4 Base with subscript and superscript.
<mrow>
3.4.1.2 Base with subscript
The <msub>
element is laid out as shown on
Figure 17.
LargeOpItalicCorrection
is the italic correction of the base
if it is an embellished operator with
the
property and 0 otherwise.
largeop
<msub>
element
The
min-content inline size (respectively max-content inline size) of the content is the
min-content inline size (respectively max-content inline size) inline size of the base's margin box −
LargeOpItalicCorrection
+
min-content inline size (respectively max-content inline size) of
the subscript's margin box + SpaceAfterScript.
If there is an inline stretch size constraint or a block stretch size constraint then the base is also laid out with the same stretch size contraint and otherwise it is laid out without any stretch size constraint. The scripts are always laid out without any stretch size constraint.
The inline size of the content
is the inline size of the base's margin box −
LargeOpItalicCorrection
+
the inline size of
the subscript's margin box + SpaceAfterScript.
SubShift
is the maximum between:
- SubscriptShiftDown
- the ink line-ascent of the subscript's margin box − SubscriptTopMax
- SubscriptBaselineDropMin + the ink line-descent of the base's margin box
The line-ascent of the content is the maximum between:
- The line-ascent of the base's margin box.
- The line-ascent of the subcript's margin box −
SubShift
.
The line-descent of the content is the maximum between:
- The line-descent of the base's margin box.
- The line-descent of the subcript's margin box +
SubShift
.
The inline offset of the base is 0 and the inline offset of the
subscript is the inline size of the base's margin box −
LargeOpItalicCorrection
.
The base is placed so that its alphabetic baseline
matches the alphabetic baseline. The subscript is placed so that its alphabetic baseline
is shifted away from the alphabetic baseline by SubShift
towards the line-under.
3.4.1.3 Base with superscript
The <msup>
element is laid out as shown on
Figure 18.
ItalicCorrection
is the italic correction of the base
if it is not an embellished operator with
the
property and 0 otherwise.
largeop
<msup>
element
The
min-content inline size (respectively max-content inline size) of
the content
is the
min-content inline size (respectively max-content inline size) of
the base's margin box +
ItalicCorrection
+
the min-content inline size (respectively max-content inline size) of
the superscript's margin box + SpaceAfterScript.
If there is an inline stretch size constraint or a block stretch size constraint then the base is also laid out with the same stretch size contraint and otherwise it is laid out without any stretch size constraint. The scripts are always laid out without any stretch size constraint.
The inline size of the content
is the inline size of the base's margin box +
ItalicCorrection
+
the inline size of
the superscript's margin box + SpaceAfterScript.
SuperShift
is the maximum between:
- The value SuperscriptShiftUpCramped if the
element has a computed
math-shift
property equal tocompact
, or SuperscriptShiftUp otherwise. - SuperscriptBottomMin + the ink line-descent of the superscript's margin box
- The ink line-ascent of the base's margin box − SuperscriptBaselineDropMax
The line-ascent of the content is the maximum between:
- The line-ascent of the base's margin box.
- The line-ascent of the supercript's margin box +
SuperShift
.
The line-descent of the content is the maximum between:
- The line-descent of the base's margin box.
- The line-descent of the supercript's margin box −
SuperShift
.
The inline offset of the base is 0 and the inline offset of
superscript is the inline size of the base's margin box +
ItalicCorrection
.
The base is placed so that its alphabetic baseline
matches the alphabetic baseline. The superscript is placed so that its
alphabetic baseline
is shifted away from the alphabetic baseline by SuperShift
towards the line-over.
3.4.1.4 Base with subscript and superscript
The <msubsup>
element is laid out as shown on
Figure 18.
LargeOpItalicCorrection
and SubShift
are set as in § 3.4.1.2 Base with subscript.
ItalicCorrection
and SuperShift
are set as in § 3.4.1.3 Base with superscript.
<msubsup>
elementThe min-content inline size (respectively max-content inline size and inline size) of the content is the maximum between the min-content inline size (respectively max-content inline size and inline size) of the content calculated in § 3.4.1.2 Base with subscript and § 3.4.1.3 Base with superscript.
If there is an inline stretch size constraint or a block stretch size constraint then the base is also laid out with the same stretch size contraint and otherwise it is laid out without any stretch size constraint. The scripts are always laid out without any stretch size constraint.
If there is an inline stretch size constraint or a block stretch size constraint then the base is also laid out with the same stretch size contraint and otherwise it is laid out without any stretch size constraint. The scripts are always laid out without any stretch size constraint.
SubSuperGap
is the gap between the two scripts
along the block axis and is defined by
(SubShift
− the ink line-ascent of the subscript's
margin box) +
(SuperShift
− the ink line-descent of the
superscript's margin box).
If SubSuperGap
is not at least
SubSuperscriptGapMin then the following steps are
performed to ensure that the condition holds:
-
Let Δ be SuperscriptBottomMaxWithSubscript
− (
SuperShift
− the ink line-descent of the superscript's margin box). If Δ > 0 then set Δ to the minimum between Δ set SubSuperscriptGapMin −SubSuperGap
and increaseSuperShift
(and soSubSuperGap
too) by Δ. -
Let Δ be SubSuperscriptGapMin −
SubSuperGap
. If Δ > 0 then increaseSubscriptShift
(and soSubSuperGap
too) by Δ.
The ink line-ascent (respectively line-ascent, ink line-descent,
line-descent) of the content
is set to the maximum
of the
ink line-ascent (respectively line-ascent, ink line-descent,
line-descent) of the content
calculated in
in § 3.4.1.2 Base with subscript and
§ 3.4.1.3 Base with superscript
but using the adjusted values SubShift
and
SuperShift
above.
The inline offset and block offset of the base and scripts are performed the same as described in § 3.4.1.2 Base with subscript and § 3.4.1.3 Base with superscript.
Even when the subscript (respectively superscript) is an empty
box, <msubsup>
does not generally render the same as
§ 3.4.1.3 Base with superscript
(respectively § 3.4.1.2 Base with subscript)
because of the additional constraint on
SubSuperGap
.
Moreover, positioning the empty subscript
(respectively superscript)
may also change the total size.
In order to keep the algorithm simple, no attempt is made to handle empty scripts in a special way.
3.4.2 Underscripts and Overscripts <munder>
, <mover>
, <munderover>
The <munder>
,
<mover>
and
<munderover>
elements are used to
attach
accents or limits placed under or over a MathML expression.
The <munderover>
element accepts the attribute
described in § 2.1.3 Global Attributes as well as the
following attributes:
Similarly, the <mover>
element
(respectively <munder>
element) accepts the
attribute described in § 2.1.3 Global Attributes
as well as the
attribute (respectively the
accent
attribute).
accentunder
accent
,
accentunder
,
attributes, if present, must have values that are booleans.
If these attributes are absent or invalid, they are treated as
equal to false
.
User agents must implement them as described in
§ 3.4.4 Displaystyle, scriptlevel and math-shift in scripts.
The following example, shows basic use of under and over scripts. The font-size is automatically scaled down within the scripts, unless they are meant to be accents.

If the
<munder>
,
<mover>
or
<munderover>
elements do not have their
computed
display
property equal to block math
or inline math
then they are laid out according to the CSS specification where
the corresponding value is described.
Otherwise, the layout below is performed.
3.4.2.1 Children of <munder>
,
<mover>
, <munderover>
If the <munder>
element
has less or more than two in-flow children, its layout algorithm
is the same as the
element.
Otherwise, the first in-flow child is called the
munder base and the second in-flow child is called the
munder underscript.
<mrow>
If the <mover>
element
has less or more than two in-flow children, its layout algorithm
is the same as the
element.
Otherwise, the first in-flow child is called the
mover base and the second in-flow child is called the
mover overscript.
<mrow>
If the <munderover>
element
has less or more than three in-flow children, its layout algorithm
is the same as the
element.
Otherwise, the first in-flow child is called the
munderover base, the second in-flow child
is called the munderover underscript
and its third in-flow child is called
the munderover overscript.
<mrow>
If the
<munder>
, <mover>
or
<munderover>
elements have a computed
math-style
property equal to compact
and their base is an embellished operator with the
property, then
their layout algorithms are respectively
the same as the ones described for
movablelimits
<msub>
, <msup>
and
<msubsup>
in
§ 3.4.1.2 Base with subscript,
§ 3.4.1.3 Base with superscript and
§ 3.4.1.4 Base with subscript and superscript.
Otherwise, the
<mover>
, <mover>
and
<munderover>
layout algorithms are respectively
described in
§ 3.4.2.3 Base with underscript,
§ 3.4.2.4 Base with overscript and
§ 3.4.2.5 Base with underscript and overscript
3.4.2.2 Algorithm for stretching operators along the inline axis
The algorithm for stretching operators along the inline axis is as follows.
- If there is an inline stretch size constraint or block stretch size constraint then the element being laid out is an embellished operator. Layout the base with the same stretch size constraint.
-
Split the list of in-flow children that have not been
laid out yet into a first list
LToStretch
containing embellished operators with astretchy
property and inline stretch axis ; and a second listLNotToStretch
. -
Perform layout without any stretch size constraint on
all the items of
LNotToStretch
. IfLToStretch
is empty then stop. IfLNotToStretch
is empty, perform layout with stretch size constraint 0 on all the items ofLToStretch
. -
Calculate the target size
T
to the maximum inline size of the margin boxes of child boxes that have been laid out in the previous step. -
Layout or relayout all the elements of
LToStretch
with inline stretch size constraintT
.
3.4.2.3 Base with underscript
The <munder>
element is laid out as shown on
Figure 20.
LargeOpItalicCorrection
is the italic correction of the base
if it is an embellished operator with
the
property and 0 otherwise.
largeop
<munder>
elementThe min-content inline size (respectively max-content inline size) of the content are calculated like the inline size of the content below but replacing the inline sizes of the base's margin box and underscript's margin box with the min-content inline size (respectively max-content inline size) of the base's margin box and underscript's margin box.
The in-flow children are laid out using the algorithm for stretching operators along the inline axis.
The inline size of the content is calculated by determining the absolute difference between:
- The maximum of:
- Half the inline size of the base's margin box.
- Half the inline size of the underscript's margin box −
half
LargeOpItalicCorrection
.
- The minimum of:
- −Half the inline size of the base's margin box.
- −Half the inline size of the underscript's margin box −
half
LargeOpItalicCorrection
.
If m is the minimum calculated in the second item above then the
inline offset
of the base is −m − half the inline size of the base's margin box.
The inline offset of the underscript is
−m − half the inline size of the underscript's margin box −
half LargeOpItalicCorrection
.
Parameters
UnderShift
and UnderExtraDescender
are determined by considering three cases in the following order:
-
The base is an embellished operator with the
property.largeop
UnderShift
is the maximum of- LowerLimitBaselineDropMin
- LowerLimitGapMin + the ascent of the underscript.
UnderExtraDescender
is 0. -
The base is an embellished operator with the
property and stretch axis inline.stretchy
UnderShift
is the maximum of:- StretchStackBottomShiftDown
- StretchStackGapAboveMin + the ascent of the underscript.
UnderExtraDescender
is 0. -
Otherwise,
UnderShift
is equal to UnderbarVerticalGap if theaccentunder
attribute is not an ASCII case-insensitive match totrue
and to zero otherwise.UnderExtraAscender
is UnderbarExtraDescender.
The line-ascent of the content is the maximum between:
- The line-ascent of the base's margin box.
- The line-ascent of the underscript's margin box −
UnderShift
.
The line-descent of the content is the maximum between:
- The line-descent of the base's margin box.
- The line-descent of the underscript's margin box +
UnderShift
+UnderExtraAscender
.
The alphabetic baseline of the base is aligned with the alphabetic baseline.
The alphabetic baseline of the underscript is shifted away from the alphabetic baseline
and towards the line-under by a distance equal to
the ink line-descent of the base's margin box
+ UnderShift
.
3.4.2.4 Base with overscript
The <mover>
element is laid out as shown on
Figure 21.
LargeOpItalicCorrection
is the italic correction of the base
if it is an embellished operator with
the
property and 0 otherwise.
largeop
<mover>
elementThe min-content inline size (respectively max-content inline size) of the content are calculated like the inline size of the content below but replacing the inline sizes of the base's margin box and underscript's margin box with the min-content inline size (respectively max-content inline size) of the base's margin box and underscript's margin box.
The in-flow children are laid out using the algorithm for stretching operators along the inline axis.
The TopAccentAttachment
is the
top accent attachment of the overscript or
half the inline size of the overscript's margin box
if it is undefined.
The inline size of the content is calculated by applying the algorithm for stretching operators along the inline axis for layout and determining the absolute difference between:
- The maximum of:
- Half the inline size of the base's margin box.
- The inline size of the overscript's margin box
−
TopAccentAttachment
+ halfLargeOpItalicCorrection
.
- The minimum of:
- −Half the inline size of the base's margin box.
- −
TopAccentAttachment
+ halfLargeOpItalicCorrection
.
If m is the minimum calculated in the second item above then the
inline offset
of the base is −m − half the inline size of the base's margin.
The inline offset of the overscript is
−m − half the inline size of the overscript's margin box +
half LargeOpItalicCorrection
.
Parameters
OverShift
and OverExtraDescender
are determined by considering three cases in the following order:
-
The base is an embellished operator with the
property.largeop
OverShift
is the maximum of- UpperLimitBaselineRiseMin
- UpperLimitGapMin + the descent of the overscript.
OverExtraAscender
is 0. -
The base is an embellished operator with the
property and stretch axis inline.stretchy
OverShift
is the maximum of:- StretchStackTopShiftUp
- StretchStackGapBelowMin + the descent of the overscript.
OverExtraDescender
is 0. -
Otherwise,
OverShift
is equal to- OverbarVerticalGap if the
accent
attribute is not an ASCII case-insensitive match totrue
. - Or AccentBaseHeight minus the line-ascent of the base's margin box if this difference is nonnegative.
- Or 0 otherwise.
OverExtraAscender
is OverbarExtraAscender. - OverbarVerticalGap if the
The line-ascent of the content is the maximum between:
- The line-ascent of the base's margin box.
- The line-ascent of the overscript's margin box +
OverShift
+OverExtraAscender
.
The line-descent of the content is the maximum between:
- The line-descent of the base's margin box.
- The line-descent of the overscript's margin box −
OverShift
.
The alphabetic baseline of the base is aligned with the alphabetic baseline.
The alphabetic baseline of the overscript is shifted away from the alphabetic baseline
and towards the line-over by a distance equal to
the ink line-ascent of the base + OverShift
.
3.4.2.5 Base with underscript and overscript
The general layout of <munderover>
is shown on
Figure 22. The
LargeOpItalicCorrection
,
UnderShift
,
UnderExtraDescender
,
OverShift
,
OverExtraDescender
parameters
are calculated the same as in
§ 3.4.2.3 Base with underscript and
§ 3.4.2.4 Base with overscript.
<munderover>
elementThe min-content inline size, max-content inline size and inline size of the content are calculated as an absolute difference between a maximum inline offset and minimum inline offset. These extrema are calculated by taking the extremum value of the corresponding extrema calculated in § 3.4.2.3 Base with underscript and § 3.4.2.4 Base with overscript. The inline offsets of the base, underscript and overscript are calculated as in these sections but using the new minimum m (minimum of the corresponding minima).
Like in these sections, the in-flow children are laid out using the algorithm for stretching operators along the inline axis.
The line-ascent and line-descent of the content are also calculated by taking the extremum value of the extrema calculated in § 3.4.2.3 Base with underscript and § 3.4.2.4 Base with overscript.
Finally, the alphabetic baselines of the base, undescript and overscript are calculated as in sections § 3.4.2.3 Base with underscript and § 3.4.2.4 Base with overscript.
When the underscript (respectively overscript) is an empty box, the base and overscript (respectively underscript) are laid out similarly to § 3.4.2.4 Base with overscript (respectively § 3.4.2.3 Base with underscript) but the position of the empty underscript (respectively overscript) may add extra space. In order to keep the algorithm simple, no attempt is made to handle empty scripts in a special way.
3.4.3 Prescripts and Tensor Indices <mmultiscripts>
Presubscripts and tensor notations are represented
the <mmultiscripts>
with hints given by the
<mprescripts>
(to distinguish postscripts and prescripts)
and
<none>
elements
(to indicate empty scripts).
These element accept the attributes described in
§ 2.1.3 Global Attributes.
The following example, shows basic use of prescripts
and postscripts, involving
<none>
and <mprescripts>
.
The font-size is automatically scaled down within the scripts.

If the
<mmultiscripts>
,
<mprescripts>
or
<none>
elements do not have their
computed
display
property equal to block math
or inline math
then they are laid out according to the CSS specification where
the corresponding value is described.
Otherwise, the layout below is performed.
The empty
<mprescripts>
and <none>
elements are laid out as an
element.
<mrow>
A valid <mmultiscripts>
element contains the
following in-flow children:
-
A first in-flow child, called the
multiscripts base, that is not a an
element.<mprescripts>
-
Followed by an even number of in-flow children called
multiscripts postscripts, none of them being a
element. These scripts form a (possibly empty) list subscript, superscript, subscript, superscript, subscript, superscript, etc. Each consecutive couple of children subscript, superscript is called a subscript/superscript pair.<mprescripts>
- Optionally followed by
an
element and an even number of in-flow children called mmultiscripts prescripts, none of them being a<mprescripts>
element. These scripts form a (possibly empty) list of subscript/superscript pair.<mprescripts>
If an <mmultiscripts>
element is not valid then
it is laid out the same as the
element.
Otherwise the layout algorithm is explained below.
<mrow>
<none>
element is preserved for backward
compatibility reasons but is actually not taken into account
in the layout algorithm.
3.4.3.1 Base with prescripts and postscripts
The <mmultiscripts>
element is laid out as
shown on Figure 23.
For each postscript pair, the ItalicCorrection
LargeOpItalicCorrection
are defined as
in § 3.4.1.2 Base with subscript
and § 3.4.1.3 Base with superscript.
<mmultiscripts>
elementThe min-content inline size (respectively max-content inline size) of the content is calculated the same as the inline size of the content below, but replacing "inline size" with "min-content inline size" (respectively "max-content inline size") for the base's margin box and scripts's margin boxes.
If there is an inline stretch size constraint or a block stretch size constraint the base is also laid out with the same stretch size constraint. Otherwise it is laid out without any stretch size constraint. The other elements are always laid out without any stretch size constraint.
The inline size of the content is calculated with the following algorithm:
- Set
inline-offset
to 0. -
For each prescript pair, increment
inline-offset
by SpaceAfterScript + the maximum of- The inline size of the subscript's margin box.
- The inline size of the superscript's margin box.
-
Increment
inline-offset
by the inline size of the base's margin box and setinline-size
toinline-offset
. -
For each postscript pair, modify
inline-size
to be at least:-
x + the inline size of the subscript's margin box +
LargeOpItalicCorrection
. -
x + the inline size of the superscript's margin box −
ItalicCorrection
.
Increment
inline-offset
to the maximum of:- the inline size of the subscript's margin box.
- the inline size of the superscript's margin box.
Increment
inline-offset
by SpaceAfterScript. -
x + the inline size of the subscript's margin box +
- Return
inline-size
SubShift
(respectively SuperShift
)
is calculated by taking the maximum of all subshifts
(respectively supershifts) of each
subscript/superscript pair as described in
§ 3.4.1.4 Base with subscript and superscript.
The line-ascent of the content is calculated
by taking the maximum of all the line-ascent
of each subscript/superscript pair as described in
§ 3.4.1.4 Base with subscript and superscript
but using the SubShift
and
SuperShift
values calculated above.
The line-descent of the content is calculated
by taking the maximum of all the line-descent
of each subscript/superscript pair as described in
§ 3.4.1.4 Base with subscript and superscript
but using the SubShift
and
SuperShift
values calculated above.
Finally, the placement of the in-flow children is performed using the following algorithm:
- Set
inline-offset
to 0. -
For each prescript pair:
-
Increment
inline-offset
by SpaceAfterScript. -
Set
pair-inline-size
to the maximum of- the inline size of the subscript's margin box.
- the inline size of the superscript's margin box.
-
Place the subscript at inline-start position
inline-offset
+pair-inline-size
− the inline size of the subscript's margin box. -
Place the superscript at inline-start position
inline-offset
+pair-inline-size
− the inline size of the superscript's margin box. -
Place the subscript (respectively superscript) so its
alphabetic baseline is
shifted away from the alphabetic baseline by
SubShift
(respectivelySuperShift
) towards the line-under (respectively line-over). -
Increment
inline-offset
bypair-inline-size
.
-
Increment
-
Place the base and
<mprescripts>
boxes at inline offsetsinline-offset
and with their alphabetic baselines aligned with the alphabetic baseline. -
For each postscript pair:
-
Set
pair-inline-size
to the maximum of- the inline size of the subscript's margin box.
- the inline size of the superscript's margin box.
-
Place the subscript
at inline-start position
inline-offset
−LargeOpItalicCorrection
. -
Place the superscript
at inline-start position
inline-offset
+ItalicCorrection
. -
Place the subscript (superscript) so its alphabetic baseline is
shifted away from the alphabetic baseline by
SubShift
(respectivelySuperShift
) towards the line-under (respectively line-over). -
Increment
inline-offset
bypair-inline-size
-
Increment
inline-offset
by SpaceAfterScript.
-
Set
An <mmultiscripts>
with only one
postscript pair is laid out the same as a
<msubsup>
with the same in-flow children.
However, as
noticed for
<msubsup>
,
if additionally the subscript (respectively superscript) is an
empty box then it is not necessarily laid out the same as an
<msub>
(respectively <msup>
) element.
In order to keep the algorithm simple, no attempt is made to
handle empty or <none>
scripts in a special
way.
3.4.4 Displaystyle, scriptlevel and math-shift in scripts
For all scripted elements, the rule of thumb is to set
to displaystyle
false
and
to increment
in all child
elements but the first one.
However, an scriptlevel
(respectively
<mover>
)
element with an <munderover>
attribute that is an
ASCII case-insensitive
match to accent
true
does not increment scriptlevel within
its second child (respectively third child). Similarly,
and
<mover>
elements
with an <munderover>
attribute that is an
ASCII case-insensitive
match to accentunder
true
do not increment scriptlevel within
their second child.
<mmultiscripts>
sets
to
math-shift
compact
on its children at even position if they are
before an <mprescripts>
, and on those at odd position
if they are after
an <mprescripts>
.
The <msub>
and <msubsup>
elements set
to
math-shift
compact
on their second child.
An
and
<mover>
elements with an <munderover>
attribute that is an
ASCII case-insensitive
match to accent
true
also sets
to
math-shift
compact
within their first child.
The § A. User Agent Stylesheet must contain the following style in order to implement this behavior:
<mprescripts>
is empty.
Hence the CSS rules essentially performs automatic displaystyle
and
scriptlevel
changes for the scripts ; and
math-shift
changes for
subscripts and sometimes the base.
3.5 Tabular Math
Matrices, arrays and other table-like mathematical notation are marked up
using
<mtable>
<mtr>
elements. These elements are similar to the
<mtd>
<table>
,
<tr>
and
<td>
elements of [HTML].
The following example, how tabular layout allows to write a matrix. Note that it is vertically centered with the fraction bar and the middle of the equal sign.

3.5.1 Table or Matrix <mtable>
The <mtable>
is laid out as an
inline-table
and sets
displaystyle
to false
. The
user agent stylesheet must contain
the following rules in order to implement these properties:
The mtable
element is as a CSS
table
and the
min-content inline size, max-content inline size,
inline size, block size,
first baseline set and last baseline set
sets are determined
accordingly.
The center of the table is aligned with the math axis.
3.5.2 Row in Table or Matrix <mtr>
The <mtr>
is laid out as
table-row
. The
user agent stylesheet must contain
the following rules in order to implement that behavior:
The <mtr>
accepts the attributes described
in § 2.1.3 Global Attributes.
3.5.3 Entry in Table or Matrix <mtd>
The <mtd>
is laid out as
a table-cell
with content centered in the cell and
a default padding. The
user agent stylesheet must contain
the following rules:
The <mtd>
accepts the attributes described
in § 2.1.3 Global Attributes as well as the following attributes:
The columnspan
(respectively
rowspan
) attribute has the same
syntax and semantic as the
colspan
(respectively
rowspan
)
attribute on the <td>
element from [HTML].
3.6 Enlivening Expressions
Historically, the
<maction>
element provides a mechanism
for binding actions to expressions.
The <maction>
element accepts the attributes described
in § 2.1.3 Global Attributes as well as the following
attributes:
This specification does not define any observable behavior that is specific to the actiontype and selection attributes.
The following example, shows the "toggle" action type from [MathML3] where the renderer alternately displays the selected subexpression, starting from "one third" and cycling through them when there is a click on the selected subexpression ("one quarter", "one half", "one third", etc). This is not part of MathML Core but can be implemented using JavaScript and CSS polyfills. The default behavior is just to render the first child.

The layout algorithm of the <maction>
element
the same as the <mrow>
element.
The user agent stylesheet
must contain the following rules in order to hide all but
its first child element,
which is the default behavior for the legacy actiontype
values:
<maction>
is implemented for compatibility with full MathML. Authors whose only target is MathML Core are encouraged to use other HTML, CSS and JavaScript mechanisms to implement custom actions. They may
rely on maction attributes defined in [MathML3].
3.7 Semantics and Presentation
The
<semantics>
element is the container element that associates
annotations with a MathML expression. Typically, the
<semantics>
element has as its first child element
a MathML expression to be annotated while subsequent child elements
represent
text annotations within an <annotation>
element, or more complex markup annotations within
an <annotation-xml>
element.
The following example, shows how the fraction "one half" can be annotated with a textual annotation (LaTeX) or an XML annotation (content MathML). These annotations are not intended to be rendered by the user agent.

The <semantics>
element accepts the attributes
described in § 2.1.3 Global Attributes. Its layout algorithm
is the same as the
element.
The user agent stylesheet
must contain the following rule in order to only render the annotated
MathML expression:
<mrow>
The <annotation-xml>
and
<annotation>
element accepts the attributes
described in § 2.1.3 Global Attributes as well as the
following attribute:
This specification does not define any observable behavior that is specific to the encoding attribute.
The layout algorithm of the <annotation-xml>
and <annotation>
element is the same as the
element.
<mtext>
/* Hide the annotated child. */
semantics > :first-child { display: none; }
/* Show all text annotations. */
semantics > annotation { display: inline; }
/* Show all HTML annotations. */
semantics > annotation-xml[encoding="text/html" i],
semantics > annotation-xml[encoding="application/xhtml+xml" i] {
display: inline-block;
}
4. CSS Extensions for Math Layout
4.1 The display: block math
and display: inline math
value
The display
property
from CSS Display Module Level 3
is extended with a new inner display type:
<display> = <display-inside-old> | math
For elements that are not MathML elements, if the specified
value of display
is inline math
or
block math
then the computed value is
block flow
and inline flow
respectively.
For the
element
the computed value is <mtable>
block table
and
inline table
respectively.
For the
element, the computed value
is <mtr>
table-row
.
For the
element, the computed value
is <mtd>
table-cell
.
MathML elements with a
computed display
value equal to
block math
or inline math
control box generation and layout according to their tag name, as
described in the relevant sections.
Unknown MathML elements
behave the same as the
element.
<mrow>
display: block math
and
display: inline math
values provide a default
layout for MathML elements while at the same time allowing
to override it with either native display values or
custom values.
This allows authors or polyfills to define their own custom notations
to tweak or extend MathML Core.
In the following example, the default layout of the
MathML <mrow>
element is overriden to render its
content as a grid.

4.2 New text-transform
values
The text-transform
property
from CSS Text Module Level 3
is extended with new values:
<text-transform> = <text-transform-old> | math-auto | math-bold | math-italic | math-bold-italic | math-double-struck | math-bold-fraktur | math-script | math-bold-script | math-fraktur | math-sans-serif | math-bold-sans-serif | math-sans-serif-italic | math-sans-serif-bold-italic | math-monospace | math-initial | math-tailed | math-looped | math-stretched
If the specified value of text-transform is math-auto
and the inherited value is not none
then the
computed value is the inherited value.
On text nodes containing a unique character, math-auto
has
the same effect as math-italic
, otherwise it has no effects.
For the
math-bold
,
math-italic
,
math-bold-italic
,
math-double-struck
,
math-bold-fraktur
,
math-script
,
math-bold-script
,
math-fraktur
,
math-sans-serif
,
math-bold-sans-serif
,
math-sans-serif-italic
,
math-sans-serif-bold-italic
,
math-monospace
,
math-initial
,
math-tailed
,
math-looped
and
math-stretched
values, the transformed text is
obtained by performing conversion of each character according to
the corresponding
bold,
italic,
bold-italic,
double-struck,
bold-fraktur,
script,
bold-script,
fraktur,
sans-serif,
bold-sans-serif,
sans-serif-italic,
sans-serif-bold-italic,
monospace,
initial,
tailed,
looped,
stretched tables.
User agents may decide to rely on italic, bold and bold-italic
font-level properties when available fonts lack the proper glyphs to
perform math-auto
, math-italic
,
math-bold
, math-bold-italic
character-level
transforms.
The following example shows a mathematical formula where "exp" is rendered with normal variant, "A" with bold variant, "gl" with fraktur variant, "n" using italic variant and and "R" using double-struck variant.

Values other than math-auto
are intended to infer
specific context-dependent mathematical meaning.
In the previous example, one can guess that the author
decided to use the convention of bold variables for
matrices, fraktur variables for Lie algebras and double-struck
variables for set of numbers. Although the corresponding Unicode
characters could have been used directly in these cases, it may
be helpful for authoring tools or polyfills to support these
transformations via the text-transform
property.
A common style convention is to render
identifiers with multiple letters (e.g. the function name "exp")
with normal style and identifiers with a single letter
(e.g. the variable "n") with italic style. The
math-auto
property is intended to implement this
default behavior, which can be overriden by authors if necessary.
Note that mathematical fonts are designed with special kind
of italic glyphs located at the Unicode positions of
§ C.13 italic
mappings, which differ from the shaping
obtained via italic font style. Compare this
mathematical formula
rendered with the Latin Modern Math font using
font-style: italic
(left) and
text-transform: math-auto
(right):

4.3 The math-style
property
Name: |
math-style
|
---|---|
Value: | normal | compact |
Initial: | normal |
Applies to: | All elements |
Inherited: | yes |
Percentages: | n/a |
Media: | visual |
Computed value: | specified keyword |
Canonical order: | n/a |
Animation type: | not animatable |
When math-style
is compact
,
the math layout on descendants try to minimize the
logical height by
applying the following rules:
- The
is scaled down when its specified value isfont-size
math
and the computed value of
ismath-depth
auto-add
(default for<mfrac>
) as described in § 4.5 New valuemath-depth
property andfont-size: math
value. - Operators with the
largeop
property do not follow rules from § 3.2.4.3 Layout of operators to make them bigger. - Under/over scripts attached to an operator with
the
movablelimits
property are actually drawn as sub/super scripts as described in § 3.4.2.1 Children of<munder>
,<mover>
,<munderover>
. - Smaller vertical gaps and shifts from the OpenType MATH table are used for fractions and radicals, as described in § 3.3.2.1 Fraction with nonzero line thickness, § 3.3.2.2 Fraction with zero line thickness and § 3.3.3.1 Radical symbol.
The following example shows a
mathematical formula renderered with
its
root styled with
<math>
math-style: compact
(left) and
math-style: normal
(right).
In the former case, the font-size is automatically scaled down
within the fractions and the summation limits are rendered as
subscript and superscript of the ∑. In the latter case, the ∑ is
drawn bigger than normal text and
vertical gaps within fractions (even relative to current
font-size) is larger.

These two math-style
values typically correspond to
mathematical expressions in inline and display
mode respectively [TeXBook].
A mathematical formula in display mode
may automatically switch to inline mode within some subformulas
(e.g. scripts, matrix elements, numerators and denominators, etc)
and it is sometimes desirable to override this default behavior.
The math-style
property allows to easily implement these
features for MathML in the
User Agent Stylesheet
and with the displaystyle
attribute ; and also exposes
them to polyfills.
4.4 The math-shift
property
Name: |
math-shift
|
---|---|
Value: | normal | compact |
Initial: | normal |
Applies to: | All elements |
Inherited: | yes |
Percentages: | n/a |
Media: | visual |
Computed value: | specified keyword |
Canonical order: | n/a |
Animation type: | not animatable |
If the value of math-shift
is compact
, the math layout on descendants will use the
superscriptShiftUpCramped parameter to place superscript.
If the value of math-shift
is normal
, the math
will use the superscriptShiftUp parameter instead.
This property is used for positioning superscript during the layout
of MathML scripted elements.
See § § 3.4.1 Subscripts and Superscripts <msub>
, <msup>
, <msubsup>
§ 3.4.3 Prescripts and Tensor Indices <mmultiscripts>
and
§ 3.4.2 Underscripts and Overscripts <munder>
, <mover>
, <munderover>
.
In the following example, the two "x squared" are rendered with
compact math-style
and the same font-size
.
However, the one within the square root is rendered with
compact math-shift
while
the other one is rendered with
normal math-shift
, leading
to subtle different shift of the superscript "2".

Per [TeXBook], a
mathematical formula uses normal style by default but may
switch to compact style ("cramped" in TeX's terminology)
within some subformulas
(e.g. radicals, fraction denominators, etc).
The math-shift
property allows to easily
implement these rules for MathML in the
User Agent Stylesheet.
Page authors or developers of polyfills may also benefit from
having access to this property to tweak or refine the default
implementation.
4.5 New value math-depth
property and font-size: math
value
The font-size
property
from CSS Fonts Module Level 4
is extended with a new value math
value, indicating that
special mathematical scaling rules must be applied when determining
the computed value of the font-size
property:
<font-size> = <font-size-old> | math
A new math-depth
property is introduced to describe a notion
of "depth" for each element of a mathematical formula, with respect to
the top-level container of that formula. Concretely, this is used to
determine the computed value of the font-size
property when its specified value is math
.
Name: |
math-depth
|
---|---|
Value: | auto-add | add(<integer>) | <integer> |
Initial: | 0 |
Applies to: | All elements |
Inherited: | yes |
Percentages: | n/a |
Media: | visual |
Computed value: | an integer, see below |
Canonical order: | n/a |
Animation type: | not animatable |
The computed value of the math-depth
value is
determined as follows:
- If the specified value of
math-depth
isauto-add
and the inherited value ofmath-style
iscompact
then the computed value ofmath-depth
of the element is its inherited value plus one. - If the specified value of
math-depth
is of the formadd(<integer>)
then the computed value ofmath-depth
of the element is its inherited value plus the specified integer. - If the specified value of
math-depth
is of the form<integer>
then the computed value ofmath-depth
of the element is the specified integer. - Otherwise, the computed value
of
math-depth
of the element is the inherited one.
If the specified value font-size
is math
then the
computed value of
font-size
is obtained by multiplying the inherited value of
font-size
by a nonzero scale factor calculated by the
following procedure:
- Let A be the inherited
math-depth
value, B the computedmath-depth
value, C be 0.71 and S be 1.0 -
- If A = B then return S.
- If B < A, swap A and B and set
InvertScaleFactor
to true. - Otherwise B > A and set
InvertScaleFactor
to false.
- Let E be B - A > 0.
- If the inherited first available font has an OpenType MATH table:
- If A ≤ 0 and B ≥ 2 then multiply S by scriptScriptPercentScaleDown and decrement E by 2.
- Otherwise if A = 1 then multiply S by scriptScriptPercentScaleDown / scriptPercentScaleDown and decrement E by 1.
- Otherwise if B = 1 then multiply S by scriptPercentScaleDown and decrement E by 1.
- Multiply S by CE
- Return S if
InvertScaleFactor
is false and 1/S otherwise.
The following example shows a mathematical formula
with normal math-style
rendered with the Latin Modern Math font.
When entering subexpressions like scripts or fractions,
the font-size is automatically scaled down according to the
values of MATH table contained in that font.
Note that font-size is scaled down when
entering the superscripts but even faster when entering a
root's prescript. Also it is scaled down when entering the inner
fraction but not when entering the outer one, due to automatic
change of math-style
in fractions.

These rules from [TeXBook] are subtle and it's worth having a
separate math-depth
mechanism to express and
handle them. They can be implemented in MathML using the
User Agent Stylesheet.
Page authors or developers of polyfills may also benefit from
having access to this property to tweak or refine the default
implementation. In particular, the scriptlevel
attribute
from MathML provides a way to perform math-depth
changes.
5. OpenType MATH
table
This chapter describes features provided by MATH
table
of an OpenType font [OPEN-FONT-FORMAT]. Throughout this chapter,
a C-like notation
Table.Subtable1[index].Subtable2.Parameter
is used to
denote OpenType parameters.
Such parameters may not be available (e.g. if the font lack one of the
subtable, has an invalid offset, etc) and so fallback options are
provided.
OpenType values expressed in design units (perhaps indirectly via a
MathValueRecord
entry) are scaled to appropriate values
for layout purpose, taking into account
head.unitsPerEm
, CSS
or zoom level.
font-size
5.1 Layout constants (MathConstants
)
These are global layout constants for the first available font:
- Default fallback constant
- 0
- Default rule thickness
-
post.underlineThickness
or Default fallback constant if the constant is not available. - scriptPercentScaleDown
-
MATH.MathConstants.scriptPercentScaleDown / 100
or 0.71 ifMATH.MathConstants.scriptPercentScaleDown
is null or not available. - scriptScriptPercentScaleDown
-
MATH.MathConstants.scriptScriptPercentScaleDown / 100
or 0.5041 ifMATH.MathConstants.scriptScriptPercentScaleDown
is null or not available. - displayOperatorMinHeight
MATH.MathConstants.displayOperatorMinHeight
or Default fallback constant if the constant is not available.- axisHeight
MATH.MathConstants.axisHeight
or halfOS/2.sxHeight
if the constant is not available.- accentBaseHeight
MATH.MathConstants.accentBaseHeight
orOS/2.sxHeight
if the constant is not available.- subscriptShiftDown
MATH.MathConstants.subscriptShiftDown
orOS/2.ySubscriptYOffset
if the constant is not available.- subscriptTopMax
MATH.MathConstants.subscriptTopMax
or ⅘ ×OS/2.sxHeight
if the constant is not available.- subscriptBaselineDropMin
MATH.MathConstants.subscriptBaselineDropMin
or Default fallback constant if the constant is not available.- superscriptShiftUp
MATH.MathConstants.superscriptShiftUp
orOS/2.ySuperscriptYOffset
if the constant is not available.- superscriptShiftUpCramped
MATH.MathConstants.superscriptShiftUpCramped
or Default fallback constant if the constant is not available.- superscriptBottomMin
MATH.MathConstants.superscriptBottomMin
or ¼ ×OS/2.sxHeight
if the constant is not available.- superscriptBaselineDropMax
MATH.MathConstants.superscriptBaselineDropMax
or Default fallback constant if the constant is not available.- subSuperscriptGapMin
MATH.MathConstants.subSuperscriptGapMin
or 4 × default rule thickness if the constant is not available.- superscriptBottomMaxWithSubscript
MATH.MathConstants.superscriptBottomMaxWithSubscript
or ⅘ ×OS/2.sxHeight
if the constant is not available.- spaceAfterScript
MATH.MathConstants.spaceAfterScript
or 1/24em if the constant is not available.- upperLimitGapMin
MATH.MathConstants.upperLimitGapMin
or Default fallback constant if the constant is not available.- upperLimitBaselineRiseMin
MATH.MathConstants.upperLimitBaselineRiseMin
or Default fallback constant if the constant is not available.- lowerLimitGapMin
MATH.MathConstants.lowerLimitGapMin
or Default fallback constant if the constant is not available.- lowerLimitBaselineDropMin
MATH.MathConstants.lowerLimitBaselineDropMin
or Default fallback constant if the constant is not available.- stackTopShiftUp
MATH.MathConstants.stackTopShiftUp
or Default fallback constant if the constant is not available.- stackTopDisplayStyleShiftUp
MATH.MathConstants.stackTopDisplayStyleShiftUp
or Default fallback constant if the constant is not available.- stackBottomShiftDown
MATH.MathConstants.stackBottomShiftDown
or Default fallback constant if the constant is not available.- stackBottomDisplayStyleShiftDown
MATH.MathConstants.stackBottomDisplayStyleShiftDown
or Default fallback constant if the constant is not available.- stackGapMin
MATH.MathConstants.stackGapMin
or 3 × default rule thickness if the constant is not available.- stackDisplayStyleGapMin
MATH.MathConstants.stackDisplayStyleGapMin
or 7 × default rule thickness if the constant is not available.- stretchStackTopShiftUp
MATH.MathConstants.stretchStackTopShiftUp
or Default fallback constant if the constant is not available.- stretchStackBottomShiftDown
MATH.MathConstants.stretchStackBottomShiftDown
or Default fallback constant if the constant is not available.- stretchStackGapAboveMin
MATH.MathConstants.stretchStackGapAboveMin
or Default fallback constant if the constant is not available.- stretchStackGapBelowMin
MATH.MathConstants.stretchStackGapBelowMin
or Default fallback constant if the constant is not available.- fractionNumeratorShiftUp
MATH.MathConstants.fractionNumeratorShiftUp
or Default fallback constant if the constant is not available.- fractionNumeratorDisplayStyleShiftUp
MATH.MathConstants.fractionNumeratorDisplayStyleShiftUp
or Default fallback constant if the constant is not available.- fractionDenominatorShiftDown
MATH.MathConstants.fractionDenominatorShiftDown
or Default fallback constant if the constant is not available.- fractionDenominatorDisplayStyleShiftDown
MATH.MathConstants.fractionDenominatorDisplayStyleShiftDown
or Default fallback constant if the constant is not available.- fractionNumeratorGapMin
MATH.MathConstants.fractionNumeratorGapMin
or default rule thickness if the constant is not available.- fractionNumDisplayStyleGapMin
MATH.MathConstants.fractionNumDisplayStyleGapMin
or 3 × default rule thickness if the constant is not available.- fractionRuleThickness
MATH.MathConstants.fractionRuleThickness
or default rule thickness if the constant is not available.- fractionDenominatorGapMin
MATH.MathConstants.fractionDenominatorGapMin
or default rule thickness if the constant is not available.- fractionDenomDisplayStyleGapMin
MATH.MathConstants.fractionDenomDisplayStyleGapMin
or 3 × default rule thickness if the constant is not available.- overbarVerticalGap
MATH.MathConstants.overbarVerticalGap
or 3 × default rule thickness if the constant is not available.- overbarRuleThickness
MATH.MathConstants.overbarRuleThickness
or default rule thickness if the constant is not available.- overbarExtraAscender
MATH.MathConstants.overbarExtraAscender
or default rule thickness if the constant is not available.- underbarVerticalGap
MATH.MathConstants.underbarVerticalGap
or 3 × default rule thickness if the constant is not available.- underbarRuleThickness
MATH.MathConstants.underbarRuleThickness
or default rule thickness if the constant is not available.- underbarExtraDescender
MATH.MathConstants.underbarExtraDescender
or default rule thickness if the constant is not available.- radicalVerticalGap
MATH.MathConstants.radicalVerticalGap
or 1¼ × default rule thickness if the constant is not available.- radicalDisplayStyleVerticalGap
MATH.MathConstants.radicalDisplayStyleVerticalGap
or default rule thickness + ¼OS/2.sxHeight
if the constant is not available.- radicalRuleThickness
MATH.MathConstants.radicalRuleThickness
or default rule thickness if the constant is not available.- radicalExtraAscender
MATH.MathConstants.radicalExtraAscender
or default rule thickness if the constant is not available.- radicalKernBeforeDegree
MATH.MathConstants.radicalKernBeforeDegree
or 5/18em if the constant is not available.- radicalKernAfterDegree
MATH.MathConstants.radicalKernAfterDegree
or −10/18em if the constant is not available.- radicalDegreeBottomRaisePercent
MATH.MathConstants.radicalDegreeBottomRaisePercent / 100.0
or 0.6 if the constant is not available.
5.2 Glyph information (MathGlyphInfo
)
These are per-glyph tables for the first available font:
- MathItalicsCorrectionInfo
-
The subtable
MATH.MathGlyphInfo.MathItalicsCorrectionInfo
of italics correction values. Use the corresponding value inMATH.MathGlyphInfo.MathItalicsCorrectionInfo.italicsCorrection
if there is one for the requested glyph or or0
otherwise. - MathTopAccentAttachment
-
The subtable
MATH.MathGlyphInfo.MathTopAccentAttachment
of positioning top math accents along the inline axis. Use the corresponding value inMATH.MathGlyphInfo.MathTopAccentAttachment.topAccentAttachment
if there is one for the requested glyph or or half the advance width of the glyph otherwise.
5.3 Size variants for operators (MathVariants
)
This section describes how to handle stretchy glyphs of arbitrary
size using the MATH.MathVariants
table.
5.3.1 The GlyphAssembly
table
This section is based on [OPEN-TYPE-MATH-IN-HARFBUZZ]. For convenience, the following definitions are used:
-
omin is
MATH.MathVariant.minConnectorOverlap
. -
A
GlyphPartRecord
is an extender if and only ifGlyphPartRecord.partFlags
has thefExtender
flag set. -
A
GlyphAssembly
is horizontal if it is obtained fromMathVariant.horizGlyphConstructionOffsets
. Otherwise it is vertical (and obtained fromMathVariant.vertGlyphConstructionOffsets
). -
For a given
GlyphAssembly
table, NExt (respectively NNonExt) is the number of extenders (respectively non-extenders) inGlyphAssembly.partRecords
. -
For a given
GlyphAssembly
table, SExt (respectively SNonExt) is the sum ofGlyphPartRecord.fullAdvance
for all extenders (respectively non-extenders) inGlyphAssembly.partRecords
. - SExt,NonOverlapping = SExt − omin NExt is the sum of maximum non overlapping parts of extenders.
User agents must treat the GlyphAssembly
as invalid
if the following conditions are not satisfied:
- NExt > 0. Otherwise, the assembly cannot be grown by repeating extenders.
- SExt,NonOverlapping > 0. Otherwise, the assembly does not grow when joining extenders.
-
For each
GlyphPartRecord
inGlyphAssembly.partRecords
, the values ofGlyphPartRecord.startConnectorLength
andGlyphPartRecord.endConnectorLength
must be at least omin. Otherwise, it is not possible to satisfy the condition ofMathVariant.minConnectorOverlap
.
In this specification, a glyph assembly is built by repeating each extender r times and using the same overlap value o between each glyph. The number of glyphs in such an assembly is AssemblyGlyphCount(r) = NNonExt + r NExt while the stretch size is AssembySize(o, r) = SNonExt + r SExt − o (AssemblyGlyphCount(r) − 1).
rmin is the minimal number of repetitions needed to obtain an assembly of size at least T i.e. the minimal r such that AssembySize(omin, r)) ≥ T. It is defined as the maximum between 0 and the ceiling of ((T − SNonExt + omin (NNonExt − 1)) / SExt,NonOverlapping).
omax is the maximum overlap possible to build an assembly of size at least T by repeating each extender rmin times. If AssemblyGlyphCount(rmin) ≤ 1, then the actual overlap value is irrelevant. Otherwise, omax is defined to be the minimum of:
- omax,theorical = (AssembySize(0, rmin) − T) / (AssemblyGlyphCount(rmin) − 1) is the theorical overlap obtained by splitting evenly the extra size of an assembly built with null overlap.
-
GlyphPartRecord.startConnectorLength
for all the entries inGlyphAssembly.partRecords
, excluding the last one if it is not an extender. -
GlyphPartRecord.endConnectorLength
for all the entries inGlyphAssembly.partRecords
, excluding the first one if it is not an extender.
The glyph assembly stretch size for a target size T is AssembySize(omax, rmin).
The glyph assembly width, glyph assembly ascent and glyph assembly descent are defined as follows:
- If
GlyphAssembly
is vertical, the width is the maximum advance width of the glyphs of idGlyphPartRecord.glyphID
for all theGlyphPartRecord
inGlyphAssembly.partRecords
, the ascent is the glyph assembly stretch size for a given target sizeT
and the descent is 0. - Otherwise, the
GlyphAssembly
is horizontal, the width is glyph assembly stretch size for a given target sizeT
while the ascent (respectively descent) is the the maximum ascent (respectively descent) of the glyphs of idGlyphPartRecord.glyphID
for all theGlyphPartRecord
inGlyphAssembly.partRecords
.
The glyph assembly height is the sum of the glyph assembly ascent and glyph assembly descent.
T
.
The shaping of the glyph assembly is performed with the following algorithm:
- Calculate rmin and omax.
-
Set
(x, y)
to(0, 0)
,RepetitionCounter
to 0 andPartIndex
to -1. -
Repeat the following steps:
-
If
RepetitionCounter
is 0, then- Increment
PartIndex
. - If
PartIndex
isGlyphAssembly.partCount
then stop. - Otherwise, set
Part
toGlyphAssembly.partRecords[PartIndex]
. SetRepetitionCounter
to rmin ifPart
is an extender and to 1 otherwise.
- Increment
-
- If the glyph assembly is horizontal then
draw the glyph of id
Part.glyphID
so that its (left, baseline) coordinates are at position(x, y)
. Setx
tox + Part.fullAdvance − omax
- Otherwise (if the glyph assembly is vertical),
then
draw the glyph of id
Part.glyphID
so that its (left, bottom) coordinates are at position(x, y)
. Sety
toy − Part.fullAdvance + omax
- If the glyph assembly is horizontal then
draw the glyph of id
- Decrement
RepetitionCounter
.
-
If
5.3.2 Algorithms for glyph stretching
The preferred inline size of a glyph stretched along the block axis is calculated using the following algorithm:
-
Set
S
to the glyph's advance width. -
If there is a
MathGlyphConstruction
table in theMathVariants.vertGlyphConstructionOffsets
table for the given glyph:-
For each
MathGlyphVariantRecord
inMathGlyphConstruction.mathGlyphVariantRecord
, ensure thatS
is at least the advance width of the glyph of idMathGlyphVariantRecord.variantGlyph
. -
If there is valid
GlyphAssembly
subtable, then ensure thatS
is at least the glyph assembly width.
-
For each
- Return
S
.
The algorithm to shape a stretchy glyph to inline
(respectively block) dimension T
is the following:
-
If there is not any
MathGlyphConstruction
table in theMathVariants.horizGlyphConstructionOffsets
table (respectivelyMathVariants.vertGlyphConstructionOffsets
table) for the given glyph the exit with failure. -
If the glyph's advance width
(respectively height) is at least
T
then use normal shaping and bounding box for that glyph, the MathItalicsCorrectionInfo for that glyph as italic correction and exit with success. -
Browse the list of
MathGlyphVariantRecord
inMathGlyphConstruction.mathGlyphVariantRecord
. If oneMathGlyphVariantRecord.advanceMeasurement
is at leastT
then use normal shaping and bounding box forMathGlyphVariantRecord.variantGlyph
, the MathItalicsCorrectionInfo for that glyph as italic correction and exit with success. -
If there is valid
GlyphAssembly
subtable then use the bounding box given by glyph assembly width, glyph assembly ascent, the valueGlyphAssembly.italicsCorrection
as italic correction, perform shaping of the glyph assembly and exit with success. - If none of the stretch option above allowed to cover the target
size
T
, then choose last one that was tried and exit with success.
A. User Agent Stylesheet
@namespace url(http://www.w3.org/1998/Math/MathML);
/* Universal rules */
/* The <math> element */
/* <mrow>-like elements */
/* Token elements */
/* Tables */
/* Fractions */
/* Other rules for scriptlevel, displaystyle and math-shift */
B. Operator Tables
B.1 Operator Dictionary
The following dictionary for default values of
§ 3.2.4.2 Dictionary-based attributes of operators
when they are not specified via explicit attributes or equal to
the generic default values. Please refer to
§ 3.2.4.2 Dictionary-based attributes for explanation about
how to use this dictionary and how to
determine the values Content
and
Form
indexing it.
Tables below are suitable for computer manipulation,
see § B.3 Operator Dictionary (human-readable) for an alternative
presentation.
This compact form removes about 800 entries from the original
operator dictionary that actually
correspond to default values.
They are not necessary since they are handled by the
fallback case of
§ 3.2.4.2 Dictionary-based attributes anyway. For other
(Content
, Form
)
key, the search is done as follows:
-
Set properties
stretchy
,symmetric
largeop
,movablelimits
tofalse
. -
If
Content
as an UTF-16 string does not have length or 1 or 2 then exit withNotFound
status. - If
Content
is a single character in the range U+0320–U+03FF then exit withNotFound
status. Otherwise, if it has two characters:- If
Content
is the surrogate pairs corresponding to U+1EEF0 ARABIC MATHEMATICAL OPERATOR MEEM WITH HAH WITH TATWEEL or U+1EEF1 ARABIC MATHEMATICAL OPERATOR HAH WITH DAL andForm
is postfix, then set properties according to category I of #operator-dictionary-categories-values and move to the last step. - If the second character is
U+0338 COMBINING LONG SOLIDUS OVERLAY or
U+20D2 COMBINING LONG VERTICAL LINE OVERLAY then replace
Content
with the first character. - Otherwise, if
Content
it is listed inOperators_2_ascii_chars
then replaceContent
with the Unicode character "U+0320 plus the index ofContent
inOperators_2_ascii_chars
". - Otherwise exit with
NotFound
status.
- If
-
During this step, the algorithm will try and find a category
corresponding to (
Content
,Form
) from #operator-dictionary-category-table and either exit withNotFound
status or and move to the next point. More precisely, this can be done as follows:- For categories that don't have an encoding in
#operator-dictionary-categories-values
(namely K, M) perform a few direct verifications
on (
Content
,Form
) according to #operator-dictionary-category-table. If a result is found then set the properties according to #operator-dictionary-categories-values. Otherwise exit withNotFound
status. - For other categories, perform the following steps:
- Set
Key
toContent
if it is in range U+0000–U+03FF ; or toContent
− 0x1C00 if it is in range U+2000–U+2BFF. Otherwise, exit withNotFound
status.Key
is at most 0x0FFF. - Add 0x0000, 0x1000, 0x2000
to
Key
according to whetherForm
isinfix
,prefix
,postfix
respectively.Key
is at most 0x2FFF. - Search an
Entry
in table #operator-dictionary-categories-hexa-table suchEntry
% 0x4000 is equal toKey
. Either exit withNotFound
status or set the properties corresponding to the category with encodingEntry
/ 0x1000 in #operator-dictionary-categories-values.
- Set
- For categories that don't have an encoding in
#operator-dictionary-categories-values
(namely K, M) perform a few direct verifications
on (
- Return the calculated
(
lspace
,rspace
,stretchy
,symmetric
largeop
,movablelimits
) value.
When encoded as ranges, one can perform a binary search by looking for the range start, followed by an extra check on the range length. Since log is concave, it is worse to do one binary search on each large subtable of #operator-dictionary-category-table than one binary search on the whole table of #operator-dictionary-categories-hexa-table. One can see that there are several contiguous Unicode blocks, so encoding tables as ranges allow to get almost 8 bits per entry.
Alternatively, it is possible to use a perfect hash function to implement table lookup in constant time [gperf] [CMPH]. This would instead take 16 bits per entry, plus 16 bits per extra empty entry (for non-minimal perfect hash function) as well as extra data to store the hash function parameters. For minimal perfect hash function, the theorical lower bound for storing these parameters is 1.44bits/entry and existing algorithms range from close to that limit up to 4bits/entry.
B.2 Stretchy Operator Axis
The default stretch axis for all characters is block. However, the stretch axis for the following characters is inline:
B.3 Operator Dictionary (human-readable)
This section is non-normative.
The following dictionary provides a human-readable version
of § B.1 Operator Dictionary. Please refer to
§ 3.2.4.2 Dictionary-based attributes for explanation about
how to use this dictionary and how to
determine the values Content
and Form
indexing together
the dictionary.
The values for rspace
and lspace
are indicated
in the corresponding columns.
The values of
,
stretchy
,
symmetric
,
largeop
,
are movablelimits
true
if they are listed in the "properties" column.
B.4 Combining Character Equivalences
This section is non-normative.
The following table gives mappings between spacing and non spacing characters when used in MathML accent constructs.
B.5 Unicode-based Glyph Assemblies
This section is non-normative.
The following table provide fallback that user agents may use for
stretching a given base character when the font does not
provide a MATH.MathVariants
table.
The algorithms of
§ 5.3 Size variants for operators (MathVariants
)
works the same except with some adjustments:
- Entries are indexed by the base character.
- All the glyph IDs and metrics have to be deduced from unicode code points.
-
If the glyph construction is horizontal then
the entry corresponds to
a
MathVariants.horizGlyphConstructionOffsets[]
item ; if it is vertical it corresponds to aMathVariants.vertGlyphConstructionOffsets[]
item. -
The
MathGlyphConstruction.mathGlyphVariantRecord
is always empty. -
The
MathVariants.minConnectorOverlap
,GlyphPartRecord.startConnectorLength
andGlyphPartRecord.endConnectorLength
are treated as 0. -
The array of
MathGlyphConstruction.GlyphAssembly.partRecords
is built from each table row as follows:- A (non-extender) bottom/left character
- Followed by an extender character.
- Optionally followed by this:
- Optionally, an (non-extender) middle character and the same extender character previously mentioned.
- A (non-extender) top/right character.
C. New text-transform
Mappings
C.1 bold-script
mappings
C.2 bold-italic
mappings
C.3 tailed
mappings
C.4 bold
mappings
C.5 fraktur
mappings
C.6 script
mappings
C.7 monospace
mappings
C.8 initial
mappings
C.9 sans-serif
mappings
C.10 double-struck
mappings
C.11 looped
mappings
C.12 stretched
mappings
C.13 italic
mappings
C.14 bold-fraktur
mappings
C.15 sans-serif-bold-italic
mappings
C.16 sans-serif-italic
mappings
C.17 bold-sans-serif
mappings
D. Acknowledgments
This section is non-normative.
MathML Core is based on MathML3. See the appendix E of [MathML3] for the people that contributed to that specification.
We would like to thank the people who, through their input and feedback on public communication channels have helped us with the creation of this specification: André Greiner-Petter, Anne van Kesteren, Boris Zbarsky, Brian Smith, Daniel Marques, David Carlisle, Deyan Ginev, Elika Etemad, Emilio Cobos Álvarez, ExE Boss, Ian Kilpatrick, Koji Ishii, L. David Baron, Michael Kohlhase, Michael Smith, Moritz Schubotz, Murray Sargent, Ryosuke Niwa, Sergey Malkin, Tab Atkins Jr., Viktor Yaffle and frankvel.
In addition, we would like to extend special thanks to Brian Kardell, Neil Soiffer and Rob Buis for help with the editing.
Many thanks also to the following people for their help with the test suite: Brian Kardell, Frédéric Wang, Neil Soiffer and Rob Buis. Several tests are also based on MathML tests from browser repositories and we are grateful to the Mozilla and WebKit contributors.
Community Group members who have regularly participated to MathML Core meetings during the development of this specification: Brian Kardell, Bruce Miller, David Carlisle, Murray Sargent, Frédéric Wang, Neil Soiffer (Chair), Patrick Ion, Rob Buis, David Farmer, Steve Noble, Daniel Marques, Sam Dooley.
E. Privacy and Security Considerations
This section is non-normative.
As explained in § 2.2.1 HTML and SVG,
MathML can be embedded into an SVG image via the
<foreignObject>
element which can thus be used in a
<canvas>
element.
UA may decide to implement any measure to prevent potential
information leakage
such as tainting the canvas and returning a
"SecurityError"
DOMException
when one tries to access the canvas' content via JavaScript APIs.
This specification only adds script execution mechanisms in the the MathML event handler attributes described in § 2.1.3 Global Attributes. UAs may decide to apply the same security restrictions as HTML and SVG to prevent execution of scripts in these attributes.
This specification describes layout of a DOM
elements which may involve system
fonts. Like for HTML/CSS layout,
it is thus possible to use JavaScript APIs
to measure box sizes and positions and infer data from system fonts
(e.g. default fonts, available glyphs, font layout
parameters...). The only font informations that are not exposed by other
existing Web APIs are the math layout data described in
§ 5. OpenType MATH
table.
<maction>
element with
the actiontype
value set to "statusline"
in order to override the text of the browser statusline. In particular,
this could be used to hide the URL text of an untrusted link.
This has been removed in MathML Core
and the <maction>
element essentially behaves
like an <mrow>
container with extra style.
F. Conformance
As well as sections marked as non-normative, all authoring guidelines, diagrams, examples, and notes in this specification are non-normative. Everything else in this specification is normative.
The key words MAY, MUST, MUST NOT, OPTIONAL, RECOMMENDED, REQUIRED, SHALL, SHALL NOT, SHOULD, and SHOULD NOT in this document are to be interpreted as described in BCP 14 [RFC2119] [RFC8174] when, and only when, they appear in all capitals, as shown here.
Conformance
F.1 Document conventions
Conformance requirements are expressed with a combination of descriptive assertions and RFC 2119 terminology. The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in the normative parts of this document are to be interpreted as described in RFC 2119. However, for readability, these words do not appear in all uppercase letters in this specification.
All of the text of this specification is normative except sections explicitly marked as non-normative, examples, and notes. [RFC2119].
Examples in this specification are introduced with the words
“for example” or are set apart from the normative text with
class="example"
, like this:
This is an example of an informative example.
Informative notes begin with the word “Note” and are set apart from
the normative text with class="note"
, like this:
Note, this is an informative note.
Advisements are normative sections styled to evoke special attention
and are set apart from other normative text with
<strong class="advisement">
, like this:
UAs MUST provide an accessible alternative.
G. References
G.1 Normative references
- [CSS-ALIGN-3]
- CSS Box Alignment Module Level 3. Elika Etemad; Tab Atkins Jr.. W3C. 21 April 2020. W3C Working Draft. URL: https://www.w3.org/TR/css-align-3/
- [CSS-BACKGROUNDS-3]
- CSS Backgrounds and Borders Module Level 3. Bert Bos; Elika Etemad; Brad Kemper. W3C. 26 July 2021. W3C Candidate Recommendation. URL: https://www.w3.org/TR/css-backgrounds-3/
- [CSS-BOX-3]
- CSS Box Model Module Level 3. Elika Etemad. W3C. 22 December 2020. W3C Candidate Recommendation. URL: https://www.w3.org/TR/css-box-3/
- [css-box-4]
- CSS Box Model Module Level 4. Elika Etemad. W3C. 21 April 2020. W3C Working Draft. URL: https://www.w3.org/TR/css-box-4/
- [CSS-COLOR-3]
- CSS Color Module Level 3. Tantek Çelik; Chris Lilley; David Baron. W3C. 19 June 2018. W3C Recommendation. URL: https://www.w3.org/TR/css-color-3/
- [CSS-DISPLAY-3]
- CSS Display Module Level 3. Tab Atkins Jr.; Elika Etemad. W3C. 18 December 2020. W3C Candidate Recommendation. URL: https://www.w3.org/TR/css-display-3/
- [CSS-FONTS-4]
- CSS Fonts Module Level 4. John Daggett; Myles Maxfield; Chris Lilley. W3C. 29 July 2021. W3C Working Draft. URL: https://www.w3.org/TR/css-fonts-4/
- [CSS-SIZING-3]
- CSS Box Sizing Module Level 3. Tab Atkins Jr.; Elika Etemad. W3C. 17 March 2021. W3C Working Draft. URL: https://www.w3.org/TR/css-sizing-3/
- [CSS-TEXT-3]
- CSS Text Module Level 3. Elika Etemad; Koji Ishii; Florian Rivoal. W3C. 22 April 2021. W3C Candidate Recommendation. URL: https://www.w3.org/TR/css-text-3/
- [CSS-VALUES-3]
- CSS Values and Units Module Level 3. Tab Atkins Jr.; Elika Etemad. W3C. 6 June 2019. W3C Candidate Recommendation. URL: https://www.w3.org/TR/css-values-3/
- [CSS-WRITING-MODES-3]
- CSS Writing Modes Level 3. Elika Etemad; Koji Ishii. W3C. 10 December 2019. W3C Recommendation. URL: https://www.w3.org/TR/css-writing-modes-3/
- [CSS2]
- Cascading Style Sheets Level 2 Revision 1 (CSS 2.1) Specification. Bert Bos; Tantek Çelik; Ian Hickson; Håkon Wium Lie. W3C. 7 June 2011. W3C Recommendation. URL: https://www.w3.org/TR/CSS21/
- [DOM]
- DOM Standard. Anne van Kesteren. WHATWG. Living Standard. URL: https://dom.spec.whatwg.org/
- [HTML]
- HTML Standard. Anne van Kesteren; Domenic Denicola; Ian Hickson; Philip Jägenstedt; Simon Pieters. WHATWG. Living Standard. URL: https://html.spec.whatwg.org/multipage/
- [INFRA]
- Infra Standard. Anne van Kesteren; Domenic Denicola. WHATWG. Living Standard. URL: https://infra.spec.whatwg.org/
- [OPEN-FONT-FORMAT]
- Information technology — Coding of audio-visual objects — Part 22: Open Font Format. International Organization for Standardization. URL: https://standards.iso.org/ittf/PubliclyAvailableStandards/c052136_ISO_IEC_14496-22_2009%28E%29.zip
- [RFC2119]
- Key words for use in RFCs to Indicate Requirement Levels. S. Bradner. IETF. March 1997. Best Current Practice. URL: https://www.rfc-editor.org/rfc/rfc2119
- [RFC8174]
- Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words. B. Leiba. IETF. May 2017. Best Current Practice. URL: https://www.rfc-editor.org/rfc/rfc8174
- [SELECT]
- Selectors Level 3. Tantek Çelik; Elika Etemad; Daniel Glazman; Ian Hickson; Peter Linss; John Williams. W3C. 6 November 2018. W3C Recommendation. URL: https://www.w3.org/TR/selectors-3/
- [SVG]
- Scalable Vector Graphics (SVG) 1.0 Specification. Jon Ferraiolo. W3C. 4 September 2001. W3C Recommendation. URL: https://www.w3.org/TR/SVG/
G.2 Informative references
- [CMPH]
- CMPH - C Minimal Perfect Hashing Library. Fabiano Cupertino Botelho et al.. URL: https://cmph.sourceforge.net/index.html
- [CSS-LAYOUT-API-1]
- CSS Layout API Level 1. Greg Whitworth; Ian Kilpatrick; Tab Atkins Jr.; Shane Stephens; Robert O'Callahan; Rossen Atanassov. W3C. 12 April 2018. W3C Working Draft. URL: https://www.w3.org/TR/css-layout-api-1/
- [gperf]
- gperf - Perfect Hash Function Generator. URL: https://www.gnu.org/software/gperf/
- [MATHML3]
- Mathematical Markup Language (MathML) Version 3.0 2nd Edition. David Carlisle; Patrick D F Ion; Robert R Miner. W3C. 10 April 2014. W3C Recommendation. URL: https://www.w3.org/TR/MathML3/
- [MATHML4]
- Mathematical Markup Language (MathML) Version 4.0. David Carlisle et al.. W3C Editor's Draft. URL: https://w3c.github.io/mathml/
- [OPEN-TYPE-MATH-ILLUMINATED]
- OpenType Math Illuminated. Ulrik Vieth. 2009. URL: https://www.tug.org/TUGboat/tb30-1/tb94vieth.pdf
- [OPEN-TYPE-MATH-IN-HARFBUZZ]
- OpenType MATH in HarfBuzz. Frédéric Wang. URL: https://frederic-wang.fr/opentype-math-in-harfbuzz.html
- [TEXBOOK]
- The TeXBook. Knuth, Donald E.. Addison-Wesley Professional. 1984.
- [WEBIDL]
- Web IDL. Boris Zbarsky. W3C. 15 December 2016. W3C Editor's Draft. URL: https://heycam.github.io/webidl/
Referenced in:
Referenced in:
Referenced in:
Referenced in:
Referenced in:
Referenced in:
Referenced in:
Referenced in:
Referenced in:
Referenced in:
Referenced in:
- § 2.1.3 Global Attributes
- § 2.1.7 The displaystyle and scriptlevel attributes (2) (3)
- § 3.2.4 Operator, Fence, Separator or Accent <mo> (2)
- § 3.3.2 Fractions <mfrac> (2) (3)
- § 3.3.3 Radicals <msqrt>, <mroot> (2)
- § 3.3.4 Style Change <mstyle>
- § 3.4.4 Displaystyle, scriptlevel and math-shift in scripts (2)
- § 4.3 The math-style property
Referenced in:
- § 2.1.3 Global Attributes
- § 2.1.7 The displaystyle and scriptlevel attributes (2) (3)
- § 3.3.2 Fractions <mfrac> (2)
- § 3.3.3 Radicals <msqrt>, <mroot> (2)
- § 3.3.4 Style Change <mstyle>
- § 3.4.4 Displaystyle, scriptlevel and math-shift in scripts (2)
- § 4.5 New value math-depth property and font-size: math value
Referenced in:
Referenced in:
Referenced in:
Referenced in:
- § 3.1.1 Box Model (2) (3)
- § 3.1.2 Layout Algorithms
- § 3.2.1.1 Layout of <mtext>
- § 3.2.4.3 Layout of operators (2) (3) (4)
- § 3.2.5 Space <mspace>
- § 3.3.1.2 Layout of <mrow> (2) (3)
- § 3.3.2.1 Fraction with nonzero line thickness (2) (3) (4) (5) (6) (7)
- § 3.3.2.2 Fraction with zero line thickness
- § 3.3.3.2 Square root (2) (3) (4)
- § 3.3.3.3 Root with index (2) (3) (4) (5)
- § 3.3.6.2 Layout of <mpadded>
- § 3.4.1.2 Base with subscript (2) (3)
- § 3.4.1.3 Base with superscript (2) (3) (4)
- § 3.4.1.4 Base with subscript and superscript (2)
- § 3.4.2.2 Algorithm for stretching operators along the inline axis
- § 3.4.2.3 Base with underscript (2) (3) (4) (5) (6) (7) (8) (9)
- § 3.4.2.4 Base with overscript (2) (3) (4) (5) (6) (7) (8) (9)
- § 3.4.2.5 Base with underscript and overscript
- § 3.4.3.1 Base with prescripts and postscripts (2) (3) (4) (5) (6) (7) (8) (9) (10) (11) (12) (13) (14) (15)
- § 3.5.1 Table or Matrix <mtable>
Referenced in:
- § 3.1.1 Box Model (2) (3) (4)
- § 3.1.2 Layout Algorithms (2)
- § 3.2.1.1 Layout of <mtext>
- § 3.2.4.3 Layout of operators
- § 3.3.2.1 Fraction with nonzero line thickness (2)
- § 3.3.2.2 Fraction with zero line thickness
- § 3.3.3.2 Square root (2)
- § 3.3.6.2 Layout of <mpadded>
- § 3.4.1.3 Base with superscript
- § 3.4.2.4 Base with overscript
- § 3.4.3.1 Base with prescripts and postscripts (2)
Referenced in:
- § 3.1.1 Box Model (2) (3)
- § 3.1.2 Layout Algorithms (2)
- § 3.2.4.3 Layout of operators
- § 3.3.2.1 Fraction with nonzero line thickness
- § 3.3.2.2 Fraction with zero line thickness
- § 3.3.3.2 Square root
- § 3.3.3.3 Root with index
- § 3.4.1.2 Base with subscript
- § 3.4.2.3 Base with underscript
- § 3.4.3.1 Base with prescripts and postscripts (2)
Referenced in:
- § 3.1.1 Box Model (2) (3)
- § 3.1.2 Layout Algorithms
- § 3.2.1.1 Layout of <mtext>
- § 3.2.4.3 Layout of operators (2) (3)
- § 3.2.5 Space <mspace>
- § 3.3.1.2 Layout of <mrow> (2) (3)
- § 3.3.2.1 Fraction with nonzero line thickness (2) (3)
- § 3.3.2.2 Fraction with zero line thickness
- § 3.3.3.2 Square root (2)
- § 3.3.3.3 Root with index (2) (3) (4)
- § 3.3.6.2 Layout of <mpadded> (2)
- § 3.4.1.2 Base with subscript (2) (3)
- § 3.4.1.3 Base with superscript (2) (3)
- § 3.4.1.4 Base with subscript and superscript (2)
- § 3.4.2.3 Base with underscript (2)
- § 3.4.2.4 Base with overscript (2)
- § 3.4.2.5 Base with underscript and overscript
- § 3.4.3.1 Base with prescripts and postscripts (2)
- § 3.5.1 Table or Matrix <mtable>
Referenced in:
- § 3.1.1 Box Model (2) (3)
- § 3.1.2 Layout Algorithms
- § 3.2.1.1 Layout of <mtext>
- § 3.2.4.3 Layout of operators (2) (3)
- § 3.2.5 Space <mspace>
- § 3.3.1.2 Layout of <mrow> (2) (3)
- § 3.3.2.1 Fraction with nonzero line thickness (2) (3)
- § 3.3.2.2 Fraction with zero line thickness
- § 3.3.3.2 Square root (2)
- § 3.3.3.3 Root with index (2) (3) (4)
- § 3.3.6.2 Layout of <mpadded> (2)
- § 3.4.1.2 Base with subscript (2) (3)
- § 3.4.1.3 Base with superscript (2) (3)
- § 3.4.1.4 Base with subscript and superscript (2)
- § 3.4.2.3 Base with underscript (2)
- § 3.4.2.4 Base with overscript (2)
- § 3.4.2.5 Base with underscript and overscript
- § 3.4.3.1 Base with prescripts and postscripts (2)
- § 3.5.1 Table or Matrix <mtable>
Referenced in:
Referenced in:
Referenced in:
- § 3.1.1 Box Model (2) (3) (4) (5) (6) (7)
- § 3.3.1 Group Sub-Expressions <mrow> (2) (3)
- § 3.3.1.2 Layout of <mrow> (2)
- § 3.3.2.1 Fraction with nonzero line thickness (2) (3)
- § 3.3.2.2 Fraction with zero line thickness (2)
- § 3.3.3.2 Square root (2) (3)
- § 3.3.3.3 Root with index (2) (3)
- § 3.3.6.2 Layout of <mpadded> (2)
- § 3.3.7 Making Sub-Expressions Invisible <mphantom>
- § 3.4.1.2 Base with subscript (2) (3) (4)
- § 3.4.1.3 Base with superscript (2) (3) (4)
- § 3.4.2.3 Base with underscript (2) (3) (4)
- § 3.4.2.4 Base with overscript (2) (3) (4) (5) (6) (7)
- § 3.4.2.5 Base with underscript and overscript
- § 3.4.3.1 Base with prescripts and postscripts (2) (3) (4) (5) (6)
Referenced in:
- § 3.1.1 Box Model
- § 3.1.2 Layout Algorithms (2) (3)
- § 3.2.4.3 Layout of operators
- § 3.2.5 Space <mspace>
- § 3.3.1.2 Layout of <mrow> (2)
- § 3.3.2.1 Fraction with nonzero line thickness (2) (3)
- § 3.3.2.2 Fraction with zero line thickness (2) (3)
- § 3.3.3.2 Square root (2) (3) (4) (5)
- § 3.3.3.3 Root with index (2) (3) (4)
- § 3.3.6.1 Inner box and requested parameters (2)
- § 3.3.6.2 Layout of <mpadded>
- § 3.4.1.2 Base with subscript (2) (3)
- § 3.4.1.3 Base with superscript (2) (3)
- § 3.4.1.4 Base with subscript and superscript (2)
- § 3.4.2.3 Base with underscript (2) (3)
- § 3.4.2.4 Base with overscript (2) (3) (4) (5)
- § 3.4.2.5 Base with underscript and overscript
- § 3.4.3.1 Base with prescripts and postscripts (2)
Referenced in:
- § 3.1.1 Box Model
- § 3.1.2 Layout Algorithms
- § 3.2.4.3 Layout of operators
- § 3.2.5 Space <mspace>
- § 3.3.1.2 Layout of <mrow>
- § 3.3.2.1 Fraction with nonzero line thickness (2) (3)
- § 3.3.2.2 Fraction with zero line thickness (2) (3)
- § 3.3.3.2 Square root (2) (3)
- § 3.3.3.3 Root with index (2) (3) (4) (5)
- § 3.3.6.2 Layout of <mpadded>
- § 3.4.1.2 Base with subscript (2) (3)
- § 3.4.1.3 Base with superscript (2) (3)
- § 3.4.1.4 Base with subscript and superscript (2)
- § 3.4.2.3 Base with underscript (2) (3)
- § 3.4.2.4 Base with overscript (2) (3)
- § 3.4.2.5 Base with underscript and overscript
- § 3.4.3.1 Base with prescripts and postscripts (2)
Referenced in:
- § 3.1.2 Layout Algorithms (2)
- § 3.2.4.3 Layout of operators
- § 3.3.1.2 Layout of <mrow> (2) (3)
- § 3.3.2.1 Fraction with nonzero line thickness
- § 3.3.2.2 Fraction with zero line thickness
- § 3.3.3.2 Square root
- § 3.4.1.2 Base with subscript
- § 3.4.1.3 Base with superscript
- § 3.4.1.4 Base with subscript and superscript (2) (3)
- § 3.4.2.4 Base with overscript
Referenced in:
Referenced in:
- § 3.1.2 Layout Algorithms (2)
- § 3.2.4.3 Layout of operators
- § 3.3.1.2 Layout of <mrow> (2)
- § 3.3.2.1 Fraction with nonzero line thickness
- § 3.3.2.2 Fraction with zero line thickness
- § 3.4.1.2 Base with subscript
- § 3.4.1.3 Base with superscript
- § 3.4.1.4 Base with subscript and superscript (2) (3) (4)
- § 3.4.2.3 Base with underscript
Referenced in:
Referenced in:
- § 3.1.1 Box Model (2)
- § 3.3.1.2 Layout of <mrow>
- § 3.3.2.1 Fraction with nonzero line thickness (2)
- § 3.3.2.2 Fraction with zero line thickness
- § 3.3.3.2 Square root (2)
- § 3.3.3.3 Root with index
- § 3.4.1.2 Base with subscript (2)
- § 3.4.1.3 Base with superscript (2)
- § 3.4.1.4 Base with subscript and superscript
- § 3.4.2.3 Base with underscript (2)
- § 3.4.2.4 Base with overscript (2)
- § 3.4.2.5 Base with underscript and overscript (2) (3)
- § 3.4.3.1 Base with prescripts and postscripts
Referenced in:
Referenced in:
- § 3.1.3 Stacking contexts
- § 3.2.4.1 Embellished operators (2) (3) (4)
- § 3.2.4.2 Dictionary-based attributes (2) (3) (4) (5) (6)
- § 3.2.5.1 Definition of space-like elements
- § 3.3.1 Group Sub-Expressions <mrow> (2)
- § 3.3.1.1 Algorithm for stretching operators along the block axis (2) (3) (4)
- § 3.3.1.2 Layout of <mrow> (2) (3) (4) (5) (6) (7) (8)
- § 3.3.2 Fractions <mfrac> (2) (3) (4)
- § 3.3.3 Radicals <msqrt>, <mroot> (2) (3) (4)
- § 3.3.6 Adjust Space Around Content <mpadded>
- § 3.3.6.1 Inner box and requested parameters
- § 3.4.1.1 Children of <msub>, <msup>, <msubsup> (2) (3) (4) (5) (6) (7) (8) (9) (10)
- § 3.4.2.1 Children of <munder>, <mover>, <munderover> (2) (3) (4) (5) (6) (7) (8) (9) (10)
- § 3.4.2.2 Algorithm for stretching operators along the inline axis
- § 3.4.2.3 Base with underscript
- § 3.4.2.4 Base with overscript
- § 3.4.2.5 Base with underscript and overscript
- § 3.4.3 Prescripts and Tensor Indices <mmultiscripts> (2) (3) (4)
- § 3.4.3.1 Base with prescripts and postscripts (2)
- § 3.4.4 Displaystyle, scriptlevel and math-shift in scripts
Referenced in:
- § 3.1.2 Layout Algorithms (2) (3)
- § 3.3.1.1 Algorithm for stretching operators along the block axis
- § 3.3.1.2 Layout of <mrow> (2) (3) (4) (5)
- § 3.3.2.1 Fraction with nonzero line thickness (2) (3) (4) (5) (6) (7) (8) (9) (10) (11) (12)
- § 3.3.2.2 Fraction with zero line thickness (2) (3) (4) (5) (6)
- § 3.3.3.2 Square root (2) (3)
- § 3.3.3.3 Root with index (2) (3) (4) (5) (6) (7)
- § 3.4.1.2 Base with subscript (2) (3) (4) (5) (6) (7) (8) (9) (10) (11)
- § 3.4.1.3 Base with superscript (2) (3) (4) (5) (6) (7) (8) (9) (10) (11)
- § 3.4.1.4 Base with subscript and superscript (2) (3)
- § 3.4.2.2 Algorithm for stretching operators along the inline axis
- § 3.4.2.3 Base with underscript (2) (3) (4) (5) (6) (7) (8) (9) (10) (11) (12) (13) (14) (15)
- § 3.4.2.4 Base with overscript (2) (3) (4) (5) (6) (7) (8) (9) (10) (11) (12) (13) (14)
- § 3.4.3.1 Base with prescripts and postscripts (2) (3) (4) (5) (6) (7) (8) (9) (10) (11) (12) (13) (14) (15)
Referenced in:
- § 3.2.4.3 Layout of operators
- § 3.3.1.1 Algorithm for stretching operators along the block axis
- § 3.3.2.1 Fraction with nonzero line thickness
- § 3.3.2.2 Fraction with zero line thickness
- § 3.4.1.2 Base with subscript
- § 3.4.1.3 Base with superscript
- § 3.4.1.4 Base with subscript and superscript (2)
- § 3.4.2.2 Algorithm for stretching operators along the inline axis (2)
- § 3.4.3.1 Base with prescripts and postscripts
Referenced in:
- § 3.2.4.3 Layout of operators
- § 3.3.1.1 Algorithm for stretching operators along the block axis (2)
- § 3.3.2.1 Fraction with nonzero line thickness
- § 3.3.2.2 Fraction with zero line thickness
- § 3.4.1.2 Base with subscript
- § 3.4.1.3 Base with superscript
- § 3.4.1.4 Base with subscript and superscript (2)
- § 3.4.2.2 Algorithm for stretching operators along the inline axis
- § 3.4.3.1 Base with prescripts and postscripts
Referenced in:
Referenced in:
Referenced in:
Referenced in:
- § 3.1.2 Layout Algorithms
- § 3.2.4.1 Embellished operators (2) (3) (4) (5) (6)
- § 3.2.4.2 Dictionary-based attributes (2) (3) (4) (5) (6) (7) (8) (9) (10) (11)
- § 3.3.1.1 Algorithm for stretching operators along the block axis (2) (3)
- § 3.3.1.2 Layout of <mrow> (2) (3) (4) (5) (6) (7) (8)
- § 3.4.1.2 Base with subscript
- § 3.4.1.3 Base with superscript
- § 3.4.2.1 Children of <munder>, <mover>, <munderover>
- § 3.4.2.2 Algorithm for stretching operators along the inline axis (2)
- § 3.4.2.3 Base with underscript (2) (3)
- § 3.4.2.4 Base with overscript (2) (3)
Referenced in:
Referenced in:
Referenced in:
Referenced in:
- § 3.2.4 Operator, Fence, Separator or Accent <mo> (2)
- § 3.2.4.3 Layout of operators
- § 3.3.1.1 Algorithm for stretching operators along the block axis
- § 3.4.2.2 Algorithm for stretching operators along the inline axis
- § 3.4.2.3 Base with underscript
- § 3.4.2.4 Base with overscript
- § B.3 Operator Dictionary (human-readable)
Referenced in:
Referenced in:
Referenced in:
Referenced in:
Referenced in:
Referenced in:
Referenced in:
Referenced in:
Referenced in:
Referenced in:
Referenced in:
- § 2.1 Elements and attributes (2)
- § 2.1.1 The Top-Level <math> Element (2)
- § 3.3.1 Group Sub-Expressions <mrow> (2) (3)
- § 3.3.2 Fractions <mfrac>
- § 3.3.3 Radicals <msqrt>, <mroot> (2)
- § 3.3.4 Style Change <mstyle> (2)
- § 3.3.5 Error Message <merror>
- § 3.3.6 Adjust Space Around Content <mpadded>
- § 3.3.6.1 Inner box and requested parameters
- § 3.3.7 Making Sub-Expressions Invisible <mphantom>
- § 3.4.1.1 Children of <msub>, <msup>, <msubsup> (2) (3)
- § 3.4.2.1 Children of <munder>, <mover>, <munderover> (2) (3)
- § 3.4.3 Prescripts and Tensor Indices <mmultiscripts> (2)
- § 3.7 Semantics and Presentation
- § 4.1 The display: block math and display: inline math value (2)
- § E. Privacy and Security Considerations
Referenced in:
Referenced in:
Referenced in:
Referenced in:
Referenced in:
Referenced in:
Referenced in:
Referenced in:
Referenced in:
Referenced in:
Referenced in:
Referenced in:
Referenced in:
Referenced in:
Referenced in:
Referenced in:
Referenced in:
Referenced in:
Referenced in:
Referenced in:
Referenced in:
- § 2.1.1 The Top-Level <math> Element (2)
- § 3.1.1 Box Model
- § 3.2.1.1 Layout of <mtext>
- § 3.2.4.3 Layout of operators
- § 3.2.5 Space <mspace>
- § 3.3.1.2 Layout of <mrow>
- § 3.3.2 Fractions <mfrac>
- § 3.3.3 Radicals <msqrt>, <mroot>
- § 3.3.6.2 Layout of <mpadded>
- § 3.4.1 Subscripts and Superscripts <msub>, <msup>, <msubsup>
- § 3.4.2 Underscripts and Overscripts <munder>, <mover>, <munderover>
- § 3.4.3 Prescripts and Tensor Indices <mmultiscripts>
Referenced in:
- § 2.1.1 The Top-Level <math> Element
- § 2.1.7 The displaystyle and scriptlevel attributes
- § 3.2.4.3 Layout of operators
- § 3.3.2.1 Fraction with nonzero line thickness (2) (3) (4)
- § 3.3.2.2 Fraction with zero line thickness (2) (3) (4)
- § 3.3.3.1 Radical symbol (2)
- § 3.4.2.1 Children of <munder>, <mover>, <munderover>
- § 4.3 The math-style property
- § 4.4 The math-shift property
- § 4.5 New value math-depth property and font-size: math value (2) (3)
Referenced in:
Referenced in:
Referenced in:
Referenced in:
Referenced in:
Referenced in:
Referenced in:
Referenced in:
Referenced in: