<< Chapter < Page | Chapter >> Page > |
Table element is applied for variety of rendering requirements, in addition to its primary use for drawing a table. The applications of table frame work include displaying two dimensional mathematical content like arrays and matrix, creation of labeled equations and enabling display of content in multiple rows equivalent to line break.
Consider the task to write two rows of equations on two consecutive lines :
3x + y = 6
2x – y = 5
How would we force two lines to be displayed in a single MathML constructor? We may probably display the lines as separate rows of a table without a frame and lines. In this sense, table frame work provides a facility, which is equivalent to forcing a new line.
Similarly, we may be required to number important equations so that the same can be referenced subsequently like :
3x + y = 6 …….. 1.1
In this context, the label attribute available for “mlabeledtr” element allows us to number the equation as above. A matrix, on the other hand, is implemented by a table construct without border and enclosed parentheses :
$$\left(\begin{array}{ccc}x& y& z\\ 1& 2& 3\end{array}\right)$$
The MathML employs six elements to render all sorts of table. However, there is a serious mis-match between specifications of some of these elements and implementation of the same by browsers. For this reason, we shall concentrate on three table forming elements namely "mtable", "mtr" and "mtd" elements, which together form the basic constructors for creating tables (only references to other elements has been given for other three elements).
$\begin{array}{l}{\text{Specific attributes : \hspace{1em}}}\left(\mathrm{align},\mathrm{rowalign},\mathrm{columnalign},\mathrm{groupalign},\mathrm{alignmentscope},\mathrm{columnwidth}\right)\\ \phantom{{\text{Specific attributes : \hspace{1em}}}}\left(\mathrm{width},\mathrm{rowspacing},\mathrm{columnspacing},\mathrm{rowlines},\mathrm{columnlines},\mathrm{frame}\right)\\ \phantom{{\text{Specific attributes : \hspace{1em}}}}\left(\mathrm{framespacing},\mathrm{equalrows},\mathrm{equalcolumns},\mathrm{displaystyle},\mathrm{side},\mathrm{minlabelspacing}\right)\end{array}$
The ‘mtable” element represents a table of rows and columns. It accepts only “mtr” or “mlabeldtr” elements as its child. Both of these define a single row in the table. The only difference between the two row elements is that “mlabeldtr” can be used to label the particular row defined by it. The “mtr” element represents a simple row. Each of these row forming elements takes child elements to define the columns.
The “mtable” element requires that all rows have same numbers of columns. If the columns in any row mismatches, then that row is padded with empty column(s). For example, when one column definition in the first row involving “y” is removed, then tables is rendered as shown below :
<m:math display="block">
<m:mtable frame="solid" columnlines="solid" rowlines="solid">
<m:mtr>
<m:mtd>
<m:mi>x</m:mi>
</m:mtd>
<m:mtd>
<m:mi>z</m:mi>
</m:mtd>
</m:mtr>
<m:mtr>
<m:mtd>
<m:mn>1</m:mn>
</m:mtd>
<m:mtd>
<m:mn>2</m:mn>
</m:mtd>
<m:mtd>
<m:mn>3</m:mn>
</m:mtd>
</m:mtr>
</m:mtable>
</m:math>
Save the file after editing as “test.xml”. The display looks like :
$$\begin{array}{|cc|}\hline x& z\\ 1& 2& 3\\ \hline\end{array}$$
Notification Switch
Would you like to follow the 'A primer in mathml' conversation and receive update notifications?