In MathML, the <mtable> element is used to create tables or matrices. The <mtable> element contains only <mtr> and <mtd> elements. These elements are similar to <table>, <tr> and <td> elements in HTML.
For example: To create a 3×3 matrix, having the following data:
Equivalent MathML code:
- <math xmlns=’http://www.w3.org/1998/Math/MathML’ display=’block’>
- <mrow>
- <mo>[</mo>
- <mtable>
- <mtr>
- <mtd>
- <mn>1</mn>
- </mtd>
- <mtd>
- <mn>0</mn>
- </mtd>
- <mtd>
- <mn>0</mn>
- </mtd>
- </mtr>
- <mtr>
- <mtd>
- <mn>0</mn>
- </mtd>
- <mtd>
- <mn>1</mn>
- </mtd>
- <mtd>
- <mn>0</mn>
- </mtd>
- </mtr>
- <mtr>
- <mtd>
- <mn>0</mn>
- </mtd>
- <mtd>
- <mn>0</mn>
- </mtd>
- <mtd>
- <mn>1</mn>
- </mtd>
- </mtr>
- </mtable>
- <mo>]</mo>
- </mrow>
Note: By default, an <mtable> element has no borders at all. So, you have to add a <mo> containing a fence character (e.g. ‘[‘, ‘]’, ‘(‘, ‘)’, ‘|’) before and after the <mtable> when you specify a matrix or the determinant of a matrix.
MathML Matrix Attributes
Index | Attributes | Description |
---|---|---|
1) | align | It specifies the vertical alignment of the table with respect to its environment. Its possible values are: axis, baseline, bottom, center, top. |
2) | class, id, style | It is provided for use with stylesheets. |
3) | columnalign | It specifies the horizontal alignment of the cells. Its possible values are: left, center (default) and right. |
4) | columnlines | It specifies column borders. Multiple values separated by space are allowed and apply to the corresponding columns (e.g. columnlines=”none none solid”). Its possible values are: none (default), solid and dashed. |
5) | columnspacing | It specifies the space between table columns. |
6) | displaystyle | It refers a Boolean value specifying whether more vertical space is used for displayed equations or, if set to false, a more compact layout is used to display formulas. |
7) | frame | It specifies borders of the entire table. Its possible values are: none (default), solid and dashed. |
8) | framespacing | It specifies additional space added between the table and frame. |
9) | href | It is used to set a hyperlink to a specified uri. |
10) | mathbackground | It specifies the background color. You can use #rgb, #rrggbb and html color names. |
11) | mathcolor | It specifies the text color. You can use #rgb, #rrggbb and html color names. |
12) | rowalign | It specifies the vertical alignment of the cells. Multiple values separated by space are allowed and apply to the corresponding rows (e.g. rowalign=”top bottom axis”). Its possible values are: axis, baseline (default), bottom, center and top. |
13) | rowlines | It specifies row borders. Multiple values separated by space are allowed and apply to the corresponding rows (e.g. rowlines=”none none solid”). Its possible values are: none (default), solid and dashed. |
14) | width | It specifies the width of the entire table. It accepts length values. |
Supporting Browsers:
Element | Chrome | IE | Firefox (Gecko) | Opera | Safari |
<mtable> | Not Supported | Not Supported | Supported | Not Supported | Only Basic Support |
Leave a Reply