mmltex.xsl 134 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360
  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"
  4. version='1.0'>
  5. <!--
  6. Copyright (C) 2001, 2002 Vasil Yaroshevich
  7. Modified Fabian Seoane 2007 for sympy
  8. -->
  9. <xsl:output method="text" indent="no" encoding="UTF-8"/>
  10. <!-- ====================================================================== -->
  11. <!-- $id: mmltex.xsl, 2002/22/11 Exp $
  12. This file is part of the XSLT MathML Library distribution.
  13. See ./README or http://www.raleigh.ru/MathML/mmltex for
  14. copyright and other information -->
  15. <!-- ====================================================================== -->
  16. <!-- Note: variables colora (template color) and symbola (template startspace) only for Sablotron -->
  17. <xsl:template name="startspace">
  18. <xsl:param name="symbol"/>
  19. <xsl:if test="contains($symbol,' ')">
  20. <xsl:variable name="symbola" select="concat(substring-before($symbol,' '),substring-after($symbol,' '))"/>
  21. <xsl:call-template name="startspace">
  22. <xsl:with-param name="symbol" select="$symbola"/>
  23. </xsl:call-template>
  24. </xsl:if>
  25. <xsl:if test="not(contains($symbol,' '))">
  26. <xsl:value-of select="$symbol"/>
  27. </xsl:if>
  28. </xsl:template>
  29. <xsl:strip-space elements="m:*"/>
  30. <xsl:template match="m:math">
  31. <xsl:text>&#x00024;</xsl:text>
  32. <xsl:apply-templates/>
  33. <xsl:text>&#x00024;</xsl:text>
  34. </xsl:template>
  35. <!-- ====================================================================== -->
  36. <!-- $id: tokens.xsl, 2002/22/11 Exp $
  37. This file is part of the XSLT MathML Library distribution.
  38. See ./README or http://www.raleigh.ru/MathML/mmltex for
  39. copyright and other information -->
  40. <!-- ====================================================================== -->
  41. <!-- 4.4.1.1 cn -->
  42. <xsl:template match="m:cn"><xsl:apply-templates/></xsl:template>
  43. <xsl:template match="m:cn[@type='complex-cartesian']">
  44. <xsl:apply-templates select="text()[1]"/>
  45. <xsl:text>+</xsl:text>
  46. <xsl:apply-templates select="text()[2]"/>
  47. <xsl:text>i</xsl:text>
  48. </xsl:template>
  49. <xsl:template match="m:cn[@type='rational']">
  50. <xsl:apply-templates select="text()[1]"/>
  51. <xsl:text>/</xsl:text>
  52. <xsl:apply-templates select="text()[2]"/>
  53. </xsl:template>
  54. <xsl:template match="m:cn[@type='integer' and @base!=10]">
  55. <xsl:apply-templates/>
  56. <xsl:text>_{</xsl:text><xsl:value-of select="@base"/><xsl:text>}</xsl:text>
  57. </xsl:template>
  58. <xsl:template match="m:cn[@type='complex-polar']">
  59. <xsl:apply-templates select="text()[1]"/>
  60. <xsl:text>e^{i </xsl:text>
  61. <xsl:apply-templates select="text()[2]"/>
  62. <xsl:text>}</xsl:text>
  63. </xsl:template>
  64. <xsl:template match="m:cn[@type='e-notation']">
  65. <xsl:apply-templates select="text()[1]"/>
  66. <xsl:text>E</xsl:text>
  67. <xsl:apply-templates select="text()[2]"/>
  68. </xsl:template>
  69. <!-- 4.4.1.1 ci 4.4.1.2 csymbol -->
  70. <xsl:template match="m:ci | m:csymbol">
  71. <xsl:choose>
  72. <xsl:when test="string-length(normalize-space(text()))>1">
  73. <xsl:text>\mathrm{</xsl:text><xsl:apply-templates/><xsl:text>}</xsl:text>
  74. </xsl:when>
  75. <xsl:otherwise><xsl:apply-templates/></xsl:otherwise>
  76. </xsl:choose>
  77. </xsl:template>
  78. <!-- 4.4.2.1 apply 4.4.2.2 reln -->
  79. <xsl:template match="m:apply | m:reln">
  80. <xsl:apply-templates select="*[1]">
  81. <!-- <? -->
  82. <xsl:with-param name="p" select="10"/>
  83. </xsl:apply-templates>
  84. <!-- ?> -->
  85. <xsl:text>(</xsl:text>
  86. <xsl:for-each select="*[position()>1]">
  87. <xsl:apply-templates select="."/>
  88. <xsl:if test="not(position()=last())"><xsl:text>, </xsl:text></xsl:if>
  89. </xsl:for-each>
  90. <xsl:text>)</xsl:text>
  91. </xsl:template>
  92. <!-- 4.4.2.3 fn -->
  93. <xsl:template match="m:fn[m:apply[1]]"> <!-- for m:fn using default rule -->
  94. <xsl:text>(</xsl:text><xsl:apply-templates/><xsl:text>)</xsl:text>
  95. </xsl:template>
  96. <!-- 4.4.2.4 interval -->
  97. <xsl:template match="m:interval[*[2]]">
  98. <xsl:choose>
  99. <xsl:when test="@closure='open' or @closure='open-closed'">
  100. <xsl:text>\left(</xsl:text>
  101. </xsl:when>
  102. <xsl:otherwise><xsl:text>\left[</xsl:text></xsl:otherwise>
  103. </xsl:choose>
  104. <xsl:apply-templates select="*[1]"/>
  105. <xsl:text> , </xsl:text>
  106. <xsl:apply-templates select="*[2]"/>
  107. <xsl:choose>
  108. <xsl:when test="@closure='open' or @closure='closed-open'">
  109. <xsl:text>\right)</xsl:text>
  110. </xsl:when>
  111. <xsl:otherwise><xsl:text>\right]</xsl:text></xsl:otherwise>
  112. </xsl:choose>
  113. </xsl:template>
  114. <xsl:template match="m:interval">
  115. <xsl:text>\left\{</xsl:text><xsl:apply-templates/><xsl:text>\right\}</xsl:text>
  116. </xsl:template>
  117. <!-- 4.4.2.5 inverse -->
  118. <xsl:template match="m:apply[*[1][self::m:inverse]]">
  119. <xsl:apply-templates select="*[2]"/><xsl:text>^{(-1)}</xsl:text>
  120. </xsl:template>
  121. <!-- 4.4.2.6 sep 4.4.2.7 condition -->
  122. <xsl:template match="m:sep | m:condition"><xsl:apply-templates/></xsl:template>
  123. <!-- 4.4.2.9 lambda -->
  124. <xsl:template match="m:lambda">
  125. <xsl:text>\mathrm{lambda}\: </xsl:text>
  126. <xsl:apply-templates select="m:bvar/*"/>
  127. <xsl:text>.\: </xsl:text>
  128. <xsl:apply-templates select="*[last()]"/>
  129. </xsl:template>
  130. <!-- 4.4.2.10 compose -->
  131. <xsl:template match="m:apply[*[1][self::m:compose]]">
  132. <xsl:param name="p" select="0"/>
  133. <xsl:call-template name="infix">
  134. <xsl:with-param name="this-p" select="1"/>
  135. <xsl:with-param name="p" select="$p"/>
  136. <xsl:with-param name="mo">\circ </xsl:with-param>
  137. </xsl:call-template>
  138. </xsl:template>
  139. <!-- 4.4.2.11 ident -->
  140. <xsl:template match="m:ident"><xsl:text>\mathrm{id}</xsl:text></xsl:template>
  141. <!-- 4.4.2.12 domain 4.4.2.13 codomain 4.4.2.14 image 4.4.3.21 arg 4.4.3.24 lcm
  142. 4.4.5.9 grad 4.4.5.10 curl 4.4.9.4 median 4.4.9.5 mode-->
  143. <xsl:template match="m:domain | m:codomain | m:image | m:arg | m:lcm | m:grad |
  144. m:curl | m:median | m:mode">
  145. <xsl:text>\mathop{\mathrm{</xsl:text>
  146. <xsl:value-of select="local-name()"/>
  147. <xsl:text>}}</xsl:text>
  148. </xsl:template>
  149. <!-- 4.4.2.15 domainofapplication -->
  150. <xsl:template match="m:domainofapplication"/>
  151. <!-- 4.4.2.16 piecewise -->
  152. <xsl:template match="m:piecewise">
  153. <xsl:text>\begin{cases}</xsl:text>
  154. <xsl:apply-templates select="m:piece"/>
  155. <xsl:apply-templates select="m:otherwise"/>
  156. <xsl:text>\end{cases}</xsl:text>
  157. </xsl:template>
  158. <xsl:template match="m:piece">
  159. <xsl:apply-templates select="*[1]"/>
  160. <xsl:text> &amp; \text{if $</xsl:text>
  161. <xsl:apply-templates select="*[2]"/>
  162. <xsl:text>$}</xsl:text>
  163. <xsl:if test="not(position()=last()) or ../m:otherwise"><xsl:text>\\ </xsl:text></xsl:if>
  164. </xsl:template>
  165. <xsl:template match="m:otherwise">
  166. <xsl:apply-templates select="*[1]"/>
  167. <xsl:text> &amp; \text{otherwise}</xsl:text>
  168. </xsl:template>
  169. <!-- 4.4.3.1 quotient -->
  170. <xsl:template match="m:apply[*[1][self::m:quotient]]">
  171. <xsl:text>\left\lfloor\frac{</xsl:text>
  172. <xsl:apply-templates select="*[2]"/>
  173. <xsl:text>}{</xsl:text>
  174. <xsl:apply-templates select="*[3]"/>
  175. <xsl:text>}\right\rfloor </xsl:text>
  176. </xsl:template>
  177. <!-- 4.4.3.2 factorial -->
  178. <xsl:template match="m:apply[*[1][self::m:factorial]]">
  179. <xsl:apply-templates select="*[2]">
  180. <xsl:with-param name="p" select="7"/>
  181. </xsl:apply-templates>
  182. <xsl:text>!</xsl:text>
  183. </xsl:template>
  184. <!-- 4.4.3.3 divide -->
  185. <xsl:template match="m:apply[*[1][self::m:divide]]">
  186. <xsl:param name="p" select="0"/>
  187. <xsl:param name="this-p" select="3"/>
  188. <xsl:if test="$this-p &lt; $p"><xsl:text>\left(</xsl:text></xsl:if>
  189. <xsl:text>\frac{</xsl:text>
  190. <xsl:apply-templates select="*[2]"/>
  191. <!-- <xsl:with-param name="p" select="$this-p"/>
  192. </xsl:apply-templates>-->
  193. <xsl:text>}{</xsl:text>
  194. <xsl:apply-templates select="*[3]"/>
  195. <!-- <xsl:with-param name="p" select="$this-p"/>
  196. </xsl:apply-templates>-->
  197. <xsl:text>}</xsl:text>
  198. <xsl:if test="$this-p &lt; $p"><xsl:text>\right)</xsl:text></xsl:if>
  199. </xsl:template>
  200. <!-- 4.4.3.4 max min -->
  201. <xsl:template match="m:apply[*[1][self::m:max or self::m:min]]">
  202. <xsl:text>\</xsl:text>
  203. <xsl:value-of select="local-name(*[1])"/>
  204. <xsl:text>\{</xsl:text>
  205. <xsl:choose>
  206. <xsl:when test="m:condition">
  207. <xsl:apply-templates select="*[last()]"/>
  208. <xsl:text>, </xsl:text>
  209. <xsl:apply-templates select="m:condition/node()"/>
  210. </xsl:when>
  211. <xsl:otherwise>
  212. <xsl:for-each select="*[position() &gt; 1]">
  213. <xsl:apply-templates select="."/>
  214. <xsl:if test="position() !=last()"><xsl:text> , </xsl:text></xsl:if>
  215. </xsl:for-each>
  216. </xsl:otherwise>
  217. </xsl:choose>
  218. <xsl:text>\}</xsl:text>
  219. </xsl:template>
  220. <!-- 4.4.3.5 minus-->
  221. <xsl:template match="m:apply[*[1][self::m:minus] and count(*)=2]">
  222. <xsl:text>-</xsl:text>
  223. <xsl:apply-templates select="*[2]">
  224. <xsl:with-param name="p" select="5"/>
  225. </xsl:apply-templates>
  226. </xsl:template>
  227. <xsl:template match="m:apply[*[1][self::m:minus] and count(*)&gt;2]">
  228. <xsl:param name="p" select="0"/>
  229. <xsl:call-template name="binary">
  230. <xsl:with-param name="mo">-</xsl:with-param>
  231. <xsl:with-param name="p" select="$p"/>
  232. <xsl:with-param name="this-p" select="2"/>
  233. </xsl:call-template>
  234. </xsl:template>
  235. <!-- 4.4.3.6 plus-->
  236. <xsl:template match="m:apply[*[1][self::m:plus]]">
  237. <xsl:param name="p" select="0"/>
  238. <xsl:if test="$p &gt; 2">
  239. <xsl:text>(</xsl:text>
  240. </xsl:if>
  241. <xsl:for-each select="*[position()&gt;1]">
  242. <xsl:if test="position() &gt; 1">
  243. <xsl:choose>
  244. <xsl:when test="self::m:apply[*[1][self::m:times] and
  245. *[2][self::m:apply/*[1][self::m:minus] or self::m:cn[not(m:sep) and
  246. (number(.) &lt; 0)]]]">-</xsl:when>
  247. <xsl:otherwise>+</xsl:otherwise>
  248. </xsl:choose>
  249. </xsl:if>
  250. <xsl:choose>
  251. <xsl:when test="self::m:apply[*[1][self::m:times] and
  252. *[2][self::m:cn[not(m:sep) and (number(.) &lt;0)]]]">
  253. <xsl:value-of select="-(*[2])"/>
  254. <xsl:apply-templates select=".">
  255. <xsl:with-param name="first" select="2"/>
  256. <xsl:with-param name="p" select="2"/>
  257. </xsl:apply-templates>
  258. </xsl:when>
  259. <xsl:when test="self::m:apply[*[1][self::m:times] and
  260. *[2][self::m:apply/*[1][self::m:minus]]]">
  261. <xsl:apply-templates select="./*[2]/*[2]"/>
  262. <xsl:apply-templates select=".">
  263. <xsl:with-param name="first" select="2"/>
  264. <xsl:with-param name="p" select="2"/>
  265. </xsl:apply-templates>
  266. </xsl:when>
  267. <xsl:otherwise>
  268. <xsl:apply-templates select=".">
  269. <xsl:with-param name="p" select="2"/>
  270. </xsl:apply-templates>
  271. </xsl:otherwise>
  272. </xsl:choose>
  273. </xsl:for-each>
  274. <xsl:if test="$p &gt; 2">
  275. <xsl:text>)</xsl:text>
  276. </xsl:if>
  277. </xsl:template>
  278. <!-- 4.4.3.7 power -->
  279. <xsl:template match="m:apply[*[1][self::m:power]]">
  280. <xsl:apply-templates select="*[2]">
  281. <xsl:with-param name="p" select="5"/>
  282. </xsl:apply-templates>
  283. <xsl:text>^{</xsl:text>
  284. <xsl:apply-templates select="*[3]">
  285. <xsl:with-param name="p" select="5"/>
  286. </xsl:apply-templates>
  287. <xsl:text>}</xsl:text>
  288. </xsl:template>
  289. <!-- 4.4.3.8 remainder -->
  290. <xsl:template match="m:apply[*[1][self::m:rem]]">
  291. <xsl:param name="p" select="0"/>
  292. <xsl:call-template name="binary">
  293. <xsl:with-param name="mo">\mod </xsl:with-param>
  294. <xsl:with-param name="p" select="$p"/>
  295. <xsl:with-param name="this-p" select="3"/>
  296. </xsl:call-template>
  297. </xsl:template>
  298. <!-- 4.4.3.9 times-->
  299. <xsl:template match="m:apply[*[1][self::m:times]]" name="times">
  300. <xsl:param name="p" select="0"/>
  301. <xsl:param name="first" select="1"/>
  302. <xsl:if test="$p &gt; 3"><xsl:text>(</xsl:text></xsl:if>
  303. <xsl:for-each select="*[position()&gt;1]">
  304. <xsl:if test="position() &gt; 1">
  305. <xsl:choose>
  306. <xsl:when test="self::m:cn">\times <!-- times --></xsl:when>
  307. <xsl:otherwise><!--invisible times--></xsl:otherwise>
  308. </xsl:choose>
  309. </xsl:if>
  310. <xsl:if test="position()&gt;= $first">
  311. <xsl:apply-templates select=".">
  312. <xsl:with-param name="p" select="3"/>
  313. </xsl:apply-templates>
  314. </xsl:if>
  315. </xsl:for-each>
  316. <xsl:if test="$p &gt; 3"><xsl:text>)</xsl:text></xsl:if>
  317. </xsl:template>
  318. <!-- 4.4.3.10 root -->
  319. <xsl:template match="m:apply[*[1][self::m:root]]">
  320. <xsl:text>\sqrt</xsl:text>
  321. <xsl:if test="m:degree!=2">
  322. <xsl:text>[</xsl:text>
  323. <xsl:apply-templates select="m:degree/*"/>
  324. <xsl:text>]</xsl:text>
  325. </xsl:if>
  326. <xsl:text>{</xsl:text>
  327. <xsl:apply-templates select="*[position()&gt;1 and not(self::m:degree)]"/>
  328. <xsl:text>}</xsl:text>
  329. </xsl:template>
  330. <!-- 4.4.3.11 gcd -->
  331. <xsl:template match="m:gcd"><xsl:text>\gcd </xsl:text></xsl:template>
  332. <!-- 4.4.3.12 and -->
  333. <xsl:template match="m:apply[*[1][self::m:and]]">
  334. <xsl:param name="p" select="0"/>
  335. <xsl:call-template name="infix">
  336. <xsl:with-param name="this-p" select="2"/>
  337. <xsl:with-param name="p" select="$p"/>
  338. <xsl:with-param name="mo">\land <!-- and --></xsl:with-param>
  339. </xsl:call-template>
  340. </xsl:template>
  341. <!-- 4.4.3.13 or -->
  342. <xsl:template match="m:apply[*[1][self::m:or]]">
  343. <xsl:param name="p" select="0"/>
  344. <xsl:call-template name="infix">
  345. <xsl:with-param name="this-p" select="3"/>
  346. <xsl:with-param name="p" select="$p"/>
  347. <xsl:with-param name="mo">\lor </xsl:with-param>
  348. </xsl:call-template>
  349. </xsl:template>
  350. <!-- 4.4.3.14 xor -->
  351. <xsl:template match="m:apply[*[1][self::m:xor]]">
  352. <xsl:param name="p" select="0"/>
  353. <xsl:call-template name="infix">
  354. <xsl:with-param name="this-p" select="3"/>
  355. <xsl:with-param name="p" select="$p"/>
  356. <xsl:with-param name="mo">\mathop{\mathrm{xor}}</xsl:with-param>
  357. </xsl:call-template>
  358. </xsl:template>
  359. <!-- 4.4.3.15 not -->
  360. <xsl:template match="m:apply[*[1][self::m:not]]">
  361. <xsl:text>\neg </xsl:text>
  362. <xsl:apply-templates select="*[2]">
  363. <xsl:with-param name="p" select="7"/>
  364. </xsl:apply-templates>
  365. </xsl:template>
  366. <!-- 4.4.3.16 implies -->
  367. <xsl:template match="m:apply[*[1][self::m:implies]]">
  368. <xsl:param name="p" select="0"/>
  369. <xsl:call-template name="binary">
  370. <xsl:with-param name="mo">\implies </xsl:with-param>
  371. <xsl:with-param name="p" select="$p"/>
  372. <xsl:with-param name="this-p" select="3"/>
  373. </xsl:call-template>
  374. </xsl:template>
  375. <!-- 4.4.3.17 forall 4.4.3.18 exists -->
  376. <xsl:template match="m:apply[*[1][self::m:forall or self::m:exists]]">
  377. <xsl:text>\</xsl:text>
  378. <xsl:value-of select="local-name(*[1])"/>
  379. <xsl:text> </xsl:text>
  380. <xsl:apply-templates select="m:bvar"/>
  381. <xsl:if test="m:condition">
  382. <xsl:text>, </xsl:text><xsl:apply-templates select="m:condition"/>
  383. </xsl:if>
  384. <xsl:if test="*[last()][local-name()!='condition'][local-name()!='bvar']">
  385. <xsl:text>\colon </xsl:text>
  386. <xsl:apply-templates select="*[last()]"/>
  387. </xsl:if>
  388. </xsl:template>
  389. <!-- 4.4.3.19 abs -->
  390. <xsl:template match="m:apply[*[1][self::m:abs]]">
  391. <xsl:text>\left|</xsl:text>
  392. <xsl:apply-templates select="*[2]"/>
  393. <xsl:text>\right|</xsl:text>
  394. </xsl:template>
  395. <!-- 4.4.3.20 conjugate -->
  396. <xsl:template match="m:apply[*[1][self::m:conjugate]]">
  397. <xsl:text>\overline{</xsl:text><xsl:apply-templates select="*[2]"/><xsl:text>}</xsl:text>
  398. </xsl:template>
  399. <!-- 4.4.3.22 real -->
  400. <xsl:template match="m:real"><xsl:text>\Re </xsl:text></xsl:template>
  401. <!-- 4.4.3.23 imaginary -->
  402. <xsl:template match="m:imaginary"><xsl:text>\Im </xsl:text></xsl:template>
  403. <!-- 4.4.3.25 floor -->
  404. <xsl:template match="m:apply[*[1][self::m:floor]]">
  405. <xsl:text>\left\lfloor </xsl:text>
  406. <xsl:apply-templates select="*[2]"/>
  407. <xsl:text>\right\rfloor </xsl:text>
  408. </xsl:template>
  409. <!-- 4.4.3.25 ceiling -->
  410. <xsl:template match="m:apply[*[1][self::m:ceiling]]">
  411. <xsl:text>\left\lceil </xsl:text>
  412. <xsl:apply-templates select="*[2]"/>
  413. <xsl:text>\right\rceil </xsl:text>
  414. </xsl:template>
  415. <!-- 4.4.4.1 eq -->
  416. <xsl:template match="m:apply[*[1][self::m:eq]]">
  417. <xsl:param name="p" select="0"/>
  418. <xsl:call-template name="infix">
  419. <xsl:with-param name="this-p" select="1"/>
  420. <xsl:with-param name="p" select="$p"/>
  421. <xsl:with-param name="mo">=</xsl:with-param>
  422. </xsl:call-template>
  423. </xsl:template>
  424. <!-- 4.4.4.2 neq -->
  425. <xsl:template match="m:apply[*[1][self::m:neq]]">
  426. <xsl:param name="p" select="0"/>
  427. <xsl:call-template name="infix">
  428. <xsl:with-param name="this-p" select="1"/>
  429. <xsl:with-param name="p" select="$p"/>
  430. <xsl:with-param name="mo">\neq </xsl:with-param>
  431. </xsl:call-template>
  432. </xsl:template>
  433. <!-- 4.4.4.3 gt -->
  434. <xsl:template match="m:apply[*[1][self::m:gt]]">
  435. <xsl:param name="p" select="0"/>
  436. <xsl:call-template name="infix">
  437. <xsl:with-param name="this-p" select="1"/>
  438. <xsl:with-param name="p" select="$p"/>
  439. <xsl:with-param name="mo">&gt; </xsl:with-param>
  440. </xsl:call-template>
  441. </xsl:template>
  442. <!-- 4.4.4.4 lt -->
  443. <xsl:template match="m:apply[*[1][self::m:lt]]">
  444. <xsl:param name="p" select="0"/>
  445. <xsl:call-template name="infix">
  446. <xsl:with-param name="this-p" select="1"/>
  447. <xsl:with-param name="p" select="$p"/>
  448. <xsl:with-param name="mo">&lt; </xsl:with-param>
  449. </xsl:call-template>
  450. </xsl:template>
  451. <!-- 4.4.4.5 geq -->
  452. <xsl:template match="m:apply[*[1][self::m:geq]]">
  453. <xsl:param name="p" select="0"/>
  454. <xsl:call-template name="infix">
  455. <xsl:with-param name="this-p" select="1"/>
  456. <xsl:with-param name="p" select="$p"/>
  457. <xsl:with-param name="mo">\ge </xsl:with-param>
  458. </xsl:call-template>
  459. </xsl:template>
  460. <!-- 4.4.4.6 leq -->
  461. <xsl:template match="m:apply[*[1][self::m:leq]]">
  462. <xsl:param name="p" select="0"/>
  463. <xsl:call-template name="infix">
  464. <xsl:with-param name="this-p" select="1"/>
  465. <xsl:with-param name="p" select="$p"/>
  466. <xsl:with-param name="mo">\le </xsl:with-param>
  467. </xsl:call-template>
  468. </xsl:template>
  469. <!-- 4.4.4.7 equivalent -->
  470. <xsl:template match="m:apply[*[1][self::m:equivalent]]">
  471. <xsl:param name="p" select="0"/>
  472. <xsl:call-template name="infix">
  473. <xsl:with-param name="this-p" select="1"/>
  474. <xsl:with-param name="p" select="$p"/>
  475. <xsl:with-param name="mo">\equiv </xsl:with-param>
  476. </xsl:call-template>
  477. </xsl:template>
  478. <!-- 4.4.4.8 approx -->
  479. <xsl:template match="m:apply[*[1][self::m:approx]]">
  480. <xsl:param name="p" select="0"/>
  481. <xsl:call-template name="infix">
  482. <xsl:with-param name="this-p" select="1"/>
  483. <xsl:with-param name="p" select="$p"/>
  484. <xsl:with-param name="mo">\approx </xsl:with-param>
  485. </xsl:call-template>
  486. </xsl:template>
  487. <!-- 4.4.4.9 factorof -->
  488. <xsl:template match="m:apply[*[1][self::m:factorof]]">
  489. <xsl:param name="p" select="0"/>
  490. <xsl:call-template name="binary">
  491. <xsl:with-param name="mo"> | </xsl:with-param>
  492. <xsl:with-param name="p" select="$p"/>
  493. <xsl:with-param name="this-p" select="3"/>
  494. </xsl:call-template>
  495. </xsl:template>
  496. <!-- 4.4.5.1 int -->
  497. <xsl:template match="m:apply[*[1][self::m:int]]">
  498. <xsl:text>\int</xsl:text>
  499. <xsl:if test="m:lowlimit/*|m:interval/*[1]|m:condition/*">
  500. <xsl:text>_{</xsl:text>
  501. <xsl:apply-templates select="m:lowlimit/*|m:interval/*[1]|m:condition/*"/>
  502. <xsl:text>}</xsl:text>
  503. </xsl:if>
  504. <xsl:if test="m:uplimit/*|m:interval/*[2]">
  505. <xsl:text>^{</xsl:text>
  506. <xsl:apply-templates select="m:uplimit/*|m:interval/*[2]"/>
  507. <xsl:text>}</xsl:text>
  508. </xsl:if>
  509. <xsl:text> </xsl:text>
  510. <xsl:apply-templates select="*[last()]"/>
  511. <xsl:text>\,d </xsl:text>
  512. <xsl:apply-templates select="m:bvar"/>
  513. </xsl:template>
  514. <!-- 4.4.5.2 diff -->
  515. <xsl:template match="m:apply[*[1][self::m:diff] and m:ci and count(*)=2]" priority="2">
  516. <xsl:apply-templates select="*[2]"/>
  517. <xsl:text>^\prime </xsl:text>
  518. </xsl:template>
  519. <xsl:template match="m:apply[*[1][self::m:diff]]" priority="1">
  520. <xsl:text>\frac{</xsl:text>
  521. <xsl:choose>
  522. <xsl:when test="m:bvar/m:degree">
  523. <xsl:text>d^{</xsl:text>
  524. <xsl:apply-templates select="m:bvar/m:degree/node()"/>
  525. <xsl:text>}</xsl:text>
  526. <xsl:apply-templates select="*[last()]"/>
  527. <xsl:text>}{d</xsl:text>
  528. <xsl:apply-templates select="m:bvar/node()"/>
  529. <xsl:text>^{</xsl:text>
  530. <xsl:apply-templates select="m:bvar/m:degree/node()"/>
  531. <xsl:text>}</xsl:text>
  532. </xsl:when>
  533. <xsl:otherwise>
  534. <xsl:text>d </xsl:text>
  535. <xsl:apply-templates select="*[last()]"/>
  536. <xsl:text>}{d </xsl:text>
  537. <xsl:apply-templates select="m:bvar"/>
  538. <xsl:text>}</xsl:text>
  539. </xsl:otherwise>
  540. </xsl:choose>
  541. <xsl:text>}</xsl:text>
  542. </xsl:template>
  543. <!-- 4.4.5.3 partialdiff -->
  544. <xsl:template match="m:apply[*[1][self::m:partialdiff] and m:list and m:ci and count(*)=3]" priority="2">
  545. <xsl:text>D_{</xsl:text>
  546. <xsl:for-each select="m:list[1]/*">
  547. <xsl:apply-templates select="."/>
  548. <xsl:if test="position()&lt;last()"><xsl:text>, </xsl:text></xsl:if>
  549. </xsl:for-each>
  550. <xsl:text>}</xsl:text>
  551. <xsl:apply-templates select="*[3]"/>
  552. </xsl:template>
  553. <xsl:template match="m:apply[*[1][self::m:partialdiff]]" priority="1">
  554. <xsl:text>\frac{\partial^{</xsl:text>
  555. <xsl:choose>
  556. <xsl:when test="m:degree">
  557. <xsl:apply-templates select="m:degree/node()"/>
  558. </xsl:when>
  559. <xsl:when test="m:bvar/m:degree[string(number(.))='NaN']">
  560. <xsl:for-each select="m:bvar/m:degree">
  561. <xsl:apply-templates select="node()"/>
  562. <xsl:if test="position()&lt;last()"><xsl:text>+</xsl:text></xsl:if>
  563. </xsl:for-each>
  564. <xsl:if test="count(m:bvar[not(m:degree)])&gt;0">
  565. <xsl:text>+</xsl:text>
  566. <xsl:value-of select="count(m:bvar[not(m:degree)])"/>
  567. </xsl:if>
  568. </xsl:when>
  569. <xsl:otherwise>
  570. <xsl:value-of select="sum(m:bvar/m:degree)+count(m:bvar[not(m:degree)])"/>
  571. </xsl:otherwise>
  572. </xsl:choose>
  573. <xsl:text>}</xsl:text>
  574. <xsl:apply-templates select="*[last()]"/>
  575. <xsl:text>}{</xsl:text>
  576. <xsl:for-each select="m:bvar">
  577. <xsl:text>\partial </xsl:text>
  578. <xsl:apply-templates select="node()"/>
  579. <xsl:if test="m:degree">
  580. <xsl:text>^{</xsl:text>
  581. <xsl:apply-templates select="m:degree/node()"/>
  582. <xsl:text>}</xsl:text>
  583. </xsl:if>
  584. </xsl:for-each>
  585. <xsl:text>}</xsl:text>
  586. </xsl:template>
  587. <!-- 4.4.2.8 declare 4.4.5.4 lowlimit 4.4.5.5 uplimit 4.4.5.7 degree 4.4.9.5 momentabout -->
  588. <xsl:template match="m:declare | m:lowlimit | m:uplimit | m:degree | m:momentabout"/>
  589. <!-- 4.4.5.6 bvar-->
  590. <xsl:template match="m:bvar">
  591. <xsl:apply-templates/>
  592. <xsl:if test="following-sibling::m:bvar"><xsl:text>, </xsl:text></xsl:if>
  593. </xsl:template>
  594. <!-- 4.4.5.8 divergence-->
  595. <xsl:template match="m:divergence"><xsl:text>\mathop{\mathrm{div}}</xsl:text></xsl:template>
  596. <!-- 4.4.5.11 laplacian-->
  597. <xsl:template match="m:laplacian"><xsl:text>\nabla^2 </xsl:text></xsl:template>
  598. <!-- 4.4.6.1 set -->
  599. <xsl:template match="m:set">
  600. <xsl:text>\{</xsl:text><xsl:call-template name="set"/><xsl:text>\}</xsl:text>
  601. </xsl:template>
  602. <!-- 4.4.6.2 list -->
  603. <xsl:template match="m:list">
  604. <xsl:text>\left[</xsl:text><xsl:call-template name="set"/><xsl:text>\right]</xsl:text>
  605. </xsl:template>
  606. <xsl:template name="set">
  607. <xsl:choose>
  608. <xsl:when test="m:condition">
  609. <xsl:apply-templates select="m:bvar/*[not(self::bvar or self::condition)]"/>
  610. <xsl:text>\colon </xsl:text>
  611. <xsl:apply-templates select="m:condition/node()"/>
  612. </xsl:when>
  613. <xsl:otherwise>
  614. <xsl:for-each select="*">
  615. <xsl:apply-templates select="."/>
  616. <xsl:if test="position()!=last()"><xsl:text>, </xsl:text></xsl:if>
  617. </xsl:for-each>
  618. </xsl:otherwise>
  619. </xsl:choose>
  620. </xsl:template>
  621. <!-- 4.4.6.3 union -->
  622. <xsl:template match="m:apply[*[1][self::m:union]]">
  623. <xsl:param name="p" select="0"/>
  624. <xsl:call-template name="infix">
  625. <xsl:with-param name="this-p" select="2"/>
  626. <xsl:with-param name="p" select="$p"/>
  627. <xsl:with-param name="mo">\cup </xsl:with-param>
  628. </xsl:call-template>
  629. </xsl:template>
  630. <!-- 4.4.6.4 intersect -->
  631. <xsl:template match="m:apply[*[1][self::m:intersect]]">
  632. <xsl:param name="p" select="0"/>
  633. <xsl:call-template name="infix">
  634. <xsl:with-param name="this-p" select="3"/>
  635. <xsl:with-param name="p" select="$p"/>
  636. <xsl:with-param name="mo">\cap </xsl:with-param>
  637. </xsl:call-template>
  638. </xsl:template>
  639. <!-- 4.4.6.5 in -->
  640. <xsl:template match="m:apply[*[1][self::m:in]]">
  641. <xsl:param name="p" select="0"/>
  642. <xsl:call-template name="binary">
  643. <xsl:with-param name="mo">\in </xsl:with-param>
  644. <xsl:with-param name="p" select="$p"/>
  645. <xsl:with-param name="this-p" select="3"/>
  646. </xsl:call-template>
  647. </xsl:template>
  648. <!-- 4.4.6.5 notin -->
  649. <xsl:template match="m:apply[*[1][self::m:notin]]">
  650. <xsl:param name="p" select="0"/>
  651. <xsl:call-template name="binary">
  652. <xsl:with-param name="mo">\notin </xsl:with-param>
  653. <xsl:with-param name="p" select="$p"/>
  654. <xsl:with-param name="this-p" select="3"/>
  655. </xsl:call-template>
  656. </xsl:template>
  657. <!-- 4.4.6.7 subset -->
  658. <xsl:template match="m:apply[*[1][self::m:subset]]">
  659. <xsl:param name="p" select="0"/>
  660. <xsl:call-template name="infix">
  661. <xsl:with-param name="this-p" select="2"/>
  662. <xsl:with-param name="p" select="$p"/>
  663. <xsl:with-param name="mo">\subseteq </xsl:with-param>
  664. </xsl:call-template>
  665. </xsl:template>
  666. <!-- 4.4.6.8 prsubset -->
  667. <xsl:template match="m:apply[*[1][self::m:prsubset]]">
  668. <xsl:param name="p" select="0"/>
  669. <xsl:call-template name="infix">
  670. <xsl:with-param name="this-p" select="2"/>
  671. <xsl:with-param name="p" select="$p"/>
  672. <xsl:with-param name="mo">\subset </xsl:with-param>
  673. </xsl:call-template>
  674. </xsl:template>
  675. <!-- 4.4.6.9 notsubset -->
  676. <xsl:template match="m:apply[*[1][self::m:notsubset]]">
  677. <xsl:param name="p" select="0"/>
  678. <xsl:call-template name="binary">
  679. <xsl:with-param name="this-p" select="2"/>
  680. <xsl:with-param name="p" select="$p"/>
  681. <xsl:with-param name="mo">\nsubseteq </xsl:with-param>
  682. </xsl:call-template>
  683. </xsl:template>
  684. <!-- 4.4.6.10 notprsubset -->
  685. <xsl:template match="m:apply[*[1][self::m:notprsubset]]">
  686. <xsl:param name="p" select="0"/>
  687. <xsl:call-template name="binary">
  688. <xsl:with-param name="this-p" select="2"/>
  689. <xsl:with-param name="p" select="$p"/>
  690. <xsl:with-param name="mo">\not\subset </xsl:with-param>
  691. </xsl:call-template>
  692. </xsl:template>
  693. <!-- 4.4.6.11 setdiff -->
  694. <xsl:template match="m:apply[*[1][self::m:setdiff]]">
  695. <xsl:param name="p" select="0"/>
  696. <xsl:call-template name="binary">
  697. <xsl:with-param name="this-p" select="2"/>
  698. <xsl:with-param name="p" select="$p"/>
  699. <xsl:with-param name="mo">\setminus </xsl:with-param>
  700. </xsl:call-template>
  701. </xsl:template>
  702. <!-- 4.4.6.12 card -->
  703. <xsl:template match="m:apply[*[1][self::m:card]]">
  704. <xsl:text>|</xsl:text>
  705. <xsl:apply-templates select="*[2]"/>
  706. <xsl:text>|</xsl:text>
  707. </xsl:template>
  708. <!-- 4.4.6.13 cartesianproduct 4.4.10.6 vectorproduct -->
  709. <xsl:template match="m:apply[*[1][self::m:cartesianproduct or self::m:vectorproduct]]">
  710. <xsl:param name="p" select="0"/>
  711. <xsl:call-template name="infix">
  712. <xsl:with-param name="this-p" select="2"/>
  713. <xsl:with-param name="p" select="$p"/>
  714. <xsl:with-param name="mo">\times </xsl:with-param>
  715. </xsl:call-template>
  716. </xsl:template>
  717. <xsl:template
  718. match="m:apply[*[1][self::m:cartesianproduct][count(following-sibling::m:reals)=count(following-sibling::*)]]"
  719. priority="2">
  720. <xsl:apply-templates select="*[2]">
  721. <xsl:with-param name="p" select="5"/>
  722. </xsl:apply-templates>
  723. <xsl:text>^{</xsl:text>
  724. <xsl:value-of select="count(*)-1"/>
  725. <xsl:text>}</xsl:text>
  726. </xsl:template>
  727. <!-- 4.4.7.1 sum -->
  728. <xsl:template match="m:apply[*[1][self::m:sum]]">
  729. <xsl:text>\sum</xsl:text><xsl:call-template name="series"/>
  730. </xsl:template>
  731. <!-- 4.4.7.2 product -->
  732. <xsl:template match="m:apply[*[1][self::m:product]]">
  733. <xsl:text>\prod</xsl:text><xsl:call-template name="series"/>
  734. </xsl:template>
  735. <xsl:template name="series">
  736. <xsl:if test="m:lowlimit/*|m:interval/*[1]|m:condition/*">
  737. <xsl:text>_{</xsl:text>
  738. <xsl:if test="not(m:condition)">
  739. <xsl:apply-templates select="m:bvar"/>
  740. <xsl:text>=</xsl:text>
  741. </xsl:if>
  742. <xsl:apply-templates select="m:lowlimit/*|m:interval/*[1]|m:condition/*"/>
  743. <xsl:text>}</xsl:text>
  744. </xsl:if>
  745. <xsl:if test="m:uplimit/*|m:interval/*[2]">
  746. <xsl:text>^{</xsl:text>
  747. <xsl:apply-templates select="m:uplimit/*|m:interval/*[2]"/>
  748. <xsl:text>}</xsl:text>
  749. </xsl:if>
  750. <xsl:text> </xsl:text>
  751. <xsl:apply-templates select="*[last()]"/>
  752. </xsl:template>
  753. <!-- 4.4.7.3 limit -->
  754. <xsl:template match="m:apply[*[1][self::m:limit]]">
  755. <xsl:text>\lim_{</xsl:text>
  756. <xsl:apply-templates select="m:lowlimit|m:condition/*"/>
  757. <xsl:text>}</xsl:text>
  758. <xsl:apply-templates select="*[last()]"/>
  759. </xsl:template>
  760. <xsl:template match="m:apply[m:limit]/m:lowlimit" priority="3">
  761. <xsl:apply-templates select="../m:bvar/node()"/>
  762. <xsl:text>\to </xsl:text>
  763. <xsl:apply-templates/>
  764. </xsl:template>
  765. <!-- 4.4.7.4 tendsto -->
  766. <xsl:template match="m:apply[*[1][self::m:tendsto]]">
  767. <xsl:param name="p"/>
  768. <xsl:call-template name="binary">
  769. <xsl:with-param name="this-p" select="2"/>
  770. <xsl:with-param name="p" select="$p"/>
  771. <xsl:with-param name="mo">
  772. <xsl:choose>
  773. <xsl:when test="@type='above'">\searrow </xsl:when>
  774. <xsl:when test="@type='below'">\nearrow </xsl:when>
  775. <xsl:when test="@type='two-sided'">\rightarrow </xsl:when>
  776. <xsl:otherwise>\to </xsl:otherwise>
  777. </xsl:choose>
  778. </xsl:with-param>
  779. </xsl:call-template>
  780. </xsl:template>
  781. <!-- 4.4.8.1 common tringonometric functions 4.4.8.3 natural logarithm -->
  782. <xsl:template match="m:apply[*[1][
  783. self::m:sin or self::m:cos or self::m:tan or self::m:sec or
  784. self::m:csc or self::m:cot or self::m:sinh or self::m:cosh or
  785. self::m:tanh or self::m:coth or self::m:arcsin or self::m:arccos or
  786. self::m:arctan or self::m:ln]]">
  787. <xsl:text>\</xsl:text>
  788. <xsl:value-of select="local-name(*[1])"/>
  789. <xsl:text> </xsl:text>
  790. <xsl:apply-templates select="*[2]">
  791. <xsl:with-param name="p" select="7"/>
  792. </xsl:apply-templates>
  793. </xsl:template>
  794. <xsl:template match="m:sin | m:cos | m:tan | m:sec | m:csc |
  795. m:cot | m:sinh | m:cosh | m:tanh | m:coth |
  796. m:arcsin | m:arccos | m:arctan | m:ln">
  797. <xsl:text>\</xsl:text>
  798. <xsl:value-of select="local-name(.)"/>
  799. <xsl:text> </xsl:text>
  800. </xsl:template>
  801. <xsl:template match="m:apply[*[1][
  802. self::m:sech or self::m:csch or self::m:arccosh or
  803. self::m:arccot or self::m:arccoth or self::m:arccsc or
  804. self::m:arccsch or self::m:arcsec or self::m:arcsech or
  805. self::m:arcsinh or self::m:arctanh]]">
  806. <xsl:text>\mathrm{</xsl:text>
  807. <xsl:value-of select="local-name(*[1])"/>
  808. <xsl:text>\,}</xsl:text>
  809. <xsl:apply-templates select="*[2]">
  810. <xsl:with-param name="p" select="7"/>
  811. </xsl:apply-templates>
  812. </xsl:template>
  813. <xsl:template match="m:sech | m:csch | m:arccosh | m:arccot |
  814. m:arccoth | m:arccsc |m:arccsch |m:arcsec |
  815. m:arcsech | m:arcsinh | m:arctanh">
  816. <xsl:text>\mathrm{</xsl:text>
  817. <xsl:value-of select="local-name(.)"/>
  818. <xsl:text>}</xsl:text>
  819. </xsl:template>
  820. <!-- 4.4.8.2 exp -->
  821. <xsl:template match="m:apply[*[1][self::m:exp]]">
  822. <xsl:text>e^{</xsl:text><xsl:apply-templates select="*[2]"/><xsl:text>}</xsl:text>
  823. </xsl:template>
  824. <!-- 4.4.8.4 log -->
  825. <xsl:template match="m:apply[*[1][self::m:log]]">
  826. <xsl:text>\lg </xsl:text>
  827. <xsl:apply-templates select="*[last()]">
  828. <xsl:with-param name="p" select="7"/>
  829. </xsl:apply-templates>
  830. </xsl:template>
  831. <xsl:template match="m:apply[*[1][self::m:log] and m:logbase != 10]">
  832. <xsl:text>\log_{</xsl:text>
  833. <xsl:apply-templates select="m:logbase/node()"/>
  834. <xsl:text>}</xsl:text>
  835. <xsl:apply-templates select="*[last()]">
  836. <xsl:with-param name="p" select="7"/>
  837. </xsl:apply-templates>
  838. </xsl:template>
  839. <!-- 4.4.9.1 mean -->
  840. <xsl:template match="m:apply[*[1][self::m:mean]]">
  841. <xsl:text>\left\langle </xsl:text>
  842. <xsl:for-each select="*[position()&gt;1]">
  843. <xsl:apply-templates select="."/>
  844. <xsl:if test="position() !=last()"><xsl:text>, </xsl:text></xsl:if>
  845. </xsl:for-each>
  846. <xsl:text>\right\rangle </xsl:text>
  847. </xsl:template>
  848. <!-- 4.4.9.2 sdef -->
  849. <xsl:template match="m:sdev"><xsl:text>\sigma </xsl:text></xsl:template>
  850. <!-- 4.4.9.3 variance -->
  851. <xsl:template match="m:apply[*[1][self::m:variance]]">
  852. <xsl:text>\sigma(</xsl:text>
  853. <xsl:apply-templates select="*[2]"/>
  854. <xsl:text>)^2</xsl:text>
  855. </xsl:template>
  856. <!-- 4.4.9.5 moment -->
  857. <xsl:template match="m:apply[*[1][self::m:moment]]">
  858. <xsl:text>\left\langle </xsl:text>
  859. <xsl:apply-templates select="*[last()]"/>
  860. <xsl:text>^{</xsl:text>
  861. <xsl:apply-templates select="m:degree/node()"/>
  862. <xsl:text>}\right\rangle</xsl:text>
  863. <xsl:if test="m:momentabout">
  864. <xsl:text>_{</xsl:text>
  865. <xsl:apply-templates select="m:momentabout/node()"/>
  866. <xsl:text>}</xsl:text>
  867. </xsl:if>
  868. <xsl:text> </xsl:text>
  869. </xsl:template>
  870. <!-- 4.4.10.1 vector -->
  871. <xsl:template match="m:vector">
  872. <xsl:text>\left(\begin{array}{c}</xsl:text>
  873. <xsl:for-each select="*">
  874. <xsl:apply-templates select="."/>
  875. <xsl:if test="position()!=last()"><xsl:text>\\ </xsl:text></xsl:if>
  876. </xsl:for-each>
  877. <xsl:text>\end{array}\right)</xsl:text>
  878. </xsl:template>
  879. <!-- 4.4.10.2 matrix -->
  880. <xsl:template match="m:matrix">
  881. <xsl:text>\begin{pmatrix}</xsl:text>
  882. <xsl:apply-templates/>
  883. <xsl:text>\end{pmatrix}</xsl:text>
  884. </xsl:template>
  885. <!-- 4.4.10.3 matrixrow -->
  886. <xsl:template match="m:matrixrow">
  887. <xsl:for-each select="*">
  888. <xsl:apply-templates select="."/>
  889. <xsl:if test="position()!=last()"><xsl:text> &amp; </xsl:text></xsl:if>
  890. </xsl:for-each>
  891. <xsl:if test="position()!=last()"><xsl:text>\\ </xsl:text></xsl:if>
  892. </xsl:template>
  893. <!-- 4.4.10.4 determinant -->
  894. <xsl:template match="m:apply[*[1][self::m:determinant]]">
  895. <xsl:text>\det </xsl:text>
  896. <xsl:apply-templates select="*[2]">
  897. <xsl:with-param name="p" select="7"/>
  898. </xsl:apply-templates>
  899. </xsl:template>
  900. <xsl:template match="m:apply[*[1][self::m:determinant]][*[2][self::m:matrix]]" priority="2">
  901. <xsl:text>\begin{vmatrix}</xsl:text>
  902. <xsl:apply-templates select="m:matrix/*"/>
  903. <xsl:text>\end{vmatrix}</xsl:text>
  904. </xsl:template>
  905. <!-- 4.4.10.5 transpose -->
  906. <xsl:template match="m:apply[*[1][self::m:transpose]]">
  907. <xsl:apply-templates select="*[2]">
  908. <xsl:with-param name="p" select="7"/>
  909. </xsl:apply-templates>
  910. <xsl:text>^T</xsl:text>
  911. </xsl:template>
  912. <!-- 4.4.10.5 selector -->
  913. <xsl:template match="m:apply[*[1][self::m:selector]]">
  914. <xsl:apply-templates select="*[2]">
  915. <xsl:with-param name="p" select="7"/>
  916. </xsl:apply-templates>
  917. <xsl:text>_{</xsl:text>
  918. <xsl:for-each select="*[position()&gt;2]">
  919. <xsl:apply-templates select="."/>
  920. <xsl:if test="position() !=last()"><xsl:text>, </xsl:text></xsl:if>
  921. </xsl:for-each>
  922. <xsl:text>}</xsl:text>
  923. </xsl:template>
  924. <!-- 4.4.10.7 scalarproduct 4.4.10.8 outerproduct -->
  925. <xsl:template match="m:apply[*[1][self::m:scalarproduct or self::m:outerproduct]]">
  926. <xsl:param name="p" select="0"/>
  927. <xsl:call-template name="infix">
  928. <xsl:with-param name="this-p" select="2"/>
  929. <xsl:with-param name="p" select="$p"/>
  930. <xsl:with-param name="mo">\dot </xsl:with-param>
  931. </xsl:call-template>
  932. </xsl:template>
  933. <!-- 4.4.11.2 semantics -->
  934. <xsl:template match="m:semantics"><xsl:apply-templates select="*[1]"/></xsl:template>
  935. <xsl:template match="m:semantics[m:annotation/@encoding='TeX']">
  936. <xsl:apply-templates select="m:annotation[@encoding='TeX']/node()"/>
  937. </xsl:template>
  938. <!-- 4.4.12.1 integers -->
  939. <xsl:template match="m:integers"><xsl:text>\mathbb{Z}</xsl:text></xsl:template>
  940. <!-- 4.4.12.2 reals -->
  941. <xsl:template match="m:reals"><xsl:text>\mathbb{R}</xsl:text></xsl:template>
  942. <!-- 4.4.12.3 rationals -->
  943. <xsl:template match="m:rationals"><xsl:text>\mathbb{Q}</xsl:text></xsl:template>
  944. <!-- 4.4.12.4 naturalnumbers -->
  945. <xsl:template match="m:naturalnumbers"><xsl:text>\mathbb{N}</xsl:text></xsl:template>
  946. <!-- 4.4.12.5 complexes -->
  947. <xsl:template match="m:complexes"><xsl:text>\mathbb{C}</xsl:text></xsl:template>
  948. <!-- 4.4.12.6 primes -->
  949. <xsl:template match="m:primes"><xsl:text>\mathbb{P}</xsl:text></xsl:template>
  950. <!-- 4.4.12.7 exponentiale -->
  951. <xsl:template match="m:exponentiale"><xsl:text>e</xsl:text></xsl:template>
  952. <!-- 4.4.12.8 imaginaryi -->
  953. <xsl:template match="m:imaginaryi"><xsl:text>i</xsl:text></xsl:template>
  954. <!-- 4.4.12.9 notanumber -->
  955. <xsl:template match="m:notanumber"><xsl:text>NaN</xsl:text></xsl:template>
  956. <!-- 4.4.12.10 true -->
  957. <xsl:template match="m:true"><xsl:text>\mbox{true}</xsl:text></xsl:template>
  958. <!-- 4.4.12.11 false -->
  959. <xsl:template match="m:false"><xsl:text>\mbox{false}</xsl:text></xsl:template>
  960. <!-- 4.4.12.12 emptyset -->
  961. <xsl:template match="m:emptyset"><xsl:text>\emptyset </xsl:text></xsl:template>
  962. <!-- 4.4.12.13 pi -->
  963. <xsl:template match="m:pi"><xsl:text>\pi </xsl:text></xsl:template>
  964. <!-- 4.4.12.14 eulergamma -->
  965. <xsl:template match="m:eulergamma"><xsl:text>\gamma </xsl:text></xsl:template>
  966. <!-- 4.4.12.15 infinity -->
  967. <xsl:template match="m:infinity"><xsl:text>\infty </xsl:text></xsl:template>
  968. <!-- ****************************** -->
  969. <xsl:template name="infix" >
  970. <xsl:param name="mo"/>
  971. <xsl:param name="p" select="0"/>
  972. <xsl:param name="this-p" select="0"/>
  973. <xsl:if test="$this-p &lt; $p"><xsl:text>(</xsl:text></xsl:if>
  974. <xsl:for-each select="*[position()&gt;1]">
  975. <xsl:if test="position() &gt; 1">
  976. <xsl:copy-of select="$mo"/>
  977. </xsl:if>
  978. <xsl:apply-templates select=".">
  979. <xsl:with-param name="p" select="$this-p"/>
  980. </xsl:apply-templates>
  981. </xsl:for-each>
  982. <xsl:if test="$this-p &lt; $p"><xsl:text>)</xsl:text></xsl:if>
  983. </xsl:template>
  984. <xsl:template name="binary" >
  985. <xsl:param name="mo"/>
  986. <xsl:param name="p" select="0"/>
  987. <xsl:param name="this-p" select="0"/>
  988. <xsl:if test="$this-p &lt; $p"><xsl:text>(</xsl:text></xsl:if>
  989. <xsl:apply-templates select="*[2]">
  990. <xsl:with-param name="p" select="$this-p"/>
  991. </xsl:apply-templates>
  992. <xsl:value-of select="$mo"/>
  993. <xsl:apply-templates select="*[3]">
  994. <xsl:with-param name="p" select="$this-p"/>
  995. </xsl:apply-templates>
  996. <xsl:if test="$this-p &lt; $p"><xsl:text>)</xsl:text></xsl:if>
  997. </xsl:template>
  998. <!-- ====================================================================== -->
  999. <!-- $id: entities.xsl, 2002/22/11 Exp $
  1000. This file is part of the XSLT MathML Library distribution.
  1001. See ./README or http://www.raleigh.ru/MathML/mmltex for
  1002. copyright and other information -->
  1003. <!-- ====================================================================== -->
  1004. <xsl:template name="replaceEntities">
  1005. <xsl:param name="content"/>
  1006. <xsl:if test="string-length($content)>0">
  1007. <xsl:choose>
  1008. <xsl:when test="starts-with($content,'&#x0025B;')"><xsl:value-of select="'\varepsilon '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x0025B;')"/></xsl:call-template></xsl:when> <!--/varepsilon -->
  1009. <!-- ====================================================================== -->
  1010. <!-- Unicode 3.2
  1011. Greek
  1012. Range: 0370-03FF
  1013. http://www.unicode.org/charts/PDF/U0370.pdf -->
  1014. <!-- ====================================================================== -->
  1015. <xsl:when test="starts-with($content,'&#x00393;')"><xsl:value-of select="'\Gamma '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x00393;')"/></xsl:call-template></xsl:when> <!--/Gamma capital Gamma, Greek -->
  1016. <xsl:when test="starts-with($content,'&#x00394;')"><xsl:value-of select="'\Delta '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x00394;')"/></xsl:call-template></xsl:when> <!--/Delta capital Delta, Greek -->
  1017. <xsl:when test="starts-with($content,'&#x00398;')"><xsl:value-of select="'\Theta '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x00398;')"/></xsl:call-template></xsl:when> <!--/Theta capital Theta, Greek -->
  1018. <xsl:when test="starts-with($content,'&#x0039B;')"><xsl:value-of select="'\Lambda '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x0039B;')"/></xsl:call-template></xsl:when> <!--/Lambda capital Lambda, Greek -->
  1019. <xsl:when test="starts-with($content,'&#x0039E;')"><xsl:value-of select="'\Xi '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x0039E;')"/></xsl:call-template></xsl:when> <!--/Xi capital Xi, Greek -->
  1020. <xsl:when test="starts-with($content,'&#x003A0;')"><xsl:value-of select="'\Pi '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x003A0;')"/></xsl:call-template></xsl:when> <!--/Pi capital Pi, Greek -->
  1021. <xsl:when test="starts-with($content,'&#x003A3;')"><xsl:value-of select="'\Sigma '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x003A3;')"/></xsl:call-template></xsl:when> <!--/Sigma capital Sigma, Greek -->
  1022. <xsl:when test="starts-with($content,'&#x003A6;')"><xsl:value-of select="'\Phi '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x003A6;')"/></xsl:call-template></xsl:when> <!--/Phi capital Phi, Greek -->
  1023. <xsl:when test="starts-with($content,'&#x003A8;')"><xsl:value-of select="'\Psi '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x003A8;')"/></xsl:call-template></xsl:when> <!--/Psi capital Psi, Greek -->
  1024. <xsl:when test="starts-with($content,'&#x003A9;')"><xsl:value-of select="'\Omega '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x003A9;')"/></xsl:call-template></xsl:when> <!--/Omega capital Omega, Greek -->
  1025. <xsl:when test="starts-with($content,'&#x003B1;')"><xsl:value-of select="'\alpha '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x003B1;')"/></xsl:call-template></xsl:when> <!--/alpha small alpha, Greek -->
  1026. <xsl:when test="starts-with($content,'&#x003B2;')"><xsl:value-of select="'\beta '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x003B2;')"/></xsl:call-template></xsl:when> <!--/beta small beta, Greek -->
  1027. <xsl:when test="starts-with($content,'&#x003B3;')"><xsl:value-of select="'\gamma '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x003B3;')"/></xsl:call-template></xsl:when> <!--/gamma small gamma, Greek -->
  1028. <xsl:when test="starts-with($content,'&#x003B4;')"><xsl:value-of select="'\delta '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x003B4;')"/></xsl:call-template></xsl:when> <!--/delta small delta, Greek -->
  1029. <xsl:when test="starts-with($content,'&#x003B5;')"><xsl:value-of select="'\epsilon '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x003B5;')"/></xsl:call-template></xsl:when> <!--/straightepsilon, small epsilon, Greek -->
  1030. <xsl:when test="starts-with($content,'&#x003B6;')"><xsl:value-of select="'\zeta '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x003B6;')"/></xsl:call-template></xsl:when> <!--/zeta small zeta, Greek -->
  1031. <xsl:when test="starts-with($content,'&#x003B7;')"><xsl:value-of select="'\eta '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x003B7;')"/></xsl:call-template></xsl:when> <!--/eta small eta, Greek -->
  1032. <xsl:when test="starts-with($content,'&#x003B8;')"><xsl:value-of select="'\theta '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x003B8;')"/></xsl:call-template></xsl:when> <!--/theta straight theta, small theta, Greek -->
  1033. <xsl:when test="starts-with($content,'&#x003B9;')"><xsl:value-of select="'\iota '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x003B9;')"/></xsl:call-template></xsl:when> <!--/iota small iota, Greek -->
  1034. <xsl:when test="starts-with($content,'&#x003BA;')"><xsl:value-of select="'\kappa '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x003BA;')"/></xsl:call-template></xsl:when> <!--/kappa small kappa, Greek -->
  1035. <xsl:when test="starts-with($content,'&#x003BB;')"><xsl:value-of select="'\lambda '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x003BB;')"/></xsl:call-template></xsl:when> <!--/lambda small lambda, Greek -->
  1036. <xsl:when test="starts-with($content,'&#x003BC;')"><xsl:value-of select="'\mu '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x003BC;')"/></xsl:call-template></xsl:when> <!--/mu small mu, Greek -->
  1037. <xsl:when test="starts-with($content,'&#x003BD;')"><xsl:value-of select="'\nu '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x003BD;')"/></xsl:call-template></xsl:when> <!--/nu small nu, Greek -->
  1038. <xsl:when test="starts-with($content,'&#x003BE;')"><xsl:value-of select="'\xi '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x003BE;')"/></xsl:call-template></xsl:when> <!--/xi small xi, Greek -->
  1039. <xsl:when test="starts-with($content,'&#x003C0;')"><xsl:value-of select="'\pi '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x003C0;')"/></xsl:call-template></xsl:when> <!--/pi small pi, Greek -->
  1040. <xsl:when test="starts-with($content,'&#x003C1;')"><xsl:value-of select="'\rho '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x003C1;')"/></xsl:call-template></xsl:when> <!--/rho small rho, Greek -->
  1041. <xsl:when test="starts-with($content,'&#x003C2;')"><xsl:value-of select="'\varsigma '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x003C2;')"/></xsl:call-template></xsl:when> <!--/varsigma -->
  1042. <xsl:when test="starts-with($content,'&#x003C3;')"><xsl:value-of select="'\sigma '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x003C3;')"/></xsl:call-template></xsl:when> <!--/sigma small sigma, Greek -->
  1043. <xsl:when test="starts-with($content,'&#x003C4;')"><xsl:value-of select="'\tau '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x003C4;')"/></xsl:call-template></xsl:when> <!--/tau small tau, Greek -->
  1044. <xsl:when test="starts-with($content,'&#x003C5;')"><xsl:value-of select="'\upsilon '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x003C5;')"/></xsl:call-template></xsl:when> <!--/upsilon small upsilon, Greek -->
  1045. <xsl:when test="starts-with($content,'&#x003C6;')"><xsl:value-of select="'\phi '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x003C6;')"/></xsl:call-template></xsl:when> <!--/straightphi - small phi, Greek -->
  1046. <xsl:when test="starts-with($content,'&#x003C7;')"><xsl:value-of select="'\chi '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x003C7;')"/></xsl:call-template></xsl:when> <!--/chi small chi, Greek -->
  1047. <xsl:when test="starts-with($content,'&#x003C8;')"><xsl:value-of select="'\psi '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x003C8;')"/></xsl:call-template></xsl:when> <!--/psi small psi, Greek -->
  1048. <xsl:when test="starts-with($content,'&#x003C9;')"><xsl:value-of select="'\omega '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x003C9;')"/></xsl:call-template></xsl:when> <!--/omega small omega, Greek -->
  1049. <xsl:when test="starts-with($content,'&#x003D1;')"><xsl:value-of select="'\vartheta '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x003D1;')"/></xsl:call-template></xsl:when> <!--/vartheta - curly or open theta -->
  1050. <xsl:when test="starts-with($content,'&#x003D2;')"><xsl:value-of select="'\Upsilon '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x003D2;')"/></xsl:call-template></xsl:when> <!--/Upsilon capital Upsilon, Greek -->
  1051. <xsl:when test="starts-with($content,'&#x003D5;')"><xsl:value-of select="'\varphi '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x003D5;')"/></xsl:call-template></xsl:when> <!--/varphi - curly or open phi -->
  1052. <xsl:when test="starts-with($content,'&#x003D6;')"><xsl:value-of select="'\varpi '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x003D6;')"/></xsl:call-template></xsl:when> <!--/varpi -->
  1053. <xsl:when test="starts-with($content,'&#x003F0;')"><xsl:value-of select="'\varkappa '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x003F0;')"/></xsl:call-template></xsl:when> <!--/varkappa -->
  1054. <xsl:when test="starts-with($content,'&#x003F1;')"><xsl:value-of select="'\varrho '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x003F1;')"/></xsl:call-template></xsl:when> <!--/varrho -->
  1055. <!-- ====================================================================== -->
  1056. <xsl:when test="starts-with($content,'&#x0200B;')"><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x0200B;')"/></xsl:call-template></xsl:when> <!--short form of &InvisibleComma; -->
  1057. <xsl:when test="starts-with($content,'&#x02026;')"><xsl:value-of select="'\dots '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x02026;')"/></xsl:call-template></xsl:when>
  1058. <xsl:when test="starts-with($content,'&#x02032;')"><xsl:value-of select="'\prime '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x02032;')"/></xsl:call-template></xsl:when> <!--/prime prime or minute -->
  1059. <xsl:when test="starts-with($content,'&#x02061;')"><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x02061;')"/></xsl:call-template></xsl:when> <!-- ApplyFunction -->
  1060. <xsl:when test="starts-with($content,'&#x02062;')"><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x02062;')"/></xsl:call-template></xsl:when> <!-- InvisibleTimes -->
  1061. <!-- ====================================================================== -->
  1062. <!-- Unicode 3.2
  1063. Letterlike Symbols
  1064. Range: 2100-214F
  1065. http://www.unicode.org/charts/PDF/U2100.pdf -->
  1066. <!-- ====================================================================== -->
  1067. <xsl:when test="starts-with($content,'&#x0210F;&#x0FE00;')"><xsl:value-of select="'\hbar '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x0210F;&#x0FE00;')"/></xsl:call-template></xsl:when> <!--/hbar - Planck's over 2pi -->
  1068. <xsl:when test="starts-with($content,'&#x0210F;')"><xsl:value-of select="'\hslash '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x0210F;')"/></xsl:call-template></xsl:when> <!--/hslash - variant Planck's over 2pi --> <!-- Required amssymb -->
  1069. <xsl:when test="starts-with($content,'&#x02111;')"><xsl:value-of select="'\Im '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x02111;')"/></xsl:call-template></xsl:when> <!--/Im - imaginary -->
  1070. <xsl:when test="starts-with($content,'&#x02113;')"><xsl:value-of select="'\ell '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x02113;')"/></xsl:call-template></xsl:when> <!--/ell - cursive small l -->
  1071. <xsl:when test="starts-with($content,'&#x02118;')"><xsl:value-of select="'\wp '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x02118;')"/></xsl:call-template></xsl:when> <!--/wp - Weierstrass p -->
  1072. <xsl:when test="starts-with($content,'&#x0211C;')"><xsl:value-of select="'\Re '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x0211C;')"/></xsl:call-template></xsl:when> <!--/Re - real -->
  1073. <xsl:when test="starts-with($content,'&#x02127;')"><xsl:value-of select="'\mho '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x02127;')"/></xsl:call-template></xsl:when> <!--/mho - conductance -->
  1074. <xsl:when test="starts-with($content,'&#x02135;')"><xsl:value-of select="'\aleph '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x02135;')"/></xsl:call-template></xsl:when> <!--/aleph aleph, Hebrew -->
  1075. <xsl:when test="starts-with($content,'&#x02136;')"><xsl:value-of select="'\beth '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x02136;')"/></xsl:call-template></xsl:when> <!--/beth - beth, Hebrew --> <!-- Required amssymb -->
  1076. <xsl:when test="starts-with($content,'&#x02137;')"><xsl:value-of select="'\gimel '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x02137;')"/></xsl:call-template></xsl:when> <!--/gimel - gimel, Hebrew --> <!-- Required amssymb -->
  1077. <xsl:when test="starts-with($content,'&#x02138;')"><xsl:value-of select="'\daleth '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x02138;')"/></xsl:call-template></xsl:when> <!--/daleth - daleth, Hebrew --> <!-- Required amssymb -->
  1078. <xsl:when test="starts-with($content,'&#x02145;')"><xsl:value-of select="'D'" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x02145;')"/></xsl:call-template></xsl:when> <!--D for use in differentials, e.g., within integrals -->
  1079. <xsl:when test="starts-with($content,'&#x02146;')"><xsl:value-of select="'d'" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x02146;')"/></xsl:call-template></xsl:when> <!--d for use in differentials, e.g., within integrals -->
  1080. <xsl:when test="starts-with($content,'&#x02147;')"><xsl:value-of select="'e'" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x02147;')"/></xsl:call-template></xsl:when> <!--e use for the exponential base of the natural logarithms -->
  1081. <xsl:when test="starts-with($content,'&#x02148;')"><xsl:value-of select="'i'" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x02148;')"/></xsl:call-template></xsl:when> <!--i for use as a square root of -1 -->
  1082. <!-- ====================================================================== -->
  1083. <xsl:when test="starts-with($content,'&#x02192;')"><xsl:value-of select="'\to '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x02192;')"/></xsl:call-template></xsl:when> <!--/rightarrow /to A: =rightward arrow -->
  1084. <!-- ====================================================================== -->
  1085. <!-- Unicode 3.2
  1086. Mathematical Operators
  1087. Range: 2200-22FF
  1088. http://www.unicode.org/charts/PDF/U2200.pdf -->
  1089. <!-- ====================================================================== -->
  1090. <xsl:when test="starts-with($content,'&#x02200;')"><xsl:value-of select="'\forall '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x02200;')"/></xsl:call-template></xsl:when> <!--/forall for all -->
  1091. <xsl:when test="starts-with($content,'&#x02201;')"><xsl:value-of select="'\complement '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x02201;')"/></xsl:call-template></xsl:when> <!--/complement - complement sign --> <!-- Required amssymb -->
  1092. <xsl:when test="starts-with($content,'&#x02202;')"><xsl:value-of select="'\partial '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x02202;')"/></xsl:call-template></xsl:when> <!--/partial partial differential -->
  1093. <xsl:when test="starts-with($content,'&#x02203;')"><xsl:value-of select="'\exists '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x02203;')"/></xsl:call-template></xsl:when> <!--/exists at least one exists -->
  1094. <xsl:when test="starts-with($content,'&#x02204;')"><xsl:value-of select="'\nexists '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x02204;')"/></xsl:call-template></xsl:when> <!--/nexists - negated exists --> <!-- Required amssymb -->
  1095. <xsl:when test="starts-with($content,'&#x02205;&#x0FE00;')"><xsl:value-of select="'\emptyset '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x02205;&#x0FE00;')"/></xsl:call-template></xsl:when> <!--/emptyset - zero, slash -->
  1096. <xsl:when test="starts-with($content,'&#x02205;')"><xsl:value-of select="'\varnothing '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x02205;')"/></xsl:call-template></xsl:when> <!--/varnothing - circle, slash --> <!-- Required amssymb -->
  1097. <!-- <xsl:when test="starts-with($content,'&#x02206;')"><xsl:value-of select="' '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x02206;')"/></xsl:call-template></xsl:when>-->
  1098. <xsl:when test="starts-with($content,'&#x02207;')"><xsl:value-of select="'\nabla '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x02207;')"/></xsl:call-template></xsl:when> <!--/nabla del, Hamilton operator -->
  1099. <xsl:when test="starts-with($content,'&#x02208;')"><xsl:value-of select="'\in '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x02208;')"/></xsl:call-template></xsl:when> <!--/in R: set membership -->
  1100. <xsl:when test="starts-with($content,'&#x02209;')"><xsl:value-of select="'\notin '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x02209;')"/></xsl:call-template></xsl:when> <!--/notin N: negated set membership -->
  1101. <xsl:when test="starts-with($content,'&#x0220B;')"><xsl:value-of select="'\ni '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x0220B;')"/></xsl:call-template></xsl:when> <!--/ni /owns R: contains -->
  1102. <xsl:when test="starts-with($content,'&#x0220C;')"><xsl:value-of select="'\not\ni '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x0220C;')"/></xsl:call-template></xsl:when> <!--negated contains -->
  1103. <xsl:when test="starts-with($content,'&#x0220F;')"><xsl:value-of select="'\prod '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x0220F;')"/></xsl:call-template></xsl:when> <!--/prod L: product operator -->
  1104. <xsl:when test="starts-with($content,'&#x02210;')"><xsl:value-of select="'\coprod '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x02210;')"/></xsl:call-template></xsl:when> <!--/coprod L: coproduct operator -->
  1105. <xsl:when test="starts-with($content,'&#x02211;')"><xsl:value-of select="'\sum '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x02211;')"/></xsl:call-template></xsl:when> <!--/sum L: summation operator -->
  1106. <xsl:when test="starts-with($content,'&#x02212;')"><xsl:value-of select="'-'" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x02212;')"/></xsl:call-template></xsl:when> <!--B: minus sign -->
  1107. <xsl:when test="starts-with($content,'&#x02213;')"><xsl:value-of select="'\mp '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x02213;')"/></xsl:call-template></xsl:when> <!--/mp B: minus-or-plus sign -->
  1108. <xsl:when test="starts-with($content,'&#x02214;')"><xsl:value-of select="'\dotplus '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x02214;')"/></xsl:call-template></xsl:when> <!--/dotplus B: plus sign, dot above --> <!-- Required amssymb -->
  1109. <!-- <xsl:when test="starts-with($content,'&#x02215;')"><xsl:value-of select="' '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x02215;')"/></xsl:call-template></xsl:when>-->
  1110. <xsl:when test="starts-with($content,'&#x02216;')"><xsl:value-of select="'\setminus '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x02216;')"/></xsl:call-template></xsl:when> <!--/setminus B: reverse solidus -->
  1111. <xsl:when test="starts-with($content,'&#x02217;')"><xsl:value-of select="'\ast '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x02217;')"/></xsl:call-template></xsl:when> <!--low asterisk -->
  1112. <xsl:when test="starts-with($content,'&#x02218;')"><xsl:value-of select="'\circ '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x02218;')"/></xsl:call-template></xsl:when> <!--/circ B: composite function (small circle) -->
  1113. <xsl:when test="starts-with($content,'&#x02219;')"><xsl:value-of select="'\bullet '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x02219;')"/></xsl:call-template></xsl:when>
  1114. <xsl:when test="starts-with($content,'&#x0221A;')"><xsl:value-of select="'\surd '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x0221A;')"/></xsl:call-template></xsl:when> <!--/surd radical -->
  1115. <xsl:when test="starts-with($content,'&#x0221D;')"><xsl:value-of select="'\propto '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x0221D;')"/></xsl:call-template></xsl:when> <!--/propto R: is proportional to -->
  1116. <xsl:when test="starts-with($content,'&#x0221E;')"><xsl:value-of select="'\infty '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x0221E;')"/></xsl:call-template></xsl:when> <!--/infty infinity -->
  1117. <!-- <xsl:when test="starts-with($content,'&#x0221F;')"><xsl:value-of select="' '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x0221F;')"/></xsl:call-template></xsl:when> right (90 degree) angle -->
  1118. <xsl:when test="starts-with($content,'&#x02220;')"><xsl:value-of select="'\angle '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x02220;')"/></xsl:call-template></xsl:when> <!--/angle - angle -->
  1119. <xsl:when test="starts-with($content,'&#x02221;')"><xsl:value-of select="'\measuredangle '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x02221;')"/></xsl:call-template></xsl:when> <!--/measuredangle - angle-measured --> <!-- Required amssymb -->
  1120. <xsl:when test="starts-with($content,'&#x02222;')"><xsl:value-of select="'\sphericalangle '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x02222;')"/></xsl:call-template></xsl:when><!--/sphericalangle angle-spherical --> <!-- Required amssymb -->
  1121. <xsl:when test="starts-with($content,'&#x02223;')"><xsl:value-of select="'\mid '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x02223;')"/></xsl:call-template></xsl:when> <!--/mid R: -->
  1122. <xsl:when test="starts-with($content,'&#x02224;&#x0FE00;')"><xsl:value-of select="'\nshortmid '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x02224;&#x0FE00;')"/></xsl:call-template></xsl:when> <!--/nshortmid --> <!-- Required amssymb -->
  1123. <xsl:when test="starts-with($content,'&#x02224;')"><xsl:value-of select="'\nmid '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x02224;')"/></xsl:call-template></xsl:when> <!--/nmid --> <!-- Required amssymb -->
  1124. <xsl:when test="starts-with($content,'&#x02225;')"><xsl:value-of select="'\parallel '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x02225;')"/></xsl:call-template></xsl:when> <!--/parallel R: parallel -->
  1125. <xsl:when test="starts-with($content,'&#x02226;&#x0FE00;')"><xsl:value-of select="'\nshortparallel '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x02226;&#x0FE00;')"/></xsl:call-template></xsl:when> <!--/nshortparallel N: not short par --> <!-- Required amssymb -->
  1126. <xsl:when test="starts-with($content,'&#x02226;')"><xsl:value-of select="'\nparallel '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x02226;')"/></xsl:call-template></xsl:when> <!--/nparallel N: not parallel --> <!-- Required amssymb -->
  1127. <xsl:when test="starts-with($content,'&#x02227;')"><xsl:value-of select="'\wedge '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x02227;')"/></xsl:call-template></xsl:when> <!--/wedge /land B: logical and -->
  1128. <xsl:when test="starts-with($content,'&#x02228;')"><xsl:value-of select="'\vee '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x02228;')"/></xsl:call-template></xsl:when> <!--/vee /lor B: logical or -->
  1129. <xsl:when test="starts-with($content,'&#x02229;')"><xsl:value-of select="'\cap '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x02229;')"/></xsl:call-template></xsl:when> <!--/cap B: intersection -->
  1130. <xsl:when test="starts-with($content,'&#x0222A;')"><xsl:value-of select="'\cup '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x0222A;')"/></xsl:call-template></xsl:when> <!--/cup B: union or logical sum -->
  1131. <xsl:when test="starts-with($content,'&#x0222B;')"><xsl:value-of select="'\int '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x0222B;')"/></xsl:call-template></xsl:when> <!--/int L: integral operator -->
  1132. <xsl:when test="starts-with($content,'&#x0222C;')"><xsl:value-of select="'\iint '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x0222C;')"/></xsl:call-template></xsl:when> <!--double integral operator --> <!-- Required amsmath -->
  1133. <xsl:when test="starts-with($content,'&#x0222D;')"><xsl:value-of select="'\iiint '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x0222D;')"/></xsl:call-template></xsl:when> <!--/iiint triple integral operator --> <!-- Required amsmath -->
  1134. <xsl:when test="starts-with($content,'&#x0222E;')"><xsl:value-of select="'\oint '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x0222E;')"/></xsl:call-template></xsl:when> <!--/oint L: contour integral operator -->
  1135. <!-- <xsl:when test="starts-with($content,'&#x0222F;')"><xsl:value-of select="' '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x0222F;')"/></xsl:call-template></xsl:when>-->
  1136. <!-- <xsl:when test="starts-with($content,'&#x02230;')"><xsl:value-of select="' '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x02230;')"/></xsl:call-template></xsl:when>-->
  1137. <!-- <xsl:when test="starts-with($content,'&#x02231;')"><xsl:value-of select="' '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x02231;')"/></xsl:call-template></xsl:when>-->
  1138. <!-- <xsl:when test="starts-with($content,'&#x02232;')"><xsl:value-of select="' '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x02232;')"/></xsl:call-template></xsl:when>-->
  1139. <!-- <xsl:when test="starts-with($content,'&#x02233;')"><xsl:value-of select="' '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x02233;')"/></xsl:call-template></xsl:when>-->
  1140. <xsl:when test="starts-with($content,'&#x02234;')"><xsl:value-of select="'\therefore '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x02234;')"/></xsl:call-template></xsl:when> <!--/therefore R: therefore --> <!-- Required amssymb -->
  1141. <xsl:when test="starts-with($content,'&#x02235;')"><xsl:value-of select="'\because '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x02235;')"/></xsl:call-template></xsl:when> <!--/because R: because --> <!-- Required amssymb -->
  1142. <!-- ? --> <xsl:when test="starts-with($content,'&#x02236;')"><xsl:value-of select="':'" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x02236;')"/></xsl:call-template></xsl:when> <!--/ratio -->
  1143. <!-- ? --> <xsl:when test="starts-with($content,'&#x02237;')"><xsl:value-of select="'\colon\colon '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x02237;')"/></xsl:call-template></xsl:when> <!--/Colon, two colons -->
  1144. <!-- ? --> <xsl:when test="starts-with($content,'&#x02238;')"><xsl:value-of select="'\dot{-}'" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x02238;')"/></xsl:call-template></xsl:when> <!--/dotminus B: minus sign, dot above -->
  1145. <!-- <xsl:when test="starts-with($content,'&#x02239;')"><xsl:value-of select="' '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x02239;')"/></xsl:call-template></xsl:when> -->
  1146. <!-- <xsl:when test="starts-with($content,'&#x0223A;')"><xsl:value-of select="' '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x0223A;')"/></xsl:call-template></xsl:when> minus with four dots, geometric properties -->
  1147. <!-- <xsl:when test="starts-with($content,'&#x0223B;')"><xsl:value-of select="' '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x0223B;')"/></xsl:call-template></xsl:when> homothetic -->
  1148. <xsl:when test="starts-with($content,'&#x0223C;')"><xsl:value-of select="'\sim '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x0223C;')"/></xsl:call-template></xsl:when> <!--/sim R: similar -->
  1149. <xsl:when test="starts-with($content,'&#x0223D;')"><xsl:value-of select="'\backsim '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x0223D;')"/></xsl:call-template></xsl:when> <!--/backsim R: reverse similar --> <!-- Required amssymb -->
  1150. <!-- <xsl:when test="starts-with($content,'&#x0223E;')"><xsl:value-of select="' '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x0223E;')"/></xsl:call-template></xsl:when> most positive -->
  1151. <!-- <xsl:when test="starts-with($content,'&#x0223F;')"><xsl:value-of select="' '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x0223F;')"/></xsl:call-template></xsl:when> ac current -->
  1152. <xsl:when test="starts-with($content,'&#x02240;')"><xsl:value-of select="'\wr '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x02240;')"/></xsl:call-template></xsl:when> <!--/wr B: wreath product -->
  1153. <xsl:when test="starts-with($content,'&#x02241;')"><xsl:value-of select="'\nsim '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x02241;')"/></xsl:call-template></xsl:when> <!--/nsim N: not similar --> <!-- Required amssymb -->
  1154. <xsl:when test="starts-with($content,'&#x02242;')"><xsl:value-of select="'\eqsim '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x02242;')"/></xsl:call-template></xsl:when> <!--/esim R: equals, similar --> <!-- Required amssymb -->
  1155. <xsl:when test="starts-with($content,'&#x02243;')"><xsl:value-of select="'\simeq '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x02243;')"/></xsl:call-template></xsl:when> <!--/simeq R: similar, equals -->
  1156. <xsl:when test="starts-with($content,'&#x02244;')"><xsl:value-of select="'\not\simeq '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x02244;')"/></xsl:call-template></xsl:when> <!--/nsimeq N: not similar, equals -->
  1157. <xsl:when test="starts-with($content,'&#x02245;')"><xsl:value-of select="'\cong '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x02245;')"/></xsl:call-template></xsl:when> <!--/cong R: congruent with -->
  1158. <!-- <xsl:when test="starts-with($content,'&#x02246;')"><xsl:value-of select="' '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x02246;')"/></xsl:call-template></xsl:when> similar, not equals -->
  1159. <xsl:when test="starts-with($content,'&#x02247;')"><xsl:value-of select="'\ncong '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x02247;')"/></xsl:call-template></xsl:when> <!--/ncong N: not congruent with --> <!-- Required amssymb -->
  1160. <xsl:when test="starts-with($content,'&#x02248;')"><xsl:value-of select="'\approx '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x02248;')"/></xsl:call-template></xsl:when> <!--/approx R: approximate -->
  1161. <!-- <xsl:when test="starts-with($content,'&#x02249;&#x00338;')"><xsl:value-of select="' '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x02249;&#x00338;')"/></xsl:call-template></xsl:when> not, vert, approximate -->
  1162. <xsl:when test="starts-with($content,'&#x02249;')"><xsl:value-of select="'\not\approx '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x02249;')"/></xsl:call-template></xsl:when> <!--/napprox N: not approximate -->
  1163. <xsl:when test="starts-with($content,'&#x0224A;')"><xsl:value-of select="'\approxeq '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x0224A;')"/></xsl:call-template></xsl:when> <!--/approxeq R: approximate, equals --> <!-- Required amssymb -->
  1164. <!-- <xsl:when test="starts-with($content,'&#x0224B;')"><xsl:value-of select="' '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x0224B;')"/></xsl:call-template></xsl:when> approximately identical to -->
  1165. <!-- <xsl:when test="starts-with($content,'&#x0224C;')"><xsl:value-of select="' '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x0224C;')"/></xsl:call-template></xsl:when> /backcong R: reverse congruent -->
  1166. <xsl:when test="starts-with($content,'&#x0224D;')"><xsl:value-of select="'\asymp '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x0224D;')"/></xsl:call-template></xsl:when> <!--/asymp R: asymptotically equal to -->
  1167. <xsl:when test="starts-with($content,'&#x0224E;')"><xsl:value-of select="'\Bumpeq '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x0224E;')"/></xsl:call-template></xsl:when> <!--/Bumpeq R: bumpy equals --> <!-- Required amssymb -->
  1168. <xsl:when test="starts-with($content,'&#x0224F;')"><xsl:value-of select="'\bumpeq '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x0224F;')"/></xsl:call-template></xsl:when> <!--/bumpeq R: bumpy equals, equals --> <!-- Required amssymb -->
  1169. <xsl:when test="starts-with($content,'&#x02250;')"><xsl:value-of select="'\doteq '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x02250;')"/></xsl:call-template></xsl:when> <!--/doteq R: equals, single dot above -->
  1170. <xsl:when test="starts-with($content,'&#x02251;')"><xsl:value-of select="'\doteqdot '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x02251;')"/></xsl:call-template></xsl:when> <!--/doteqdot /Doteq R: eq, even dots --> <!-- Required amssymb -->
  1171. <xsl:when test="starts-with($content,'&#x02252;')"><xsl:value-of select="'\fallingdotseq '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x02252;')"/></xsl:call-template></xsl:when> <!--/fallingdotseq R: eq, falling dots --> <!-- Required amssymb -->
  1172. <xsl:when test="starts-with($content,'&#x02253;')"><xsl:value-of select="'\risingdotseq '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x02253;')"/></xsl:call-template></xsl:when> <!--/risingdotseq R: eq, rising dots --> <!-- Required amssymb -->
  1173. <!-- <xsl:when test="starts-with($content,'&#x02254;')"><xsl:value-of select="' '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x02254;')"/></xsl:call-template></xsl:when> /coloneq R: colon, equals -->
  1174. <!-- <xsl:when test="starts-with($content,'&#x02255;')"><xsl:value-of select="' '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x02255;')"/></xsl:call-template></xsl:when> /eqcolon R: equals, colon -->
  1175. <xsl:when test="starts-with($content,'&#x02256;')"><xsl:value-of select="'\eqcirc '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x02256;')"/></xsl:call-template></xsl:when> <!--/eqcirc R: circle on equals sign --> <!-- Required amssymb -->
  1176. <xsl:when test="starts-with($content,'&#x02257;')"><xsl:value-of select="'\circeq '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x02257;')"/></xsl:call-template></xsl:when> <!--/circeq R: circle, equals --> <!-- Required amssymb -->
  1177. <!-- ? --> <xsl:when test="starts-with($content,'&#x02258;')"><xsl:value-of select="'\stackrel{\frown}{=}'" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x02258;')"/></xsl:call-template></xsl:when>
  1178. <!-- ? --> <xsl:when test="starts-with($content,'&#x02259;')"><xsl:value-of select="'\stackrel{\wedge}{=}'" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x02259;')"/></xsl:call-template></xsl:when> <!--/wedgeq R: corresponds to (wedge, equals) -->
  1179. <!-- ? --> <xsl:when test="starts-with($content,'&#x0225A;')"><xsl:value-of select="'\stackrel{\vee}{=}'" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x0225A;')"/></xsl:call-template></xsl:when> <!--logical or, equals -->
  1180. <!-- ? --> <xsl:when test="starts-with($content,'&#x0225B;')"><xsl:value-of select="'\stackrel{\star}{=}'" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x0225B;')"/></xsl:call-template></xsl:when> <!--equal, asterisk above -->
  1181. <xsl:when test="starts-with($content,'&#x0225C;')"><xsl:value-of select="'\triangleq '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x0225C;')"/></xsl:call-template></xsl:when> <!--/triangleq R: triangle, equals --> <!-- Required amssymb -->
  1182. <!-- ? --> <xsl:when test="starts-with($content,'&#x0225D;')"><xsl:value-of select="'\stackrel{\scriptscriptstyle\mathrm{def}}{=}'" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x0225D;')"/></xsl:call-template></xsl:when>
  1183. <!-- ? --> <xsl:when test="starts-with($content,'&#x0225E;')"><xsl:value-of select="'\stackrel{\scriptscriptstyle\mathrm{m}}{=}'" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x0225E;')"/></xsl:call-template></xsl:when>
  1184. <!-- ? --> <xsl:when test="starts-with($content,'&#x0225F;')"><xsl:value-of select="'\stackrel{?}{=}'" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x0225F;')"/></xsl:call-template></xsl:when> <!--/questeq R: equal with questionmark -->
  1185. <!-- <xsl:when test="starts-with($content,'&#x02260;&#x0FE00;')"><xsl:value-of select="' '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x02260;&#x0FE00;')"/></xsl:call-template></xsl:when> not equal, dot -->
  1186. <xsl:when test="starts-with($content,'&#x02260;')"><xsl:value-of select="'\ne '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x02260;')"/></xsl:call-template></xsl:when> <!--/ne /neq R: not equal -->
  1187. <!-- <xsl:when test="starts-with($content,'&#x02261;&#x020E5;')"><xsl:value-of select="' '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x02261;&#x020E5;')"/></xsl:call-template></xsl:when> reverse not equivalent -->
  1188. <xsl:when test="starts-with($content,'&#x02261;')"><xsl:value-of select="'\equiv '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x02261;')"/></xsl:call-template></xsl:when> <!--/equiv R: identical with -->
  1189. <xsl:when test="starts-with($content,'&#x02262;')"><xsl:value-of select="'\not\equiv '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x02262;')"/></xsl:call-template></xsl:when> <!--/nequiv N: not identical with -->
  1190. <!-- <xsl:when test="starts-with($content,'&#x02263;')"><xsl:value-of select="' '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x02263;')"/></xsl:call-template></xsl:when> -->
  1191. <xsl:when test="starts-with($content,'&#x02264;')"><xsl:value-of select="'\le '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x02264;')"/></xsl:call-template></xsl:when> <!--/leq /le R: less-than-or-equal -->
  1192. <xsl:when test="starts-with($content,'&#x02265;')"><xsl:value-of select="'\ge '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x02265;')"/></xsl:call-template></xsl:when> <!--/geq /ge R: greater-than-or-equal -->
  1193. <xsl:when test="starts-with($content,'&#x02266;')"><xsl:value-of select="'\leqq '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x02266;')"/></xsl:call-template></xsl:when> <!--/leqq R: less, double equals --> <!-- Required amssymb -->
  1194. <xsl:when test="starts-with($content,'&#x02267;')"><xsl:value-of select="'\geqq '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x02267;')"/></xsl:call-template></xsl:when> <!--/geqq R: greater, double equals --> <!-- Required amssymb -->
  1195. <xsl:when test="starts-with($content,'&#x02268;')"><xsl:value-of select="'\lneqq '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x02268;')"/></xsl:call-template></xsl:when> <!--/lneqq N: less, not double equals --> <!-- Required amssymb -->
  1196. <xsl:when test="starts-with($content,'&#x02269;')"><xsl:value-of select="'\gneqq '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x02269;')"/></xsl:call-template></xsl:when> <!--/gneqq N: greater, not dbl equals --> <!-- Required amssymb -->
  1197. <!-- <xsl:when test="starts-with($content,'&#x0226A;&#x00338;&#x0FE00;')"><xsl:value-of select="' '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x0226A;&#x00338;&#x0FE00;')"/></xsl:call-template></xsl:when> not much less than, variant -->
  1198. <!-- <xsl:when test="starts-with($content,'&#x0226A;&#x00338;')"><xsl:value-of select="' '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x0226A;&#x00338;')"/></xsl:call-template></xsl:when> not, vert, much less than -->
  1199. <xsl:when test="starts-with($content,'&#x0226A;')"><xsl:value-of select="'\ll '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x0226A;')"/></xsl:call-template></xsl:when> <!--/ll R: double less-than sign -->
  1200. <!-- <xsl:when test="starts-with($content,'&#x0226B;&#x00338;&#x0FE00;')"><xsl:value-of select="' '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x0226B;&#x00338;&#x0FE00;')"/></xsl:call-template></xsl:when> not much greater than, variant -->
  1201. <!-- <xsl:when test="starts-with($content,'&#x0226B;&#x00338;')"><xsl:value-of select="' '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x0226B;&#x00338;')"/></xsl:call-template></xsl:when> not, vert, much greater than -->
  1202. <xsl:when test="starts-with($content,'&#x0226B;')"><xsl:value-of select="'\gg '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x0226B;')"/></xsl:call-template></xsl:when> <!--/gg R: dbl greater-than sign -->
  1203. <xsl:when test="starts-with($content,'&#x0226C;')"><xsl:value-of select="'\between '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x0226C;')"/></xsl:call-template></xsl:when> <!--/between R: between --> <!-- Required amssymb -->
  1204. <xsl:when test="starts-with($content,'&#x0226D;')"><xsl:value-of select="'\not\asymp '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x0226D;')"/></xsl:call-template></xsl:when>
  1205. <xsl:when test="starts-with($content,'&#x0226E;')"><xsl:value-of select="'\nless '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x0226E;')"/></xsl:call-template></xsl:when> <!--/nless N: not less-than --> <!-- Required amssymb -->
  1206. <xsl:when test="starts-with($content,'&#x0226F;')"><xsl:value-of select="'\ngtr '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x0226F;')"/></xsl:call-template></xsl:when> <!--/ngtr N: not greater-than --> <!-- Required amssymb -->
  1207. <xsl:when test="starts-with($content,'&#x02270;&#x020E5;')"><xsl:value-of select="'\nleq '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x02270;&#x020E5;')"/></xsl:call-template></xsl:when> <!--/nleq N: not less-than-or-equal --> <!-- Required amssymb -->
  1208. <xsl:when test="starts-with($content,'&#x02270;')"><xsl:value-of select="'\nleqq '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x02270;')"/></xsl:call-template></xsl:when> <!--/nleqq N: not less, dbl equals --> <!-- Required amssymb -->
  1209. <xsl:when test="starts-with($content,'&#x02271;&#x020E5;')"><xsl:value-of select="'\ngeq '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x02271;&#x020E5;')"/></xsl:call-template></xsl:when> <!--/ngeq N: not greater-than-or-equal --> <!-- Required amssymb -->
  1210. <xsl:when test="starts-with($content,'&#x02271;')"><xsl:value-of select="'\ngeqq '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x02271;')"/></xsl:call-template></xsl:when> <!--/ngeqq N: not greater, dbl equals --> <!-- Required amssymb -->
  1211. <xsl:when test="starts-with($content,'&#x02272;')"><xsl:value-of select="'\lesssim '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x02272;')"/></xsl:call-template></xsl:when> <!--/lesssim R: less, similar --> <!-- Required amssymb -->
  1212. <xsl:when test="starts-with($content,'&#x02273;')"><xsl:value-of select="'\gtrsim '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x02273;')"/></xsl:call-template></xsl:when> <!--/gtrsim R: greater, similar --> <!-- Required amssymb -->
  1213. <xsl:when test="starts-with($content,'&#x02274;')"><xsl:value-of select="'\not\lesssim '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x02274;')"/></xsl:call-template></xsl:when> <!--not less, similar --> <!-- Required amssymb -->
  1214. <xsl:when test="starts-with($content,'&#x02275;')"><xsl:value-of select="'\not\gtrsim '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x02275;')"/></xsl:call-template></xsl:when> <!--not greater, similar --> <!-- Required amssymb -->
  1215. <xsl:when test="starts-with($content,'&#x02276;')"><xsl:value-of select="'\lessgtr '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x02276;')"/></xsl:call-template></xsl:when> <!--/lessgtr R: less, greater --> <!-- Required amssymb -->
  1216. <xsl:when test="starts-with($content,'&#x02277;')"><xsl:value-of select="'\gtrless '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x02277;')"/></xsl:call-template></xsl:when> <!--/gtrless R: greater, less --> <!-- Required amssymb -->
  1217. <xsl:when test="starts-with($content,'&#x02278;')"><xsl:value-of select="'\not\lessgtr '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x02278;')"/></xsl:call-template></xsl:when> <!--not less, greater --> <!-- Required amssymb -->
  1218. <xsl:when test="starts-with($content,'&#x02279;')"><xsl:value-of select="'\not\gtrless '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x02279;')"/></xsl:call-template></xsl:when> <!--not greater, less --> <!-- Required amssymb -->
  1219. <xsl:when test="starts-with($content,'&#x0227A;')"><xsl:value-of select="'\prec '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x0227A;')"/></xsl:call-template></xsl:when> <!--/prec R: precedes -->
  1220. <xsl:when test="starts-with($content,'&#x0227B;')"><xsl:value-of select="'\succ '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x0227B;')"/></xsl:call-template></xsl:when> <!--/succ R: succeeds -->
  1221. <xsl:when test="starts-with($content,'&#x0227C;')"><xsl:value-of select="'\preccurlyeq '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x0227C;')"/></xsl:call-template></xsl:when> <!--/preccurlyeq R: precedes, curly eq --> <!-- Required amssymb -->
  1222. <xsl:when test="starts-with($content,'&#x0227D;')"><xsl:value-of select="'\succcurlyeq '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x0227D;')"/></xsl:call-template></xsl:when> <!--/succcurlyeq R: succeeds, curly eq --> <!-- Required amssymb -->
  1223. <xsl:when test="starts-with($content,'&#x0227E;')"><xsl:value-of select="'\precsim '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x0227E;')"/></xsl:call-template></xsl:when> <!--/precsim R: precedes, similar --> <!-- Required amssymb -->
  1224. <xsl:when test="starts-with($content,'&#x0227F;')"><xsl:value-of select="'\succsim '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x0227F;')"/></xsl:call-template></xsl:when> <!--/succsim R: succeeds, similar --> <!-- Required amssymb -->
  1225. <xsl:when test="starts-with($content,'&#x02280;')"><xsl:value-of select="'\nprec '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x02280;')"/></xsl:call-template></xsl:when> <!--/nprec N: not precedes --> <!-- Required amssymb -->
  1226. <xsl:when test="starts-with($content,'&#x02281;')"><xsl:value-of select="'\nsucc '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x02281;')"/></xsl:call-template></xsl:when> <!--/nsucc N: not succeeds --> <!-- Required amssymb -->
  1227. <xsl:when test="starts-with($content,'&#x02282;')"><xsl:value-of select="'\subset '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x02282;')"/></xsl:call-template></xsl:when> <!--/subset R: subset or is implied by -->
  1228. <xsl:when test="starts-with($content,'&#x02283;')"><xsl:value-of select="'\supset '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x02283;')"/></xsl:call-template></xsl:when> <!--/supset R: superset or implies -->
  1229. <xsl:when test="starts-with($content,'&#x02284;')"><xsl:value-of select="'\not\subset '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x02284;')"/></xsl:call-template></xsl:when> <!--not subset -->
  1230. <xsl:when test="starts-with($content,'&#x02285;')"><xsl:value-of select="'\not\supset '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x02285;')"/></xsl:call-template></xsl:when> <!--not superset -->
  1231. <xsl:when test="starts-with($content,'&#x02286;')"><xsl:value-of select="'\subseteq '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x02286;')"/></xsl:call-template></xsl:when> <!--/subseteq R: subset, equals -->
  1232. <xsl:when test="starts-with($content,'&#x02287;')"><xsl:value-of select="'\supseteq '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x02287;')"/></xsl:call-template></xsl:when> <!--/supseteq R: superset, equals -->
  1233. <xsl:when test="starts-with($content,'&#x0228E;')"><xsl:value-of select="'\uplus '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x0228E;')"/></xsl:call-template></xsl:when> <!--/uplus B: plus sign in union -->
  1234. <xsl:when test="starts-with($content,'&#x02293;')"><xsl:value-of select="'\sqcap '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x02293;')"/></xsl:call-template></xsl:when> <!--/sqcap B: square intersection -->
  1235. <xsl:when test="starts-with($content,'&#x02294;')"><xsl:value-of select="'\bigsqcup '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x02294;')"/></xsl:call-template></xsl:when> <!--/sqcup B: square union -->
  1236. <xsl:when test="starts-with($content,'&#x02295;')"><xsl:value-of select="'\oplus '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x02295;')"/></xsl:call-template></xsl:when> <!--/oplus B: plus sign in circle -->
  1237. <xsl:when test="starts-with($content,'&#x02296;')"><xsl:value-of select="'\ominus '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x02296;')"/></xsl:call-template></xsl:when> <!--/ominus B: minus sign in circle -->
  1238. <xsl:when test="starts-with($content,'&#x02297;')"><xsl:value-of select="'\otimes '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x02297;')"/></xsl:call-template></xsl:when> <!--/otimes B: multiply sign in circle -->
  1239. <xsl:when test="starts-with($content,'&#x02298;')"><xsl:value-of select="'\oslash '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x02298;')"/></xsl:call-template></xsl:when> <!--/oslash B: solidus in circle -->
  1240. <!-- ? --> <xsl:when test="starts-with($content,'&#x02299;')"><xsl:value-of select="'\odot '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x02299;')"/></xsl:call-template></xsl:when> <!--/odot B: middle dot in circle --> <!--/bigodot L: circle dot operator -->
  1241. <xsl:when test="starts-with($content,'&#x0229F;')"><xsl:value-of select="'\boxminus '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x0229F;')"/></xsl:call-template></xsl:when> <!--/boxminus B: minus sign in box --> <!-- Required amssymb -->
  1242. <xsl:when test="starts-with($content,'&#x022A4;')"><xsl:value-of select="'\top '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x022A4;')"/></xsl:call-template></xsl:when> <!--/top top -->
  1243. <xsl:when test="starts-with($content,'&#x022A5;')"><xsl:value-of select="'\perp '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x022A5;')"/></xsl:call-template></xsl:when> <!--/perp R: perpendicular --><!--/bot bottom -->
  1244. <xsl:when test="starts-with($content,'&#x022A6;')"><xsl:value-of select="'\vdash '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x022A6;')"/></xsl:call-template></xsl:when> <!--/vdash R: vertical, dash -->
  1245. <xsl:when test="starts-with($content,'&#x022A7;')"><xsl:value-of select="'\vDash '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x022A7;')"/></xsl:call-template></xsl:when> <!--/vDash R: vertical, dbl dash --> <!-- Required amssymb -->
  1246. <xsl:when test="starts-with($content,'&#x022A8;')"><xsl:value-of select="'\models '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x022A8;')"/></xsl:call-template></xsl:when> <!--/models R: -->
  1247. <xsl:when test="starts-with($content,'&#x022AA;')"><xsl:value-of select="'\Vvdash '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x022AA;')"/></xsl:call-template></xsl:when> <!--/Vvdash R: triple vertical, dash --> <!-- Required amssymb -->
  1248. <xsl:when test="starts-with($content,'&#x022C0;')"><xsl:value-of select="'\bigwedge '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x022C0;')"/></xsl:call-template></xsl:when> <!--/bigwedge L: logical or operator -->
  1249. <xsl:when test="starts-with($content,'&#x022C1;')"><xsl:value-of select="'\bigvee '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x022C1;')"/></xsl:call-template></xsl:when> <!--/bigcap L: intersection operator -->
  1250. <xsl:when test="starts-with($content,'&#x022C2;')"><xsl:value-of select="'\bigcap '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x022C2;')"/></xsl:call-template></xsl:when> <!--/bigvee L: logical and operator -->
  1251. <xsl:when test="starts-with($content,'&#x022C3;')"><xsl:value-of select="'\bigcup '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x022C3;')"/></xsl:call-template></xsl:when> <!--/bigcup L: union operator -->
  1252. <xsl:when test="starts-with($content,'&#x022C4;')"><xsl:value-of select="'\diamond '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x022C4;')"/></xsl:call-template></xsl:when> <!--/diamond B: open diamond -->
  1253. <xsl:when test="starts-with($content,'&#x022C5;')"><xsl:value-of select="'\cdot '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x022C5;')"/></xsl:call-template></xsl:when> <!--/cdot B: small middle dot -->
  1254. <xsl:when test="starts-with($content,'&#x022C6;')"><xsl:value-of select="'\star '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x022C6;')"/></xsl:call-template></xsl:when> <!--/star B: small star, filled -->
  1255. <xsl:when test="starts-with($content,'&#x022C7;')"><xsl:value-of select="'\divideontimes '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x022C7;')"/></xsl:call-template></xsl:when> <!--/divideontimes B: division on times --> <!-- Required amssymb -->
  1256. <xsl:when test="starts-with($content,'&#x022C8;')"><xsl:value-of select="'\bowtie '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x022C8;')"/></xsl:call-template></xsl:when> <!--/bowtie R: -->
  1257. <xsl:when test="starts-with($content,'&#x022CD;')"><xsl:value-of select="'\backsimeq '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x022CD;')"/></xsl:call-template></xsl:when> <!--/backsimeq R: reverse similar, eq --> <!-- Required amssymb -->
  1258. <xsl:when test="starts-with($content,'&#x022EF;')"><xsl:value-of select="'\cdots '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x022EF;')"/></xsl:call-template></xsl:when> <!--/cdots, three dots, centered -->
  1259. <!-- <xsl:when test="starts-with($content,'&#x022F0;')"><xsl:value-of select="' '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x022F0;')"/></xsl:call-template></xsl:when> three dots, ascending -->
  1260. <xsl:when test="starts-with($content,'&#x022F1;')"><xsl:value-of select="'\ddots '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x022F1;')"/></xsl:call-template></xsl:when> <!--/ddots, three dots, descending -->
  1261. <!-- ====================================================================== -->
  1262. <xsl:when test="starts-with($content,'&#x025A1;')"><xsl:value-of select="'\square '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x025A1;')"/></xsl:call-template></xsl:when> <!--/square, square --> <!-- Required amssymb -->
  1263. <xsl:when test="starts-with($content,'&#x025AA;')"><xsl:value-of select="'\blacksquare '" /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '&#x025AA;')"/></xsl:call-template></xsl:when> <!--/blacksquare, square, filled --> <!-- Required amssymb -->
  1264. <xsl:when test='starts-with($content,"&apos;")'><xsl:value-of select='"\text{&apos;}"' /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select='substring-after($content, "&apos;")'/></xsl:call-template></xsl:when><!-- \text required amslatex -->
  1265. <xsl:when test='starts-with($content,"(")'><xsl:value-of select='"\left("' /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '(')"/></xsl:call-template></xsl:when>
  1266. <xsl:when test='starts-with($content,")")'><xsl:value-of select='"\right)"' /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, ')')"/></xsl:call-template></xsl:when>
  1267. <xsl:when test='starts-with($content,"[")'><xsl:value-of select='"\left["' /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '[')"/></xsl:call-template></xsl:when>
  1268. <xsl:when test='starts-with($content,"]")'><xsl:value-of select='"\right]"' /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, ']')"/></xsl:call-template></xsl:when>
  1269. <xsl:when test='starts-with($content,"{")'><xsl:value-of select='"\left\{"' /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '{')"/></xsl:call-template></xsl:when>
  1270. <xsl:when test='starts-with($content,"}")'><xsl:value-of select='"\right\}"' /><xsl:call-template name="replaceEntities"><xsl:with-param name="content" select="substring-after($content, '}')"/></xsl:call-template></xsl:when>
  1271. <xsl:otherwise>
  1272. <xsl:value-of select="substring($content,1,1)"/>
  1273. <xsl:call-template name="replaceEntities">
  1274. <xsl:with-param name="content" select="substring($content, 2)"/>
  1275. </xsl:call-template>
  1276. </xsl:otherwise>
  1277. </xsl:choose></xsl:if>
  1278. </xsl:template>
  1279. <xsl:template name="replaceMtextEntities">
  1280. <xsl:param name="content"/>
  1281. <xsl:choose>
  1282. <xsl:when test="contains($content,'&#x02009;&#x0200A;&#x0200A;')"> <!-- ThickSpace - space of width 5/18 em -->
  1283. <xsl:call-template name="replaceMtextEntities">
  1284. <xsl:with-param name="content" select="concat(substring-before($content,'&#x02009;&#x0200A;&#x0200A;'),'\hspace{0.28em}',substring-after($content,'&#x02009;&#x0200A;&#x0200A;'))"/>
  1285. </xsl:call-template>
  1286. </xsl:when>
  1287. <xsl:when test="contains($content,'&#x02009;')"> <!-- ThinSpace - space of width 3/18 em -->
  1288. <xsl:call-template name="replaceMtextEntities">
  1289. <xsl:with-param name="content" select="concat(substring-before($content,'&#x02009;'),'\hspace{0.17em}',substring-after($content,'&#x02009;'))"/>
  1290. </xsl:call-template>
  1291. </xsl:when>
  1292. <xsl:otherwise>
  1293. <xsl:value-of select="normalize-space($content)"/>
  1294. </xsl:otherwise>
  1295. </xsl:choose>
  1296. </xsl:template>
  1297. <!-- ====================================================================== -->
  1298. <!-- $id: tables.xsl, 2002/17/05 Exp $
  1299. This file is part of the XSLT MathML Library distribution.
  1300. See ./README or http://www.raleigh.ru/MathML/mmltex for
  1301. copyright and other information -->
  1302. <!-- ====================================================================== -->
  1303. <xsl:template match="m:mtd[@columnspan]">
  1304. <xsl:text>\multicolumn{</xsl:text>
  1305. <xsl:value-of select="@columnspan"/>
  1306. <xsl:text>}{c}{</xsl:text>
  1307. <xsl:apply-templates/>
  1308. <xsl:text>}</xsl:text>
  1309. <xsl:if test="count(following-sibling::*)>0">
  1310. <xsl:text>&amp; </xsl:text>
  1311. </xsl:if>
  1312. </xsl:template>
  1313. <xsl:template match="m:mtd">
  1314. <xsl:if test="@columnalign='right' or @columnalign='center'">
  1315. <xsl:text>\hfill </xsl:text>
  1316. </xsl:if>
  1317. <xsl:apply-templates/>
  1318. <xsl:if test="@columnalign='left' or @columnalign='center'">
  1319. <xsl:text>\hfill </xsl:text>
  1320. </xsl:if>
  1321. <xsl:if test="count(following-sibling::*)>0">
  1322. <!-- this test valid for Sablotron, another form - test="not(position()=last())".
  1323. Also for m:mtd[@columnspan] and m:mtr -->
  1324. <xsl:text>&amp; </xsl:text>
  1325. </xsl:if>
  1326. </xsl:template>
  1327. <xsl:template match="m:mtr">
  1328. <xsl:apply-templates/>
  1329. <xsl:if test="count(following-sibling::*)>0">
  1330. <xsl:text>\\ </xsl:text>
  1331. </xsl:if>
  1332. </xsl:template>
  1333. <xsl:template match="m:mtable">
  1334. <xsl:text>\begin{array}{</xsl:text>
  1335. <xsl:if test="@frame='solid'">
  1336. <xsl:text>|</xsl:text>
  1337. </xsl:if>
  1338. <xsl:variable name="numbercols" select="count(./m:mtr[1]/m:mtd[not(@columnspan)])+sum(./m:mtr[1]/m:mtd/@columnspan)"/>
  1339. <xsl:choose>
  1340. <xsl:when test="@columnalign">
  1341. <xsl:variable name="colalign">
  1342. <xsl:call-template name="colalign">
  1343. <xsl:with-param name="colalign" select="@columnalign"/>
  1344. </xsl:call-template>
  1345. </xsl:variable>
  1346. <xsl:choose>
  1347. <xsl:when test="string-length($colalign) > $numbercols">
  1348. <xsl:value-of select="substring($colalign,1,$numbercols)"/>
  1349. </xsl:when>
  1350. <xsl:when test="string-length($colalign) &lt; $numbercols">
  1351. <xsl:value-of select="$colalign"/>
  1352. <xsl:call-template name="generate-string">
  1353. <xsl:with-param name="text" select="substring($colalign,string-length($colalign))"/>
  1354. <xsl:with-param name="count" select="$numbercols - string-length($colalign)"/>
  1355. </xsl:call-template>
  1356. </xsl:when>
  1357. <xsl:otherwise>
  1358. <xsl:value-of select="$colalign"/>
  1359. </xsl:otherwise>
  1360. </xsl:choose>
  1361. </xsl:when>
  1362. <xsl:otherwise>
  1363. <xsl:call-template name="generate-string">
  1364. <xsl:with-param name="text" select="'c'"/>
  1365. <xsl:with-param name="count" select="$numbercols"/>
  1366. </xsl:call-template>
  1367. </xsl:otherwise>
  1368. </xsl:choose>
  1369. <xsl:if test="@frame='solid'">
  1370. <xsl:text>|</xsl:text>
  1371. </xsl:if>
  1372. <xsl:text>}</xsl:text>
  1373. <xsl:if test="@frame='solid'">
  1374. <xsl:text>\hline </xsl:text>
  1375. </xsl:if>
  1376. <xsl:apply-templates/>
  1377. <xsl:if test="@frame='solid'">
  1378. <xsl:text>\\ \hline</xsl:text>
  1379. </xsl:if>
  1380. <xsl:text>\end{array}</xsl:text>
  1381. </xsl:template>
  1382. <xsl:template name="colalign">
  1383. <xsl:param name="colalign"/>
  1384. <xsl:choose>
  1385. <xsl:when test="contains($colalign,' ')">
  1386. <xsl:value-of select="substring($colalign,1,1)"/>
  1387. <xsl:call-template name="colalign">
  1388. <xsl:with-param name="colalign" select="substring-after($colalign,' ')"/>
  1389. </xsl:call-template>
  1390. </xsl:when>
  1391. <xsl:otherwise>
  1392. <xsl:value-of select="substring($colalign,1,1)"/>
  1393. </xsl:otherwise>
  1394. </xsl:choose>
  1395. </xsl:template>
  1396. <xsl:template name="generate-string">
  1397. <!-- template from XSLT Standard Library v1.1 -->
  1398. <xsl:param name="text"/>
  1399. <xsl:param name="count"/>
  1400. <xsl:choose>
  1401. <xsl:when test="string-length($text) = 0 or $count &lt;= 0"/>
  1402. <xsl:otherwise>
  1403. <xsl:value-of select="$text"/>
  1404. <xsl:call-template name="generate-string">
  1405. <xsl:with-param name="text" select="$text"/>
  1406. <xsl:with-param name="count" select="$count - 1"/>
  1407. </xsl:call-template>
  1408. </xsl:otherwise>
  1409. </xsl:choose>
  1410. </xsl:template>
  1411. <!-- ====================================================================== -->
  1412. <!-- $Id: scripts.xsl,v 1.1.1.1 2002/10/26 14:20:06 shade33 Exp $
  1413. This file is part of the XSLT MathML Library distribution.
  1414. See ./README or http://www.raleigh.ru/MathML/mmltex for
  1415. copyright and other information -->
  1416. <!-- ====================================================================== -->
  1417. <xsl:template match="m:munderover">
  1418. <xsl:variable name="base">
  1419. <xsl:call-template name="startspace">
  1420. <xsl:with-param name="symbol" select="./*[1]"/>
  1421. </xsl:call-template>
  1422. </xsl:variable>
  1423. <xsl:variable name="under">
  1424. <xsl:call-template name="startspace">
  1425. <xsl:with-param name="symbol" select="./*[2]"/>
  1426. </xsl:call-template>
  1427. </xsl:variable>
  1428. <xsl:variable name="over">
  1429. <xsl:call-template name="startspace">
  1430. <xsl:with-param name="symbol" select="./*[3]"/>
  1431. </xsl:call-template>
  1432. </xsl:variable>
  1433. <xsl:choose>
  1434. <xsl:when test="$over='&#x000AF;'"> <!-- OverBar - over bar -->
  1435. <xsl:text>\overline{</xsl:text>
  1436. <xsl:call-template name="munder">
  1437. <xsl:with-param name="base" select="$base"/>
  1438. <xsl:with-param name="under" select="$under"/>
  1439. </xsl:call-template>
  1440. <xsl:text>}</xsl:text>
  1441. </xsl:when>
  1442. <xsl:when test="$over='&#x0FE37;'"> <!-- OverBrace - over brace -->
  1443. <xsl:text>\overbrace{</xsl:text>
  1444. <xsl:call-template name="munder">
  1445. <xsl:with-param name="base" select="$base"/>
  1446. <xsl:with-param name="under" select="$under"/>
  1447. </xsl:call-template>
  1448. <xsl:text>}</xsl:text>
  1449. </xsl:when>
  1450. <xsl:when test="$under='&#x00332;'"> <!-- UnderBar - combining low line -->
  1451. <xsl:text>\underline{</xsl:text>
  1452. <xsl:call-template name="mover">
  1453. <xsl:with-param name="base" select="$base"/>
  1454. <xsl:with-param name="over" select="$over"/>
  1455. <xsl:with-param name="pos_over" select="3"/>
  1456. </xsl:call-template>
  1457. <xsl:text>}</xsl:text>
  1458. </xsl:when>
  1459. <xsl:when test="$under='&#x0FE38;'"> <!-- UnderBrace - under brace -->
  1460. <xsl:text>\underbrace{</xsl:text>
  1461. <xsl:call-template name="mover">
  1462. <xsl:with-param name="base" select="$base"/>
  1463. <xsl:with-param name="over" select="$over"/>
  1464. <xsl:with-param name="pos_over" select="3"/>
  1465. </xsl:call-template>
  1466. <xsl:text>}</xsl:text>
  1467. </xsl:when>
  1468. <xsl:when test="translate($base,'&#x0220F;&#x02210;&#x022c2;&#x022c3;&#x02294;',
  1469. '&#x02211;&#x02211;&#x02211;&#x02211;&#x02211;')='&#x02211;'">
  1470. <!-- if $base is operator, such as
  1471. &#x02211; /sum L: summation operator
  1472. &#x0220F; /prod L: product operator
  1473. &#x02210; /coprod L: coproduct operator
  1474. &#x022c2; /bigcap
  1475. &#x022c3; /bigcup
  1476. &#x02294; /bigsqcup
  1477. -->
  1478. <xsl:apply-templates select="./*[1]"/>
  1479. <xsl:text>_{</xsl:text>
  1480. <xsl:apply-templates select="./*[2]"/>
  1481. <xsl:text>}^{</xsl:text>
  1482. <xsl:apply-templates select="./*[3]"/>
  1483. <xsl:text>}</xsl:text>
  1484. </xsl:when>
  1485. <xsl:otherwise>
  1486. <xsl:text>\underset{</xsl:text>
  1487. <xsl:apply-templates select="./*[2]"/>
  1488. <xsl:text>}{\overset{</xsl:text>
  1489. <xsl:apply-templates select="./*[3]"/>
  1490. <xsl:text>}{</xsl:text>
  1491. <xsl:apply-templates select="./*[1]"/>
  1492. <xsl:text>}}</xsl:text>
  1493. </xsl:otherwise>
  1494. </xsl:choose>
  1495. </xsl:template>
  1496. <xsl:template match="m:mover">
  1497. <xsl:call-template name="mover">
  1498. <xsl:with-param name="base">
  1499. <xsl:call-template name="startspace">
  1500. <xsl:with-param name="symbol" select="./*[1]"/>
  1501. </xsl:call-template>
  1502. </xsl:with-param>
  1503. <xsl:with-param name="over">
  1504. <xsl:call-template name="startspace">
  1505. <xsl:with-param name="symbol" select="./*[2]"/>
  1506. </xsl:call-template>
  1507. </xsl:with-param>
  1508. </xsl:call-template>
  1509. </xsl:template>
  1510. <xsl:template match="m:munder">
  1511. <xsl:call-template name="munder">
  1512. <xsl:with-param name="base">
  1513. <xsl:call-template name="startspace">
  1514. <xsl:with-param name="symbol" select="./*[1]"/>
  1515. </xsl:call-template>
  1516. </xsl:with-param>
  1517. <xsl:with-param name="under">
  1518. <xsl:call-template name="startspace">
  1519. <xsl:with-param name="symbol" select="./*[2]"/>
  1520. </xsl:call-template>
  1521. </xsl:with-param>
  1522. </xsl:call-template>
  1523. </xsl:template>
  1524. <xsl:template name="mover">
  1525. <xsl:param name="base"/>
  1526. <xsl:param name="over"/>
  1527. <xsl:param name="pos_over" select="2"/>
  1528. <xsl:choose>
  1529. <xsl:when test="$over='&#x000AF;'"> <!-- OverBar - over bar -->
  1530. <xsl:text>\overline{</xsl:text>
  1531. <xsl:apply-templates select="./*[1]"/>
  1532. <xsl:text>}</xsl:text>
  1533. </xsl:when>
  1534. <xsl:when test="$over='&#x0FE37;'"> <!-- OverBrace - over brace -->
  1535. <xsl:text>\overbrace{</xsl:text>
  1536. <xsl:apply-templates select="./*[1]"/>
  1537. <xsl:text>}</xsl:text>
  1538. </xsl:when>
  1539. <xsl:when test="translate($base,'&#x0220F;&#x02210;&#x022c2;&#x022c3;&#x02294;',
  1540. '&#x02211;&#x02211;&#x02211;&#x02211;&#x02211;')='&#x02211;'">
  1541. <!-- if $base is operator, such as
  1542. &#x02211; /sum L: summation operator
  1543. &#x0220F; /prod L: product operator
  1544. &#x02210; /coprod L: coproduct operator
  1545. &#x022c2; /bigcap
  1546. &#x022c3; /bigcup
  1547. &#x02294; /bigsqcup
  1548. -->
  1549. <xsl:apply-templates select="./*[1]"/>
  1550. <xsl:text>^{</xsl:text>
  1551. <xsl:apply-templates select="./*[$pos_over]"/>
  1552. <xsl:text>}</xsl:text>
  1553. </xsl:when>
  1554. <xsl:otherwise>
  1555. <xsl:text>\stackrel{</xsl:text>
  1556. <xsl:apply-templates select="./*[$pos_over]"/>
  1557. <xsl:text>}{</xsl:text>
  1558. <xsl:apply-templates select="./*[1]"/>
  1559. <xsl:text>}</xsl:text>
  1560. <!--
  1561. <xsl:text>\overset{</xsl:text>
  1562. <xsl:apply-templates select="./*[$pos_over]"/>
  1563. <xsl:text>}{</xsl:text>
  1564. <xsl:apply-templates select="./*[1]"/>
  1565. <xsl:text>}</xsl:text>-->
  1566. </xsl:otherwise>
  1567. </xsl:choose>
  1568. </xsl:template>
  1569. <xsl:template name="munder">
  1570. <xsl:param name="base"/>
  1571. <xsl:param name="under"/>
  1572. <xsl:choose>
  1573. <xsl:when test="$under='&#x00332;'"> <!-- UnderBar - combining low line -->
  1574. <xsl:text>\underline{</xsl:text>
  1575. <xsl:apply-templates select="./*[1]"/>
  1576. <xsl:text>}</xsl:text>
  1577. </xsl:when>
  1578. <xsl:when test="$under='&#x0FE38;'"> <!-- UnderBrace - under brace -->
  1579. <xsl:text>\underbrace{</xsl:text>
  1580. <xsl:apply-templates select="./*[1]"/>
  1581. <xsl:text>}</xsl:text>
  1582. </xsl:when>
  1583. <xsl:when test="translate($base,'&#x0220F;&#x02210;&#x022c2;&#x022c3;&#x02294;',
  1584. '&#x02211;&#x02211;&#x02211;&#x02211;&#x02211;')='&#x02211;'">
  1585. <!-- if $base is operator, such as
  1586. &#x02211; /sum L: summation operator
  1587. &#x0220F; /prod L: product operator
  1588. &#x02210; /coprod L: coproduct operator
  1589. &#x022c2; /bigcap
  1590. &#x022c3; /bigcup
  1591. &#x02294; /bigsqcup
  1592. -->
  1593. <xsl:apply-templates select="./*[1]"/>
  1594. <xsl:text>_{</xsl:text>
  1595. <xsl:apply-templates select="./*[2]"/>
  1596. <xsl:text>}</xsl:text>
  1597. </xsl:when>
  1598. <xsl:otherwise>
  1599. <xsl:text>\underset{</xsl:text> <!-- Required AmsMath package -->
  1600. <xsl:apply-templates select="./*[2]"/>
  1601. <xsl:text>}{</xsl:text>
  1602. <xsl:apply-templates select="./*[1]"/>
  1603. <xsl:text>}</xsl:text>
  1604. </xsl:otherwise>
  1605. </xsl:choose>
  1606. </xsl:template>
  1607. <xsl:template match="m:msubsup">
  1608. <xsl:text>{</xsl:text>
  1609. <xsl:apply-templates select="./*[1]"/>
  1610. <xsl:text>}_{</xsl:text>
  1611. <xsl:apply-templates select="./*[2]"/>
  1612. <xsl:text>}^{</xsl:text>
  1613. <xsl:apply-templates select="./*[3]"/>
  1614. <xsl:text>}</xsl:text>
  1615. </xsl:template>
  1616. <xsl:template match="m:msup">
  1617. <xsl:text>{</xsl:text>
  1618. <xsl:apply-templates select="./*[1]"/>
  1619. <xsl:text>}^{</xsl:text>
  1620. <xsl:apply-templates select="./*[2]"/>
  1621. <xsl:text>}</xsl:text>
  1622. </xsl:template>
  1623. <xsl:template match="m:msub">
  1624. <xsl:text>{</xsl:text>
  1625. <xsl:apply-templates select="./*[1]"/>
  1626. <xsl:text>}_{</xsl:text>
  1627. <xsl:apply-templates select="./*[2]"/>
  1628. <xsl:text>}</xsl:text>
  1629. </xsl:template>
  1630. <xsl:template match="m:mmultiscripts" mode="mprescripts">
  1631. <xsl:for-each select="m:mprescripts/following-sibling::*">
  1632. <xsl:if test="position() mod 2 and local-name(.)!='none'">
  1633. <xsl:text>{}_{</xsl:text>
  1634. <xsl:apply-templates select="."/>
  1635. <xsl:text>}</xsl:text>
  1636. </xsl:if>
  1637. <xsl:if test="not(position() mod 2) and local-name(.)!='none'">
  1638. <xsl:text>{}^{</xsl:text>
  1639. <xsl:apply-templates select="."/>
  1640. <xsl:text>}</xsl:text>
  1641. </xsl:if>
  1642. </xsl:for-each>
  1643. <xsl:apply-templates select="./*[1]"/>
  1644. <xsl:for-each select="m:mprescripts/preceding-sibling::*[position()!=last()]">
  1645. <xsl:if test="position()>2 and local-name(.)!='none'">
  1646. <xsl:text>{}</xsl:text>
  1647. </xsl:if>
  1648. <xsl:if test="position() mod 2 and local-name(.)!='none'">
  1649. <xsl:text>_{</xsl:text>
  1650. <xsl:apply-templates select="."/>
  1651. <xsl:text>}</xsl:text>
  1652. </xsl:if>
  1653. <xsl:if test="not(position() mod 2) and local-name(.)!='none'">
  1654. <xsl:text>^{</xsl:text>
  1655. <xsl:apply-templates select="."/>
  1656. <xsl:text>}</xsl:text>
  1657. </xsl:if>
  1658. </xsl:for-each>
  1659. </xsl:template>
  1660. <xsl:template match="m:mmultiscripts">
  1661. <xsl:choose>
  1662. <xsl:when test="m:mprescripts">
  1663. <xsl:apply-templates select="." mode="mprescripts"/>
  1664. </xsl:when>
  1665. <xsl:otherwise>
  1666. <xsl:apply-templates select="./*[1]"/>
  1667. <xsl:for-each select="*[position()>1]">
  1668. <xsl:if test="position()>2 and local-name(.)!='none'">
  1669. <xsl:text>{}</xsl:text>
  1670. </xsl:if>
  1671. <xsl:if test="position() mod 2 and local-name(.)!='none'">
  1672. <xsl:text>_{</xsl:text>
  1673. <xsl:apply-templates select="."/>
  1674. <xsl:text>}</xsl:text>
  1675. </xsl:if>
  1676. <xsl:if test="not(position() mod 2) and local-name(.)!='none'">
  1677. <xsl:text>^{</xsl:text>
  1678. <xsl:apply-templates select="."/>
  1679. <xsl:text>}</xsl:text>
  1680. </xsl:if>
  1681. </xsl:for-each>
  1682. </xsl:otherwise>
  1683. </xsl:choose>
  1684. </xsl:template>
  1685. <!-- ====================================================================== -->
  1686. <!-- $id: glayout.xsl, 2002/17/05 Exp $
  1687. This file is part of the XSLT MathML Library distribution.
  1688. See ./README or http://www.raleigh.ru/MathML/mmltex for
  1689. copyright and other information -->
  1690. <!-- ====================================================================== -->
  1691. <xsl:template match="m:mfrac">
  1692. <xsl:choose>
  1693. <xsl:when test="@bevelled='true'">
  1694. <!-- <xsl:text>\raisebox{1ex}{</xsl:text>
  1695. <xsl:apply-templates select="./*[1]"/>
  1696. <xsl:text>}\!\left/ \!\raisebox{-1ex}{</xsl:text>
  1697. <xsl:apply-templates select="./*[2]"/>
  1698. <xsl:text>}\right.</xsl:text>-->
  1699. </xsl:when>
  1700. <xsl:when test="@linethickness">
  1701. <xsl:text>\genfrac{}{}{</xsl:text>
  1702. <xsl:choose>
  1703. <xsl:when test="number(@linethickness)">
  1704. <xsl:value-of select="@linethickness div 10"/>
  1705. <xsl:text>ex</xsl:text>
  1706. </xsl:when>
  1707. <xsl:when test="@linethickness='thin'">
  1708. <xsl:text>.05ex</xsl:text>
  1709. </xsl:when>
  1710. <xsl:when test="@linethickness='medium'"/>
  1711. <xsl:when test="@linethickness='thick'">
  1712. <xsl:text>.2ex</xsl:text>
  1713. </xsl:when>
  1714. <xsl:otherwise>
  1715. <xsl:value-of select="@linethickness"/>
  1716. </xsl:otherwise>
  1717. </xsl:choose>
  1718. <xsl:text>}{}{</xsl:text>
  1719. </xsl:when>
  1720. <xsl:otherwise>
  1721. <xsl:text>\frac{</xsl:text>
  1722. </xsl:otherwise>
  1723. </xsl:choose>
  1724. <xsl:if test="@numalign='right'">
  1725. <xsl:text>\hfill </xsl:text>
  1726. </xsl:if>
  1727. <xsl:apply-templates select="./*[1]"/>
  1728. <xsl:if test="@numalign='left'">
  1729. <xsl:text>\hfill </xsl:text>
  1730. </xsl:if>
  1731. <xsl:text>}{</xsl:text>
  1732. <xsl:if test="@denomalign='right'">
  1733. <xsl:text>\hfill </xsl:text>
  1734. </xsl:if>
  1735. <xsl:apply-templates select="./*[2]"/>
  1736. <xsl:if test="@denomalign='left'">
  1737. <xsl:text>\hfill </xsl:text>
  1738. </xsl:if>
  1739. <xsl:text>}</xsl:text>
  1740. </xsl:template>
  1741. <xsl:template match="m:mroot">
  1742. <xsl:choose>
  1743. <xsl:when test="count(./*)=2">
  1744. <xsl:text>\sqrt[</xsl:text>
  1745. <xsl:apply-templates select="./*[2]"/>
  1746. <xsl:text>]{</xsl:text>
  1747. <xsl:apply-templates select="./*[1]"/>
  1748. <xsl:text>}</xsl:text>
  1749. </xsl:when>
  1750. <xsl:otherwise>
  1751. <!-- number of arguments is not 2 - code 25 -->
  1752. <xsl:message>exception 25:</xsl:message>
  1753. <xsl:text>\text{exception 25:}</xsl:text>
  1754. </xsl:otherwise>
  1755. </xsl:choose>
  1756. </xsl:template>
  1757. <xsl:template match="m:msqrt">
  1758. <xsl:text>\sqrt{</xsl:text>
  1759. <xsl:apply-templates/>
  1760. <xsl:text>}</xsl:text>
  1761. </xsl:template>
  1762. <xsl:template match="m:mfenced">
  1763. <xsl:choose>
  1764. <xsl:when test="@open">
  1765. <xsl:if test="translate(@open,'{}[]()|','{{{{{{{')='{'">
  1766. <xsl:text>\left</xsl:text>
  1767. </xsl:if>
  1768. <xsl:if test="@open='{' or @open='}'">
  1769. <xsl:text>\</xsl:text>
  1770. </xsl:if>
  1771. <xsl:value-of select="@open"/>
  1772. </xsl:when>
  1773. <xsl:otherwise><xsl:text>\left(</xsl:text></xsl:otherwise>
  1774. </xsl:choose>
  1775. <xsl:choose>
  1776. <xsl:when test="count(./*)>1">
  1777. <xsl:variable name="symbol">
  1778. <xsl:choose>
  1779. <xsl:when test="@separators">
  1780. <xsl:call-template name="startspace">
  1781. <xsl:with-param name="symbol" select="@separators"/>
  1782. </xsl:call-template>
  1783. </xsl:when>
  1784. <xsl:otherwise>,</xsl:otherwise>
  1785. </xsl:choose>
  1786. </xsl:variable>
  1787. <xsl:for-each select="./*">
  1788. <xsl:apply-templates select="."/>
  1789. <xsl:if test="not(position()=last())">
  1790. <xsl:choose>
  1791. <xsl:when test="position()>string-length($symbol)">
  1792. <xsl:value-of select="substring($symbol,string-length($symbol))"/>
  1793. </xsl:when>
  1794. <xsl:otherwise>
  1795. <xsl:value-of select="substring($symbol,position(),1)"/>
  1796. </xsl:otherwise>
  1797. </xsl:choose>
  1798. </xsl:if>
  1799. </xsl:for-each>
  1800. </xsl:when>
  1801. <xsl:otherwise>
  1802. <xsl:apply-templates/>
  1803. </xsl:otherwise>
  1804. </xsl:choose>
  1805. <xsl:choose>
  1806. <xsl:when test="@close">
  1807. <xsl:if test="translate(@open,'{}[]()|','{{{{{{{')='{'">
  1808. <xsl:text>\right</xsl:text>
  1809. </xsl:if>
  1810. <xsl:if test="@open='{' or @open='}'">
  1811. <xsl:text>\</xsl:text>
  1812. </xsl:if>
  1813. <xsl:value-of select="@close"/>
  1814. </xsl:when>
  1815. <xsl:otherwise><xsl:text>\right)</xsl:text></xsl:otherwise>
  1816. </xsl:choose>
  1817. </xsl:template>
  1818. <xsl:template match="m:mphantom">
  1819. <xsl:text>\phantom{</xsl:text>
  1820. <xsl:apply-templates/>
  1821. <xsl:text>}</xsl:text>
  1822. </xsl:template>
  1823. <xsl:template match="m:menclose">
  1824. <xsl:choose>
  1825. <xsl:when test="@notation = 'actuarial'">
  1826. <xsl:text>\overline{</xsl:text>
  1827. <xsl:apply-templates/>
  1828. <xsl:text>\hspace{.2em}|}</xsl:text>
  1829. </xsl:when>
  1830. <xsl:when test="@notation = 'radical'">
  1831. <xsl:text>\sqrt{</xsl:text>
  1832. <xsl:apply-templates/>
  1833. <xsl:text>}</xsl:text>
  1834. </xsl:when>
  1835. <xsl:otherwise>
  1836. <xsl:text>\overline{)</xsl:text>
  1837. <xsl:apply-templates/>
  1838. <xsl:text>}</xsl:text>
  1839. </xsl:otherwise>
  1840. </xsl:choose>
  1841. </xsl:template>
  1842. <xsl:template match="m:mrow">
  1843. <xsl:apply-templates/>
  1844. </xsl:template>
  1845. <xsl:template match="m:mstyle">
  1846. <xsl:if test="@background">
  1847. <xsl:text>\colorbox[rgb]{</xsl:text>
  1848. <xsl:call-template name="color">
  1849. <xsl:with-param name="color" select="@background"/>
  1850. </xsl:call-template>
  1851. <xsl:text>}{$</xsl:text>
  1852. </xsl:if>
  1853. <xsl:if test="@color">
  1854. <xsl:text>\textcolor[rgb]{</xsl:text>
  1855. <xsl:call-template name="color">
  1856. <xsl:with-param name="color" select="@color"/>
  1857. </xsl:call-template>
  1858. <xsl:text>}{</xsl:text>
  1859. </xsl:if>
  1860. <xsl:apply-templates/>
  1861. <xsl:if test="@color">
  1862. <xsl:text>}</xsl:text>
  1863. </xsl:if>
  1864. <xsl:if test="@background">
  1865. <xsl:text>$}</xsl:text>
  1866. </xsl:if>
  1867. </xsl:template>
  1868. <!--
  1869. <xsl:template match="m:mstyle">
  1870. <xsl:if test="@displaystyle='true'">
  1871. <xsl:text>{\displaystyle</xsl:text>
  1872. </xsl:if>
  1873. <xsl:if test="@scriptlevel=2">
  1874. <xsl:text>{\scriptscriptstyle</xsl:text>
  1875. </xsl:if>
  1876. <xsl:apply-templates/>
  1877. <xsl:if test="@scriptlevel=2">
  1878. <xsl:text>}</xsl:text>
  1879. </xsl:if>
  1880. <xsl:if test="@displaystyle='true'">
  1881. <xsl:text>}</xsl:text>
  1882. </xsl:if>
  1883. </xsl:template>
  1884. -->
  1885. <xsl:template match="m:merror">
  1886. <xsl:apply-templates/>
  1887. </xsl:template>
  1888. <!-- ====================================================================== -->
  1889. <!-- $id: tokens.xsl, 2002/22/11 Exp $
  1890. This file is part of the XSLT MathML Library distribution.
  1891. See ./README or http://www.raleigh.ru/MathML/mmltex for
  1892. copyright and other information -->
  1893. <!-- ====================================================================== -->
  1894. <xsl:template match="m:mi|m:mn|m:mo|m:mtext|m:ms">
  1895. <xsl:call-template name="CommonTokenAtr"/>
  1896. </xsl:template>
  1897. <xsl:template name="mi">
  1898. <xsl:choose>
  1899. <xsl:when test="string-length(normalize-space(.))>1 and not(@mathvariant)">
  1900. <xsl:text>\mathrm{</xsl:text>
  1901. <xsl:apply-templates/>
  1902. <xsl:text>}</xsl:text>
  1903. </xsl:when>
  1904. <xsl:otherwise>
  1905. <xsl:apply-templates/>
  1906. </xsl:otherwise>
  1907. </xsl:choose>
  1908. </xsl:template>
  1909. <xsl:template name="mn">
  1910. <xsl:apply-templates/>
  1911. </xsl:template>
  1912. <xsl:template name="mo">
  1913. <xsl:apply-templates/>
  1914. </xsl:template>
  1915. <xsl:template name="mtext">
  1916. <xsl:variable name="content">
  1917. <xsl:call-template name="replaceMtextEntities">
  1918. <xsl:with-param name="content" select="."/>
  1919. </xsl:call-template>
  1920. </xsl:variable>
  1921. <xsl:text>\text{</xsl:text>
  1922. <xsl:value-of select="$content"/>
  1923. <xsl:text>}</xsl:text>
  1924. </xsl:template>
  1925. <xsl:template match="m:mspace">
  1926. <xsl:text>\phantom{\rule</xsl:text>
  1927. <xsl:if test="@depth">
  1928. <xsl:text>[-</xsl:text>
  1929. <xsl:value-of select="@depth"/>
  1930. <xsl:text>]</xsl:text>
  1931. </xsl:if>
  1932. <xsl:text>{</xsl:text>
  1933. <xsl:if test="not(@width)">
  1934. <xsl:text>0ex</xsl:text>
  1935. </xsl:if>
  1936. <xsl:value-of select="@width"/>
  1937. <xsl:text>}{</xsl:text>
  1938. <xsl:if test="not(@height)">
  1939. <xsl:text>0ex</xsl:text>
  1940. </xsl:if>
  1941. <xsl:value-of select="@height"/>
  1942. <xsl:text>}}</xsl:text>
  1943. </xsl:template>
  1944. <xsl:template name="ms">
  1945. <xsl:choose>
  1946. <xsl:when test="@lquote"><xsl:value-of select="@lquote"/></xsl:when>
  1947. <xsl:otherwise><xsl:text>"</xsl:text></xsl:otherwise>
  1948. </xsl:choose><xsl:apply-templates/><xsl:choose>
  1949. <xsl:when test="@rquote"><xsl:value-of select="@rquote"/></xsl:when>
  1950. <xsl:otherwise><xsl:text>"</xsl:text></xsl:otherwise>
  1951. </xsl:choose>
  1952. </xsl:template>
  1953. <xsl:template name="CommonTokenAtr">
  1954. <xsl:if test="@mathbackground">
  1955. <xsl:text>\colorbox[rgb]{</xsl:text>
  1956. <xsl:call-template name="color">
  1957. <xsl:with-param name="color" select="@mathbackground"/>
  1958. </xsl:call-template>
  1959. <xsl:text>}{$</xsl:text>
  1960. </xsl:if>
  1961. <xsl:if test="@color or @mathcolor"> <!-- Note: @color is deprecated in MathML 2.0 -->
  1962. <xsl:text>\textcolor[rgb]{</xsl:text>
  1963. <xsl:call-template name="color">
  1964. <xsl:with-param name="color" select="@color|@mathcolor"/>
  1965. </xsl:call-template>
  1966. <xsl:text>}{</xsl:text>
  1967. </xsl:if>
  1968. <xsl:if test="@mathvariant">
  1969. <xsl:choose>
  1970. <xsl:when test="@mathvariant='normal'">
  1971. <xsl:text>\mathrm{</xsl:text>
  1972. </xsl:when>
  1973. <xsl:when test="@mathvariant='bold'">
  1974. <xsl:text>\mathbf{</xsl:text>
  1975. </xsl:when>
  1976. <xsl:when test="@mathvariant='italic'">
  1977. <xsl:text>\mathit{</xsl:text>
  1978. </xsl:when>
  1979. <xsl:when test="@mathvariant='bold-italic'"> <!-- Required definition -->
  1980. <xsl:text>\mathbit{</xsl:text>
  1981. </xsl:when>
  1982. <xsl:when test="@mathvariant='double-struck'"> <!-- Required amsfonts -->
  1983. <xsl:text>\mathbb{</xsl:text>
  1984. </xsl:when>
  1985. <xsl:when test="@mathvariant='bold-fraktur'"> <!-- Error -->
  1986. <xsl:text>{</xsl:text>
  1987. </xsl:when>
  1988. <xsl:when test="@mathvariant='script'">
  1989. <xsl:text>\mathcal{</xsl:text>
  1990. </xsl:when>
  1991. <xsl:when test="@mathvariant='bold-script'"> <!-- Error -->
  1992. <xsl:text>\mathsc{</xsl:text>
  1993. </xsl:when>
  1994. <xsl:when test="@mathvariant='fraktur'"> <!-- Required amsfonts -->
  1995. <xsl:text>\mathfrak{</xsl:text>
  1996. </xsl:when>
  1997. <xsl:when test="@mathvariant='sans-serif'">
  1998. <xsl:text>\mathsf{</xsl:text>
  1999. </xsl:when>
  2000. <xsl:when test="@mathvariant='bold-sans-serif'"> <!-- Required definition -->
  2001. <xsl:text>\mathbsf{</xsl:text>
  2002. </xsl:when>
  2003. <xsl:when test="@mathvariant='sans-serif-italic'"> <!-- Required definition -->
  2004. <xsl:text>\mathsfit{</xsl:text>
  2005. </xsl:when>
  2006. <xsl:when test="@mathvariant='sans-serif-bold-italic'"> <!-- Error -->
  2007. <xsl:text>\mathbsfit{</xsl:text>
  2008. </xsl:when>
  2009. <xsl:when test="@mathvariant='monospace'">
  2010. <xsl:text>\mathtt{</xsl:text>
  2011. </xsl:when>
  2012. <xsl:otherwise>
  2013. <xsl:text>{</xsl:text>
  2014. </xsl:otherwise>
  2015. </xsl:choose>
  2016. </xsl:if>
  2017. <xsl:call-template name="selectTemplate"/>
  2018. <xsl:if test="@mathvariant">
  2019. <xsl:text>}</xsl:text>
  2020. </xsl:if>
  2021. <xsl:if test="@color or @mathcolor">
  2022. <xsl:text>}</xsl:text>
  2023. </xsl:if>
  2024. <xsl:if test="@mathbackground">
  2025. <xsl:text>$}</xsl:text>
  2026. </xsl:if>
  2027. </xsl:template>
  2028. <xsl:template name="selectTemplate">
  2029. <!-- <xsl:variable name="name" select="local-name()"/>
  2030. <xsl:call-template name="{$name}"/>-->
  2031. <xsl:choose>
  2032. <xsl:when test="local-name(.)='mi'">
  2033. <xsl:call-template name="mi"/>
  2034. </xsl:when>
  2035. <xsl:when test="local-name(.)='mn'">
  2036. <xsl:call-template name="mn"/>
  2037. </xsl:when>
  2038. <xsl:when test="local-name(.)='mo'">
  2039. <xsl:call-template name="mo"/>
  2040. </xsl:when>
  2041. <xsl:when test="local-name(.)='mtext'">
  2042. <xsl:call-template name="mtext"/>
  2043. </xsl:when>
  2044. <xsl:when test="local-name(.)='ms'">
  2045. <xsl:call-template name="ms"/>
  2046. </xsl:when>
  2047. </xsl:choose>
  2048. </xsl:template>
  2049. <xsl:template name="color">
  2050. <!-- NB: Variables colora and valueColor{n} only for Sablotron -->
  2051. <xsl:param name="color"/>
  2052. <xsl:variable name="colora" select="translate($color,'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz')"/>
  2053. <xsl:choose>
  2054. <xsl:when test="starts-with($colora,'#') and string-length($colora)=4">
  2055. <xsl:variable name="valueColor">
  2056. <xsl:call-template name="Hex2Decimal">
  2057. <xsl:with-param name="arg" select="substring($colora,2,1)"/>
  2058. </xsl:call-template>
  2059. </xsl:variable>
  2060. <xsl:value-of select="$valueColor div 15"/><xsl:text>,</xsl:text>
  2061. <xsl:variable name="valueColor1">
  2062. <xsl:call-template name="Hex2Decimal">
  2063. <xsl:with-param name="arg" select="substring($colora,3,1)"/>
  2064. </xsl:call-template>
  2065. </xsl:variable>
  2066. <xsl:value-of select="$valueColor1 div 15"/><xsl:text>,</xsl:text>
  2067. <xsl:variable name="valueColor2">
  2068. <xsl:call-template name="Hex2Decimal">
  2069. <xsl:with-param name="arg" select="substring($colora,4,1)"/>
  2070. </xsl:call-template>
  2071. </xsl:variable>
  2072. <xsl:value-of select="$valueColor2 div 15"/>
  2073. </xsl:when>
  2074. <xsl:when test="starts-with($colora,'#') and string-length($colora)=7">
  2075. <xsl:variable name="valueColor1">
  2076. <xsl:call-template name="Hex2Decimal">
  2077. <xsl:with-param name="arg" select="substring($colora,2,1)"/>
  2078. </xsl:call-template>
  2079. </xsl:variable>
  2080. <xsl:variable name="valueColor2">
  2081. <xsl:call-template name="Hex2Decimal">
  2082. <xsl:with-param name="arg" select="substring($colora,3,1)"/>
  2083. </xsl:call-template>
  2084. </xsl:variable>
  2085. <xsl:value-of select="($valueColor1*16 + $valueColor2) div 255"/><xsl:text>,</xsl:text>
  2086. <xsl:variable name="valueColor1a">
  2087. <xsl:call-template name="Hex2Decimal">
  2088. <xsl:with-param name="arg" select="substring($colora,4,1)"/>
  2089. </xsl:call-template>
  2090. </xsl:variable>
  2091. <xsl:variable name="valueColor2a">
  2092. <xsl:call-template name="Hex2Decimal">
  2093. <xsl:with-param name="arg" select="substring($colora,5,1)"/>
  2094. </xsl:call-template>
  2095. </xsl:variable>
  2096. <xsl:value-of select="($valueColor1a*16 + $valueColor2a) div 255"/><xsl:text>,</xsl:text>
  2097. <xsl:variable name="valueColor1b">
  2098. <xsl:call-template name="Hex2Decimal">
  2099. <xsl:with-param name="arg" select="substring($colora,6,1)"/>
  2100. </xsl:call-template>
  2101. </xsl:variable>
  2102. <xsl:variable name="valueColor2b">
  2103. <xsl:call-template name="Hex2Decimal">
  2104. <xsl:with-param name="arg" select="substring($colora,7,1)"/>
  2105. </xsl:call-template>
  2106. </xsl:variable>
  2107. <xsl:value-of select="($valueColor1b*16 + $valueColor2b) div 255"/>
  2108. </xsl:when>
  2109. <!-- ======================= if color specified as an html-color-name ========================================== -->
  2110. <xsl:when test="$colora='aqua'"><xsl:text>0,1,1</xsl:text></xsl:when>
  2111. <xsl:when test="$colora='black'"><xsl:text>0,0,0</xsl:text></xsl:when>
  2112. <xsl:when test="$colora='blue'"><xsl:text>0,0,1</xsl:text></xsl:when>
  2113. <xsl:when test="$colora='fuchsia'"><xsl:text>1,0,1</xsl:text></xsl:when>
  2114. <xsl:when test="$colora='gray'"><xsl:text>.5,.5,.5</xsl:text></xsl:when>
  2115. <xsl:when test="$colora='green'"><xsl:text>0,.5,0</xsl:text></xsl:when>
  2116. <xsl:when test="$colora='lime'"><xsl:text>0,1,0</xsl:text></xsl:when>
  2117. <xsl:when test="$colora='maroon'"><xsl:text>.5,0,0</xsl:text></xsl:when>
  2118. <xsl:when test="$colora='navy'"><xsl:text>0,0,.5</xsl:text></xsl:when>
  2119. <xsl:when test="$colora='olive'"><xsl:text>.5,.5,0</xsl:text></xsl:when>
  2120. <xsl:when test="$colora='purple'"><xsl:text>.5,0,.5</xsl:text></xsl:when>
  2121. <xsl:when test="$colora='red'"><xsl:text>1,0,0</xsl:text></xsl:when>
  2122. <xsl:when test="$colora='silver'"><xsl:text>.75,.75,.75</xsl:text></xsl:when>
  2123. <xsl:when test="$colora='teal'"><xsl:text>0,.5,.5</xsl:text></xsl:when>
  2124. <xsl:when test="$colora='white'"><xsl:text>1,1,1</xsl:text></xsl:when>
  2125. <xsl:when test="$colora='yellow'"><xsl:text>1,1,0</xsl:text></xsl:when>
  2126. <xsl:otherwise>
  2127. <xsl:message>Exception at color template</xsl:message>
  2128. </xsl:otherwise>
  2129. </xsl:choose>
  2130. </xsl:template>
  2131. <xsl:template name="Hex2Decimal">
  2132. <xsl:param name="arg"/>
  2133. <xsl:choose>
  2134. <xsl:when test="$arg='f'">
  2135. <xsl:value-of select="15"/>
  2136. </xsl:when>
  2137. <xsl:when test="$arg='e'">
  2138. <xsl:value-of select="14"/>
  2139. </xsl:when>
  2140. <xsl:when test="$arg='d'">
  2141. <xsl:value-of select="13"/>
  2142. </xsl:when>
  2143. <xsl:when test="$arg='c'">
  2144. <xsl:value-of select="12"/>
  2145. </xsl:when>
  2146. <xsl:when test="$arg='b'">
  2147. <xsl:value-of select="11"/>
  2148. </xsl:when>
  2149. <xsl:when test="$arg='a'">
  2150. <xsl:value-of select="10"/>
  2151. </xsl:when>
  2152. <xsl:when test="translate($arg, '0123456789', '9999999999')='9'"> <!-- if $arg is number -->
  2153. <xsl:value-of select="$arg"/>
  2154. </xsl:when>
  2155. <xsl:otherwise>
  2156. <xsl:message>Exception at Hex2Decimal template</xsl:message>
  2157. </xsl:otherwise>
  2158. </xsl:choose>
  2159. </xsl:template>
  2160. <xsl:template match="m:*/text()">
  2161. <xsl:call-template name="replaceEntities">
  2162. <xsl:with-param name="content" select="normalize-space()"/>
  2163. </xsl:call-template>
  2164. </xsl:template>
  2165. </xsl:stylesheet>