1 <?xml version='1.0' encoding="UTF-8"?>
2 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3 xmlns:m="http://www.w3.org/1998/Math/MathML"
6 <!-- ====================================================================== -->
7 <!-- $id: glayout.xsl, 2002/17/05 Exp $
8 This file is part of the XSLT MathML Library distribution.
9 See ./README or http://www.raleigh.ru/MathML/mmltex for
10 copyright and other information -->
11 <!-- ====================================================================== -->
13 <xsl:template match="m:mfrac">
15 <xsl:when test="@bevelled='true'">
16 <!-- <xsl:text>\raisebox{1ex}{</xsl:text>
17 <xsl:apply-templates select="./*[1]"/>
18 <xsl:text>}\!\left/ \!\raisebox{-1ex}{</xsl:text>
19 <xsl:apply-templates select="./*[2]"/>
20 <xsl:text>}\right.</xsl:text>-->
22 <xsl:when test="@linethickness">
23 <xsl:text>\genfrac{}{}{</xsl:text>
25 <xsl:when test="number(@linethickness)">
26 <xsl:value-of select="@linethickness div 10"/>
27 <xsl:text>ex</xsl:text>
29 <xsl:when test="@linethickness='thin'">
30 <xsl:text>.05ex</xsl:text>
32 <xsl:when test="@linethickness='medium'"/>
33 <xsl:when test="@linethickness='thick'">
34 <xsl:text>.2ex</xsl:text>
37 <xsl:value-of select="@linethickness"/>
40 <xsl:text>}{}{</xsl:text>
43 <xsl:text>\frac{</xsl:text>
46 <xsl:if test="@numalign='right'">
47 <xsl:text>\hfill </xsl:text>
49 <xsl:apply-templates select="./*[1]"/>
50 <xsl:if test="@numalign='left'">
51 <xsl:text>\hfill </xsl:text>
53 <xsl:text>}{</xsl:text>
54 <xsl:if test="@denomalign='right'">
55 <xsl:text>\hfill </xsl:text>
57 <xsl:apply-templates select="./*[2]"/>
58 <xsl:if test="@denomalign='left'">
59 <xsl:text>\hfill </xsl:text>
61 <xsl:text>}</xsl:text>
64 <xsl:template match="m:mroot">
66 <xsl:when test="count(./*)=2">
67 <xsl:text>\sqrt[</xsl:text>
68 <xsl:apply-templates select="./*[2]"/>
69 <xsl:text>]{</xsl:text>
70 <xsl:apply-templates select="./*[1]"/>
71 <xsl:text>}</xsl:text>
74 <!-- number of argumnets is not 2 - code 25 -->
75 <xsl:message>exception 25:</xsl:message>
76 <xsl:text>\text{exception 25:}</xsl:text>
81 <xsl:template match="m:msqrt">
82 <xsl:text>\sqrt{</xsl:text>
83 <xsl:apply-templates/>
84 <xsl:text>}</xsl:text>
87 <xsl:template match="m:mfenced">
89 <xsl:when test="@open">
90 <xsl:if test="translate(@open,'{}[]()|','{{{{{{{')='{'">
91 <xsl:text>\left</xsl:text>
93 <xsl:if test="@open='{' or @open='}'">
94 <xsl:text>\</xsl:text>
96 <xsl:value-of select="@open"/>
98 <xsl:otherwise><xsl:text>\left(</xsl:text></xsl:otherwise>
101 <xsl:when test="count(./*)>1">
102 <xsl:variable name="symbol">
104 <xsl:when test="@separators">
105 <xsl:call-template name="startspace">
106 <xsl:with-param name="symbol" select="@separators"/>
109 <xsl:otherwise>,</xsl:otherwise>
112 <xsl:for-each select="./*">
113 <xsl:apply-templates select="."/>
114 <xsl:if test="not(position()=last())">
116 <xsl:when test="position()>string-length($symbol)">
117 <xsl:value-of select="substring($symbol,string-length($symbol))"/>
120 <xsl:value-of select="substring($symbol,position(),1)"/>
127 <xsl:apply-templates/>
131 <xsl:when test="@close">
132 <xsl:if test="translate(@open,'{}[]()|','{{{{{{{')='{'">
133 <xsl:text>\right</xsl:text>
135 <xsl:if test="@open='{' or @open='}'">
136 <xsl:text>\</xsl:text>
138 <xsl:value-of select="@close"/>
140 <xsl:otherwise><xsl:text>\right)</xsl:text></xsl:otherwise>
144 <xsl:template match="m:mphantom">
145 <xsl:text>\phantom{</xsl:text>
146 <xsl:apply-templates/>
147 <xsl:text>}</xsl:text>
150 <xsl:template match="m:menclose">
152 <xsl:when test="@notation = 'actuarial'">
153 <xsl:text>\overline{</xsl:text>
154 <xsl:apply-templates/>
155 <xsl:text>\hspace{.2em}|}</xsl:text>
157 <xsl:when test="@notation = 'radical'">
158 <xsl:text>\sqrt{</xsl:text>
159 <xsl:apply-templates/>
160 <xsl:text>}</xsl:text>
163 <xsl:text>\overline{)</xsl:text>
164 <xsl:apply-templates/>
165 <xsl:text>}</xsl:text>
170 <xsl:template match="m:mrow">
171 <xsl:apply-templates/>
174 <xsl:template match="m:mstyle">
175 <xsl:if test="@background">
176 <xsl:text>\colorbox[rgb]{</xsl:text>
177 <xsl:call-template name="color">
178 <xsl:with-param name="color" select="@background"/>
180 <xsl:text>}{$</xsl:text>
182 <xsl:if test="@color">
183 <xsl:text>\textcolor[rgb]{</xsl:text>
184 <xsl:call-template name="color">
185 <xsl:with-param name="color" select="@color"/>
187 <xsl:text>}{</xsl:text>
189 <xsl:apply-templates/>
190 <xsl:if test="@color">
191 <xsl:text>}</xsl:text>
193 <xsl:if test="@background">
194 <xsl:text>$}</xsl:text>
199 <xsl:template match="m:mstyle">
200 <xsl:if test="@displaystyle='true'">
201 <xsl:text>{\displaystyle</xsl:text>
203 <xsl:if test="@scriptlevel=2">
204 <xsl:text>{\scriptscriptstyle</xsl:text>
206 <xsl:apply-templates/>
207 <xsl:if test="@scriptlevel=2">
208 <xsl:text>}</xsl:text>
210 <xsl:if test="@displaystyle='true'">
211 <xsl:text>}</xsl:text>
216 <xsl:template match="m:merror">
217 <xsl:apply-templates/>