MathML Matrices

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:

Mathml Matrices 1

Equivalent MathML code:

  1. <math xmlns=’http://www.w3.org/1998/Math/MathML’ display=’block’>  
  2. <mrow>  
  3.   <mo>[</mo>  
  4.   <mtable>  
  5.     <mtr>  
  6.       <mtd>  
  7.         <mn>1</mn>  
  8.       </mtd>  
  9.       <mtd>  
  10.         <mn>0</mn>  
  11.       </mtd>  
  12.       <mtd>  
  13.         <mn>0</mn>  
  14.       </mtd>  
  15.     </mtr>  
  16.     <mtr>  
  17.       <mtd>  
  18.         <mn>0</mn>  
  19.       </mtd>  
  20.       <mtd>  
  21.         <mn>1</mn>  
  22.       </mtd>  
  23.       <mtd>  
  24.         <mn>0</mn>  
  25.       </mtd>  
  26.     </mtr>  
  27.     <mtr>  
  28.       <mtd>  
  29.         <mn>0</mn>  
  30.       </mtd>  
  31.       <mtd>  
  32.         <mn>0</mn>  
  33.       </mtd>  
  34.       <mtd>  
  35.         <mn>1</mn>  
  36.       </mtd>  
  37.     </mtr>  
  38.   </mtable>  
  39.   <mo>]</mo>  
  40. </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

IndexAttributesDescription
1)alignIt specifies the vertical alignment of the table with respect to its environment. Its possible values are: axis, baseline, bottom, center, top.
2)class, id, styleIt is provided for use with stylesheets.
3)columnalignIt specifies the horizontal alignment of the cells. Its possible values are: left, center (default) and right.
4)columnlinesIt 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)columnspacingIt specifies the space between table columns.
6)displaystyleIt 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)frameIt specifies borders of the entire table. Its possible values are: none (default), solid and dashed.
8)framespacingIt specifies additional space added between the table and frame.
9)hrefIt is used to set a hyperlink to a specified uri.
10)mathbackgroundIt specifies the background color. You can use #rgb, #rrggbb and html color names.
11)mathcolorIt specifies the text color. You can use #rgb, #rrggbb and html color names.
12)rowalignIt 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)rowlinesIt 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)widthIt specifies the width of the entire table. It accepts length values.

Supporting Browsers:

Elementchrome browser Chromeie browser IEfirefox browser Firefox (Gecko)opera browser Operasafari browser Safari
<mtable>Not SupportedNot SupportedSupportedNot SupportedOnly Basic Support

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *