12345678910111213 |
- /*
- * /MathJax/jax/output/SVG/autoload/mmultiscripts.js
- *
- * Copyright (c) 2009-2013 The MathJax Consortium
- *
- * Part of the MathJax library.
- * See http://www.mathjax.org for details.
- *
- * Licensed under the Apache License, Version 2.0;
- * you may not use this file except in compliance with the License.
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- */MathJax.Hub.Register.StartupHook("SVG Jax Ready",function(){var g=MathJax.OutputJax.SVG;MathJax.ElementJax.mml.mmultiscripts.Augment({toSVG:function(w,q){this.SVGgetStyles();var a=this.SVG();this.SVGhandleSpace(a);var b=this.SVGgetScale(),c=this.data[this.base]?this.SVGdataStretched(this.base,w,q):g.BBOX.G().Clean(),t=g.TeX.x_height*b,m=g.TeX.scriptspace*b*.75,d=this.SVGgetScripts(m),h=d[0],r=d[1],k=d[2],d=d[3],l=(this.data[1]||this).SVGgetScale(),p=g.TeX.sup_drop*l,f=c.h-p,e=c.d+g.TeX.sub_drop*l,u=0;c.ic&&(u=c.ic);!this.data[this.base]||"mi"!==this.data[this.base].type&&"mo"!==this.data[this.base].type||1!==this.data[this.base].data.join("").length||1!==c.scale||c.stretched||this.data[this.base].Get("largeop")||(f=e=0);var l=this.getValues("subscriptshift","superscriptshift"),n=this.SVGgetMu(a);l.subscriptshift=""===l.subscriptshift?0:g.length2em(l.subscriptshift,n);l.superscriptshift=""===l.superscriptshift?0:g.length2em(l.superscriptshift,n);n=0;k?n=k.w+u:d&&(n=d.w-u);a.Add(c,Math.max(0,n),0);if(r||d)if(h||k){var e=Math.max(e,g.TeX.sub2*b),b=g.TeX.rule_thickness*b,p=(h||k).h,v=(r||d).d;k&&(p=Math.max(p,k.h));d&&(v=Math.max(v,d.d));f-v-(p-e)<3*b&&(e=3*b-f+v+p,p=.8*t-(f-v),0<p&&(f+=p,e-=p));f=Math.max(f,l.superscriptshift);e=Math.max(e,l.subscriptshift);r&&a.Add(r,n+c.w+m,f);d&&a.Add(d,n+u-d.w,f);h&&a.Add(h,n+c.w+m-u,-e);k&&a.Add(k,n-k.w,-e)}else h=this.getValues("displaystyle","texprimestyle"),h=g.TeX[h.displaystyle?"sup1":h.texprimestyle?"sup3":"sup2"],f=Math.max(f,h*b,l.superscriptshift),r&&(f=Math.max(f,r.d+.25*t)),d&&(f=Math.max(f,d.d+.25*t)),r&&a.Add(r,n+c.w+m,f),d&&a.Add(d,0,f);else e=Math.max(e,g.TeX.sub1*b,l.subscriptshift),h&&(e=Math.max(e,h.h-.8*t)),k&&(e=Math.max(e,k.h-.8*t)),h&&a.Add(h,n+c.w+m-u,-e),k&&a.Add(k,0,-e);a.Clean();this.SVGhandleColor(a);this.SVGsaveData(a);return a},SVGgetScripts:function(w){for(var q,a,b=[],c=1,t=this.data.length,m=q=0;4>m;m+=2){for(;c<t&&"mprescripts"!==this.data[c].type;){for(a=m;a<m+2;a++)this.data[c]&&"none"!==this.data[c].type&&(b[a]||(b[a]=g.BBOX.G()),b[a].Add(this.data[c].toSVG().With({x:q}))),c++;a=b[m]||{w:0};q=b[m+1]||{w:0};a.w=q.w=q=Math.max(a.w,q.w)}c++;q=0}for(a=0;4>a;a++)b[a]&&(b[a].w+=w,b[a].Clean());return b}});MathJax.Hub.Startup.signal.Post("SVG mmultiscripts Ready");MathJax.Ajax.loadComplete(g.autoloadDir+"/mmultiscripts.js")});
|