Name

math:msup (in formatting mode) — Formatting a superscript.

Synopsis

<xsl:template match="math:msup" mode="formatting">
<xsl:param name="x"/>
<xsl:param name="y"/>
<xsl:param name="baseline" select="0"/>
<xsl:param name="scriptlevel" tunnel="yes"/>
<xsl:param name="displayStyle" tunnel="yes"/>
<xsl:param name="rightSwitch" tunnel="yes"/>
<xsl:param name="fontName" tunnel="yes"/>
  ...
</xsl:template>

Description

msup element has two children: the first child is the base and the second is the superscript. After font size computation, the base and the superscript are computed by calling the formatting mode template on the first and second child. The superscript gets a X coordinate value that depends on the base's size in order to place its box on the right of base one. Some general parameters are also modified when the superscript computation is called: the display style has to be false and the script level has to be incremented by one. Using this new value, the size of superscript elements will be smaller than base ones.

After that, some information is retrieved for each child: its height, Y coordinate of its top edge and its height over its baseline. This data will be used to compute the final height, baseline and coordinate of the box.

The next four variables are used to compute a shift value for the superscript. By default, this value depends on the base height, if the base element is lower than 1.2em, the shift value will be 80 percent of the base height over the baseline. In all other case, the default value will be 90 percent of the base height over the baseline. If the users as specified a shift value, using the superscriptshift attributes, this value will be retrieved and used instead of the default one. Then the shift value is corrected with respect to the initial position of the superscript and finally the descender of the superscript is added to the final shift value if it is not a token element.

After that, the box representation is computed by using the shift value. The height is computed by taking the difference between the lowest and the highest Y. The baseline is the baseline of the base.

Fnally, the tree node is annotated and contains, like all other elements, its box representation, and information that determine if the msup is an embellished operator (EMBELLISH, LSPACE, RSPACE, ACCENT and stretchVertical. Some other information is also added to shift and to place the superscript: SHIFTY_BASE that will shift the base on the y-axis to place it correctly if necessary, SHIFTY_SUPERSCRIPT that will shift the superscript on the y-axis to its final position, and SHIFTX_SUPERSCRIPT that will withdraw the LSPACE value of the superscript if this one is an embellished operator. This last shift on x-axis is done to draw the superscript much closer to its base.