Merge 'issue211' into issue234

This commit is contained in:
Davide P. Cervone 2012-08-15 15:57:08 -04:00
commit 700a24ba65
2 changed files with 16 additions and 14 deletions

File diff suppressed because one or more lines are too long

View File

@ -136,7 +136,7 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
},
//
// Make a number of fraction preceeding an atom,
// Make a number or fraction preceeding an atom,
// or a subscript for an atom.
//
ParseNumber: function () {
@ -215,7 +215,8 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
c = this.string.charAt(++this.i);
if (c === "{") {
this.i++; var m = this.Find("}");
if (m === "-.") {this.sup += "{-}{\\cdot}"} else if (m) {this.sup += CE(m).Parse()}
if (m === "-.") {this.sup += "{-}{\\cdot}"}
else if (m) {this.sup += CE(m).Parse().replace(/^\{-\}/,"-")}
} else if (c === " " || c === "") {
this.tex += "{\\"+this.Arrows["^"]+"}"; this.i++;
} else {
@ -228,7 +229,7 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
//
ParseSubscript: function (c) {
if (this.string.charAt(++this.i) == "{") {
this.i++; this.sub += CE(this.Find("}")).Parse();
this.i++; this.sub += CE(this.Find("}")).Parse().replace(/^\{-\}/,"-");
} else {
var n = this.Match(/^\d+/);
if (n) {this.sub += n}
@ -300,15 +301,15 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
//
// right-justify super- and subscripts when they are before the atom
//
var n = Math.abs(this.sup.length-this.sub.length);
if (n) {
var zeros = "0000000000".substr(0,n);
var script = (this.sup.length > this.sub.length ? "sub" : "sup");
this[script] = "\\phantom{"+zeros+"}" + this[script];
}
var sup = this.sup, sub = this.sub;
if (!sup.match(/\d/)) {sup += "\\vphantom{0}"} // force common heights
if (!sub.match(/\d/)) {sub += "\\vphantom{0}"}
this.tex += "\\raise 1pt{\\scriptstyle\\begin{CEscriptstack}"+sup+"\\\\"+
sub+"\\end{CEscriptstack}}\\kern-.125em ";
} else {
if (!this.sup) {this.sup = "\\Space{0pt}{0pt}{.2em}"} // forces subscripts to align properly
this.tex += "^{"+this.sup+"}_{"+this.sub+"}";
}
if (!this.sup) {this.sup = "\\Space{0pt}{0pt}{.2em}"} // forces subscripts to align properly
this.tex += "^{"+this.sup+"}_{"+this.sub+"}";
this.sup = this.sub = "";
}
this.atom = false;
@ -358,6 +359,7 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
});
MathJax.Extension["TeX/mhchem"].CE = CE;
/***************************************************************************/
@ -398,7 +400,8 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
// Needed for \bond for the ~ forms
//
environment: {
CEstack: ['Array',null,null,null,'r',null,"0.001em",'T',1]
CEstack: ['Array',null,null,null,'r',null,"0.001em",'T',1],
CEscriptstack: ['Array',null,null,null,'r',null,"0.2em",'S',1]
}
},null,true);
@ -428,7 +431,6 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
},null,true);
});
TEX.Parse.Augment({
//