Name

math:mi|math:mn|math:mtext|math:ms (in formatting mode) — Formatting a token element.

Synopsis

<xsl:template match="math:mi|math:mn|math:mtext|math:ms" mode="formatting">
<xsl:param name="x"/>
<xsl:param name="y"/>
<xsl:param name="baseline" select="0"/>
<xsl:param name="fontName" tunnel="yes"/>
<xsl:param name="scriptlevel" tunnel="yes"/>
<xsl:param name="mathvariant" tunnel="yes"/>
<xsl:param name="mathcolor" tunnel="yes"/>
<xsl:param name="mathbackground" tunnel="yes"/>
  ...
</xsl:template>

Description

All these elements are treated the same way with a few exceptions. Therefore, in the implemented stylesheet, they share the same template, both for formatting and for drawing. These elements are the leaf of the MathML tree, they do not have any children, they only contain text.

After computing the font size of these elements, the ms lquote and rquote attributes are retrieved. These attributes determine which symbol will be used to surround the text, respectively, on the left and on the right. After that, the text content of the element is retrieved. lquote is added before the first character and rquote after the last one if the element is ms.

Next, the font variant is computed to retrieve the width and the height of the text. An mi element with one letter (except infinity symbol) has to be displayed in italic, so the font variant is computed using that particularities. All the parameters of the box can now be computed: the height is given by font metrics file, the width is computed using the stringWidth function and the baseline is set on the bottom of the text with descender stretching under it. The box also contains an other measure: HEIGHTOVERBASELINE which is the height of the box from its baseline to its top edge. Here is a figure that represent the box for a token element: