From e0a81d5f7c2ef211dc3eb4ce6e39154962a4c3e7 Mon Sep 17 00:00:00 2001 From: "Davide P. Cervone" Date: Thu, 11 Sep 2014 13:53:49 -0400 Subject: [PATCH] Force displaystyle and scriptstyle to be included in toMathML output, since the defaults for these are complicated. Resolves issue #912. --- unpacked/extensions/toMathML.js | 6 ++---- unpacked/jax/element/mml/jax.js | 1 + 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/unpacked/extensions/toMathML.js b/unpacked/extensions/toMathML.js index 4a0949f61..61fb02ab5 100644 --- a/unpacked/extensions/toMathML.js +++ b/unpacked/extensions/toMathML.js @@ -59,11 +59,9 @@ MathJax.Hub.Register.LoadHook("[MathJax]/jax/element/mml/jax.js",function () { if (!this.attrNames) { if (this.type === "mstyle") {defaults = MML.math.prototype.defaults} for (var id in defaults) {if (!skip[id] && defaults.hasOwnProperty(id)) { - var force = (id === "open" || id === "close" || id === "form"); - if (this[id] != null && (force || this[id] !== defaults[id])) { + if (this[id] != null && this[id] !== defaults[id]) { var value = this[id]; delete this[id]; - if (force || this.Get(id) !== value) - {attr.push(id+'="'+this.toMathMLattribute(value)+'"')} + if (this.Get(id) !== value) {attr.push(id+'="'+this.toMathMLattribute(value)+'"')} this[id] = value; } }} diff --git a/unpacked/jax/element/mml/jax.js b/unpacked/jax/element/mml/jax.js index b0a7add04..f8f56f1ef 100644 --- a/unpacked/jax/element/mml/jax.js +++ b/unpacked/jax/element/mml/jax.js @@ -221,6 +221,7 @@ MathJax.ElementJax.mml.Augment({ }, skipAttributes: {texClass: true, useHeight: true, texprimestyle: true}, copyAttributeNames: [ + "displaystyle", "scriptlevel", "open", "close", "form", // force these to be copied "fontfamily", "fontsize", "fontweight", "fontstyle", "color", "background", "id", "class", "href", "style"