diff --git a/unpacked/extensions/MatchWebFonts.js b/unpacked/extensions/MatchWebFonts.js index 5872faa53..c6546ce3c 100644 --- a/unpacked/extensions/MatchWebFonts.js +++ b/unpacked/extensions/MatchWebFonts.js @@ -40,7 +40,7 @@ fontCheckTimeout: 15 * 1000, // how long to keep looking for fonts (15 seconds) }); - var MATCH = MathJax.Extension.MatchWebFonts = { + MathJax.Extension.MatchWebFonts = { version: VERSION, config: CONFIG }; @@ -81,7 +81,6 @@ for (i = 0, m = scripts.length; i < m; i++) { script = scripts[i]; if (!script.parentNode) continue; retry = true; var jax = script.MathJax.elementJax; if (!jax) continue; - var span = document.getElementById(jax.inputID+"-Frame"); // // Check if ex or mex has changed // @@ -153,13 +152,12 @@ for (i = 0, m = scripts.length; i < m; i++) { script = scripts[i]; if (!script.parentNode) continue; retry = true; var jax = script.MathJax.elementJax; if (!jax) continue; - var span = document.getElementById(jax.inputID+"-Frame"); // // Check if ex or mex has changed // var test = script.previousSibling; var ex = test.firstChild.offsetHeight/60; - if (ex === 0 || ex === "NaN") {ex = this.defaultEx; em = this.defaultEm} + if (ex === 0 || ex === "NaN") {ex = this.defaultEx} if (ex !== jax.SVG.ex) {size.push(script); scripts[i] = {}} } // @@ -259,7 +257,7 @@ // Check widths of mtd elements // if (math.MathJaxMtds) { - for (j = 0, n = math.MathJaxMtds.length; j < n; j++) { + for (var j = 0, n = math.MathJaxMtds.length; j < n; j++) { if (!math.MathJaxMtds[j].parentNode) continue; if (newEx || math.MathJaxMtds[j].firstChild.scrollWidth !== jax.mtds[j]) { jax.mtds[j] = math.MathJaxMtds[j].firstChild.scrollWidth; diff --git a/unpacked/extensions/MathZoom.js b/unpacked/extensions/MathZoom.js index ac1555536..42bb6c43f 100644 --- a/unpacked/extensions/MathZoom.js +++ b/unpacked/extensions/MathZoom.js @@ -258,7 +258,7 @@ overlay.style.display = ""; }, findContainer: function (obj) { - var obj = obj.parentNode; + obj = obj.parentNode; while (obj.parentNode && obj !== document.body && ZOOM.getOverflow(obj) === "visible") {obj = obj.parentNode} return obj; diff --git a/unpacked/extensions/TeX/enclose.js b/unpacked/extensions/TeX/enclose.js index 2c80489f1..0e6c48311 100644 --- a/unpacked/extensions/TeX/enclose.js +++ b/unpacked/extensions/TeX/enclose.js @@ -74,7 +74,9 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () { keyvalue[1] = keyvalue[1].replace(/^"(.*)"$/,"$1"); if (keyvalue[1] === "true") {keyvalue[1] = true} if (keyvalue[1] === "false") {keyvalue[1] = false} - def[keyvalue[0]] = keyvalue[1]; + if (keyvalue[0] === "arrow" && keyvalue[1]) + {def.notation = def.notation + " updiagonalarrow"} else + {def[keyvalue[0]] = keyvalue[1]} } } } diff --git a/unpacked/jax/element/mml/jax.js b/unpacked/jax/element/mml/jax.js index e24fd3339..e8e41bac0 100644 --- a/unpacked/jax/element/mml/jax.js +++ b/unpacked/jax/element/mml/jax.js @@ -610,7 +610,7 @@ MathJax.ElementJax.mml.Augment({ this.texClass = this.Get("texClass"); if (this.data.join("") === "\u2061") { // force previous node to be texClass OP, and skip this node - if (prev) prev.texClass = MML.TEXCLASS.OP; + if (prev) {prev.texClass = MML.TEXCLASS.OP; prev.fnOP = true} this.texClass = this.prevClass = MML.TEXCLASS.NONE; return prev; } @@ -752,7 +752,7 @@ MathJax.ElementJax.mml.Augment({ }, setTeXclass: function (prev) { var i, m = this.data.length; - if (this.open || this.close) { + if ((this.open || this.close) && (!prev || !prev.fnOP)) { // // came from \left...\right // so treat as subexpression (tex class INNER) diff --git a/unpacked/jax/input/TeX/jax.js b/unpacked/jax/input/TeX/jax.js index 7afc365c4..a6a660c41 100644 --- a/unpacked/jax/input/TeX/jax.js +++ b/unpacked/jax/input/TeX/jax.js @@ -1490,7 +1490,7 @@ Lap: function (name) { var mml = MML.mpadded(this.ParseArg(name)).With({width: 0}); - if (name === "\\llap") {mml.lspace = "-1 width"} + if (name === "\\llap") {mml.lspace = "-1width"} this.Push(MML.TeXAtom(mml)); }, @@ -1721,7 +1721,7 @@ if (!cmd) {TEX.Error(["UnknownEnv","Unknown environment '%1'",env])} if (!(cmd instanceof Array)) {cmd = [cmd]} var end = (cmd[1] instanceof Array ? cmd[1][0] : cmd[1]); - mml = STACKITEM.begin().With({name: env, end: end, parse:this}); + var mml = STACKITEM.begin().With({name: env, end: end, parse:this}); if (name === "\\end") { if (!isEnd && cmd[1] instanceof Array && this[cmd[1][1]]) { mml = this[cmd[1][1]].apply(this,[mml].concat(cmd.slice(2))); diff --git a/unpacked/jax/output/HTML-CSS/autoload/mglyph.js b/unpacked/jax/output/HTML-CSS/autoload/mglyph.js index a4ae0bb7d..c93f0acd4 100644 --- a/unpacked/jax/output/HTML-CSS/autoload/mglyph.js +++ b/unpacked/jax/output/HTML-CSS/autoload/mglyph.js @@ -68,7 +68,7 @@ MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function () { this.Append(err); err.toHTML(span); this.data.pop(); span.bbox = err.HTMLspanElement().bbox; } else { - var mu = this.HTMLgetMu(span), size; + var mu = this.HTMLgetMu(span); img = HTMLCSS.addElement(span,"img",{isMathJax:true, src:values.src, alt:values.alt, title:values.alt}); if (values.width) { img.style.width = HTMLCSS.Em(HTMLCSS.length2em(values.width,mu,this.img.img.width/HTMLCSS.em)); diff --git a/unpacked/jax/output/HTML-CSS/autoload/multiline.js b/unpacked/jax/output/HTML-CSS/autoload/multiline.js index 2c8584a8c..2e83e9d67 100644 --- a/unpacked/jax/output/HTML-CSS/autoload/multiline.js +++ b/unpacked/jax/output/HTML-CSS/autoload/multiline.js @@ -570,8 +570,11 @@ MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function () { }, HTMLmoveLine: function (start,end,span,state,values) { - var SPAN = this.HTMLspanElement(), data = SPAN.bbox, base = data, - stack = SPAN.firstChild, box = stack.firstChild, dx, BOX = {}; + var SPAN = this.HTMLspanElement(), data = SPAN.bbox, + stack = SPAN.firstChild, BOX = {}; + if (HTMLCSS.msiePaddingWidthBug) {stack = stack.nextSibling} + var box = stack.firstChild; + // // Get the boxes for the scripts (if any) // diff --git a/unpacked/jax/output/HTML-CSS/jax.js b/unpacked/jax/output/HTML-CSS/jax.js index 6e8e56ada..3eb7479da 100644 --- a/unpacked/jax/output/HTML-CSS/jax.js +++ b/unpacked/jax/output/HTML-CSS/jax.js @@ -380,6 +380,16 @@ NeoEulerWeb: "Neo-Euler" }, + fontInUse: "generic", + FONTDATA: { + TeX_factor: 1, baselineskip: 1.2, lineH: .8, lineD: .2, ffLineH: .8, + FONTS: {}, + VARIANT: { + "normal": {fonts:[]}, "-generic-variant": {fonts:[]}, + "-largeOp": {fonts:[]}, "-smallOp": {fonts:[]} + }, RANGES: [], DELIMITERS: {}, RULECHAR: 0x2D, REMAP: {} + }, + Config: function () { if (!this.require) {this.require = []} this.Font = FONTTEST(); this.SUPER(arguments).Config.call(this); @@ -414,15 +424,6 @@ } else { MESSAGE(["CantFindFontUsing","Can't find a valid font using %1", "["+this.config.availableFonts.join(", ")+"]"],null,3000); - this.fontInUse = "generic"; - this.FONTDATA = { - TeX_factor: 1, baselineskip: 1.2, lineH: .8, lineD: .2, ffLineH: .8, - FONTS: {}, - VARIANT: { - "normal": {fonts:[]}, "-generic-variant": {fonts:[]}, - "-largeOp": {fonts:[]}, "-smallOp": {fonts:[]} - }, RANGES: [], DELIMITERS: {}, RULECHAR: 0x2D, REMAP: {} - }; HUB.Startup.signal.Post("HTML-CSS Jax - no valid font"); } this.require.push(MathJax.OutputJax.extensionDir+"/MathEvents.js"); @@ -845,20 +846,19 @@ getW: function (span) { var W, H, w = (span.bbox||{}).w, start = span; if (span.bbox && span.bbox.exactW) {return w} - if ((span.bbox && w >= 0 && !this.initialSkipBug) || this.negativeBBoxes || !span.firstChild) { + if ((span.bbox && w >= 0 && !this.initialSkipBug && !this.msieItalicWidthBug) || + this.negativeBBoxes || !span.firstChild) { W = span.offsetWidth; H = span.parentNode.offsetHeight; } else if (span.bbox && w < 0 && this.msieNegativeBBoxBug) { W = -span.offsetWidth, H = span.parentNode.offsetHeight; } else { // IE can't deal with a space at the beginning, so put something else first - if (this.initialSkipBug) { - var position = span.style.position; span.style.position = "absolute"; - start = this.startMarker; span.insertBefore(start,span.firstChild) - } + var position = span.style.position; span.style.position = "absolute"; + start = this.startMarker; span.insertBefore(start,span.firstChild) span.appendChild(this.endMarker); W = this.endMarker.offsetLeft - start.offsetLeft; span.removeChild(this.endMarker); - if (this.initialSkipBug) {span.removeChild(start); span.style.position = position} + span.removeChild(start); span.style.position = position } if (H != null) {span.parentNode.HH = H/this.em} return W/this.em; @@ -1201,6 +1201,14 @@ }, alignBox: function (span,align,y) { this.placeBox(span,0,y); // set y position (and left aligned) + if (this.msiePlaceBoxBug) { + // + // placeBox() adds an extra  , so remove it here. + // + var node = span.lastChild; + while (node && node.nodeName !== "#text") {node = node.previousSibling} + if (node) {span.removeChild(node)} + } var bbox = span.bbox; if (bbox.isMultiline) return; var isRelative = bbox.width != null && !bbox.isFixed; var r = 0, c = -bbox.w/2, l = "50%"; @@ -1687,7 +1695,7 @@ var h = span.bbox.h, d = span.bbox.d, stretched = false; for (i = 0, m = stretchy.length; i < m; i++) { var bbox = stretchy[i].HTMLspanElement().bbox; - if (bbox.h !== h || bbox.d !== d) + if (stretchy[i].forceStretch || bbox.h !== h || bbox.d !== d) {stretchy[i].HTMLstretchV(span,h,d); stretched = true} } if (stretched) {this.HTMLcomputeBBox(span,true)} @@ -1914,7 +1922,8 @@ HTMLgetScale: function () { if (this.scale) {return this.scale * this.mscale} - var scale = 1, values = this.getValues("mathsize","scriptlevel","fontsize"); + var scale = 1, values = this.getValues("scriptlevel","fontsize"); + values.mathsize = (this.isToken ? this : this.Parent()).Get("mathsize"); if (this.style) { var span = this.HTMLspanElement(); if (span.style.fontSize != "") {values.fontsize = span.style.fontSize} @@ -2204,7 +2213,9 @@ else if (under && this === under.CoreMO() && parent.Get("accentunder")) {c = HTMLCSS.FONTDATA.REMAPACCENTUNDER[c]||c} } c = HTMLCSS.FONTDATA.DELIMITERS[c.charCodeAt(0)]; - return (c && c.dir == direction.substr(0,1)); + var stretch = (c && c.dir === direction.substr(0,1)); + this.forceStretch = (stretch && (this.Get("minsize",true) || this.Get("maxsize",true))); + return stretch; }, HTMLstretchV: function (box,h,d) { this.HTMLremoveColor(); @@ -2457,7 +2468,7 @@ // (TeXBook pg 150 and Appendix G rule 15e) // var space = HTMLCSS.TeX.nulldelimiterspace * this.mscale; - var style = span.firstChild.style; + var style = span.childNodes[HTMLCSS.msiePaddingWidthBug ? 1 : 0].style; style.marginLeft = style.marginRight = HTMLCSS.Em(space); span.bbox.w += 2*space; span.bbox.r += 2*space; } @@ -2898,6 +2909,7 @@ msieClipRectBug: !isIE8, msieNegativeSpaceBug: quirks, cloneNodeBug: (isIE8 && browser.version === "8.0"), + msieItalicWidthBug: true, // can't measure boxes ending in italics correctly initialSkipBug: (mode < 8), // confused by initial left-margin values msieNegativeBBoxBug: (mode >= 8), // negative bboxes have positive widths msieIE6: !isIE7, diff --git a/unpacked/jax/output/NativeMML/jax.js b/unpacked/jax/output/NativeMML/jax.js index 92fd152a2..ec48b706c 100644 --- a/unpacked/jax/output/NativeMML/jax.js +++ b/unpacked/jax/output/NativeMML/jax.js @@ -195,17 +195,19 @@ // // If that fails, give an alert about security settings // - alert(MathJax.Localization._(["MathML", "MathPlayer"], - "MathJax was not able to set up MathPlayer.\n\n"+ - "If MathPlayer is not installed, you need to install it first.\n"+ - "Otherwise, your security settings may be preventing ActiveX \n"+ - "controls from running. Use the Internet Options item under\n"+ - "the Tools menu and select the Security tab, then press the\n"+ - "Custom Level button. Check that the settings for\n"+ - "'Run ActiveX Controls', and 'Binary and script behaviors'\n"+ - "are enabled.\n\n"+ - "Currently you will see error messages rather than\n"+ - "typeset mathematics.")); + if (!this.config.noMathPlayerWarning) { + alert(MathJax.Localization._(["MathML", "MathPlayer"], + "MathJax was not able to set up MathPlayer.\n\n"+ + "If MathPlayer is not installed, you need to install it first.\n"+ + "Otherwise, your security settings may be preventing ActiveX \n"+ + "controls from running. Use the Internet Options item under\n"+ + "the Tools menu and select the Security tab, then press the\n"+ + "Custom Level button. Check that the settings for\n"+ + "'Run ActiveX Controls', and 'Binary and script behaviors'\n"+ + "are enabled.\n\n"+ + "Currently you will see error messages rather than\n"+ + "typeset mathematics.")); + } } } else { // diff --git a/unpacked/jax/output/SVG/autoload/multiline.js b/unpacked/jax/output/SVG/autoload/multiline.js index 62e9f4c50..9d6e82194 100644 --- a/unpacked/jax/output/SVG/autoload/multiline.js +++ b/unpacked/jax/output/SVG/autoload/multiline.js @@ -336,7 +336,7 @@ MathJax.Hub.Register.StartupHook("SVG Jax Ready",function () { if (state.last && svg.X) {svg.X = 0} line.Add(svg,line.w,0,true); } - if (state.first && svg.w === 0) {state.nextIsFirst = true} + if (state.first && svg && svg.w === 0) {state.nextIsFirst = true} else {delete state.nextIsFirst} } }); diff --git a/unpacked/jax/output/SVG/jax.js b/unpacked/jax/output/SVG/jax.js index ac3530d53..e96bf73dd 100644 --- a/unpacked/jax/output/SVG/jax.js +++ b/unpacked/jax/output/SVG/jax.js @@ -904,7 +904,7 @@ { var svg = this.svg[i], mml = svg.mml; if (mml) { - if (mml.SVGdata.h !== this.sh || mml.SVGdata.d !== this.sd) { + if (mml.forceStretch || mml.SVGdata.h !== this.sh || mml.SVGdata.d !== this.sd) { svg = mml.SVGstretchV(this.sh,this.sd); } mml.SVGdata.HW = this.sh; mml.SVGdata.D = this.sd; @@ -1290,7 +1290,8 @@ if (this.mscale) { scale = this.scale; } else { - var values = this.getValues("mathsize","scriptlevel","fontsize"); + var values = this.getValues("scriptlevel","fontsize"); + values.mathsize = (this.isToken ? this : this.Parent()).Get("mathsize"); if ((this.styles||{}).fontSize && !values.fontsize) {values.fontsize = this.styles.fontSize} if (values.fontsize && !this.mathsize) {values.mathsize = values.fontsize} if (values.scriptlevel !== 0) { @@ -1466,6 +1467,7 @@ c = SVG.FONTDATA.DELIMITERS[c.charCodeAt(0)]; var can = (c && c.dir == direction.substr(0,1)); if (!can) {delete this.svg} + this.forceStretch = can && (this.Get("minsize",true) || this.Get("maxsize",true)); return can; }, SVGstretchV: function (h,d) { @@ -1564,7 +1566,8 @@ var values = this.getValues("height","depth","width"); values.mathbackground = this.mathbackground; if (this.background && !this.mathbackground) {values.mathbackground = this.background} - var svg = this.SVG(), scale = this.SVGgetScale(svg), mu = this.SVGgetMu(svg); + var svg = this.SVG(); this.SVGgetScale(svg); + var scale = this.mscale, mu = this.SVGgetMu(svg); svg.h = SVG.length2em(values.height,mu) * scale; svg.d = SVG.length2em(values.depth,mu) * scale; svg.w = svg.r = SVG.length2em(values.width,mu) * scale;