commit 5a5205e0131c56c46930d2cac44cb3da1f723042
parent f8d42155194f2184dadc2e433661b8a4310d81be
Author: Frédéric Wang <fred.wang@free.fr>
Date: Fri, 1 Feb 2013 12:22:55 +0100
Make the input TeX jax generate mrow+mo rather than mfenced.
Diffstat:
2 files changed, 26 insertions(+), 5 deletions(-)
diff --git a/unpacked/extensions/TeX/AMSmath.js b/unpacked/extensions/TeX/AMSmath.js
@@ -1,3 +1,5 @@
+/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */
+/* vim: set ts=2 et sw=2 tw=80: */
/*************************************************************
*
* MathJax/extensions/TeX/AMSmath.js
@@ -252,7 +254,13 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
var den = this.ParseArg(name);
var frac = MML.mfrac(num,den);
if (thick !== "") {frac.linethickness = thick}
- if (left || right) {frac = MML.mfenced(frac).With({open: left, close: right})}
+ if (left || right) {
+ var mrow = MML.mrow();
+ if (left) {mrow.Append(MML.mo(left))}
+ mrow.Append(frac);
+ if (right) {mrow.Append(MML.mo(right))}
+ frac = mrow;
+ }
if (style !== "") {
var STYLE = (["D","T","S","SS"])[style];
if (STYLE == null) {TEX.Error("Bad math style for "+name)}
diff --git a/unpacked/jax/input/TeX/jax.js b/unpacked/jax/input/TeX/jax.js
@@ -1,3 +1,5 @@
+/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */
+/* vim: set ts=2 et sw=2 tw=80: */
/*************************************************************
*
* MathJax/jax/input/TeX/jax.js
@@ -175,7 +177,11 @@
if (this.open || this.close) {
mml.texClass = MML.TEXCLASS.INNER;
mml.texWithDelims = true;
- mml = MML.mfenced(mml).With({open: this.open, close: this.close});
+ var mrow = MML.mrow();
+ if (this.open) {mrow.Append(MML.mo(this.open))}
+ mrow.Append(mml);
+ if (this.close) {mrow.Append(MML.mo(this.close))}
+ mml = mrow;
}
return [STACKITEM.mml(mml), item];
}
@@ -189,8 +195,11 @@
stopError: "Extra \\left or missing \\right",
checkItem: function (item) {
if (item.type === "right") {
- var mml = MML.mfenced(this.data.length === 1 ? this.data[0] : MML.mrow.apply(MML,this.data));
- return STACKITEM.mml(mml.With({open: this.delim, close: item.delim}));
+ var mml = MML.mrow();
+ if (this.delim) {mml.Append(MML.mo(this.delim))}
+ mml.Append(this.data.length === 1 ? this.data[0] : this.data);
+ if (item.delim) {mml.Append(MML.mo(item.delim))}
+ return STACKITEM.mml(mml);
}
return this.SUPER(arguments).checkItem.call(this,item);
}
@@ -267,7 +276,11 @@
(this.arraydef.rowlines||"none") != "none") {mml.padding = 0} // HTML-CSS jax implements this
}
if (this.open || this.close) {
- mml = MML.mfenced(mml).With({open: this.open, close: this.close});
+ var mrow = MML.mrow();
+ if (this.open) {mrow.Append(MML.mo(this.open))}
+ mrow.Append(mml);
+ if (this.close) {mrow.Append(MML.mo(this.close))}
+ mml = mrow;
}
mml = STACKITEM.mml(mml);
if (this.requireClose) {