THE GITHTML FIELD GUIDE

Keep simple equations readable with native MathML

Use MathML for equations that need mathematical structure rather than a screenshot or script-generated drawing. Include a nearby explanation of the symbols and the equation's meaning. Native rendering removes a runtime typesetting dependency, but mathematical speech, copying, and layout still need checking in the reader and assistive technology you intend to support.

Choose the right representation

A fraction has a numerator and a denominator, not merely two lines separated by a border. MathML can express those relationships inside HTML. This is especially useful for a small report that needs a handful of equations but should not depend on downloading a typesetting library. Do not assume that converting notation automatically produces a clear explanation.

Apply the pattern deliberately

Start with a simple expression and meaningful identifiers. Place longer equations in their own block and explain every symbol before using it in a conclusion. If a formula needs substantial horizontal space, preserve the mathematical grouping and provide an equivalent sentence. Shrinking symbols until the whole expression fits can make exponents and operators unreadable.

  1. Write a sentence explaining what the equation computes before introducing its symbolic form.
  2. Check the smallest exponent and every minus sign after enlarging the surrounding text.
  3. Keep a textual interpretation alongside the equation rather than offering an unexplained image fallback.
html
<p>The mean is the total divided by the count.</p>
<math display="block"><mfrac><mi>total</mi><mi>count</mi></mfrac></math>

Choose a small, verifiable equation

Begin with a relationship that the report already explains, such as an average computed from a total and a count. State the units: dividing elapsed milliseconds by completed requests produces milliseconds per request. The visual fraction alone cannot supply that context. Also explain the exceptional case when the count is zero; changing the markup does not make an undefined calculation valid. Keep a sample calculation nearby so a reader can check the interpretation without learning your entire notation system.

Use the appropriate mathematical elements for identifiers, numbers, and operators instead of treating an equation as a string of decorative characters. When importing an expression from another authoring tool, inspect the generated markup for a complete mathematical structure. A screenshot may look correct while a conversion has placed the numerator and denominator in ordinary text with only CSS positioning. That arrangement can lose its relationship when fonts change or the page is read nonvisually.

Test the smallest useful expression before converting a whole textbook or reference. Check a fraction, an exponent, and a multi-character variable name in the environments your audience actually uses. Native MathML does not require a JavaScript typesetter, but that does not certify every reader's rendering or speech behavior. If a particular expression remains difficult to navigate, retain its ordinary-language interpretation and identify the limitation rather than claiming that visual similarity proves accessibility.

Check the finished reading experience

Test one equation with fractions and one with subscripts in the target environment. Check whether selection, zoom, and spoken navigation preserve the distinctions that matter. A plain-language interpretation is valuable even when rendering is excellent because readers may not share the author's notation conventions.

Sources and further reading

AI-assisted writing with source-linked guidance and illustrative examples. Read our editorial approach or report a correction.

All reading html on your phone guides →

Read as MarkdownAll guides

Keep simple equations readable with native MathML · gitHtml