Fix alignment of prescripts in mhchem to properly right-justify (won't work well in NativeMML output, but then neither do several other features)
This commit is contained in:
parent
7c6b2c01df
commit
d542c87077
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -302,17 +302,14 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
|
||||||
// right-justify super- and subscripts when they are before the atom
|
// right-justify super- and subscripts when they are before the atom
|
||||||
//
|
//
|
||||||
var sup = this.sup, sub = this.sub;
|
var sup = this.sup, sub = this.sub;
|
||||||
var n = Math.abs(sup.replace(/[^\d]/g,"").length-sub.replace(/[^\d]/g,"").length);
|
if (!sup.match(/\d/)) {sup += "\\vphantom{0}"} // force common heights
|
||||||
if (n) {
|
if (!sub.match(/\d/)) {sub += "\\vphantom{0}"}
|
||||||
var zeros = "0000000000".substr(0,n);
|
this.tex += "\\raise 1pt{\\scriptstyle\\begin{CEscriptstack}"+sup+"\\\\"+
|
||||||
var script = (sup.length > sub.length ? "sub" : "sup");
|
sub+"\\end{CEscriptstack}}\\kern-.125em ";
|
||||||
this[script] = "\\phantom{"+zeros+"}" + this[script];
|
} else {
|
||||||
}
|
if (!this.sup) {this.sup = "\\Space{0pt}{0pt}{.2em}"} // forces subscripts to align properly
|
||||||
if (sup.charAt(0) === "-" && sub.charAt(0) !== "-") {this.sub = "\\phantom{-}"+this.sub}
|
this.tex += "^{"+this.sup+"}_{"+this.sub+"}";
|
||||||
if (sub.charAt(0) === "-" && sup.charAt(0) !== "-") {this.sup = "\\phantom{-}"+this.sup}
|
|
||||||
}
|
}
|
||||||
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.sup = this.sub = "";
|
||||||
}
|
}
|
||||||
this.atom = false;
|
this.atom = false;
|
||||||
|
@ -388,7 +385,8 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
|
||||||
// Needed for \bond for the ~ forms
|
// Needed for \bond for the ~ forms
|
||||||
//
|
//
|
||||||
MACROS.tripledash = ["Macro","\\raise3mu{\\tiny\\text{-}\\kern2mu\\text{-}\\kern2mu\\text{-}}"];
|
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
|
// Add \hyphen used in some mhchem examples
|
||||||
|
|
Loading…
Reference in New Issue
Block a user