MathML

MathML marks up mathematics. Browsers implement MathML Core, Baseline in all major browsers since January 2023, so equations need no JavaScript. Elements describe layout: mi, mn and mo for identifiers, numbers and operators, plus msub, mfrac and munderover:

MathML in HTML: BookNest's revenue formulaHTMLLive
<p style="font: 18px system-ui">Daily revenue over the order lines <i>i</i>:</p>
<math display="block" style="font-size: 24px">
  <mi>R</mi><mo>=</mo>
  <munderover><mo>&#x2211;</mo>
    <mrow><mi>i</mi><mo>=</mo><mn>1</mn></mrow><mi>n</mi></munderover>
  <msub><mi>q</mi><mi>i</mi></msub><mo>&#x22C5;</mo><msub><mi>p</mi><mi>i</mi></msub>
  <mo>&#x22C5;</mo>
  <mrow><mo>(</mo><mn>1</mn><mo>&#x2212;</mo>
    <mfrac><msub><mi>d</mi><mi>i</mi></msub><mn>100</mn></mfrac><mo>)</mo></mrow>
</math>
Browser output of Listing 2.145
Browser output of 145

Authors rarely type MathML; LaTeX converters (MathJax 30,423 , Temml 351 , pandoc) generate it. In pipelines it sits inside publishing XML such as JATS and must pass through transformations untouched.


MathML

Mathematical Markup Language (MathML) describes mathematical notations. It aims at integrating mathematical formulae into the World Wide Web and other documents. Not all browsers support MathML.

The example below marks up a representation of ax2+bx+c.
ch11-mathml-formula.xmlXML
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE math PUBLIC "-//W3C//DTD MathML 2.0//EN"
      "http://www.w3.org/Math/DTD/mathml2/mathml2.dtd">
<math xmlns="http://www.w3.org/1998/Math/MathML">
  <mrow>
    <mi>a</mi>
    <mo>&InvisibleTimes;</mo>
    <msup>
      <mi>x</mi>
      <mn>2</mn>
    </msup>
    <mo>+</mo>
    <mi>b</mi>
    <mo>&InvisibleTimes;</mo>
    <mi>x</mi>
    <mo>+</mo>
    <mi>c</mi>
  </mrow>
</math>