commit 5b1655a2fe6d058c8bc4dd64f376b2afc9d75078
parent 2afb80176c0ed5be08efe5babf9b0dbd4835fbf5
Author: Davide P. Cervone <dpvc@union.edu>
Date: Sun, 9 Feb 2014 05:52:24 -0500
Treat initial <mo> of split and multline (and other related environments) as infix (but remove initial space). Not sure this exactly matches LaTeX, but is closer than current behavior. Resolves issue #389.
Diffstat:
2 files changed, 25 insertions(+), 1 deletion(-)
diff --git a/unpacked/extensions/TeX/AMSmath.js b/unpacked/extensions/TeX/AMSmath.js
@@ -453,6 +453,15 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
stack.global.tagged = !numbered && !stack.global.forcetag; // prevent automatic tagging in starred environments
},
EndEntry: function () {
+ for (var i = 0, m = this.data.length; i < m; i++) {
+ if (this.data[i] && this.data[i].type !== "mspace") {
+ if (this.data[i].isEmbellished()) {
+ var core = this.data[i].CoreMO();
+ core.form = MML.FORM.INFIX; core.lspace = 0;
+ }
+ break;
+ }
+ }
var mtd = MML.mtd.apply(MML,this.data);
if (this.data.shove) {mtd.columnalign = this.data.shove}
this.row.push(mtd);
@@ -499,6 +508,21 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
stack.global.notags = (taggable ? null : name);
stack.global.tagged = !numbered && !stack.global.forcetag; // prevent automatic tagging in starred environments
},
+ EndEntry: function () {
+ if (this.row.length > 0) {
+ for (var i = 0, m = this.data.length; i < m; i++) {
+ if (this.data[i] && this.data[i].type !== "mspace") {
+ if (this.data[i].isEmbellished()) {
+ var core = this.data[i].CoreMO();
+ core.form = MML.FORM.INFIX; core.lspace = 0;
+ }
+ break;
+ }
+ }
+ }
+ this.row.push(MML.mtd.apply(MML,this.data));
+ this.data = [];
+ },
EndRow: function () {
var mtr = MML.mtr;
if (!this.global.tag && this.numbered) {this.autoTag()}
diff --git a/unpacked/extensions/toMathML.js b/unpacked/extensions/toMathML.js
@@ -59,7 +59,7 @@ 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");
+ var force = (id === "open" || id === "close" || id === "form");
if (this[id] != null && (force || this[id] !== defaults[id])) {
var value = this[id]; delete this[id];
if (force || this.Get(id) !== value)