www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 983dd18b698627c823ab382d9d19273ac61709f0
parent 0ed5d463e539ae1eebf1a1ced1b33c2a0e37f111
Author: Davide P. Cervone <dpvc@union.edu>
Date:   Sat,  8 Sep 2012 15:31:07 -0400

Allow negative dimensions for \\[] but clip to 0 since this isn't really allowed in MathML.  I will need to figure out something better for the future, but for now this will prevent the error message.  Issue #236.

Diffstat:
Munpacked/extensions/TeX/AMSmath.js | 9+++++++--
Munpacked/jax/input/TeX/config.js | 2+-
Munpacked/jax/input/TeX/jax.js | 14+++++++++-----
3 files changed, 17 insertions(+), 8 deletions(-)

diff --git a/unpacked/extensions/TeX/AMSmath.js b/unpacked/extensions/TeX/AMSmath.js @@ -22,7 +22,7 @@ */ MathJax.Extension["TeX/AMSmath"] = { - version: "2.0.2", + version: "2.0.3", number: 0, // current equation number startNumber: 0, // current starting equation number (for when equation is restarted) @@ -41,7 +41,12 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () { STACKITEM = TEX.Stack.Item, CONFIG = TEX.config.equationNumbers; - var COLS = function (W) {return W.join("em ") + "em"}; + var COLS = function (W) { + var WW = []; + for (var i = 0, m = W.length; i < m; i++) + {WW[i] = TEX.Parse.prototype.Em(W[i])} + return WW.join(" "); + }; /******************************************************************************/ diff --git a/unpacked/jax/input/TeX/config.js b/unpacked/jax/input/TeX/config.js @@ -24,7 +24,7 @@ MathJax.InputJax.TeX = MathJax.InputJax({ id: "TeX", - version: "2.0.6", + version: "2.0.7", directory: MathJax.InputJax.directory + "/TeX", extensionDir: MathJax.InputJax.extensionDir + "/TeX", diff --git a/unpacked/jax/input/TeX/jax.js b/unpacked/jax/input/TeX/jax.js @@ -296,7 +296,7 @@ } if (this.rowspacing) { var rows = this.arraydef.rowspacing.split(/ /); - while (rows.length < this.table.length) {rows.push(this.rowspacing)} + while (rows.length < this.table.length) {rows.push(this.rowspacing+"em")} this.arraydef.rowspacing = rows.join(' '); } }, @@ -1613,7 +1613,7 @@ var n; if (this.string.charAt(this.i) === "[") { n = this.GetBrackets(name,"").replace(/ /g,""); - if (n && !n.match(/^(((\.\d+|\d+(\.\d*)?))(pt|em|ex|mu|mm|cm|in|pc))$/)) + if (n && !n.match(/^((-?(\.\d+|\d+(\.\d*)?))(pt|em|ex|mu|mm|cm|in|pc))$/)) {TEX.Error("Bracket argument to "+name+" must be a dimension")} } this.Push(STACKITEM.cell().With({isCR: true, name: name, linebreak: true})); @@ -1622,8 +1622,8 @@ if (n && top.arraydef.rowspacing) { var rows = top.arraydef.rowspacing.split(/ /); if (!top.rowspacing) {top.rowspacing = this.dimen2em(rows[0])} - while (rows.length < top.table.length) {rows.push(top.rowspacing)} - rows[top.table.length-1] = (top.rowspacing+this.dimen2em(n)) + "em"; + while (rows.length < top.table.length) {rows.push(this.Em(top.rowspacing))} + rows[top.table.length-1] = this.Em(Math.max(0,top.rowspacing+this.dimen2em(n))); top.arraydef.rowspacing = rows.join(' '); } } else { @@ -1633,7 +1633,7 @@ }, emPerInch: 7.2, dimen2em: function (dim) { - var match = dim.match(/^((?:\.\d+|\d+(?:\.\d*)?))(pt|em|ex|mu|pc|in|mm|cm)/); + var match = dim.match(/^(-?(?:\.\d+|\d+(?:\.\d*)?))(pt|em|ex|mu|pc|in|mm|cm)/); var m = parseFloat(match[1]||"1"), unit = match[2]; if (unit === "em") {return m} if (unit === "ex") {return m * .43} @@ -1645,6 +1645,10 @@ if (unit === "mu") {return m / 18} return 0; }, + Em: function (m) { + if (Math.abs(m) < .0006) {return "0em"} + return m.toFixed(3).replace(/\.?0+$/,"") + "em"; + }, HLine: function (name,style) { if (style == null) {style = "solid"}