Make the input TeX jax generate mrow+mo rather than mfenced.

This commit is contained in:
Frédéric Wang 2013-02-01 12:22:55 +01:00
parent f8d4215519
commit 5a5205e013
2 changed files with 26 additions and 5 deletions

View File

@ -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 * MathJax/extensions/TeX/AMSmath.js
@ -252,7 +254,13 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
var den = this.ParseArg(name); var den = this.ParseArg(name);
var frac = MML.mfrac(num,den); var frac = MML.mfrac(num,den);
if (thick !== "") {frac.linethickness = thick} 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 !== "") { if (style !== "") {
var STYLE = (["D","T","S","SS"])[style]; var STYLE = (["D","T","S","SS"])[style];
if (STYLE == null) {TEX.Error("Bad math style for "+name)} if (STYLE == null) {TEX.Error("Bad math style for "+name)}

View File

@ -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 * MathJax/jax/input/TeX/jax.js
@ -175,7 +177,11 @@
if (this.open || this.close) { if (this.open || this.close) {
mml.texClass = MML.TEXCLASS.INNER; mml.texClass = MML.TEXCLASS.INNER;
mml.texWithDelims = true; 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]; return [STACKITEM.mml(mml), item];
} }
@ -189,8 +195,11 @@
stopError: "Extra \\left or missing \\right", stopError: "Extra \\left or missing \\right",
checkItem: function (item) { checkItem: function (item) {
if (item.type === "right") { if (item.type === "right") {
var mml = MML.mfenced(this.data.length === 1 ? this.data[0] : MML.mrow.apply(MML,this.data)); var mml = MML.mrow();
return STACKITEM.mml(mml.With({open: this.delim, close: item.delim})); 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); 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 (this.arraydef.rowlines||"none") != "none") {mml.padding = 0} // HTML-CSS jax implements this
} }
if (this.open || this.close) { 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); mml = STACKITEM.mml(mml);
if (this.requireClose) { if (this.requireClose) {