Fix problem with fractions in displaystyle, fix problem with minus sign in superscripts, add \hyphen macro (used in some examples), and removed extra comman (that causes IE to fail).

This commit is contained in:
Davide P. Cervone 2011-07-24 08:06:16 -04:00
parent 5e9616370b
commit 29239f00ce
2 changed files with 13 additions and 6 deletions

File diff suppressed because one or more lines are too long

View File

@ -23,7 +23,7 @@
*/ */
MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () { MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
var VERSION = "1.0"; var VERSION = "1.1.1";
var TEX = MathJax.InputJax.TeX, var TEX = MathJax.InputJax.TeX,
MACROS = TEX.Definitions.macros; MACROS = TEX.Definitions.macros;
@ -67,7 +67,7 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
'#': "Pound", '#': "Pound",
'$': "Math", '$': "Math",
'\\': "Macro", '\\': "Macro",
' ': "Space", ' ': "Space"
}, },
// //
// Basic arrow names for reactions // Basic arrow names for reactions
@ -144,8 +144,8 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
this.FinishAtom(); this.FinishAtom();
var match = this.Match(/^\/\d+/); var match = this.Match(/^\/\d+/);
if (match) { if (match) {
this.tex += "\\frac{"+n+"}{"+match.substr(1)+"}"; var frac = "\\frac{"+n+"}{"+match.substr(1)+"}";
this.i += match.length; this.tex += "\\mathchoice{\\textstyle"+frac+"}{"+frac+"}{"+frac+"}{"+frac+"}";
} else { } else {
this.tex += n; this.tex += n;
if (this.i < this.string.length) {this.tex += "\\,"} if (this.i < this.string.length) {this.tex += "\\,"}
@ -157,7 +157,9 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
// Make a superscript minus, or an arrow, or a single bond. // Make a superscript minus, or an arrow, or a single bond.
// //
ParseMinus: function (c) { ParseMinus: function (c) {
if (this.atom && this.i === this.string.length-1) {this.sup += c} else { if (this.atom && (this.i === this.string.length-1 || this.string.charAt(this.i+1) === " ")) {
this.sup += c;
} else {
this.FinishAtom(); this.FinishAtom();
if (this.string.substr(this.i,2) === "->") {this.i += 2; this.AddArrow("->"); return} if (this.string.substr(this.i,2) === "->") {this.i += 2; this.AddArrow("->"); return}
else {this.tex += "{-}"} else {this.tex += "{-}"}
@ -380,6 +382,11 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
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]
//
// Add \hyphen used in some mhchem examples
//
MACROS.hyphen = ["Macro","\\text{-}"];
TEX.Parse.Augment({ TEX.Parse.Augment({
// //