Français

<mtable>

Create a matrix or system of equations

  • MathML
  • accessibility
  • semantics

<mtable> + <mtr> + <mtd> — The mathematical table

<mtable> creates a mathematical table. <mtr> represents a row and <mtd> a cell. Together, they are used to display matrices, systems of equations, and piecewise functions.

When to use it

You want to display a matrix with aligned rows and columns. You want to write a system of equations with clean alignment on the equals signs. You want to define a piecewise function with aligned conditions. This is the equivalent of <table> in HTML, but for mathematical context.

What you gain

Accessibility: screen readers navigate through the matrix cell by cell, row by row. The structure is preserved and the user knows where they are in the table.

Code example

<!-- 2x2 matrix -->
<math display="block">
  <mrow>
    <mo>[</mo>
    <mtable>
      <mtr>
        <mtd><mn>1</mn></mtd>
        <mtd><mn>0</mn></mtd>
      </mtr>
      <mtr>
        <mtd><mn>0</mn></mtd>
        <mtd><mn>1</mn></mtd>
      </mtr>
    </mtable>
    <mo>]</mo>
  </mrow>
</math>
 
<!-- System of equations -->
<math display="block">
  <mtable>
    <mtr>
      <mtd><mn>2</mn><mi>x</mi><mo>+</mo><mi>y</mi></mtd>
      <mtd><mo>=</mo></mtd>
      <mtd><mn>5</mn></mtd>
    </mtr>
    <mtr>
      <mtd><mi>x</mi><mo>-</mo><mi>y</mi></mtd>
      <mtd><mo>=</mo></mtd>
      <mtd><mn>1</mn></mtd>
    </mtr>
  </mtable>
</math>

Further reading