commit 45817c1519cb8d3580df1d990725c2beac111b46
parent 6f461fdb5c1832b5ccafea60f03a56ef3ca3f1d9
Author: Davide P. Cervone <dpvc@union.edu>
Date: Mon, 14 Sep 2015 07:27:21 -0400
merge branch 'develop' into more-menu (fix conflicts with Volker's changes)
Diffstat:
9 files changed, 764 insertions(+), 53 deletions(-)
diff --git a/unpacked/MathJax.js b/unpacked/MathJax.js
@@ -3105,11 +3105,13 @@ MathJax.Hub.Startup = {
isMac: (navigator.platform.substr(0,3) === "Mac"),
isPC: (navigator.platform.substr(0,3) === "Win"),
isMSIE: ("ActiveXObject" in window && "clipboardData" in window),
+ isEdge: ("MSGestureEvent" in window && "chrome" in window &&
+ window.chrome.loadTimes == null),
isFirefox: (!!AGENT.match(/Gecko\//) && !AGENT.match(/like Gecko/)),
isSafari: (!!AGENT.match(/ (Apple)?WebKit\//) && !AGENT.match(/ like iPhone /) &&
- (!window.chrome || window.chrome.loadTimes == null)),
- isChrome: (window.chrome != null && window.chrome.loadTimes != null),
- isOpera: (window.opera != null && window.opera.version != null),
+ (!window.chrome || window.chrome.app == null)),
+ isChrome: ("chrome" in window && window.chrome.loadTimes != null),
+ isOpera: ("opera" in window && window.opera.version != null),
isKonqueror: ("konqueror" in window && navigator.vendor == "KDE"),
versionAtLeast: function (v) {
var bv = (this.version).split('.'); v = (new String(v)).split('.');
@@ -3137,7 +3139,7 @@ MathJax.Hub.Startup = {
HUB.Browser = HUB.Insert(new String(browser),BROWSERS);
var VERSION = new RegExp(
".*(Version/| Trident/.*; rv:)((?:\\d+\\.)+\\d+)|" + // for Safari, Opera10, and IE11+
- ".*("+browser+")"+(browser == "MSIE" ? " " : "/")+"((?:\\d+\\.)*\\d+)|"+ // for one of the main browser
+ ".*("+browser+")"+(browser == "MSIE" ? " " : "/")+"((?:\\d+\\.)*\\d+)|"+ // for one of the main browsers
"(?:^|\\(| )([a-z][-a-z0-9._: ]+|(?:Apple)?WebKit)/((?:\\d+\\.)+\\d+)"); // for unrecognized browser
var MATCH = VERSION.exec(xAGENT) || ["","","","unknown","0.0"];
HUB.Browser.name = (MATCH[1] != "" ? browser : (MATCH[3] || MATCH[5]));
@@ -3191,8 +3193,15 @@ MathJax.Hub.Startup = {
AGENT.match(/ Fennec\//) != null ||
AGENT.match(/Mobile/) != null);
},
+ Chrome: function (browser) {
+ browser.noContextMenu = browser.isMobile = !!navigator.userAgent.match(/ Mobile[ \/]/);
+ },
Opera: function (browser) {browser.version = opera.version()},
+ Edge: function (browser) {
+ browser.isMobile = !!navigator.userAgent.match(/ Phone/);
+ },
MSIE: function (browser) {
+ browser.isMobile = !!navigator.userAgent.match(/ Phone/);
browser.isIE9 = !!(document.documentMode && (window.performance || window.msPerformance));
MathJax.HTML.setScriptBug = !browser.isIE9 || document.documentMode < 9;
MathJax.Hub.msieHTMLCollectionBug = (document.documentMode < 9);
diff --git a/unpacked/extensions/HelpDialog.js b/unpacked/extensions/HelpDialog.js
@@ -161,8 +161,8 @@
]],
["a",{href:"http://www.mathjax.org/"},["www.mathjax.org"]],
["span",{id: "MathJax_HelpClose", onclick: HELP.Remove,
- onkeydown: HELP.Keydown, tabIndex: 0, "aria-label": "Close",
- "aria-describedby": LOCALE._(["HelpDialog","CloseWindow"],"Close window")},
+ onkeydown: HELP.Keydown, tabIndex: 0, role: "button",
+ "aria-label": LOCALE._(["HelpDialog","CloseWindow"],"Close window")},
[["span",{},["\u00D7"]]]
]
]));
diff --git a/unpacked/extensions/MathML/mml3.js b/unpacked/extensions/MathML/mml3.js
@@ -72,17 +72,661 @@ MathJax.Hub.Register.StartupHook("MathML Jax Ready",function () {
});
/*
- * The following is taken from mml3mj.xsl
- * (https://web-xslt.googlecode.com/svn/trunk/ctop/mml3mj.xsl)
+ * The following is derived from mml3mj.xsl
+ * (https://github.com/davidcarlisle/web-xslt/blob/master/ctop/mml3mj.xsl)
* which is Copyright (c) David Carlisle 2008-2015.
* It is used by permission of David Carlisle, who has agreed to allow it to
* be released under the Apache License, Version 2.0.
*/
- var mml3Stylesheet = '<x:stylesheet version="1.0" xmlns:x="http://www.w3.org/1999/XSL/Transform" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns="http://www.w3.org/1998/Math/MathML" xmlns:c="http://exslt.org/common" exclude-result-prefixes="m c"><ms:script language="JScript" implements-prefix="c" xmlns:ms="urn:schemas-microsoft-com:xslt"> this[\'node-set\'] = function (x) { return x; }</ms:script><x:output indent="yes" omit-xml-declaration="yes"/><x:template match="*"><x:copy><x:copy-of select="@*"/><x:apply-templates/></x:copy></x:template><x:template match="*[@dir=\'rtl\']" priority="10"><x:apply-templates mode="rtl" select="."/></x:template><x:template match="@*" mode="rtl"><x:copy-of select="."/></x:template><x:template match="*" mode="rtl"><x:copy><x:apply-templates select="@*" mode="rtl"/><x:for-each select="node()"><x:sort data-type="number" order="descending" select="position()"/><x:text></x:text><x:apply-templates mode="rtl" select="."/></x:for-each></x:copy></x:template><x:template match="@open" mode="rtl"><x:attribute name="close"><x:value-of select="."/></x:attribute></x:template><x:template match="@open[.=\'(\']" mode="rtl"><x:attribute name="close">)</x:attribute></x:template><x:template match="@open[.=\')\']" mode="rtl"><x:attribute name="close">(</x:attribute></x:template><x:template match="@open[.=\'[\']" mode="rtl"><x:attribute name="close">]</x:attribute></x:template><x:template match="@open[.=\']\']" mode="rtl"><x:attribute name="close">[</x:attribute></x:template><x:template match="@open[.=\'{\']" mode="rtl"><x:attribute name="close">}</x:attribute></x:template><x:template match="@open[.=\'}\']" mode="rtl"><x:attribute name="close">{</x:attribute></x:template><x:template match="@close" mode="rtl"><x:attribute name="open"><x:value-of select="."/></x:attribute></x:template><x:template match="@close[.=\'(\']" mode="rtl"><x:attribute name="open">)</x:attribute></x:template><x:template match="@close[.=\')\']" mode="rtl"><x:attribute name="open">(</x:attribute></x:template><x:template match="@close[.=\'[\']" mode="rtl"><x:attribute name="open">]</x:attribute></x:template><x:template match="@close[.=\']\']" mode="rtl"><x:attribute name="open">[</x:attribute></x:template><x:template match="@close[.=\'{\']" mode="rtl"><x:attribute name="open">}</x:attribute></x:template><x:template match="@close[.=\'}\']" mode="rtl"><x:attribute name="open">{</x:attribute></x:template><x:template match="m:mfrac[@bevelled=\'true\']" mode="rtl"><mrow><msub><mi></mi><x:apply-templates select="*[2]" mode="rtl"/></msub><mo>\</mo><msup><mi></mi><x:apply-templates select="*[1]" mode="rtl"/></msup></mrow></x:template><x:template match="m:mfrac" mode="rtl"><x:copy><x:apply-templates mode="rtl" select="@*|*"/></x:copy></x:template><x:template match="m:mroot" mode="rtl"><msup><menclose notation="top right"><x:apply-templates mode="rtl" select="@*|*[1]"/></menclose><x:apply-templates mode="rtl" select="*[2]"/></msup></x:template><x:template match="m:msqrt" mode="rtl"><menclose notation="top right"><x:apply-templates mode="rtl" select="@*|*[1]"/></menclose></x:template><x:template match="m:mtable|m:munder|m:mover|m:munderover" mode="rtl" priority="2"><x:copy><x:apply-templates select="@*" mode="rtl"/><x:apply-templates mode="rtl"></x:apply-templates></x:copy></x:template><x:template match="m:msup" mode="rtl" priority="2"><mmultiscripts><x:apply-templates select="*[1]" mode="rtl"/><mprescripts/><none/><x:apply-templates select="*[2]" mode="rtl"/></mmultiscripts></x:template><x:template match="m:msub" mode="rtl" priority="2"><mmultiscripts><x:apply-templates select="*[1]" mode="rtl"/><mprescripts/><x:apply-templates select="*[2]" mode="rtl"/><none/></mmultiscripts></x:template><x:template match="m:msubsup" mode="rtl" priority="2"><mmultiscripts><x:apply-templates select="*[1]" mode="rtl"/><mprescripts/><x:apply-templates select="*[2]" mode="rtl"/><x:apply-templates select="*[3]" mode="rtl"/></mmultiscripts></x:template><x:template match="m:mmultiscripts" mode="rtl" priority="2"><mmultiscripts><x:apply-templates select="*[1]" mode="rtl"/><x:for-each select="m:mprescripts/following-sibling::*[position() mod 2 = 1]"><x:sort data-type="number" order="descending" select="position()"/><x:apply-templates select="." mode="rtl"/><x:apply-templates select="following-sibling::*[1]" mode="rtl"/></x:for-each><mprescripts/><x:for-each select="m:mprescripts/preceding-sibling::*[position()!=last()][position() mod 2 = 0]"><x:sort data-type="number" order="descending" select="position()"/><x:apply-templates select="." mode="rtl"/><x:apply-templates select="following-sibling::*[1]" mode="rtl"/></x:for-each></mmultiscripts></x:template><x:template match="m:mmultiscripts[not(m:mprescripts)]" mode="rtl" priority="3"><mmultiscripts><x:apply-templates select="*[1]" mode="rtl"/><mprescripts/><x:for-each select="*[position() mod 2 = 0]"><x:sort data-type="number" order="descending" select="position()"/><x:apply-templates select="." mode="rtl"/><x:apply-templates select="following-sibling::*[1]" mode="rtl"/></x:for-each></mmultiscripts></x:template><x:template match="text()[.=\'(\']" mode="rtl">)</x:template><x:template match="text()[.=\')\']" mode="rtl">(</x:template><x:template match="text()[.=\'{\']" mode="rtl">}</x:template><x:template match="text()[.=\'}\']" mode="rtl">{</x:template><x:template match="text()[.=\'<\']" mode="rtl">></x:template><x:template match="text()[.=\'>\']" mode="rtl"><</x:template><x:template match="text()[.=\'∈\']" mode="rtl">∋</x:template><x:template match="text()[.=\'∋\']" mode="rtl">∈</x:template><x:template match="@notation[.=\'radical\']" mode="rtl"><x:attribute name="notation">top right</x:attribute></x:template><x:template match="m:mlongdiv|m:mstack" mode="rtl"><mrow dir="ltr"><x:apply-templates select="."/></mrow></x:template><x:template match="m:mstack" priority="11"><x:variable name="m"><mtable columnspacing="0em"><x:copy-of select="@align"/><x:variable name="t"><x:apply-templates select="*" mode="mstack1"><x:with-param name="p" select="0"/></x:apply-templates></x:variable><x:variable name="maxl"><x:for-each select="c:node-set($t)/*/@l"><x:sort data-type="number" order="descending"/><x:if test="position()=1"><x:value-of select="."/></x:if></x:for-each></x:variable><x:for-each select="c:node-set($t)/*[not(@class=\'mscarries\') or following-sibling::*[1]/@class=\'mscarries\']"><x:variable name="c" select="preceding-sibling::*[1][@class=\'mscarries\']"/><x:text> </x:text><mtr><x:copy-of select="@class[.=\'msline\']"/><x:variable name="offset" select="$maxl - @l"/><x:choose><x:when test="@class=\'msline\' and @l=\'*\'"><x:variable name="msl" select="*[1]"/><x:for-each select="(//node())[position()<=$maxl]"><x:copy-of select="$msl"/></x:for-each></x:when><x:when test="$c"><x:variable name="ldiff" select="$c/@l - @l"/><x:variable name="loffset" select="$maxl - $c/@l"/><x:for-each select="(//*)[position()<= $offset]"><x:variable name="pn" select="position()"/><x:variable name="cy" select="$c/*[position()=$pn - $loffset]"/><mtd><x:if test="$cy/*"><mover><mphantom><mn>0</mn></mphantom><mpadded width="0em" lspace="-0.5width"><x:copy-of select="$cy/*"/></mpadded></mover></x:if></mtd></x:for-each><x:for-each select="*"><x:variable name="pn" select="position()"/><x:variable name="cy" select="$c/*[position()=$pn + $ldiff]"/><x:copy><x:copy-of select="@*"/><x:variable name="b"><x:choose><x:when test="not(string($cy/@crossout) or $cy/@crossout=\'none\')"><x:copy-of select="*"/></x:when><x:otherwise><menclose notation="{$cy/@crossout}"><x:copy-of select="*"/></menclose></x:otherwise></x:choose></x:variable><x:choose><x:when test="$cy/m:none or not($cy/*)"><x:copy-of select="$b"/></x:when><x:when test="not(string($cy/@location)) or $cy/@location=\'n\'"><mover><x:copy-of select="$b"/><mpadded width="0em" lspace="-0.5width"><x:copy-of select="$cy/*"/></mpadded></mover></x:when><x:when test="$cy/@location=\'nw\'"><mmultiscripts><x:copy-of select="$b"/><mprescripts/><none/><mpadded lspace="-1width" width="0em"><x:copy-of select="$cy/*"/></mpadded></mmultiscripts></x:when><x:when test="$cy/@location=\'s\'"><munder><x:copy-of select="$b"/><mpadded width="0em" lspace="-0.5width"><x:copy-of select="$cy/*"/></mpadded></munder></x:when><x:when test="$cy/@location=\'sw\'"><mmultiscripts><x:copy-of select="$b"/><mprescripts/><mpadded lspace="-1width" width="0em"><x:copy-of select="$cy/*"/></mpadded><none/></mmultiscripts></x:when><x:when test="$cy/@location=\'ne\'"><msup><x:copy-of select="$b"/><mpadded width="0em"><x:copy-of select="$cy/*"/></mpadded></msup></x:when><x:when test="$cy/@location=\'se\'"><msub><x:copy-of select="$b"/><mpadded width="0em"><x:copy-of select="$cy/*"/></mpadded></msub></x:when><x:when test="$cy/@location=\'w\'"><msup><mrow/><mpadded lspace="-1width" width="0em"><x:copy-of select="$cy/*"/></mpadded></msup><x:copy-of select="$b"/></x:when><x:when test="$cy/@location=\'e\'"><x:copy-of select="$b"/><msup><mrow/><mpadded width="0em"><x:copy-of select="$cy/*"/></mpadded></msup></x:when><x:otherwise><x:copy-of select="$b"/></x:otherwise></x:choose></x:copy></x:for-each></x:when><x:otherwise><x:for-each select="(//*)[position()<= $offset]"><mtd/></x:for-each><x:copy-of select="*"/></x:otherwise></x:choose></mtr></x:for-each></mtable></x:variable><x:apply-templates mode="ml" select="c:node-set($m)"/></x:template><x:template match="*" mode="ml"><x:copy><x:copy-of select="@*"/><x:apply-templates mode="ml"/></x:copy></x:template><x:template mode="ml" match="m:mtr[following-sibling::*[1][@class=\'msline\']]"><mtr><x:copy-of select="@*"/><x:variable name="m" select="following-sibling::*[1]/m:mtd"/><x:for-each select="m:mtd"><x:variable name="p" select="position()"/><mtd><x:copy-of select="@*"/><x:choose><x:when test="$m[$p]/m:mpadded"><menclose notation="bottom"><mpadded depth=".1em" height="1em" width=".4em"><x:copy-of select="*"/></mpadded></menclose></x:when><x:otherwise><x:copy-of select="*"/></x:otherwise></x:choose></mtd></x:for-each></mtr></x:template><x:template mode="ml" match="m:mtr[not(preceding-sibling::*)][@class=\'msline\']" priority="3"><mtr><x:copy-of select="@*"/><x:for-each select="m:mtd"><mtd><x:copy-of select="@*"/><x:if test="m:mpadded"><menclose notation="bottom"><mpadded depth=".1em" height="1em" width=".4em"><mspace width=".2em"/></mpadded></menclose></x:if></mtd></x:for-each></mtr></x:template><x:template mode="ml" match="m:mtr[@class=\'msline\']" priority="2"/><x:template mode="mstack1" match="*"><x:param name="p"/><x:param name="maxl" select="0"/><mtr l="{1 + $p}"><x:if test="ancestor::mstack[1]/@stackalign=\'left\'"><x:attribute name="l"><x:value-of select="$p"/></x:attribute></x:if><mtd><x:apply-templates select="."/></mtd></mtr></x:template><x:template mode="mstack1" match="m:msrow"><x:param name="p"/><x:param name="maxl" select="0"/><x:variable name="align1" select="ancestor::m:mstack[1]/@stackalign"/><x:variable name="align"><x:choose><x:when test="string($align1)=\'\'">decimalpoint</x:when><x:otherwise><x:value-of select="$align1"/></x:otherwise></x:choose></x:variable><x:variable name="row"><x:apply-templates mode="mstack1" select="*"><x:with-param name="p" select="0"/></x:apply-templates></x:variable><x:text> </x:text><x:variable name="l1"><x:choose><x:when test="$align=\'decimalpoint\' and m:mn"><x:for-each select="c:node-set($row)/m:mtr[m:mtd/m:mn][1]"><x:value-of select="number(sum(@l))+count(preceding-sibling::*/@l)"/></x:for-each></x:when><x:when test="$align=\'right\' or $align=\'decimalpoint\'"><x:value-of select="count(c:node-set($row)/m:mtr/m:mtd)"/></x:when><x:otherwise><x:value-of select="0"/></x:otherwise></x:choose></x:variable><mtr class="msrow" l="{number($l1) + number(sum(@position)) +$p}"><x:copy-of select="c:node-set($row)/m:mtr/*"/></mtr></x:template><x:template mode="mstack1" match="m:mn"><x:param name="p"/><x:variable name="align1" select="ancestor::m:mstack[1]/@stackalign"/><x:variable name="dp1" select="ancestor::*[@decimalpoint][1]/@decimalpoint"/><x:variable name="align"><x:choose><x:when test="string($align1)=\'\'">decimalpoint</x:when><x:otherwise><x:value-of select="$align1"/></x:otherwise></x:choose></x:variable><x:variable name="dp"><x:choose><x:when test="string($dp1)=\'\'">.</x:when><x:otherwise><x:value-of select="$dp1"/></x:otherwise></x:choose></x:variable><mtr l="$p"><x:variable name="mn" select="normalize-space(.)"/><x:variable name="len" select="string-length($mn)"/><x:choose><x:when test="$align=\'right\' or ($align=\'decimalpoint\' and not(contains($mn,$dp)))"><x:attribute name="l"><x:value-of select="$p + $len"/></x:attribute></x:when><x:when test="$align=\'center\'"><x:attribute name="l"><x:value-of select="round(($p + $len) div 2)"/></x:attribute></x:when><x:when test="$align=\'decimalpoint\'"><x:attribute name="l"><x:value-of select="$p + string-length(substring-before($mn,$dp))"/></x:attribute></x:when></x:choose><x:for-each select="(//node())[position() <=$len]"><x:variable name="pos" select="position()"/><mtd><mn><x:value-of select="substring($mn,$pos,1)"/></mn></mtd></x:for-each></mtr></x:template><x:template match="m:msgroup" mode="mstack1"><x:param name="p"/><x:variable name="s" select="number(sum(@shift))"/><x:variable name="thisp" select="number(sum(@position))"/><x:for-each select="*"><x:apply-templates mode="mstack1" select="."><x:with-param name="p" select="number($p)+$thisp+(position()-1)*$s"/></x:apply-templates></x:for-each></x:template><x:template match="m:msline" mode="mstack1"><x:param name="p"/><x:variable name="align1" select="ancestor::m:mstack[1]/@stackalign"/><x:variable name="align"><x:choose><x:when test="string($align1)=\'\'">decimalpoint</x:when><x:otherwise><x:value-of select="$align1"/></x:otherwise></x:choose></x:variable><mtr class="msline"><x:attribute name="l"><x:choose><x:when test="not(string(@length)) or @length=0">*</x:when><x:when test="string($align)=\'right\' or string($align)=\'decimalpoint\' "><x:value-of select="$p+ @length"/></x:when><x:otherwise><x:value-of select="$p"/></x:otherwise></x:choose></x:attribute><x:variable name="w"><x:choose><x:when test="@mslinethickness=\'thin\'">0.1em</x:when><x:when test="@mslinethickness=\'medium\'">0.15em</x:when><x:when test="@mslinethickness=\'thick\'">0.2em</x:when><x:when test="@mslinethickness"><x:value-of select="@mslinethickness"/></x:when><x:otherwise>0.15em</x:otherwise></x:choose></x:variable><x:choose><x:when test="not(string(@length)) or @length=0"><mtd class="mslinemax"><mpadded lspace="-0.2em" width="0em" height="0em"><mfrac linethickness="{$w}"><mspace width=".4em"/><mrow/></mfrac></mpadded></mtd></x:when><x:otherwise><x:variable name="l" select="@length"/><x:for-each select="(//node())[position()<=$l]"><mtd class="msline"><mpadded lspace="-0.2em" width="0em" height="0em"><mfrac linethickness="{$w}"><mspace width=".4em"/><mrow/></mfrac></mpadded></mtd></x:for-each></x:otherwise></x:choose></mtr></x:template><x:template match="m:mscarries" mode="mstack1"><x:param name="p"/><x:variable name="align1" select="ancestor::m:mstack[1]/@stackalign"/><x:variable name="l1"><x:choose><x:when test="string($align1)=\'left\'">0</x:when><x:otherwise><x:value-of select="count(*)"/></x:otherwise></x:choose></x:variable><mtr class="mscarries" l="{$p + $l1 + sum(@position)}"><x:apply-templates select="*" mode="msc"/></mtr></x:template><x:template match="*" mode="msc"><mtd><x:copy-of select="../@location|../@crossout"/><x:choose><x:when test="../@scriptsizemultiplier"><mstyle mathsize="{round(../@scriptsizemultiplier div .007)}%"><x:apply-templates select="."/></mstyle></x:when><x:otherwise><x:apply-templates select="."/></x:otherwise></x:choose></mtd></x:template><x:template match="m:mscarry" mode="msc"><mtd><x:copy-of select="@location|@crossout"/><x:choose><x:when test="../@scriptsizemultiplier"><mstyle mathsize="{round(../@scriptsizemultiplier div .007)}%"><x:apply-templates/></mstyle></x:when><x:otherwise><x:apply-templates/></x:otherwise></x:choose></mtd></x:template><x:template match="m:mlongdiv" priority="11"><x:variable name="ms"><mstack><x:copy-of select="(ancestor-or-self::*/@decimalpoint)[last()]"/><x:choose><x:when test="@longdivstyle=\'left)(right\'"><msrow><mrow><x:copy-of select="*[1]"/></mrow><mo>)</mo><x:copy-of select="*[3]"/><mo>(</mo><x:copy-of select="*[2]"/></msrow></x:when><x:when test="@longdivstyle=\'left/\\right\'"><msrow><mrow><x:copy-of select="*[1]"/></mrow><mo>/</mo><x:copy-of select="*[3]"/><mo>\\</mo><x:copy-of select="*[2]"/></msrow></x:when><x:when test="@longdivstyle=\':right=right\'"><msrow><x:copy-of select="*[3]"/><mo>:</mo><x:copy-of select="*[1]"/><mo>=</mo><x:copy-of select="*[2]"/></msrow></x:when><x:when test="@longdivstyle=\'stackedrightright\' or @longdivstyle=\'mediumstackedrightright\' or @longdivstyle=\'shortstackedrightright\' or @longdivstyle=\'stackedleftleft\' "><x:attribute name="align">top</x:attribute><x:copy-of select="*[3]"/></x:when><x:when test="@longdivstyle=\'stackedleftlinetop\'"><x:copy-of select="*[2]"/><msline length="{string-length(*[3])-1}"/><msrow><mrow><menclose notation="bottom right"><x:copy-of select="*[1]"/></menclose></mrow><x:copy-of select="*[3]"/></msrow></x:when><x:when test="@longdivstyle=\'righttop\'"><x:copy-of select="*[2]"/><msline length="{string-length(*[3])}"/><msrow><x:copy-of select="*[3]"/><menclose notation="top left bottom"><x:copy-of select="*[1]"/></menclose></msrow></x:when><x:otherwise><x:copy-of select="*[2]"/><msline length="{string-length(*[3])}"/><msrow><mrow><x:copy-of select="*[1]"/></mrow><mo>)</mo><x:copy-of select="*[3]"/></msrow></x:otherwise></x:choose><x:copy-of select="*[position()>3]"/></mstack></x:variable><x:choose><x:when test="@longdivstyle=\'stackedrightright\'"><menclose notation="right"><x:apply-templates select="c:node-set($ms)"/></menclose><mtable align="top"><mtr><menclose notation="bottom"><x:copy-of select="*[1]"/></menclose></mtr><mtr><mtd><x:copy-of select="*[2]"/></mtd></mtr></mtable></x:when><x:when test="@longdivstyle=\'mediumstackedrightright\'"><x:apply-templates select="c:node-set($ms)"/><menclose notation="left"><mtable align="top"><mtr><menclose notation="bottom"><x:copy-of select="*[1]"/></menclose></mtr><mtr><mtd><x:copy-of select="*[2]"/></mtd></mtr></mtable></menclose></x:when><x:when test="@longdivstyle=\'shortstackedrightright\'"><x:apply-templates select="c:node-set($ms)"/><mtable align="top"><mtr><menclose notation="left bottom"><x:copy-of select="*[1]"/></menclose></mtr><mtr><mtd><x:copy-of select="*[2]"/></mtd></mtr></mtable></x:when><x:when test="@longdivstyle=\'stackedleftleft\'"><mtable align="top"><mtr><menclose notation="bottom"><x:copy-of select="*[1]"/></menclose></mtr><mtr><mtd><x:copy-of select="*[2]"/></mtd></mtr></mtable><menclose notation="left"><x:apply-templates select="c:node-set($ms)"/></menclose></x:when><x:otherwise><x:apply-templates select="c:node-set($ms)"/></x:otherwise></x:choose></x:template><x:template match="m:menclose[@notation=\'madruwb\']" mode="rtl"><menclose notation="bottom right"><x:apply-templates mode="rtl"/></menclose></x:template></x:stylesheet>';
+ var BROWSER = MathJax.Hub.Browser;
+ var exslt = '';
+ if (BROWSER.isEdge || BROWSER.isMSIE) {
+ exslt = 'urn:schemas-microsoft-com:xslt'
+ } else {
+ exslt = 'http://exslt.org/common';
+ }
+ var mml3Stylesheet =
+ '<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" ' +
+ ' xmlns:m="http://www.w3.org/1998/Math/MathML"' +
+ ' xmlns:c="' + exslt + '"' +
+ ' exclude-result-prefixes="m c">' +
+ '<xsl:output indent="yes" omit-xml-declaration="yes"/>' +
+ '<xsl:output indent="yes" omit-xml-declaration="yes"/><xsl:template match="*">' +
+ ' <xsl:copy>' +
+ ' <xsl:copy-of select="@*"/>' +
+ ' <xsl:apply-templates/>' +
+ ' </xsl:copy>' +
+ '</xsl:template><xsl:template match="m:*[@dir=\'rtl\']" priority="10">' +
+ ' <xsl:apply-templates mode="rtl" select="."/>' +
+ '</xsl:template><xsl:template match="@*" mode="rtl">' +
+ ' <xsl:copy-of select="."/>' +
+ ' <xsl:attribute name="dir">ltr</xsl:attribute>' +
+ '</xsl:template>' +
+ '<xsl:template match="*" mode="rtl">' +
+ ' <xsl:copy>' +
+ ' <xsl:apply-templates select="@*" mode="rtl"/>' +
+ ' <xsl:for-each select="node()">' +
+ ' <xsl:sort data-type="number" order="descending" select="position()"/>' +
+ ' <xsl:text> </xsl:text>' +
+ ' <xsl:apply-templates mode="rtl" select="."/>' +
+ ' </xsl:for-each>' +
+ ' </xsl:copy>' +
+ '</xsl:template><xsl:template match="@open" mode="rtl">' +
+ ' <xsl:attribute name="close"><xsl:value-of select="."/></xsl:attribute>' +
+ '</xsl:template><xsl:template match="@open[.=\'(\']" mode="rtl">' +
+ ' <xsl:attribute name="close">)</xsl:attribute>' +
+ '</xsl:template><xsl:template match="@open[.=\')\']" mode="rtl">' +
+ ' <xsl:attribute name="close">(</xsl:attribute>' +
+ '</xsl:template>' +
+ '<xsl:template match="@open[.=\'[\']" mode="rtl">' +
+ ' <xsl:attribute name="close">]</xsl:attribute>' +
+ '</xsl:template>' +
+ '<xsl:template match="@open[.=\']\']" mode="rtl">' +
+ ' <xsl:attribute name="close">[</xsl:attribute>' +
+ '</xsl:template>' +
+ '<xsl:template match="@open[.=\'{\']" mode="rtl">' +
+ ' <xsl:attribute name="close">}</xsl:attribute>' +
+ '</xsl:template>' +
+ '<xsl:template match="@open[.=\'}\']" mode="rtl">' +
+ ' <xsl:attribute name="close">{</xsl:attribute>' +
+ '</xsl:template>' +
+ '<xsl:template match="@close" mode="rtl">' +
+ ' <xsl:attribute name="open"><xsl:value-of select="."/></xsl:attribute>' +
+ '</xsl:template><xsl:template match="@close[.=\'(\']" mode="rtl">' +
+ ' <xsl:attribute name="open">)</xsl:attribute>' +
+ '</xsl:template><xsl:template match="@close[.=\')\']" mode="rtl">' +
+ ' <xsl:attribute name="open">(</xsl:attribute>' +
+ '</xsl:template>' +
+ '<xsl:template match="@close[.=\'[\']" mode="rtl">' +
+ ' <xsl:attribute name="open">]</xsl:attribute>' +
+ '</xsl:template>' +
+ '<xsl:template match="@close[.=\']\']" mode="rtl">' +
+ ' <xsl:attribute name="open">[</xsl:attribute>' +
+ '</xsl:template>' +
+ '<xsl:template match="@close[.=\'{\']" mode="rtl">' +
+ ' <xsl:attribute name="open">}</xsl:attribute>' +
+ '</xsl:template>' +
+ '<xsl:template match="@close[.=\'}\']" mode="rtl">' +
+ ' <xsl:attribute name="open">{</xsl:attribute>' +
+ '</xsl:template><xsl:template match="m:mfrac[@bevelled=\'true\']" mode="rtl">' +
+ ' <m:mrow>' +
+ ' <m:msub><m:mi></m:mi><xsl:apply-templates select="*[2]" mode="rtl"/></m:msub>' +
+ ' <m:mo>\</m:mo>' +
+ ' <m:msup><m:mi></m:mi><xsl:apply-templates select="*[1]" mode="rtl"/></m:msup>' +
+ ' </m:mrow>' +
+ '</xsl:template><xsl:template match="m:mfrac" mode="rtl">' +
+ ' <xsl:copy>' +
+ ' <xsl:apply-templates mode="rtl" select="@*|*"/>' +
+ ' </xsl:copy>' +
+ '</xsl:template><xsl:template match="m:mroot" mode="rtl">' +
+ ' <m:msup>' +
+ ' <m:menclose notation="top right">' +
+ ' <xsl:apply-templates mode="rtl" select="@*|*[1]"/>' +
+ ' </m:menclose>' +
+ ' <xsl:apply-templates mode="rtl" select="*[2]"/>' +
+ ' </m:msup>' +
+ '</xsl:template>' +
+ '<xsl:template match="m:msqrt" mode="rtl">' +
+ ' <m:menclose notation="top right">' +
+ ' <xsl:apply-templates mode="rtl" select="@*|*[1]"/>' +
+ ' </m:menclose>' +
+ '</xsl:template><xsl:template match="m:mtable|m:munder|m:mover|m:munderover" mode="rtl" priority="2">' +
+ ' <xsl:copy>' +
+ ' <xsl:apply-templates select="@*" mode="rtl"/>' +
+ ' <xsl:apply-templates mode="rtl">' +
+ ' </xsl:apply-templates>' +
+ ' </xsl:copy>' +
+ '</xsl:template>' +
+ '<xsl:template match="m:msup" mode="rtl" priority="2">' +
+ ' <m:mmultiscripts>' +
+ ' <xsl:apply-templates select="*[1]" mode="rtl"/>' +
+ ' <m:mprescripts/>' +
+ ' <m:none/>' +
+ ' <xsl:apply-templates select="*[2]" mode="rtl"/>' +
+ ' </m:mmultiscripts>' +
+ '</xsl:template>' +
+ '<xsl:template match="m:msub" mode="rtl" priority="2">' +
+ ' <m:mmultiscripts>' +
+ ' <xsl:apply-templates select="*[1]" mode="rtl"/>' +
+ ' <m:mprescripts/>' +
+ ' <xsl:apply-templates select="*[2]" mode="rtl"/>' +
+ ' <m:none/>' +
+ ' </m:mmultiscripts>' +
+ '</xsl:template>' +
+ '<xsl:template match="m:msubsup" mode="rtl" priority="2">' +
+ ' <m:mmultiscripts>' +
+ ' <xsl:apply-templates select="*[1]" mode="rtl"/>' +
+ ' <m:mprescripts/>' +
+ ' <xsl:apply-templates select="*[2]" mode="rtl"/>' +
+ ' <xsl:apply-templates select="*[3]" mode="rtl"/>' +
+ ' </m:mmultiscripts>' +
+ '</xsl:template>' +
+ '<xsl:template match="m:mmultiscripts" mode="rtl" priority="2">' +
+ ' <m:mmultiscripts>' +
+ ' <xsl:apply-templates select="*[1]" mode="rtl"/>' +
+ ' <xsl:for-each select="m:mprescripts/following-sibling::*[position() mod 2 = 1]">' +
+ ' <xsl:sort data-type="number" order="descending" select="position()"/>' +
+ ' <xsl:apply-templates select="." mode="rtl"/>' +
+ ' <xsl:apply-templates select="following-sibling::*[1]" mode="rtl"/>' +
+ ' </xsl:for-each>' +
+ ' <m:mprescripts/>' +
+ ' <xsl:for-each select="m:mprescripts/preceding-sibling::*[position()!=last()][position() mod 2 = 0]">' +
+ ' <xsl:sort data-type="number" order="descending" select="position()"/>' +
+ ' <xsl:apply-templates select="." mode="rtl"/>' +
+ ' <xsl:apply-templates select="following-sibling::*[1]" mode="rtl"/>' +
+ ' </xsl:for-each>' +
+ ' </m:mmultiscripts>' +
+ '</xsl:template>' +
+ '<xsl:template match="m:mmultiscripts[not(m:mprescripts)]" mode="rtl" priority="3">' +
+ ' <m:mmultiscripts>' +
+ ' <xsl:apply-templates select="*[1]" mode="rtl"/>' +
+ ' <m:mprescripts/>' +
+ ' <xsl:for-each select="*[position() mod 2 = 0]">' +
+ ' <xsl:sort data-type="number" order="descending" select="position()"/>' +
+ ' <xsl:apply-templates select="." mode="rtl"/>' +
+ ' <xsl:apply-templates select="following-sibling::*[1]" mode="rtl"/>' +
+ ' </xsl:for-each>' +
+ ' </m:mmultiscripts>' +
+ '</xsl:template>' +
+ '<xsl:template match="text()[.=\'(\']" mode="rtl">)</xsl:template>' +
+ '<xsl:template match="text()[.=\')\']" mode="rtl">(</xsl:template>' +
+ '<xsl:template match="text()[.=\'{\']" mode="rtl">}</xsl:template>' +
+ '<xsl:template match="text()[.=\'}\']" mode="rtl">{</xsl:template>' +
+ '<xsl:template match="text()[.=\'<\']" mode="rtl">></xsl:template>' +
+ '<xsl:template match="text()[.=\'>\']" mode="rtl"><</xsl:template>' +
+ '<xsl:template match="text()[.=\'∈\']" mode="rtl">∋</xsl:template>' +
+ '<xsl:template match="text()[.=\'∋\']" mode="rtl">∈</xsl:template>' +
+ '<xsl:template match="@notation[.=\'radical\']" mode="rtl">' +
+ ' <xsl:attribute name="notation">top right</xsl:attribute>' +
+ '</xsl:template>' +
+ '<xsl:template match="m:mlongdiv|m:mstack" mode="rtl">' +
+ ' <m:mrow dir="ltr">' +
+ ' <xsl:apply-templates select="."/>' +
+ ' </m:mrow>' +
+ '</xsl:template>' +
+ '<xsl:template match="m:mstack" priority="11">' +
+ ' <xsl:variable name="m">' +
+ ' <m:mtable columnspacing="0em">' +
+ ' <xsl:copy-of select="@align"/>' +
+ ' <xsl:variable name="t">' +
+ ' <xsl:apply-templates select="*" mode="mstack1">' +
+ ' <xsl:with-param name="p" select="0"/>' +
+ ' </xsl:apply-templates>' +
+ ' </xsl:variable>' +
+ ' <xsl:variable name="maxl">' +
+ ' <xsl:for-each select="c:node-set($t)/*/@l">' +
+ ' <xsl:sort data-type="number" order="descending"/>' +
+ ' <xsl:if test="position()=1">' +
+ ' <xsl:value-of select="."/>' +
+ ' </xsl:if>' +
+ ' </xsl:for-each>' +
+ ' </xsl:variable>' +
+ ' <xsl:for-each select="c:node-set($t)/*[not(@class=\'mscarries\') or following-sibling::*[1]/@class=\'mscarries\']">' +
+ '<xsl:variable name="c" select="preceding-sibling::*[1][@class=\'mscarries\']"/>' +
+ ' <xsl:text> </xsl:text>' +
+ ' <m:mtr>' +
+ ' <xsl:copy-of select="@class[.=\'msline\']"/>' +
+ ' <xsl:variable name="offset" select="$maxl - @l"/>' +
+ ' <xsl:choose>' +
+ ' <xsl:when test="@class=\'msline\' and @l=\'*\'">' +
+ ' <xsl:variable name="msl" select="*[1]"/>' +
+ ' <xsl:for-each select="(//node())[position()<=$maxl]">' +
+ ' <xsl:copy-of select="$msl"/>' +
+ ' </xsl:for-each>' +
+ ' </xsl:when>' +
+ ' <xsl:when test="$c">' +
+ ' <xsl:variable name="ldiff" select="$c/@l - @l"/>' +
+ ' <xsl:variable name="loffset" select="$maxl - $c/@l"/>' +
+ ' <xsl:for-each select="(//*)[position()<= $offset]">' +
+ ' <xsl:variable name="pn" select="position()"/>' +
+ ' <xsl:variable name="cy" select="$c/*[position()=$pn - $loffset]"/>' +
+ ' <m:mtd>' +
+ ' <xsl:if test="$cy/*">' +
+ ' <m:mover><m:mphantom><m:mn>0</m:mn></m:mphantom><m:mpadded width="0em" lspace="-0.5width">' +
+ ' <xsl:copy-of select="$cy/*"/></m:mpadded></m:mover>' +
+ ' </xsl:if>' +
+ ' </m:mtd>' +
+ ' </xsl:for-each>' +
+ ' <xsl:for-each select="*">' +
+ ' <xsl:variable name="pn" select="position()"/>' +
+ ' <xsl:variable name="cy" select="$c/*[position()=$pn + $ldiff]"/>' +
+ ' <xsl:copy>' +
+ ' <xsl:copy-of select="@*"/>' +
+ ' <xsl:variable name="b">' +
+ ' <xsl:choose>' +
+ ' <xsl:when test="not(string($cy/@crossout) or $cy/@crossout=\'none\')"><xsl:copy-of select="*"/></xsl:when>' +
+ ' <xsl:otherwise>' +
+ ' <m:menclose notation="{$cy/@crossout}"><xsl:copy-of select="*"/></m:menclose>' +
+ ' </xsl:otherwise>' +
+ ' </xsl:choose>' +
+ ' </xsl:variable>' +
+ ' <xsl:choose>' +
+ ' <xsl:when test="$cy/m:none or not($cy/*)"><xsl:copy-of select="$b"/></xsl:when>' +
+ ' <xsl:when test="not(string($cy/@location)) or $cy/@location=\'n\'">' +
+ ' <m:mover>' +
+ ' <xsl:copy-of select="$b"/><m:mpadded width="0em" lspace="-0.5width">' +
+ ' <xsl:copy-of select="$cy/*"/>' +
+ ' </m:mpadded>' +
+ ' </m:mover>' +
+ ' </xsl:when>' +
+ ' <xsl:when test="$cy/@location=\'nw\'">' +
+ ' <m:mmultiscripts><xsl:copy-of select="$b"/><m:mprescripts/><m:none/><m:mpadded lspace="-1width" width="0em"><xsl:copy-of select="$cy/*"/></m:mpadded></m:mmultiscripts>' +
+ ' </xsl:when>' +
+ ' <xsl:when test="$cy/@location=\'s\'">' +
+ ' <m:munder><xsl:copy-of select="$b"/><m:mpadded width="0em" lspace="-0.5width"><xsl:copy-of select="$cy/*"/></m:mpadded></m:munder>' +
+ ' </xsl:when>' +
+ ' <xsl:when test="$cy/@location=\'sw\'">' +
+ ' <m:mmultiscripts><xsl:copy-of select="$b"/><m:mprescripts/><m:mpadded lspace="-1width" width="0em"><xsl:copy-of select="$cy/*"/></m:mpadded><m:none/></m:mmultiscripts>' +
+ ' </xsl:when>' +
+ ' <xsl:when test="$cy/@location=\'ne\'">' +
+ ' <m:msup><xsl:copy-of select="$b"/><m:mpadded width="0em"><xsl:copy-of select="$cy/*"/></m:mpadded></m:msup>' +
+ ' </xsl:when>' +
+ ' <xsl:when test="$cy/@location=\'se\'">' +
+ ' <m:msub><xsl:copy-of select="$b"/><m:mpadded width="0em"><xsl:copy-of select="$cy/*"/></m:mpadded></m:msub>' +
+ ' </xsl:when>' +
+ ' <xsl:when test="$cy/@location=\'w\'">' +
+ ' <m:msup><m:mrow/><m:mpadded lspace="-1width" width="0em"><xsl:copy-of select="$cy/*"/></m:mpadded></m:msup>' +
+ ' <xsl:copy-of select="$b"/>' +
+ ' </xsl:when>' +
+ ' <xsl:when test="$cy/@location=\'e\'">' +
+ ' <xsl:copy-of select="$b"/>' +
+ ' <m:msup><m:mrow/><m:mpadded width="0em"><xsl:copy-of select="$cy/*"/></m:mpadded></m:msup>' +
+ ' </xsl:when>' +
+ ' <xsl:otherwise>' +
+ ' <xsl:copy-of select="$b"/>' +
+ ' </xsl:otherwise>' +
+ ' </xsl:choose>' +
+ ' </xsl:copy>' +
+ ' </xsl:for-each>' +
+ ' </xsl:when>' +
+ ' <xsl:otherwise>' +
+ ' <xsl:for-each select="(//*)[position()<= $offset]"><m:mtd/></xsl:for-each>' +
+ ' <xsl:copy-of select="*"/>' +
+ ' </xsl:otherwise>' +
+ ' </xsl:choose>' +
+ ' </m:mtr>' +
+ ' </xsl:for-each>' +
+ ' </m:mtable>' +
+ '</xsl:variable>' +
+ '<xsl:apply-templates mode="ml" select="c:node-set($m)"/>' +
+ '</xsl:template>' +
+ '<xsl:template match="*" mode="ml">' +
+ ' <xsl:copy>' +
+ ' <xsl:copy-of select="@*"/>' +
+ ' <xsl:apply-templates mode="ml"/>' +
+ ' </xsl:copy>' +
+ '</xsl:template>' +
+ '<xsl:template mode="ml" match="m:mtr[following-sibling::*[1][@class=\'msline\']]">' +
+ ' <m:mtr>' +
+ ' <xsl:copy-of select="@*"/>' +
+ ' <xsl:variable name="m" select="following-sibling::*[1]/m:mtd"/>' +
+ ' <xsl:for-each select="m:mtd">' +
+ ' <xsl:variable name="p" select="position()"/>' +
+ ' <m:mtd>' +
+ ' <xsl:copy-of select="@*"/>' +
+ ' <xsl:choose>' +
+ ' <xsl:when test="$m[$p]/m:mpadded">' +
+ ' <m:menclose notation="bottom">' +
+ ' <m:mpadded depth=".1em" height="1em" width=".4em">' +
+ ' <xsl:copy-of select="*"/>' +
+ ' </m:mpadded>' +
+ ' </m:menclose>' +
+ ' </xsl:when>' +
+ ' <xsl:otherwise>' +
+ ' <xsl:copy-of select="*"/>' +
+ ' </xsl:otherwise>' +
+ ' </xsl:choose>' +
+ ' </m:mtd>' +
+ ' </xsl:for-each>' +
+ ' </m:mtr>' +
+ '</xsl:template><xsl:template mode="ml" match="m:mtr[not(preceding-sibling::*)][@class=\'msline\']" priority="3">' +
+ ' <m:mtr>' +
+ ' <xsl:copy-of select="@*"/>' +
+ ' <xsl:for-each select="m:mtd">' +
+ ' <m:mtd>' +
+ ' <xsl:copy-of select="@*"/>' +
+ ' <xsl:if test="m:mpadded">' +
+ ' <m:menclose notation="bottom">' +
+ ' <m:mpadded depth=".1em" height="1em" width=".4em">' +
+ ' <m:mspace width=".2em"/>' +
+ ' </m:mpadded>' +
+ ' </m:menclose>' +
+ ' </xsl:if>' +
+ ' </m:mtd>' +
+ ' </xsl:for-each>' +
+ ' </m:mtr>' +
+ '</xsl:template><xsl:template mode="ml" match="m:mtr[@class=\'msline\']" priority="2"/>' +
+ '<xsl:template mode="mstack1" match="*">' +
+ ' <xsl:param name="p"/>' +
+ ' <xsl:param name="maxl" select="0"/>' +
+ ' <m:mtr l="{1 + $p}">' +
+ ' <xsl:if test="ancestor::mstack[1]/@stackalign=\'left\'">' +
+ ' <xsl:attribute name="l"><xsl:value-of select="$p"/></xsl:attribute>' +
+ ' </xsl:if>' +
+ ' <m:mtd><xsl:apply-templates select="."/></m:mtd>' +
+ ' </m:mtr>' +
+ '</xsl:template>' +
+ '<xsl:template mode="mstack1" match="m:msrow">' +
+ ' <xsl:param name="p"/>' +
+ ' <xsl:param name="maxl" select="0"/>' +
+ ' <xsl:variable name="align1" select="ancestor::m:mstack[1]/@stackalign"/>' +
+ ' <xsl:variable name="align">' +
+ ' <xsl:choose>' +
+ ' <xsl:when test="string($align1)=\'\'">decimalpoint</xsl:when>' +
+ ' <xsl:otherwise><xsl:value-of select="$align1"/></xsl:otherwise>' +
+ ' </xsl:choose>' +
+ ' </xsl:variable>' +
+ ' <xsl:variable name="row">' +
+ ' <xsl:apply-templates mode="mstack1" select="*">' +
+ ' <xsl:with-param name="p" select="0"/>' +
+ ' </xsl:apply-templates>' +
+ ' </xsl:variable>' +
+ ' <xsl:text> </xsl:text>' +
+ ' <xsl:variable name="l1">' +
+ ' <xsl:choose>' +
+ ' <xsl:when test="$align=\'decimalpoint\' and m:mn">' +
+ ' <xsl:for-each select="c:node-set($row)/m:mtr[m:mtd/m:mn][1]">' +
+ ' <xsl:value-of select="number(sum(@l))+count(preceding-sibling::*/@l)"/>' +
+ ' </xsl:for-each>' +
+ ' </xsl:when>' +
+ ' <xsl:when test="$align=\'right\' or $align=\'decimalpoint\'">' +
+ ' <xsl:value-of select="count(c:node-set($row)/m:mtr/m:mtd)"/>' +
+ ' </xsl:when>' +
+ ' <xsl:otherwise>' +
+ ' <xsl:value-of select="0"/>' +
+ ' </xsl:otherwise>' +
+ ' </xsl:choose>' +
+ ' </xsl:variable>' +
+ ' <m:mtr class="msrow" l="{number($l1) + number(sum(@position)) +$p}">' +
+ ' <xsl:copy-of select="c:node-set($row)/m:mtr/*"/>' +
+ ' </m:mtr>' +
+ '</xsl:template><xsl:template mode="mstack1" match="m:mn">' +
+ ' <xsl:param name="p"/>' +
+ ' <xsl:variable name="align1" select="ancestor::m:mstack[1]/@stackalign"/>' +
+ ' <xsl:variable name="dp1" select="ancestor::*[@decimalpoint][1]/@decimalpoint"/>' +
+ ' <xsl:variable name="align">' +
+ ' <xsl:choose>' +
+ ' <xsl:when test="string($align1)=\'\'">decimalpoint</xsl:when>' +
+ ' <xsl:otherwise><xsl:value-of select="$align1"/></xsl:otherwise>' +
+ ' </xsl:choose>' +
+ ' </xsl:variable>' +
+ ' <xsl:variable name="dp">' +
+ ' <xsl:choose>' +
+ ' <xsl:when test="string($dp1)=\'\'">.</xsl:when>' +
+ ' <xsl:otherwise><xsl:value-of select="$dp1"/></xsl:otherwise>' +
+ ' </xsl:choose>' +
+ ' </xsl:variable>' +
+ ' <m:mtr l="$p">' +
+ ' <xsl:variable name="mn" select="normalize-space(.)"/>' +
+ ' <xsl:variable name="len" select="string-length($mn)"/>' +
+ ' <xsl:choose>' +
+ ' <xsl:when test="$align=\'right\' or ($align=\'decimalpoint\' and not(contains($mn,$dp)))">' +
+ ' <xsl:attribute name="l"><xsl:value-of select="$p + $len"/></xsl:attribute>' +
+ ' </xsl:when>' +
+ ' <xsl:when test="$align=\'center\'">' +
+ ' <xsl:attribute name="l"><xsl:value-of select="round(($p + $len) div 2)"/></xsl:attribute>' +
+ ' </xsl:when>' +
+ ' <xsl:when test="$align=\'decimalpoint\'">' +
+ ' <xsl:attribute name="l"><xsl:value-of select="$p + string-length(substring-before($mn,$dp))"/></xsl:attribute>' +
+ ' </xsl:when>' +
+ ' </xsl:choose> <xsl:for-each select="(//node())[position() <=$len]">' +
+ ' <xsl:variable name="pos" select="position()"/>' +
+ ' <m:mtd><m:mn><xsl:value-of select="substring($mn,$pos,1)"/></m:mn></m:mtd>' +
+ ' </xsl:for-each>' +
+ ' </m:mtr>' +
+ '</xsl:template>' +
+ '<xsl:template match="m:msgroup" mode="mstack1">' +
+ ' <xsl:param name="p"/>' +
+ ' <xsl:variable name="s" select="number(sum(@shift))"/>' +
+ ' <xsl:variable name="thisp" select="number(sum(@position))"/>' +
+ ' <xsl:for-each select="*">' +
+ ' <xsl:apply-templates mode="mstack1" select=".">' +
+ ' <xsl:with-param name="p" select="number($p)+$thisp+(position()-1)*$s"/>' +
+ ' </xsl:apply-templates>' +
+ ' </xsl:for-each>' +
+ '</xsl:template>' +
+ '<xsl:template match="m:msline" mode="mstack1">' +
+ ' <xsl:param name="p"/>' +
+ ' <xsl:variable name="align1" select="ancestor::m:mstack[1]/@stackalign"/>' +
+ ' <xsl:variable name="align">' +
+ ' <xsl:choose>' +
+ ' <xsl:when test="string($align1)=\'\'">decimalpoint</xsl:when>' +
+ ' <xsl:otherwise><xsl:value-of select="$align1"/></xsl:otherwise>' +
+ ' </xsl:choose>' +
+ ' </xsl:variable>' +
+ ' <m:mtr class="msline">' +
+ ' <xsl:attribute name="l">' +
+ ' <xsl:choose>' +
+ ' <xsl:when test="not(string(@length)) or @length=0">*</xsl:when>' +
+ ' <xsl:when test="string($align)=\'right\' or string($align)=\'decimalpoint\' "><xsl:value-of select="$p+ @length"/></xsl:when>' +
+ ' <xsl:otherwise><xsl:value-of select="$p"/></xsl:otherwise>' +
+ ' </xsl:choose>' +
+ ' </xsl:attribute>' +
+ ' <xsl:variable name="w">' +
+ ' <xsl:choose>' +
+ ' <xsl:when test="@mslinethickness=\'thin\'">0.1em</xsl:when>' +
+ ' <xsl:when test="@mslinethickness=\'medium\'">0.15em</xsl:when>' +
+ ' <xsl:when test="@mslinethickness=\'thick\'">0.2em</xsl:when>' +
+ ' <xsl:when test="@mslinethickness"><xsl:value-of select="@mslinethickness"/></xsl:when>' +
+ ' <xsl:otherwise>0.15em</xsl:otherwise>' +
+ ' </xsl:choose>' +
+ ' </xsl:variable>' +
+ ' <xsl:choose>' +
+ ' <xsl:when test="not(string(@length)) or @length=0">' +
+ ' <m:mtd class="mslinemax">' +
+ ' <m:mpadded lspace="-0.2em" width="0em" height="0em">' +
+ ' <m:mfrac linethickness="{$w}">' +
+ ' <m:mspace width=".4em"/>' +
+ ' <m:mrow/>' +
+ ' </m:mfrac>' +
+ ' </m:mpadded>' +
+ ' </m:mtd>' +
+ ' </xsl:when>' +
+ ' <xsl:otherwise>' +
+ ' <xsl:variable name="l" select="@length"/>' +
+ ' <xsl:for-each select="(//node())[position()<=$l]">' +
+ ' <m:mtd class="msline">' +
+ ' <m:mpadded lspace="-0.2em" width="0em" height="0em">' +
+ ' <m:mfrac linethickness="{$w}">' +
+ ' <m:mspace width=".4em"/>' +
+ ' <m:mrow/>' +
+ ' </m:mfrac>' +
+ ' </m:mpadded>' +
+ ' </m:mtd>' +
+ ' </xsl:for-each>' +
+ ' </xsl:otherwise>' +
+ ' </xsl:choose>' +
+ ' </m:mtr>' +
+ '</xsl:template>' +
+ '<xsl:template match="m:mscarries" mode="mstack1">' +
+ ' <xsl:param name="p"/>' +
+ ' <xsl:variable name="align1" select="ancestor::m:mstack[1]/@stackalign"/>' +
+ ' <xsl:variable name="l1">' +
+ ' <xsl:choose>' +
+ ' <xsl:when test="string($align1)=\'left\'">0</xsl:when>' +
+ ' <xsl:otherwise><xsl:value-of select="count(*)"/></xsl:otherwise>' +
+ ' </xsl:choose>' +
+ ' </xsl:variable>' +
+ ' <m:mtr class="mscarries" l="{$p + $l1 + sum(@position)}">' +
+ ' <xsl:apply-templates select="*" mode="msc"/>' +
+ ' </m:mtr>' +
+ '</xsl:template><xsl:template match="*" mode="msc">' +
+ ' <m:mtd>' +
+ ' <xsl:copy-of select="../@location|../@crossout"/>' +
+ ' <xsl:choose>' +
+ ' <xsl:when test="../@scriptsizemultiplier">' +
+ ' <m:mstyle mathsize="{round(../@scriptsizemultiplier div .007)}%">' +
+ ' <xsl:apply-templates select="."/>' +
+ ' </m:mstyle>' +
+ ' </xsl:when>' +
+ ' <xsl:otherwise>' +
+ ' <xsl:apply-templates select="."/>' +
+ ' </xsl:otherwise>' +
+ ' </xsl:choose>' +
+ ' </m:mtd>' +
+ '</xsl:template><xsl:template match="m:mscarry" mode="msc">' +
+ ' <m:mtd>' +
+ ' <xsl:copy-of select="@location|@crossout"/>' +
+ ' <xsl:choose>' +
+ ' <xsl:when test="../@scriptsizemultiplier">' +
+ ' <m:mstyle mathsize="{round(../@scriptsizemultiplier div .007)}%">' +
+ ' <xsl:apply-templates/>' +
+ ' </m:mstyle>' +
+ ' </xsl:when>' +
+ ' <xsl:otherwise>' +
+ ' <xsl:apply-templates/>' +
+ ' </xsl:otherwise>' +
+ ' </xsl:choose>' +
+ ' </m:mtd>' +
+ '</xsl:template>' +
+ '<xsl:template match="m:mlongdiv" priority="11">' +
+ ' <xsl:variable name="ms">' +
+ ' <m:mstack>' +
+ ' <xsl:copy-of select="(ancestor-or-self::*/@decimalpoint)[last()]"/>' +
+ ' <xsl:choose>' +
+ ' <xsl:when test="@longdivstyle=\'left)(right\'">' +
+ ' <m:msrow>' +
+ ' <m:mrow><xsl:copy-of select="*[1]"/></m:mrow>' +
+ ' <m:mo>)</m:mo>' +
+ ' <xsl:copy-of select="*[3]"/>' +
+ ' <m:mo>(</m:mo>' +
+ ' <xsl:copy-of select="*[2]"/>' +
+ ' </m:msrow>' +
+ ' </xsl:when>' +
+ ' <xsl:when test="@longdivstyle=\'left/\right\'">' +
+ ' <m:msrow>' +
+ ' <m:mrow><xsl:copy-of select="*[1]"/></m:mrow>' +
+ ' <m:mo>/</m:mo>' +
+ ' <xsl:copy-of select="*[3]"/>' +
+ ' <m:mo>\</m:mo>' +
+ ' <xsl:copy-of select="*[2]"/>' +
+ ' </m:msrow>' +
+ ' </xsl:when>' +
+ ' <xsl:when test="@longdivstyle=\':right=right\'">' +
+ ' <m:msrow>' +
+ ' <xsl:copy-of select="*[3]"/>' +
+ ' <m:mo>:</m:mo>' +
+ ' <xsl:copy-of select="*[1]"/>' +
+ ' <m:mo>=</m:mo>' +
+ ' <xsl:copy-of select="*[2]"/>' +
+ ' </m:msrow>' +
+ ' </xsl:when>' +
+ ' <xsl:when test="@longdivstyle=\'stackedrightright\'' +
+ ' or @longdivstyle=\'mediumstackedrightright\'' +
+ ' or @longdivstyle=\'shortstackedrightright\'' +
+ ' or @longdivstyle=\'stackedleftleft\'' +
+ ' ">' +
+ ' <xsl:attribute name="align">top</xsl:attribute>' +
+ ' <xsl:copy-of select="*[3]"/>' +
+ ' </xsl:when>' +
+ ' <xsl:when test="@longdivstyle=\'stackedleftlinetop\'">' +
+ ' <xsl:copy-of select="*[2]"/>' +
+ ' <m:msline length="{string-length(*[3])-1}"/>' +
+ ' <m:msrow>' +
+ ' <m:mrow>' +
+ ' <m:menclose notation="bottom right">' +
+ ' <xsl:copy-of select="*[1]"/>' +
+ ' </m:menclose>' +
+ ' </m:mrow>' +
+ ' <xsl:copy-of select="*[3]"/>' +
+ ' </m:msrow>' +
+ ' </xsl:when>' +
+ ' <xsl:when test="@longdivstyle=\'righttop\'">' +
+ ' <xsl:copy-of select="*[2]"/>' +
+ ' <m:msline length="{string-length(*[3])}"/>' +
+ ' <m:msrow>' +
+ ' <xsl:copy-of select="*[3]"/>' +
+ ' <m:menclose notation="top left bottom">' +
+ ' <xsl:copy-of select="*[1]"/></m:menclose>' +
+ ' </m:msrow>' +
+ ' </xsl:when>' +
+ ' <xsl:otherwise>' +
+ ' <xsl:copy-of select="*[2]"/>' +
+ ' <m:msline length="{string-length(*[3])}"/>' +
+ ' <m:msrow>' +
+ ' <m:mrow><xsl:copy-of select="*[1]"/></m:mrow>' +
+ ' <m:mo>)</m:mo>' +
+ ' <xsl:copy-of select="*[3]"/>' +
+ ' </m:msrow>' +
+ ' </xsl:otherwise>' +
+ ' </xsl:choose>' +
+ ' <xsl:copy-of select="*[position()>3]"/>' +
+ ' </m:mstack>' +
+ ' </xsl:variable>' +
+ ' <xsl:choose>' +
+ ' <xsl:when test="@longdivstyle=\'stackedrightright\'">' +
+ ' <m:menclose notation="right">' +
+ ' <xsl:apply-templates select="c:node-set($ms)"/>' +
+ ' </m:menclose>' +
+ ' <m:mtable align="top">' +
+ ' <m:mtr>' +
+ ' <m:menclose notation="bottom">' +
+ ' <xsl:copy-of select="*[1]"/>' +
+ ' </m:menclose>' +
+ ' </m:mtr>' +
+ ' <m:mtr>' +
+ ' <mtd><xsl:copy-of select="*[2]"/></mtd>' +
+ ' </m:mtr>' +
+ ' </m:mtable>' +
+ ' </xsl:when>' +
+ ' <xsl:when test="@longdivstyle=\'mediumstackedrightright\'">' +
+ ' <xsl:apply-templates select="c:node-set($ms)"/>' +
+ ' <m:menclose notation="left">' +
+ ' <m:mtable align="top">' +
+ ' <m:mtr>' +
+ ' <m:menclose notation="bottom">' +
+ ' <xsl:copy-of select="*[1]"/>' +
+ ' </m:menclose>' +
+ ' </m:mtr>' +
+ ' <m:mtr>' +
+ ' <mtd><xsl:copy-of select="*[2]"/></mtd>' +
+ ' </m:mtr>' +
+ ' </m:mtable>' +
+ ' </m:menclose>' +
+ ' </xsl:when>' +
+ ' <xsl:when test="@longdivstyle=\'shortstackedrightright\'">' +
+ ' <xsl:apply-templates select="c:node-set($ms)"/>' +
+ ' <m:mtable align="top">' +
+ ' <m:mtr>' +
+ ' <m:menclose notation="left bottom">' +
+ ' <xsl:copy-of select="*[1]"/>' +
+ ' </m:menclose>' +
+ ' </m:mtr>' +
+ ' <m:mtr>' +
+ ' <mtd><xsl:copy-of select="*[2]"/></mtd>' +
+ ' </m:mtr>' +
+ ' </m:mtable>' +
+ ' </xsl:when>' +
+ ' <xsl:when test="@longdivstyle=\'stackedleftleft\'">' +
+ ' <m:mtable align="top">' +
+ ' <m:mtr>' +
+ ' <m:menclose notation="bottom">' +
+ ' <xsl:copy-of select="*[1]"/>' +
+ ' </m:menclose>' +
+ ' </m:mtr>' +
+ ' <m:mtr>' +
+ ' <mtd><xsl:copy-of select="*[2]"/></mtd>' +
+ ' </m:mtr>' +
+ ' </m:mtable>' +
+ ' <m:menclose notation="left">' +
+ ' <xsl:apply-templates select="c:node-set($ms)"/>' +
+ ' </m:menclose>' +
+ ' </xsl:when>' +
+ ' <xsl:otherwise>' +
+ ' <xsl:apply-templates select="c:node-set($ms)"/>' +
+ ' </xsl:otherwise>' +
+ ' </xsl:choose>' +
+ '</xsl:template>' +
+ '<xsl:template match="m:menclose[@notation=\'madruwb\']" mode="rtl">' +
+ ' <m:menclose notation="bottom right">' +
+ ' <xsl:apply-templates mode="rtl"/>' +
+ ' </m:menclose>' +
+ '</xsl:template></xsl:stylesheet>';
+
/*
* End of mml3mj.xsl material.
*/
-
+
var mml3;
if (window.XSLTProcessor) {
// standard method: just use an XSLTProcessor and parse the stylesheet
@@ -121,6 +765,18 @@ MathJax.Hub.Register.StartupHook("MathML Jax Ready",function () {
// No XSLT support. Do not change the <math> content.
MATHML.mml3XSLT = null;
}
+
+ // Tweak CSS to avoid some browsers rearranging HTML output
+ MathJax.Ajax.Styles({
+ ".MathJax .mi, .MathJax .mo, .MathJax .mn, .MathJax .mtext": {
+ direction: "ltr",
+ display: "inline-block"
+ },
+ ".MathJax .ms, .MathJax .mspace, .MathJax .mglyph": {
+ direction: "ltr",
+ display: "inline-block"
+ }
+ });
MathJax.Hub.Startup.signal.Post("MathML mml3.js Ready");
});
diff --git a/unpacked/extensions/MathMenu.js b/unpacked/extensions/MathMenu.js
@@ -295,7 +295,7 @@
onmouseup: MENU.Mouseup, ondblclick: FALSE,
ondragstart: FALSE, onselectstart: FALSE, oncontextmenu: FALSE,
menuItem: this, className: "MathJax_Menu", onkeydown: MENU.Keydown,
- role: "navigation"
+ role: "menu"
});
if (event.type === "contextmenu" || event.type === "mouseover")
menu.className += " MathJax_ContextMenu";
@@ -614,7 +614,8 @@
{onmouseup: MENU.Mouseup,
ondragstart: FALSE, onselectstart: FALSE, onselectend: FALSE,
ontouchstart: MENU.Touchstart, ontouchend: MENU.Touchend,
- className: "MathJax_MenuItem", menuItem: this},
+ className: "MathJax_MenuItem", role: this.role,
+ menuItem: this},
def);
},
@@ -695,14 +696,12 @@
* Abstract class of menu items that are focusable and perform some action
*/
MENU.ENTRY = MENU.ITEM.Subclass({
-
role: "menuitem", // Aria role.
Attributes: function(def) {
def = HUB.Insert(
{onmouseover: MENU.Mouseover, onmouseout: MENU.Mouseout,
- onmousedown: MENU.Mousedown, role: this.role,
- onkeydown: MENU.Keydown,
+ onmousedown: MENU.Mousedown, onkeydown: MENU.Keydown,
"aria-disabled": !!this.disabled},
def);
def = this.SUPER(arguments).Attributes.call(this, def);
@@ -814,6 +813,11 @@
marker: "\u25BA", // the submenu arrow
markerRTL: "\u25C4", // the submenu arrow for RTL
+ Attributes: function(def) {
+ def = HUB.Insert({"aria-haspopup": "true"}, def);
+ def = this.SUPER(arguments).Attributes.call(this, def);
+ return def;
+ },
Init: function (name,def) {
if (!(name instanceof Array)) {name = [name,name]} // make [id,label] pair
this.name = name; var i = 1;
@@ -907,6 +911,12 @@
marker: (isPC ? "\u25CF" : "\u2713"), // the checkmark
role: "menuitemradio",
+ Attributes: function(def) {
+ var checked = CONFIG.settings[this.variable] === this.value ? "true" : "false";
+ def = HUB.Insert({"aria-checked": checked}, def);
+ def = this.SUPER(arguments).Attributes.call(this, def);
+ return def;
+ },
Init: function (name,variable,def) {
if (!(name instanceof Array)) {name = [name,name]} // make [id,label] pair
this.name = name; this.variable = variable; this.With(def);
@@ -914,7 +924,9 @@
},
Label: function (def,menu) {
var span = {className:"MathJax_MenuRadioCheck" + this.rtlClass()};
- if (CONFIG.settings[this.variable] !== this.value) {span = {style:{display:"none"}}}
+ if (CONFIG.settings[this.variable] !== this.value) {
+ span = {style:{display:"none"}};
+ }
return [["span",span,[this.marker]]," "+this.Name()];
},
Mouseup: function (event,menu) {
@@ -922,8 +934,9 @@
var child = menu.parentNode.childNodes;
for (var i = 0, m = child.length; i < m; i++) {
var item = child[i].menuItem;
- if (item && item.variable === this.variable)
- {child[i].firstChild.style.display = "none"}
+ if (item && item.variable === this.variable) {
+ child[i].firstChild.style.display = "none";
+ }
}
menu.firstChild.display = "";
CONFIG.settings[this.variable] = this.value;
@@ -945,6 +958,12 @@
marker: "\u2713", // the checkmark
role: "menuitemcheckbox",
+ Attributes: function(def) {
+ var checked = CONFIG.settings[this.variable] ? "true" : "false";
+ def = HUB.Insert({"aria-checked": checked}, def);
+ def = this.SUPER(arguments).Attributes.call(this, def);
+ return def;
+ },
Init: function (name,variable,def) {
if (!(name instanceof Array)) {name = [name,name]} // make [id,label] pair
this.name = name; this.variable = variable; this.With(def);
@@ -994,6 +1013,13 @@
* A rule in a menu
*/
MENU.ITEM.RULE = MENU.ITEM.Subclass({
+ role: "separator",
+
+ Attributes: function(def) {
+ def = HUB.Insert({"aria-orientation": "vertical"}, def);
+ def = this.SUPER(arguments).Attributes.call(this, def);
+ return def;
+ },
Label: function (def,menu) {
def.className += " MathJax_MenuRule";
return null;
@@ -1035,8 +1061,8 @@
["a",{href:"http://www.mathjax.org/"},["www.mathjax.org"]],
["span",{className:"MathJax_MenuClose",id:"MathJax_AboutClose",
onclick:MENU.About.Remove,
- onkeydown: MENU.About.Keydown, tabIndex: 0,
- "aria-label": "Close", "aria-describedby": _("CloseWindow","Close window")},
+ onkeydown: MENU.About.Keydown, tabIndex: 0, role: "button",
+ "aria-label": _("CloseWindow","Close window")},
[["span",{},"\u00D7"]]]
]);
if (event.type === "mouseup") about.className += " MathJax_MousePost";
@@ -1230,6 +1256,7 @@
if (BROWSER.isChrome && BROWSER.version.substr(0,3) !== "24.") {message = MESSAGE.MML.WebKit}
else if (BROWSER.isSafari && !BROWSER.versionAtLeast("5.0")) {message = MESSAGE.MML.WebKit}
else if (BROWSER.isMSIE) {if (!BROWSER.hasMathPlayer) {message = MESSAGE.MML.MSIE}}
+ else if (BROWSER.isEdge) {message = MESSAGE.MML.WebKit}
else {message = MESSAGE.MML[BROWSER]}
warned = "warnedMML";
}
diff --git a/unpacked/extensions/TeX/AMSmath.js b/unpacked/extensions/TeX/AMSmath.js
@@ -134,14 +134,14 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
aligned: ['AlignedAMSArray',null,null,null,'rlrlrlrlrlrl',COLS([0,2,0,2,0,2,0,2,0,2,0]),".5em",'D'],
gathered: ['AlignedAMSArray',null,null,null,'c',null,".5em",'D'],
- subarray: ['Array',null,null,null,null,COLS([0,0,0,0]),"0.1em",'S',1],
+ subarray: ['Array',null,null,null,null,COLS([0]),"0.1em",'S',1],
smallmatrix: ['Array',null,null,null,'c',COLS([1/3]),".2em",'S',1],
'equation': ['EquationBegin','Equation',true],
'equation*': ['EquationBegin','EquationStar',false],
- eqnarray: ['AMSarray',null,true,true, 'rcl',MML.LENGTH.THICKMATHSPACE,".5em"],
- 'eqnarray*': ['AMSarray',null,false,true,'rcl',MML.LENGTH.THICKMATHSPACE,".5em"]
+ eqnarray: ['AMSarray',null,true,true, 'rcl',COLS([0]),".5em"],
+ 'eqnarray*': ['AMSarray',null,false,true,'rcl',COLS([0]),".5em"]
},
delimiter: {
diff --git a/unpacked/jax/output/CommonHTML/autoload/mmultiscripts.js b/unpacked/jax/output/CommonHTML/autoload/mmultiscripts.js
@@ -45,7 +45,7 @@ MathJax.Hub.Register.StartupHook("CommonHTML Jax Ready",function () {
//
var base, bbox;
if (stretch) {
- base = node.getElementsByTagName("mjx-base")[0];
+ base = CHTML.getNode(node,"mjx-base");
} else {
this.CHTMLaddChild(node,0,{type:"mjx-base", noBBox:true, forceChild:true});
base = node.firstChild;
@@ -137,10 +137,10 @@ MathJax.Hub.Register.StartupHook("CommonHTML Jax Ready",function () {
//
CHTMLgetScripts: function (BOX,BBOX,stretch,node) {
if (stretch) {
- BOX.sub = node.getElementsByTagName("mjx-sub")[0];
- BOX.sup = node.getElementsByTagName("mjx-sup")[0];
- BOX.presub = node.getElementsByTagName("mjx-presub")[0];
- BOX.presup = node.getElementsByTagName("mjx-presup")[0];
+ BOX.sub = CHTML.getNode(node,"mjx-sub");
+ BOX.sup = CHTML.getNode(node,"mjx-sup");
+ BOX.presub = CHTML.getNode(node,"mjx-presub");
+ BOX.presup = CHTML.getNode(node,"mjx-presup");
BBOX.sub = this.CHTMLbbox.sub;
BBOX.sup = this.CHTMLbbox.sup;
BBOX.presub = this.CHTMLbbox.presub;
@@ -182,7 +182,7 @@ MathJax.Hub.Register.StartupHook("CommonHTML Jax Ready",function () {
BBOX = state.BBOX[type] = CHTML.BBOX.empty();
if (state.w) {
BOX.style.paddingLeft = CHTML.Em(state.w);
- BBOX.w = BBOX.r = state.w;
+ BBOX.w = BBOX.r = state.w; BBOX.x = state.w;
}
}
data.toCommonHTML(BOX);
@@ -198,7 +198,7 @@ MathJax.Hub.Register.StartupHook("CommonHTML Jax Ready",function () {
// right-justify the scripts, otherwise, left-justify them.
//
CHTMLpadScript: function (type,w,bbox,state) {
- if (!bbox) bbox = {w:0, fake:1};
+ if (!bbox) bbox = {w:0, fake:1, rscale:1};
var BBOX = state.BBOX[type], dx = 0, dw = 0;
if (BBOX) {
if (bbox.rscale*bbox.w < w) {
@@ -252,7 +252,7 @@ MathJax.Hub.Register.StartupHook("CommonHTML Jax Ready",function () {
CHTMLplaceSubSup: function (sub,sbox,sup,Sbox,x,delta,u,v,s) {
sub.style.paddingRight = CHTML.Em(s); sbox.w += s;
sup.style.paddingBottom = CHTML.Em(u+v-Sbox.d-sbox.h);
- sup.style.paddingLeft = CHTML.Em(delta);
+ sup.style.paddingLeft = CHTML.Em(delta+(Sbox.x||0));
sup.style.paddingRight = CHTML.Em(s); Sbox.w += s;
sup.parentNode.style.verticalAlign = CHTML.Em(-v);
this.CHTML.combine(sbox,x,-v);
@@ -272,7 +272,7 @@ MathJax.Hub.Register.StartupHook("CommonHTML Jax Ready",function () {
CHTMLplacePresubPresup: function (presub,pbox,presup,Pbox,delta,u,v,s) {
presub.style.paddingLeft = CHTML.Em(s);
presup.style.paddingBottom = CHTML.Em(u+v-Pbox.d-pbox.h);
- presup.style.paddingLeft = CHTML.Em(delta+s);
+ presup.style.paddingLeft = CHTML.Em(delta+s+(Pbox.x||0));
presup.style.paddingRight = CHTML.Em(-delta);
presup.parentNode.style.verticalAlign = CHTML.Em(-v);
this.CHTML.combine(pbox,s,-v);
diff --git a/unpacked/jax/output/CommonHTML/autoload/multiline.js b/unpacked/jax/output/CommonHTML/autoload/multiline.js
@@ -505,9 +505,9 @@ MathJax.Hub.Register.StartupHook("CommonHTML Jax Ready",function () {
//
if (end.length === 0) {
var NODE = this.CHTMLnodeElement(),
- stack = NODE.getElementsByTagName("mjx-stack")[0],
- sup = NODE.getElementsByTagName("mjx-sup")[0],
- sub = NODE.getElementsByTagName("mjx-sub")[0];
+ stack = CHTML.getNode(NODE,"mjx-stack"),
+ sup = CHTML.getNode(NODE,"mjx-sup"),
+ sub = CHTML.getNode(NODE,"mjx-sub");
if (stack) node.appendChild(stack);
else if (sup) node.appendChild(sup);
else if (sub) node.appendChild(sub);
@@ -569,9 +569,9 @@ MathJax.Hub.Register.StartupHook("CommonHTML Jax Ready",function () {
//
if (start.length < 1) {
NODE = this.CHTMLnodeElement();
- var prestack = NODE.getElementsByTagName("mjx-prestack")[0],
- presup = NODE.getElementsByTagName("mjx-presup")[0],
- presub = NODE.getElementsByTagName("mjx-presub")[0];
+ var prestack = CHTML.getNode(NODE,"mjx-prestack"),
+ presup = CHTML.getNode(NODE,"mjx-presup"),
+ presub = CHTML.getNode(NODE,"mjx-presub");
if (prestack) node.appendChild(prestack);
else if (presup) node.appendChild(presup);
else if (presub) node.appendChild(presub);
@@ -598,9 +598,9 @@ MathJax.Hub.Register.StartupHook("CommonHTML Jax Ready",function () {
//
if (end.length === 0) {
NODE = this.CHTMLnodeElement();
- var stack = NODE.getElementsByTagName("mjx-stack")[0],
- sup = NODE.getElementsByTagName("mjx-sup")[0],
- sub = NODE.getElementsByTagName("mjx-sub")[0];
+ var stack = CHTML.getNode(NODE,"mjx-stack"),
+ sup = CHTML.getNode(NODE,"mjx-sup"),
+ sub = CHTML.getNode(NODE,"mjx-sub");
if (stack) node.appendChild(stack);
else if (sup) node.appendChild(sup);
else if (sub) node.appendChild(sub);
diff --git a/unpacked/jax/output/CommonHTML/jax.js b/unpacked/jax/output/CommonHTML/jax.js
@@ -325,8 +325,9 @@
if (!def) def = {};
if (def.isMathJax == null) def.isMathJax = true;
if (def.className) def.className = type+" "+def.className; else def.className = type;
+ type = "span";
}
- return this.HTMLElement("span",def,content);
+ return this.HTMLElement(type,def,content);
},
addElement: function (node,type,def,content) {
return node.appendChild(this.Element(type,def,content));
@@ -335,6 +336,22 @@
ucMatch: HTML.ucMatch,
setScript: HTML.setScript,
+ //
+ // This replaces node.getElementsByTagName(type)[0]
+ // and should be replaced by that if we go back to using
+ // custom tags
+ //
+ getNode: (document.getElementsByClassName ?
+ function (node,type) {return node.getElementsByClassName(type)[0]} :
+ function (node,type) {
+ var nodes = node.getElementsByTagName("span");
+ var name = RegExp("\\b"+type+"\\b");
+ for (var i = 0, m = nodes.length; i < m; i++) {
+ if (name.test(nodes[i].className)) return nodes[i];
+ }
+ }
+ ),
+
/********************************************/
@@ -361,7 +378,7 @@
// Remove any existing output
//
prev = script.previousSibling;
- if (prev && prev.nodeName.toLowerCase() === "mjx-chtml")
+ if (prev && prev.className && String(prev.className).substr(0,9) === "mjx-chtml")
prev.parentNode.removeChild(prev);
//
// Add the node for the math and mark it as being processed
@@ -1328,7 +1345,7 @@
if (child) {
var type = options.childNodes;
if (type) {
- if (type instanceof Array) type = type[i];
+ if (type instanceof Array) type = type[i]||"span";
node = CHTML.addElement(node,type);
}
cnode = child.toCommonHTML(node,options.childOptions);
@@ -1667,6 +1684,9 @@
MML.math.Augment({
toCommonHTML: function (node) {
node = this.CHTMLdefaultNode(node);
+ var alttext = this.Get("alttext");
+ if (alttext && !node.getAttribute("aria-label")) node.setAttribute("aria-label",alttext);
+ if (!node.getAttribute("role")) node.setAttribute("role","math");
if (this.CHTML.pwidth) {
node.parentNode.style.width = this.CHTML.pwidth;
node.parentNode.style.minWidth = this.CHTML.mwidth;
@@ -2032,9 +2052,9 @@
//
var base, under, over, nodes = [];
if (stretch) {
- base = node.getElementsByTagName("mjx-op")[0];
- under = node.getElementsByTagName("mjx-under")[0];
- over = node.getElementsByTagName("mjx-over")[0];
+ base = CHTML.getNode(node,"mjx-op");
+ under = CHTML.getNode(node,"mjx-under");
+ over = CHTML.getNode(node,"mjx-over");
nodes[0] = base; nodes[1] = under||over; nodes[2] = over;
} else {
var types = ["mjx-op","mjx-under","mjx-over"];
@@ -2232,9 +2252,9 @@
//
var base, sub, sup;
if (stretch) {
- base = node.getElementsByTagName("mjx-base")[0];
- sub = node.getElementsByTagName("mjx-sub")[0];
- sup = node.getElementsByTagName("mjx-sup")[0];
+ base = CHTML.getNode(node,"mjx-base");
+ sub = CHTML.getNode(node,"mjx-sub");
+ sup = CHTML.getNode(node,"mjx-sup");
} else {
var types = ["mjx-base","mjx-sub","mjx-sup"];
if (this.sup === 1) types[1] = types[2];
diff --git a/unpacked/jax/output/SVG/jax.js b/unpacked/jax/output/SVG/jax.js
@@ -2100,9 +2100,8 @@
// Add it to the MathJax span
//
var alttext = this.Get("alttext");
- if (alttext && !svg.element.getAttribute("aria-label")) span.setAttribute("aria-label",alttext);
- if (!svg.element.getAttribute("role")) span.setAttribute("role","math");
-// span.setAttribute("tabindex",0); // causes focus outline, so disable for now
+ if (alttext && !svg.element.getAttribute("aria-label")) svg.element.setAttribute("aria-label",alttext);
+ if (!svg.element.getAttribute("role")) svg.element.setAttribute("role","img");
svg.element.setAttribute("focusable","false");
span.appendChild(svg.element);
svg.element = null;