math:mtable (in formatting mode) — Formatting a table.
<xsl:template match="math:mtable" mode="formatting"> <xsl:param name="x"/> <xsl:param name="y"/> <xsl:param name="baseline" select="0"/> <xsl:param name="tableSpace" tunnel="yes"/> <xsl:param name="fontName" tunnel="yes"/> ... </xsl:template>
This element has one or more mtr
elements as children.
It is also quite complex to render, elements that compose a column have to be aligned. The elements on a line also have
to be aligned. The table must be centered on the middle of the mathematic expression. The main idea is to first compute all
the cells on the same place, as if they were
not in a table. For example, in the two by two identity matrix, all 0 and 1 are computed like simple mn
element. Finally, shift values are computed to move each cell to its final position.
Therefore, in the formatting mode, the first action is to compute all mtr
children by calling the appropriate
template in formatting mode. After that, cells that contain a stretchy operator have to be stretched with respect to other cells
that compose the columns and the row. For example, if a column contains a cell with a right arrow, given that the arrow has to stretch
horizontally, the width of this cell has to have the value of the largest cell in the column. To compute the new size of the cells,
stretch values are computed using the computeStretch
function and the cell nodes are modified by using the
stretchRows
template.
After that, the box representation is computed. The height is the sum of each row's height plus spaces between each two lines. The space
size value comes from the global paramaters (parameter tableSpace
). The table width is computed by calling the
mtableWidth
template on rows. The baseline is placed at the middle of the table. And, the upper left corner
Y
is the Y
coordinate of the table top edge.
The columnalign
is then retrieved. This attributes is used to determine how the cells in a column have to be aligned.
The default value is center
. The shift values for the y-axis are computed by using the mtableShiftY
template and the shift values for the x-axis are computed by using the mtableShiftX
template and
columnalign
attribute.
Finally, the tree is annotated with the box representation and all shift values.