www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 7cb05e2e2092b6d3b2a5830596ed6a672c95d682
parent 9f80a1ebab2e5cf4d8db5d390320f387486c5767
Author: Davide P. Cervone <dpvc@union.edu>
Date:   Tue, 25 Oct 2011 14:51:43 -0400

Fix a problem with \mathchoice when the contents have negative width in Firefox (needed to resolve issue #148 in Firefox)

Diffstat:
Mextensions/TeX/mathchoice.js | 2+-
Munpacked/extensions/TeX/mathchoice.js | 10++++++++++
2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/extensions/TeX/mathchoice.js b/extensions/TeX/mathchoice.js @@ -12,5 +12,5 @@ * http://www.apache.org/licenses/LICENSE-2.0 */ -MathJax.Hub.Register.StartupHook("TeX Jax Ready",function(){var c="1.1";var a=MathJax.ElementJax.mml;var d=MathJax.InputJax.TeX;var b=d.Definitions;b.macros.mathchoice="MathChoice";d.Parse.Augment({MathChoice:function(f){var i=this.ParseArg(f),e=this.ParseArg(f),g=this.ParseArg(f),h=this.ParseArg(f);this.Push(a.TeXmathchoice(i,e,g,h))}});a.TeXmathchoice=a.mbase.Subclass({type:"TeXmathchoice",choice:function(){var e=this.getValues("displaystyle","scriptlevel");if(e.scriptlevel>0){return Math.min(3,e.scriptlevel+1)}return(e.displaystyle?0:1)},setTeXclass:function(e){return this.Core().setTeXclass(e)},isSpacelike:function(){return this.Core().isSpacelike()},isEmbellished:function(){return this.Core().isEmbellished()},Core:function(){return this.data[this.choice()]},toHTML:function(e){e=this.HTMLcreateSpan(e);e.bbox=this.Core().toHTML(e).bbox;return e}});MathJax.Hub.Startup.signal.Post("TeX mathchoice Ready")});MathJax.Ajax.loadComplete("[MathJax]/extensions/TeX/mathchoice.js"); +MathJax.Hub.Register.StartupHook("TeX Jax Ready",function(){var c="1.1";var a=MathJax.ElementJax.mml;var d=MathJax.InputJax.TeX;var b=d.Definitions;b.macros.mathchoice="MathChoice";d.Parse.Augment({MathChoice:function(f){var i=this.ParseArg(f),e=this.ParseArg(f),g=this.ParseArg(f),h=this.ParseArg(f);this.Push(a.TeXmathchoice(i,e,g,h))}});a.TeXmathchoice=a.mbase.Subclass({type:"TeXmathchoice",choice:function(){var e=this.getValues("displaystyle","scriptlevel");if(e.scriptlevel>0){return Math.min(3,e.scriptlevel+1)}return(e.displaystyle?0:1)},setTeXclass:function(e){return this.Core().setTeXclass(e)},isSpacelike:function(){return this.Core().isSpacelike()},isEmbellished:function(){return this.Core().isEmbellished()},Core:function(){return this.data[this.choice()]},toHTML:function(e){e=this.HTMLcreateSpan(e);e.bbox=this.Core().toHTML(e).bbox;if(e.firstChild&&e.firstChild.style.marginLeft){e.style.marginLeft=e.firstChild.style.marginLeft;e.firstChild.style.marginLeft=""}return e}});MathJax.Hub.Startup.signal.Post("TeX mathchoice Ready")});MathJax.Ajax.loadComplete("[MathJax]/extensions/TeX/mathchoice.js"); diff --git a/unpacked/extensions/TeX/mathchoice.js b/unpacked/extensions/TeX/mathchoice.js @@ -56,6 +56,16 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () { toHTML: function (span) { span = this.HTMLcreateSpan(span); span.bbox = this.Core().toHTML(span).bbox; + // Firefox doesn't correctly handle a span with a negatively sized content, + // so move marginLeft to main span (this is a hack to get \iiiint to work). + // FIXME: This is a symptom of a more general problem with Firefox, and + // there probably needs to be a more general solution (e.g., modifying + // HTMLhandleSpace() to get the width and adjust the right margin to + // compensate for negative-width contents) + if (span.firstChild && span.firstChild.style.marginLeft) { + span.style.marginLeft = span.firstChild.style.marginLeft; + span.firstChild.style.marginLeft = ""; + } return span; } });