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

20 lines
7.7 KiB
JavaScript
Raw Normal View History

/*
* /MathJax/jax/output/SVG/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("SVG Jax Ready",function(){var c="2.3";var a=MathJax.ElementJax.mml,d=MathJax.OutputJax.SVG,b=d.BBOX;a.mtable.Augment({toSVG:function(V){this.SVGgetStyles();var l=this.SVG();if(this.data.length===0){this.SVGsaveData(l);return l}var aI=this.getValues("columnalign","rowalign","columnspacing","rowspacing","columnwidth","equalcolumns","equalrows","columnlines","rowlines","frame","framespacing","align","useHeight","width","side","minlabelspacing");if(aI.width.match(/%$/)){l.width=aI.width=Math.floor(d.cwidth*parseFloat(aI.width)/100)+"px"}var al=this.SVGgetScale(),t=this.SVGgetMu(l);var aF=-1;var v=[],E=[],h=[],L=[],G=[],aD,aC,u=-1,aA,r,av,O,aj,z;var aK=d.FONTDATA.baselineskip*al*aI.useHeight,aw,Z=d.FONTDATA.lineH*al,ad=d.FONTDATA.lineD*al;for(aD=0,aA=this.data.length;aD<aA;aD++){O=this.data[aD];av=(O.type==="mlabeledtr"?aF:0);L[aD]=[];v[aD]=E[aD]=0;for(aC=av,r=O.data.length+av;aC<r;aC++){if(h[aC]==null){if(aC>u){u=aC}G[aC]=b.G();h[aC]=-d.BIGDIMEN}aj=O.data[aC-av];L[aD][aC]=aj.toSVG();if(aj.isEmbellished()){z=aj.CoreMO();var aH=z.Get("minsize",true);if(aH){if(z.SVGcanStretch("Vertical")){aw=z.SVGdata.h+z.SVGdata.d;if(aw){aH=d.length2em(aH,t,aw);if(aH*z.SVGdata.h/aw>v[aC]){v[aC]=aH*z.SVGdata.h/aw}if(aH*z.SVGdata.d/aw>E[aC]){E[aC]=aH*z.SVGdata.d/aw}}}else{if(z.SVGcanStretch("Horizontal")){aH=d.length2em(aH,t,z.SVGdata.w);if(aH>h[aC]){h[aC]=aH}}}}}if(L[aD][aC].h>v[aD]){v[aD]=L[aD][aC].h}if(L[aD][aC].d>E[aD]){E[aD]=L[aD][aC].d}if(L[aD][aC].w>h[aC]){h[aC]=L[aD][aC].w}}}if(v[0]+E[0]){v[0]=Math.max(v[0],Z)}if(v[L.length-1]+E[L.length-1]){E[L.length-1]=Math.max(E[L.length-1],ad)}var ak=MathJax.Hub.SplitList;var ai=ak(aI.columnspacing),Q=ak(aI.rowspacing),af=ak(aI.columnalign),I=ak(aI.rowalign),K=ak(aI.columnlines),g=ak(aI.rowlines),an=ak(aI.columnwidth),ar=[];for(aD=0,aA=ai.length;aD<aA;aD++){ai[aD]=d.length2em(ai[aD],t)}for(aD=0,aA=Q.length;aD<aA;aD++){Q[aD]=d.length2em(Q[aD],t)}while(ai.length<u){ai.push(ai[ai.length-1])}while(af.length<=u){af.push(af[af.length-1])}while(K.length<u){K.push(K[K.length-1])}while(an.length<=u){an.push(an[an.length-1])}while(Q.length<L.length){Q.push(Q[Q.length-1])}while(I.length<=L.length){I.push(I[I.length-1])}while(g.length<L.length){g.push(g[g.length-1])}if(G[aF]){af[aF]=(aI.side.substr(0,1)==="l"?"left":"right");ai[aF]=-h[aF]}for(aD=0,aA=L.length;aD<aA;aD++){O=this.data[aD];ar[aD]=[];if(O.rowalign){I[aD]=O.rowalign}if(O.columnalign){ar[aD]=ak(O.columnalign);while(ar[aD].length<=u){ar[aD].push(ar[aD][ar[aD].length-1])}}}if(aI.equalrows){var R=Math.max.apply(Math,v),am=Math.max.apply(Math,E);for(aD=0,aA=L.length;aD<aA;aD++){av=((R+am)-(v[aD]+E[aD]))/2;v[aD]+=av;E[aD]+=av}}aw=v[0]+E[L.length-1];for(aD=0,aA=L.length-1;aD<aA;aD++){aw+=Math.max((v[aD]+E[aD]?aK:0),E[aD]+v[aD+1]+Q[aD])}var ab=0,X=0,ax,aG=aw;if(aI.frame!=="none"||(aI.columnlines+aI.rowlines).match(/solid|dashed/)){var q=ak(aI.framespacing);if(q.length!=2){q=ak(this.defaults.framespacing)}ab=d.length2em(q[0],t);X=d.length2em(q[1],t);aG=aw+2*X}var e,au,az="";if(typeof(aI.align)!=="string"){aI.align=String(aI.align)}if(aI.align.match(/(top|bottom|center|baseline|axis)( +(-?\d+))?/)){az=RegExp.$3;aI.align=RegExp.$1}else{aI.align=this.defaults.align}if(az!==""){az=parseInt(az);if(az<0){az=L.length+1+az}if(az<1){az=1}else{if(az>L.length){az=L.length}}e=0;au=-(aw+X)+v[0];for(aD=0,aA=az-1;aD<aA;aD++){var U=Math.max((v[aD]+E[aD]?aK:0),E[aD]+v[aD+1]+Q[aD]);e+=U;au+=U}}else{e=({top:-(v[0]+X),bottom:aw+X-v[0],center:aw/2-v[0],baseline:aw/2-v[0],axis:aw/2+d.TeX.axis_height*al-v[0]})[aI.align];au=({top:-(aw+2*X),bottom:0,center:-(aw/2+X),baseline:-(aw/2+X),axis:d.TeX.axis_height*al-aw/2-X})[aI.align]}var ao,at=0,S=0,T=0,ay=0,aE=0,o=[],w=[],ag=1;if(aI.equalcolumns&&aI.width!=="auto"){ao=d.length2em(aI.width,t);for(aD=0,aA=Math.min(u+1,ai.length);aD<aA;aD++){ao-=ai[aD]}ao/=u+1;for(aD=0,aA=Math.min(u+1,an.length);aD<aA;aD++){h[aD]=ao}}else{for(aD=0,aA=Math.min(u+1,an.length);aD<aA;aD++){if(an[aD]==="auto"){S+=h[aD]}else{if(an[aD]==="fit"){w[aE]=aD;aE++;S+=h[aD]}else{if(an[aD].match(/%$/)){o[ay]=aD;ay++;T+=h[aD];at+=d.lengt