Make \\left...\\right be of TeX class INNER. Resolves issue #746.

This commit is contained in:
Davide P. Cervone 2014-02-19 19:17:28 -05:00
parent 9bed669135
commit f6bc6fa129
2 changed files with 23 additions and 6 deletions

View File

@ -751,10 +751,27 @@ MathJax.ElementJax.mml.Augment({
return this.SUPER(arguments).toString.call(this); return this.SUPER(arguments).toString.call(this);
}, },
setTeXclass: function (prev) { setTeXclass: function (prev) {
for (var i = 0, m = this.data.length; i < m; i++) var i, m = this.data.length;
{if (this.data[i]) {prev = this.data[i].setTeXclass(prev)}} if (this.open || this.close) {
if (this.data[0]) {this.updateTeXclass(this.data[0])} //
return prev; // <mrow> came from \left...\right
// so treat as subexpression (tex class INNER)
//
this.getPrevClass(prev);
for (i = 0; i < m; i++)
{if (this.data[i]) {prev = this.data[i].setTeXclass(prev)}}
this.texClass = MML.TEXCLASS.INNER;
return this;
} else {
//
// Normal <mrow>, so treat as
// thorugh mrow is not there
//
for (i = 0; i < m; i++)
{if (this.data[i]) {prev = this.data[i].setTeXclass(prev)}}
if (this.data[0]) {this.updateTeXclass(this.data[0])}
return prev;
}
}, },
getAnnotation: function (name) { getAnnotation: function (name) {
if (this.data.length != 1) return null; if (this.data.length != 1) return null;
@ -947,6 +964,7 @@ MathJax.ElementJax.mml.Augment({
} }
// get the data from the open item // get the data from the open item
this.updateTeXclass(this.data.open); this.updateTeXclass(this.data.open);
this.texClass = MML.TEXCLASS.INNER;
return prev; return prev;
} }
}); });

View File

@ -2130,8 +2130,7 @@
* Create an mrow that has stretchy delimiters at either end, as needed * Create an mrow that has stretchy delimiters at either end, as needed
*/ */
fenced: function (open,mml,close) { fenced: function (open,mml,close) {
var mrow = MML.mrow(); var mrow = MML.mrow().With({open:open, close:close, texClass:MML.TEXCLASS.INNER});
mrow.open = open; mrow.close = close;
if (open) {mrow.Append(MML.mo(open).With({fence:true, stretchy:true, texClass:MML.TEXCLASS.OPEN}))} if (open) {mrow.Append(MML.mo(open).With({fence:true, stretchy:true, texClass:MML.TEXCLASS.OPEN}))}
if (mml.type === "mrow") {mrow.Append.apply(mrow,mml.data)} else {mrow.Append(mml)} if (mml.type === "mrow") {mrow.Append.apply(mrow,mml.data)} else {mrow.Append(mml)}
if (close) {mrow.Append(MML.mo(close).With({fence:true, stretchy:true, texClass:MML.TEXCLASS.CLOSE}))} if (close) {mrow.Append(MML.mo(close).With({fence:true, stretchy:true, texClass:MML.TEXCLASS.CLOSE}))}