Français

<mrow>

Group sub-expressions in a formula

  • MathML
  • accessibility
  • semantics

<mrow> — Grouping

The <mrow> element groups MathML elements into a coherent sub-expression. It is the equivalent of <g> in SVG: no visual rendering of its own, but a structure that helps tools understand the boundaries of an expression.

When to use it

You want to group the numerator or denominator of a fraction. You want to delimit what is under a radical. You want to indicate that a set of elements forms a single sub-expression within a more complex equation. As a general rule, whenever you place multiple MathML elements somewhere that expects only one child, wrap them in <mrow>.

What you gain

Accessibility: screen readers understand the boundaries of the sub-expression and read it as a block. Without <mrow>, elements are read independently, which can create confusion.

Code example

<math display="block">
  <mfrac>
    <mrow>
      <mi>a</mi>
      <mo>+</mo>
      <mi>b</mi>
    </mrow>
    <mrow>
      <mi>c</mi>
      <mo>-</mo>
      <mi>d</mi>
    </mrow>
  </mfrac>
</math>

Further reading