Skip to content

Commit

Permalink
Make \\left...\\right be of TeX class INNER. Resolves issue mathjax#746.
Browse files Browse the repository at this point in the history
  • Loading branch information
dpvc committed Feb 20, 2014
1 parent 9bed669 commit f6bc6fa
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 6 deletions.
26 changes: 22 additions & 4 deletions unpacked/jax/element/mml/jax.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
} }
}); });
Expand Down
3 changes: 1 addition & 2 deletions unpacked/jax/input/TeX/jax.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -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}))}
Expand Down

0 comments on commit f6bc6fa

Please sign in to comment.