This document provides comprehensive examples of MathML markup patterns that comply with the Nordic MathML Guidelines 2024. These examples demonstrate proper usage of the new MathML requirements and can be used for testing and reference. Version 2.0.0 includes enhanced validation and backward compatibility support.
Addition:
<math xmlns="http://www.w3.org/1998/Math/MathML" xml:lang="en">
<mn>3</mn><mo>+</mo><mn>2</mn><mo>=</mo><mn>5</mn>
</math>Subtraction:
<math xmlns="http://www.w3.org/1998/Math/MathML" xml:lang="en">
<mn>10</mn><mo>−</mo><mn>4</mn><mo>=</mo><mn>6</mn>
</math>Multiplication:
<math xmlns="http://www.w3.org/1998/Math/MathML" xml:lang="en">
<mn>4</mn><mo>⁢</mo><mn>5</mn><mo>=</mo><mn>20</mn>
</math>Division:
<math xmlns="http://www.w3.org/1998/Math/MathML" xml:lang="en">
<mn>15</mn><mo>/</mo><mn>3</mn><mo>=</mo><mn>5</mn>
</math>Simple variable:
<math xmlns="http://www.w3.org/1998/Math/MathML" xml:lang="en">
<mi>x</mi><mo>+</mo><mn>5</mn>
</math>Variable with coefficient:
<math xmlns="http://www.w3.org/1998/Math/MathML" xml:lang="en">
<mn>3</mn><mo>⁢</mo><mi>x</mi><mo>+</mo><mn>2</mn><mo>⁢</mo><mi>y</mi>
</math>Equation:
<math xmlns="http://www.w3.org/1998/Math/MathML" xml:lang="en" display="block">
<mi>x</mi><mo>+</mo><mi>y</mi><mo>=</mo><mn>10</mn>
</math>Number and variable:
<math xmlns="http://www.w3.org/1998/Math/MathML" xml:lang="en">
<mn>3</mn><mo>⁢</mo><mi>x</mi>
</math>Variable and variable:
<math xmlns="http://www.w3.org/1998/Math/MathML" xml:lang="en">
<mi>x</mi><mo>⁢</mo><mi>y</mi>
</math>Number with unit:
<math xmlns="http://www.w3.org/1998/Math/MathML" xml:lang="en">
<mn>100</mn><mo>⁢</mo><mi mathvariant="normal">m</mi>
</math>Function call:
<math xmlns="http://www.w3.org/1998/Math/MathML" xml:lang="en">
<mi>f</mi><mo>⁡</mo><mo>(</mo><mi>x</mi><mo>)</mo>
</math>Multiple arguments:
<math xmlns="http://www.w3.org/1998/Math/MathML" xml:lang="en">
<mi>g</mi><mo>⁡</mo><mo>(</mo><mi>x</mi><mo>,</mo><mi>y</mi><mo>)</mo>
</math>Minus sign (not hyphen):
<math xmlns="http://www.w3.org/1998/Math/MathML" xml:lang="en">
<mn>5</mn><mo>−</mo><mn>3</mn>
</math>Prime:
<math xmlns="http://www.w3.org/1998/Math/MathML" xml:lang="en">
<mi>x</mi><mo>′</mo>
</math>Element of:
<math xmlns="http://www.w3.org/1998/Math/MathML" xml:lang="en">
<mi>x</mi><mo>∈</mo><mi>A</mi>
</math>Alpha, beta, gamma:
<math xmlns="http://www.w3.org/1998/Math/MathML" xml:lang="en">
<mi>α</mi><mo>+</mo><mi>β</mi><mo>=</mo><mi>γ</mi>
</math>Delta:
<math xmlns="http://www.w3.org/1998/Math/MathML" xml:lang="en">
<mi>Δ</mi><mi>x</mi>
</math>Pi:
<math xmlns="http://www.w3.org/1998/Math/MathML" xml:lang="en">
<mi>π</mi><mo>⁢</mo><mi>r</mi><mo>⁲</mo>
</math>Water (H₂O):
<math xmlns="http://www.w3.org/1998/Math/MathML" xml:lang="en">
<msub><mi>H</mi><mn>2</mn></msub><mi>O</mi>
</math>Carbon dioxide (CO₂):
<math xmlns="http://www.w3.org/1998/Math/MathML" xml:lang="en">
<mi>C</mi><msub><mi>O</mi><mn>2</mn></msub>
</math>Carbon-14:
<math xmlns="http://www.w3.org/1998/Math/MathML" xml:lang="en">
<mmultiscripts>
<mi>C</mi>
<mn>14</mn>
<none/>
<mn>6</mn>
</mmultiscripts>
</math>Equation with label:
<math xmlns="http://www.w3.org/1998/Math/MathML" xml:lang="en" display="block">
<mtable>
<mtr>
<mtd><mi>E</mi><mo>=</mo><mi>m</mi><mo>⁢</mo><msup><mi>c</mi><mn>2</mn></msup></mtd>
<mtd><mo>(</mo><mn>1</mn><mo>)</mo></mtd>
</mtr>
</mtable>
</math>Crossed out expression:
<math xmlns="http://www.w3.org/1998/Math/MathML" xml:lang="en">
<menclose notation="updiagonalstrike">
<mn>3</mn><mo>+</mo><mn>2</mn>
</menclose>
</math>Single blank:
<math xmlns="http://www.w3.org/1998/Math/MathML" xml:lang="en">
<mn>3</mn><mo>+</mo><mi>鄉</mi><mo>=</mo><mn>5</mn>
</math>Meters:
<math xmlns="http://www.w3.org/1998/Math/MathML" xml:lang="en">
<mn>100</mn><mo>⁢</mo><mi mathvariant="normal">m</mi>
</math>Kilometers per hour:
<math xmlns="http://www.w3.org/1998/Math/MathML" xml:lang="en">
<mn>50</mn><mo>⁢</mo><mi mathvariant="normal">km/h</mi>
</math>❌ Don't use mfenced:
<!-- DEPRECATED -->
<math xmlns="http://www.w3.org/1998/Math/MathML">
<mfenced><mn>3</mn><mo>+</mo><mn>2</mn></mfenced>
</math>✅ Use mo elements instead:
<!-- CORRECT -->
<math xmlns="http://www.w3.org/1998/Math/MathML">
<mo>(</mo><mn>3</mn><mo>+</mo><mn>2</mn><mo>)</mo>
</math>❌ Don't use m: prefix:
<!-- DEPRECATED -->
<m:math xmlns:m="http://www.w3.org/1998/Math/MathML">
<m:mn>3</m:mn><m:mo>+</m:mo><m:mn>2</m:mn>
</m:math>✅ Use direct namespace:
<!-- CORRECT -->
<math xmlns="http://www.w3.org/1998/Math/MathML">
<mn>3</mn><mo>+</mo><mn>2</mn>
</math>curl -H 'Content-Type: application/json' \
-d '{
"contentType": "math",
"content": "<math xmlns=\"http://www.w3.org/1998/Math/MathML\" xml:lang=\"en\"><mn>3</mn><mo>+</mo><mn>2</mn><mo>=</mo><mn>5</mn></math>"
}' \
-X POST \
http://localhost:3000/curl -H 'Content-Type: application/json' \
-d '{
"contentType": "math",
"content": "<math xmlns=\"http://www.w3.org/1998/Math/MathML\"><msub><mi>H</mi><mn>2</mn></msub><mi>O</mi></math>"
}' \
-X POST \
http://localhost:3000/curl -H 'Content-Type: application/json' \
-d '{
"content": "<m:math xmlns:m=\"http://www.w3.org/1998/Math/MathML\"><m:mn>3</m:mn><m:mo>+</m:mo><m:mn>2</m:mn></m:math>"
}' \
-X POST \
http://localhost:3000/detect-versioncurl -H 'Content-Type: application/json' \
-d '{
"content": "<m:math xmlns:m=\"http://www.w3.org/1998/Math/MathML\"><m:mn>3</m:mn><m:mo>+</m:mo><m:mn>2</m:mn></m:math>"
}' \
-X POST \
http://localhost:3000/migrate