/* * /MathJax/jax/output/CommonHTML/autoload/mmultiscripts.js * * Copyright (c) 2009-2015 The MathJax Consortium * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ MathJax.Hub.Register.StartupHook("CommonHTML Jax Ready",function(){var c="2.6.0";var a=MathJax.ElementJax.mml,b=MathJax.OutputJax.CommonHTML;a.mmultiscripts.Augment({toCommonHTML:function(J,O){if(!O){J=this.CHTMLcreateNode(J);this.CHTMLhandleStyle(J);this.CHTMLhandleScale(J);this.CHTMLgetVariant()}b.BBOX.empty(this.CHTML);var l,e;if(O){l=b.getNode(J,"mjx-base")}else{this.CHTMLaddChild(J,0,{type:"mjx-base",noBBox:true,forceChild:true});l=J.firstChild}e=this.CHTMLbboxFor(0);if(e.ic){e.R-=e.ic;if(!O){l.style.marginRight=b.Em(-e.ic)}Q=1.3*e.ic+0.05}var D={},m={};this.CHTMLgetScripts(D,m,O,J);var o=D.sub,f=D.sup,A=D.presub,k=D.presup;var G=m.sub,M=m.sup,j=m.presub,n=m.presup;if(!O){this.CHTMLaddBoxes(J,l,D)}var g=this.getValues("scriptlevel","scriptsizemultiplier");var i=(this.Get("scriptlevel")<3?g.scriptsizemultiplier:1);var N=b.TEX.x_height,E=b.TEX.scriptspace;var H=b.TEX.sup_drop*i,F=b.TEX.sub_drop*i;var B=e.h-H,z=e.d+F,Q=0,I;var K=this.data[this.base];if(K&&(K.type==="mi"||K.type==="mo")){if(K.data.join("").length===1&&e.rscale===1&&!e.sH&&!K.Get("largeop")){B=z=0}}g=this.getValues("displaystyle","subscriptshift","superscriptshift","texprimestyle");g.subscriptshift=(g.subscriptshift===""?0:this.CHTMLlength2em(g.subscriptshift));g.superscriptshift=(g.superscriptshift===""?0:this.CHTMLlength2em(g.superscriptshift));var y=(A?E+j.w:k?E+n.w-Q:0);this.CHTML.combine(e,y,0);var w=this.CHTML.w;if(!f&&!k){z=Math.max(z,b.TEX.sub1,g.subscriptshift);if(o){z=Math.max(z,G.h-(4/5)*N)}if(A){z=Math.max(z,j.h-(4/5)*N)}if(o){this.CHTMLplaceSubOnly(o,G,w,z,E)}if(A){this.CHTMLplacePresubOnly(A,j,z,E)}}else{if(!o&&!A){I=b.TEX[(g.displaystyle?"sup1":(g.texprimestyle?"sup3":"sup2"))];B=Math.max(B,I,g.superscriptshift);if(f){B=Math.max(B,M.d+(1/4)*N)}if(k){B=Math.max(B,n.d+(1/4)*N)}if(f){this.CHTMLplaceSupOnly(f,M,w,Q,B,E)}if(k){this.CHTMLplacePresupOnly(k,n,Q,B,E)}}else{z=Math.max(z,b.TEX.sub2);var C=b.TEX.rule_thickness;var L=(G||j).h,P=(M||n).d;if(A){L=Math.max(L,j.h)}if(k){P=Math.max(P,n.d)}if((B-P)-(L-z)<3*C){z=3*C-B+P+L;H=(4/5)*N-(B-P);if(H>0){B+=H;z-=H}}B=Math.max(B,g.superscriptshift);z=Math.max(z,g.subscriptshift);if(f){if(o){this.CHTMLplaceSubSup(o,G,f,M,w,Q,B,z,E)}else{this.CHTMLplaceSupOnly(f,M,w,Q,B,E)}}else{if(o){this.CHTMLplaceSubOnly(o,G,w,z,E)}}if(k){if(A){this.CHTMLplacePresubPresup(A,j,k,n,Q,B,z,E)}else{this.CHTMLplacePresupOnly(k,n,Q,B,E)}}else{if(A){this.CHTMLplacePresubOnly(A,j,z,E)}}}}this.CHTML.clean();this.CHTMLhandleSpace(J);this.CHTMLhandleBBox(J);this.CHTMLhandleColor(J);return J},CHTMLgetScripts:function(e,o,g,h){if(g){e.sub=b.getNode(h,"mjx-sub");e.sup=b.getNode(h,"mjx-sup");e.presub=b.getNode(h,"mjx-presub");e.presup=b.getNode(h,"mjx-presup");o.sub=this.CHTMLbbox.sub;o.sup=this.CHTMLbbox.sup;o.presub=this.CHTMLbbox.presub;o.presup=this.CHTMLbbox.presup;return}this.CHTMLbbox=o;var f={i:1,w:0,BOX:e,BBOX:o},i=this.data.length;var d="sub",j="sup";while(f.i