Menu
Coding a Matrice in MathML

In MathML, coding a matrice is very similar to coding a table in HTML. So if understand HTML table code, MathML matrices will be easy for you. Unfortunately most people don't understand HTML table code. So lets go about it step-by-step.

A MathML matrice consists of a grid of boxes, each box created by a <mtd></mtd> element. The "td" stands for "table data". So within each mtd box is a single matrice number, variable, or expression element. The mtd boxes are inturn arranged in rows by nesting them inside <mtr></mtr> elements. The "tr" stands for "table row".

1
<math>
<mtable>
<mtr><mtd><mn>1</mn></mtd></mtr>
</mtable>
</math>

Shown above is the code for a minimal matrice, consisting of one row containing one matrice data element.

10 01
<math>
<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>
</math>

Shown above is the code for a 2x2 matrice, consisting of 2 rows, each containing 2 matrice data elements.

[ 10 01 ]
<math>
<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>
</math>

By default an mtable element has no borders. So you'll need to next the mtable element within an <mo> element to display the desired brackets as shown above.


Learn more at amazon.com

More Graphics Design Tips:
• Image Processing Filters - How to Sharpen a Photograph
• SVG Code to Create a Rectangle and Text and Translate as a Group
• Inkscape Circles, Ellipses, and Arcs Drawing Tutorial
• CSS Button Designer
• What is the Pantone Color System?
• Inkscape Text on Path
• Example Code for X3Dom Basic Primitive Shapes: Box, Sphere, Cylinder, Cone, and Torus
• SVG Example Code to Scale Elements
• Inkscape Text Kerning
• SVG Code to Translate a Rectangle and Text