From 964a9e0c59a5c9ab168214f5dff4684de1ba0057 Mon Sep 17 00:00:00 2001 From: "Davide P. Cervone" Date: Mon, 17 Aug 2015 13:40:44 -0400 Subject: [PATCH] More improvements to mmultiscripts in mhchem. --- unpacked/extensions/TeX/mhchem.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/unpacked/extensions/TeX/mhchem.js b/unpacked/extensions/TeX/mhchem.js index 2e1a811a5..59d70253e 100644 --- a/unpacked/extensions/TeX/mhchem.js +++ b/unpacked/extensions/TeX/mhchem.js @@ -303,9 +303,11 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () { // FinishAtom: function (force) { if (this.sup || this.sub || this.presup || this.presub) { - if (!this.atom && this.tex === "" && !force) { + if (!force && !this.atom && (this.tex === "" || this.tex === "{" || + (this.tex === "}" && this.TEX.substr(-1) === "{"))) { this.presup = this.sup, this.presub = this.sub; // save for later this.sub = this.sup = ""; + this.TEX += this.tex; this.tex = ""; return; } if (this.sub && !this.sup) {this.sup = "\\Space{0pt}{0pt}{.2em}"} // forces subscripts to align properly @@ -313,7 +315,7 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () { if (!this.presup && !this.sup) {this.presup = "\\Space{0pt}{0pt}{.2em}"} this.tex = "\\CEprescripts{"+(this.presub||"\\CEnone")+"}{"+(this.presup||"\\CEnone")+"}" + "{"+(this.tex !== "}" ? this.tex : "")+"}" - +" {"+(this.sub||"\\CEnone")+"}{"+(this.sup||"\\CEnone")+"}" + + "{"+(this.sub||"\\CEnone")+"}{"+(this.sup||"\\CEnone")+"}" + (this.tex === "}" ? "}" : ""); this.presub = this.presup = ""; } else {