You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
11 KiB
JavaScript
20 lines
11 KiB
JavaScript
2 years ago
|
/*
|
||
|
* /MathJax/jax/output/HTML-CSS/autoload/mtable.js
|
||
|
*
|
||
|
* Copyright (c) 2009-2018 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("HTML-CSS Jax Ready",function(){var c="2.7.5";var a=MathJax.ElementJax.mml,b=MathJax.OutputJax["HTML-CSS"];a.mtable.Augment({toHTML:function(r){r=this.HTMLcreateSpan(r);if(this.data.length===0){return r}var I=this.getValues("columnalign","rowalign","columnspacing","rowspacing","columnwidth","equalcolumns","equalrows","columnlines","rowlines","frame","framespacing","align","useHeight","width","side","minlabelspacing");var aM=I.width.match(/%$/);var ay=b.createStack(r);var aJ=this.HTMLgetScale(),aB=this.HTMLgetMu(r),aC=-1;var aq=[],au=[],aj=[],aw=[],av=[],ae,ad,ap=-1,ac,ao,X,aH,Q,aE,aR=[],aW;var G=b.FONTDATA.lineH*aJ*I.useHeight,N=b.FONTDATA.lineD*aJ*I.useHeight;for(ae=0,ac=this.data.length;ae<ac;ae++){aH=this.data[ae];X=(aH.type==="mlabeledtr"?aC:0);aw[ae]=[];aq[ae]=G;au[ae]=N;for(ad=X,ao=aH.data.length+X;ad<ao;ad++){if(aj[ad]==null){if(ad>ap){ap=ad}av[ad]=b.createStack(b.createBox(ay));aj[ad]=-b.BIGDIMEN}aw[ae][ad]=b.createBox(av[ad]);aR.push(aH.data[ad-X].toHTML(aw[ae][ad]))}}b.MeasureSpans(aR);for(ae=0,ac=this.data.length;ae<ac;ae++){aH=this.data[ae];X=(aH.type==="mlabeledtr"?aC:0);for(ad=X,ao=aH.data.length+X;ad<ao;ad++){Q=aH.data[ad-X];if(Q.isMultiline){aw[ae][ad].style.width="100%"}if(Q.isEmbellished()){aE=Q.CoreMO();var aV=aE.Get("minsize",true);if(aV){var aO=aE.HTMLspanElement().bbox;if(aE.HTMLcanStretch("Vertical")){aW=aO.h+aO.d;if(aW){aV=b.length2em(aV,aB,aW);if(aV*aO.h/aW>aq[ae]){aq[ae]=aV*aO.h/aW}if(aV*aO.d/aW>au[ae]){au[ae]=aV*aO.d/aW}}}else{if(aE.HTMLcanStretch("Horizontal")){aV=b.length2em(aV,aB,aO.w);if(aV>aj[ad]){aj[ad]=aV}}}}}if(aw[ae][ad].bbox.h>aq[ae]){aq[ae]=aw[ae][ad].bbox.h}if(aw[ae][ad].bbox.d>au[ae]){au[ae]=aw[ae][ad].bbox.d}if(aw[ae][ad].bbox.w>aj[ad]){aj[ad]=aw[ae][ad].bbox.w}}}var aG=MathJax.Hub.SplitList;var aA=aG(I.columnspacing),aT=aG(I.rowspacing),e=aG(I.columnalign),B=aG(I.rowalign),d=aG(I.columnlines),w=aG(I.rowlines),aP=aG(I.columnwidth),U=[];for(ae=0,ac=aA.length;ae<ac;ae++){aA[ae]=b.length2em(aA[ae],aB)}for(ae=0,ac=aT.length;ae<ac;ae++){aT[ae]=b.length2em(aT[ae],aB)}while(aA.length<ap){aA.push(aA[aA.length-1])}while(e.length<=ap){e.push(e[e.length-1])}while(d.length<ap){d.push(d[d.length-1])}while(aP.length<=ap){aP.push(aP[aP.length-1])}while(aT.length<aw.length){aT.push(aT[aT.length-1])}while(B.length<=aw.length){B.push(B[B.length-1])}while(w.length<aw.length){w.push(w[w.length-1])}if(av[aC]){e[aC]=(I.side.substr(0,1)==="l"?"left":"right");aA[aC]=-aj[aC]}for(ae=0,ac=aw.length;ae<ac;ae++){aH=this.data[ae];U[ae]=[];if(aH.rowalign){B[ae]=aH.rowalign}if(aH.columnalign){U[ae]=aG(aH.columnalign);while(U[ae].length<=ap){U[ae].push(U[ae][U[ae].length-1])}}}if(I.equalrows){var aF=Math.max.apply(Math,aq),V=Math.max.apply(Math,au);for(ae=0,ac=aw.length;ae<ac;ae++){X=((aF+V)-(aq[ae]+au[ae]))/2;aq[ae]+=X;au[ae]+=X}}aW=aq[0]+au[aw.length-1];for(ae=0,ac=aw.length-1;ae<ac;ae++){aW+=Math.max(0,au[ae]+aq[ae+1]+aT[ae])}var aL=0,aK=0,aZ,g=aW;if(I.frame!=="none"||(I.columnlines+I.rowlines).match(/solid|dashed/)){var v=aG(I.framespacing);if(v.length!=2){v=aG(this.defaults.framespacing)}aL=b.length2em(v[0],aB);aK=b.length2em(v[1],aB);g=aW+2*aK}var ai,aY,aa="";if(typeof(I.align)!=="string"){I.align=String(I.align)}if(I.align.match(/(top|bottom|center|baseline|axis)( +(-?\d+))?/)){aa=RegExp.$3||"";I.align=RegExp.$1}else{I.align=this.defaults.align}if(aa!==""){aa=parseInt(aa);if(aa<0){aa=aw.length+1+aa}if(aa<1){aa=1}else{if(aa>aw.length){aa=aw.length}}ai=0;aY=-(aW+aK)+aq[0];for(ae=0,ac=aa-1;ae<ac;ae++){var L=Math.max(0,au[ae]+aq[ae+1]+aT[ae]);ai+=L;aY+=L}}else{ai=({top:-(aq[0]+aK),bottom:aW+aK-aq[0],center:aW/2-aq[0],baseline:aW/2-aq[0],axis:aW/2+b.TeX.axis_height*aJ-aq[0]})[I.align];aY=({top:-(aW+2*aK),bottom:0,center:-(aW/2+aK),baseline:-(aW/2+aK),axis:b.TeX.axis_height*aJ-aW/2-aK})[I.align]}var ab,af=0,z=0,K=0,Z=0,ag=0,am=[],at=[],R=1;if(I.equalcolumns&&I.width!=="auto"){if(aM){ab=(100/(ap+1)).toFixed(2).replace(/\.?0+$/,"")+"%";for(ae=0,ac=Math.min(ap+1,aP.length);ae<ac;ae++){aP[ae]=ab}ab=0;af=1;ag=ap+1;for(ae=0,ac=Math.min(ap+1,aA.length);ae<ac;ae++){ab+=aA[ae]}}else{ab=b
|