Merge branch 'issue211' into develop

This commit is contained in:
Davide P. Cervone 2012-08-15 15:52:58 -04:00
commit 000e2586f4
2 changed files with 17 additions and 14 deletions

File diff suppressed because one or more lines are too long

View File

@ -23,7 +23,7 @@
*/
MathJax.Extension["TeX/mhchem"] = {
version: "2.0"
version: "2.0.1"
};
MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
@ -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;
/***************************************************************************/
@ -383,7 +385,8 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
// Needed for \bond for the ~ forms
//
MACROS.tripledash = ["Macro","\\raise3mu{\\tiny\\text{-}\\kern2mu\\text{-}\\kern2mu\\text{-}}"];
TEX.Definitions.environment.CEstack = ['Array',null,null,null,'r',null,"0.001em",'T',1]
TEX.Definitions.environment.CEstack = ['Array',null,null,null,'r',null,"0.001em",'T',1];
TEX.Definitions.environment.CEscriptstack = ['Array',null,null,null,'r',null,"0.2em",'S',1];
//
// Add \hyphen used in some mhchem examples