From 4e143688ccb440d6e8cec5d96146c3d64c42a6bf Mon Sep 17 00:00:00 2001 From: "Davide P. Cervone" Date: Thu, 20 Feb 2014 12:37:03 -0500 Subject: [PATCH] Add useMathMLspacing option to AsciiMath input jax. Resolves issue #743 --- unpacked/config/default.js | 8 ++++++++ unpacked/jax/input/AsciiMath/config.js | 1 + unpacked/jax/input/AsciiMath/jax.js | 6 +++++- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/unpacked/config/default.js b/unpacked/config/default.js index e12f66e44..8a0a610b9 100644 --- a/unpacked/config/default.js +++ b/unpacked/config/default.js @@ -592,6 +592,14 @@ MathJax.Hub.Config({ // fixphi: true, + // + // Determines whether the MathML should be marked so that the HTML-CSS + // and SVG output jax will use MathML spacing rules rather than TeX + // spacing rules. Since AsciiMath was designed for MathML output, the + // MathML rules are used by default. + // + useMathMLspacing: true, + // // Determines whether limits are placed above and below operators, // or next to them. (AsciiMath doesn't have separate in-line and diff --git a/unpacked/jax/input/AsciiMath/config.js b/unpacked/jax/input/AsciiMath/config.js index f02dff2aa..3e84f9220 100644 --- a/unpacked/jax/input/AsciiMath/config.js +++ b/unpacked/jax/input/AsciiMath/config.js @@ -36,6 +36,7 @@ MathJax.InputJax.AsciiMath = MathJax.InputJax({ config: { fixphi: true, // switch phi and varphi unicode values + useMathMLspacing: true, // use MathML spacing rather than TeX spacing? displaystyle: true, // put limits above and below operators decimalsign: "." // can change to "," but watch out for "(1,2)" } diff --git a/unpacked/jax/input/AsciiMath/jax.js b/unpacked/jax/input/AsciiMath/jax.js index f932511e8..13a6ea5b4 100644 --- a/unpacked/jax/input/AsciiMath/jax.js +++ b/unpacked/jax/input/AsciiMath/jax.js @@ -167,7 +167,11 @@ // var document = { getElementById: true, - createElementNS: function (ns,type) {return MML[type]()}, + createElementNS: function (ns,type) { + var node = MML[type](); + if (type === "mo" && ASCIIMATH.config.useMathMLspacing) {node.useMMLspacing = 0x80} + return node; + }, createTextNode: function (text) {return MML.chars(text).With({nodeValue:text})}, createDocumentFragment: function () {return DOCFRAG()} };