From d613dabd8eceee873563c38956bf4642d1f9d03f Mon Sep 17 00:00:00 2001 From: "Davide P. Cervone" Date: Mon, 20 Jul 2015 15:06:37 -0400 Subject: [PATCH 1/2] Treat missing super- or subscript as when not properly paired in multiscripts. Resolves issue #1188. --- unpacked/jax/output/HTML-CSS/autoload/mmultiscripts.js | 6 ++++-- unpacked/jax/output/SVG/autoload/mmultiscripts.js | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/unpacked/jax/output/HTML-CSS/autoload/mmultiscripts.js b/unpacked/jax/output/HTML-CSS/autoload/mmultiscripts.js index b8e1616a3..1bfe065a6 100644 --- a/unpacked/jax/output/HTML-CSS/autoload/mmultiscripts.js +++ b/unpacked/jax/output/HTML-CSS/autoload/mmultiscripts.js @@ -122,14 +122,16 @@ MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function () { while (i < m && this.data[i].type !== "mprescripts") { var box = [null,null,null,null]; for (var j = k; j < k+2; j++) { - if (this.data[i] && this.data[i].type !== "none") { + if (this.data[i] && this.data[i].type !== "none" && this.data[i].type !== "mprescripts") { if (!BOX[j]) { BOX[j] = HTMLCSS.createBox(stack); BOX[j].bbox = this.HTMLemptyBBox({}); if (W) {HTMLCSS.createBlank(BOX[j],W); BOX[j].bbox.w = BOX[j].bbox.rw = W} } box[j] = this.data[i].toHTML(BOX[j]); + } else { + box[j] = MathJax.HTML.Element("span",{bbox:this.HTMLemptyBBox({})}); } - i++; + if ((this.data[i]||{}).type !== "mprescripts") i++; } var isPre = (k === 2); sub = BOX[k]; sup = BOX[k+1]; diff --git a/unpacked/jax/output/SVG/autoload/mmultiscripts.js b/unpacked/jax/output/SVG/autoload/mmultiscripts.js index 000a62e95..14705258b 100644 --- a/unpacked/jax/output/SVG/autoload/mmultiscripts.js +++ b/unpacked/jax/output/SVG/autoload/mmultiscripts.js @@ -103,11 +103,13 @@ MathJax.Hub.Register.StartupHook("SVG Jax Ready",function () { while (i < m && this.data[i].type !== "mprescripts") { var box = [null,null,null,null]; for (var j = k; j < k+2; j++) { - if (this.data[i] && this.data[i].type !== "none") { + if (this.data[i] && this.data[i].type !== "none" && this.data[i].type !== "mprescripts") { if (!BOX[j]) {BOX[j] = SVG.BBOX.G()} box[j] = this.data[i].toSVG(); + } else { + box[j] = {w:0}; } - i++; + if (this.data[i].type !== "mprescripts") i++; } var isPre = (k === 2); if (isPre) W += Math.max((box[k]||{w:0}).w,(box[k+1]||{w:0}).w); From ca53ebdd738fa1144262c2b3858de7f25fb37857 Mon Sep 17 00:00:00 2001 From: "Davide P. Cervone" Date: Mon, 20 Jul 2015 15:18:46 -0400 Subject: [PATCH 2/2] More fixes for #1188 to prevent empty object problems --- unpacked/jax/output/HTML-CSS/autoload/mmultiscripts.js | 2 +- unpacked/jax/output/SVG/autoload/mmultiscripts.js | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/unpacked/jax/output/HTML-CSS/autoload/mmultiscripts.js b/unpacked/jax/output/HTML-CSS/autoload/mmultiscripts.js index 1bfe065a6..fbe2ddd62 100644 --- a/unpacked/jax/output/HTML-CSS/autoload/mmultiscripts.js +++ b/unpacked/jax/output/HTML-CSS/autoload/mmultiscripts.js @@ -119,7 +119,7 @@ MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function () { var sup, sub, BOX = []; var i = 1, m = this.data.length, W = 0; for (var k = 0; k < 4; k += 2) { - while (i < m && this.data[i].type !== "mprescripts") { + while (i < m && (this.data[i]||{}).type !== "mprescripts") { var box = [null,null,null,null]; for (var j = k; j < k+2; j++) { if (this.data[i] && this.data[i].type !== "none" && this.data[i].type !== "mprescripts") { diff --git a/unpacked/jax/output/SVG/autoload/mmultiscripts.js b/unpacked/jax/output/SVG/autoload/mmultiscripts.js index 14705258b..57dcbfece 100644 --- a/unpacked/jax/output/SVG/autoload/mmultiscripts.js +++ b/unpacked/jax/output/SVG/autoload/mmultiscripts.js @@ -100,16 +100,14 @@ MathJax.Hub.Register.StartupHook("SVG Jax Ready",function () { var sup, sub, BOX = []; var i = 1, m = this.data.length, W = 0; for (var k = 0; k < 4; k += 2) { - while (i < m && this.data[i].type !== "mprescripts") { + while (i < m && (this.data[i]||{}).type !== "mprescripts") { var box = [null,null,null,null]; for (var j = k; j < k+2; j++) { if (this.data[i] && this.data[i].type !== "none" && this.data[i].type !== "mprescripts") { if (!BOX[j]) {BOX[j] = SVG.BBOX.G()} box[j] = this.data[i].toSVG(); - } else { - box[j] = {w:0}; } - if (this.data[i].type !== "mprescripts") i++; + if ((this.data[i]||{}).type !== "mprescripts") i++; } var isPre = (k === 2); if (isPre) W += Math.max((box[k]||{w:0}).w,(box[k+1]||{w:0}).w);