reveal-js-base-theme/plugin/math/mathjax/jax/output/HTML-CSS/autoload/mtable.js

20 lines
11 KiB
JavaScript
Raw Permalink Normal View History

/*
* /MathJax/jax/output/HTML-CSS/autoload/mtable.js
*
* Copyright (c) 2009-2013 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.3";var a=MathJax.ElementJax.mml,b=MathJax.OutputJax["HTML-CSS"];a.mtable.Augment({toHTML:function(t){t=this.HTMLcreateSpan(t);if(this.data.length===0){return t}var K=this.getValues("columnalign","rowalign","columnspacing","rowspacing","columnwidth","equalcolumns","equalrows","columnlines","rowlines","frame","framespacing","align","useHeight","width","side","minlabelspacing");var aJ=K.width.match(/%$/);var ay=b.createStack(t);var aG=this.HTMLgetScale(),aA=this.HTMLgetMu(t),aB=-1;var aq=[],au=[],ak=[],aw=[],av=[],af,ae,ap=-1,ad,ao,Z,aF,R,aC,aO=[];var al=b.FONTDATA.baselineskip*aG*K.useHeight,aT,I=b.FONTDATA.lineH*aG,O=b.FONTDATA.lineD*aG;for(af=0,ad=this.data.length;af<ad;af++){aF=this.data[af];Z=(aF.type==="mlabeledtr"?aB:0);aw[af]=[];aq[af]=au[af]=0;for(ae=Z,ao=aF.data.length+Z;ae<ao;ae++){if(ak[ae]==null){if(ae>ap){ap=ae}av[ae]=b.createStack(b.createBox(ay));ak[ae]=-b.BIGDIMEN}aw[af][ae]=b.createBox(av[ae]);aO.push(aF.data[ae-Z].toHTML(aw[af][ae]))}}b.MeasureSpans(aO);for(af=0,ad=this.data.length;af<ad;af++){aF=this.data[af];Z=(aF.type==="mlabeledtr"?aB:0);for(ae=Z,ao=aF.data.length+Z;ae<ao;ae++){R=aF.data[ae-Z];if(R.isMultiline){aw[af][ae].style.width="100%"}if(R.isEmbellished()){aC=R.CoreMO();var aS=aC.Get("minsize",true);if(aS){var aL=aC.HTMLspanElement().bbox;if(aC.HTMLcanStretch("Vertical")){aT=aL.h+aL.d;if(aT){aS=b.length2em(aS,aA,aT);if(aS*aL.h/aT>aq[af]){aq[af]=aS*aL.h/aT}if(aS*aL.d/aT>au[af]){au[af]=aS*aL.d/aT}}}else{if(aC.HTMLcanStretch("Horizontal")){aS=b.length2em(aS,aA,aL.w);if(aS>ak[ae]){ak[ae]=aS}}}}}if(aw[af][ae].bbox.h>aq[af]){aq[af]=aw[af][ae].bbox.h}if(aw[af][ae].bbox.d>au[af]){au[af]=aw[af][ae].bbox.d}if(aw[af][ae].bbox.w>ak[ae]){ak[ae]=aw[af][ae].bbox.w}}}if(aq[0]+au[0]){aq[0]=Math.max(aq[0],I)}if(aq[aw.length-1]+au[aw.length-1]){au[aw.length-1]=Math.max(au[aw.length-1],O)}var aE=MathJax.Hub.SplitList;var az=aE(K.columnspacing),aQ=aE(K.rowspacing),e=aE(K.columnalign),E=aE(K.rowalign),d=aE(K.columnlines),z=aE(K.rowlines),aM=aE(K.columnwidth),V=[];for(af=0,ad=az.length;af<ad;af++){az[af]=b.length2em(az[af],aA)}for(af=0,ad=aQ.length;af<ad;af++){aQ[af]=b.length2em(aQ[af],aA)}while(az.length<ap){az.push(az[az.length-1])}while(e.length<=ap){e.push(e[e.length-1])}while(d.length<ap){d.push(d[d.length-1])}while(aM.length<=ap){aM.push(aM[aM.length-1])}while(aQ.length<aw.length){aQ.push(aQ[aQ.length-1])}while(E.length<=aw.length){E.push(E[E.length-1])}while(z.length<aw.length){z.push(z[z.length-1])}if(av[aB]){e[aB]=(K.side.substr(0,1)==="l"?"left":"right");az[aB]=-ak[aB]}for(af=0,ad=aw.length;af<ad;af++){aF=this.data[af];V[af]=[];if(aF.rowalign){E[af]=aF.rowalign}if(aF.columnalign){V[af]=aE(aF.columnalign);while(V[af].length<=ap){V[af].push(V[af][V[af].length-1])}}}if(K.equalrows){var aD=Math.max.apply(Math,aq),X=Math.max.apply(Math,au);for(af=0,ad=aw.length;af<ad;af++){Z=((aD+X)-(aq[af]+au[af]))/2;aq[af]+=Z;au[af]+=Z}}aT=aq[0]+au[aw.length-1];for(af=0,ad=aw.length-1;af<ad;af++){aT+=Math.max((aq[af]+au[af]?al:0),au[af]+aq[af+1]+aQ[af])}var aI=0,aH=0,aV,g=aT;if(K.frame!=="none"||(K.columnlines+K.rowlines).match(/solid|dashed/)){var w=aE(K.framespacing);if(w.length!=2){w=aE(this.defaults.framespacing)}aI=b.length2em(w[0],aA);aH=b.length2em(w[1],aA);g=aT+2*aH}var aj,aU,ab="";if(typeof(K.align)!=="string"){K.align=String(K.align)}if(K.align.match(/(top|bottom|center|baseline|axis)( +(-?\d+))?/)){ab=RegExp.$3;K.align=RegExp.$1}else{K.align=this.defaults.align}if(ab!==""){ab=parseInt(ab);if(ab<0){ab=aw.length+1+ab}if(ab<1){ab=1}else{if(ab>aw.length){ab=aw.length}}aj=0;aU=-(aT+aH)+aq[0];for(af=0,ad=ab-1;af<ad;af++){var N=Math.max((aq[af]+au[af]?al:0),au[af]+aq[af+1]+aQ[af]);aj+=N;aU+=N}}else{aj=({top:-(aq[0]+aH),bottom:aT+aH-aq[0],center:aT/2-aq[0],baseline:aT/2-aq[0],axis:aT/2+b.TeX.axis_height*aG-aq[0]})[K.align];aU=({top:-(aT+2*aH),bottom:0,center:-(aT/2+aH),baseline:-(aT/2+aH),axis:b.TeX.axis_height*aG-aT/2-aH})[K.align]}var ac,ag=0,B=0,L=0,aa=0,ah=0,an=[],at=[],S=1;if(K.equalcolumns&&K.width!=="auto"){if(aJ){ac=(100/(ap+1)).toFixed(2).rep