diff --git a/modules/fonts.xml b/modules/fonts.xml index baab74e..d6fa1a5 100644 --- a/modules/fonts.xml +++ b/modules/fonts.xml @@ -251,9 +251,17 @@ <!-- Non-maths super- and subscript. --> <template name="superscript" match="superscript"> <common formats="/latex/xelatex/"> - <xsl:text>\ensuremath{^{\mathrm{</xsl:text> + <xsl:if test="ancestor::section"> + <xsl:text>\texorpdfstring{</xsl:text> + </xsl:if> + <xsl:text>\textsuperscript{</xsl:text> <xsl:apply-templates /> - <xsl:text>}}}</xsl:text> + <xsl:text>}</xsl:text> + <xsl:if test="ancestor::section"> + <xsl:text>}{(</xsl:text> + <xsl:apply-templates /> + <xsl:text>)}</xsl:text> + </xsl:if> </common> <common formats="/html/xhtml/"> <sup><xsl:apply-templates /></sup> @@ -262,9 +270,17 @@ <template name="subscript" match="subscript"> <common formats="/latex/xelatex/"> - <xsl:text>\ensuremath{_{\mathrm{</xsl:text> + <xsl:if test="ancestor::section"> + <xsl:text>\texorpdfstring{</xsl:text> + </xsl:if> + <xsl:text>\textsubscript{</xsl:text> <xsl:apply-templates /> - <xsl:text>}}}</xsl:text> + <xsl:text>}</xsl:text> + <xsl:if test="ancestor::section"> + <xsl:text>}{(</xsl:text> + <xsl:apply-templates /> + <xsl:text>)}</xsl:text> + </xsl:if> </common> <common formats="/html/xhtml/"> <sub><xsl:apply-templates /></sub>