/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ /* vim: set ts=2 et sw=2 tw=80: */ /************************************************************* * * MathJax/jax/output/SVG/autoload/mtable.js * * Implements the SVG output for elements. * * --------------------------------------------------------------------- * * Copyright (c) 2011-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 H=MathJax.ElementJax.mml,h=MathJax.OutputJax.SVG,F=h.BBOX;H.mtable.Augment({toSVG:function(f){this.SVGgetStyles();f=this.SVG();if(0===this.data.length)return this.SVGsaveData(f),f;var d=this.getValues("columnalign","rowalign","columnspacing","rowspacing","columnwidth","equalcolumns","equalrows","columnlines","rowlines","frame","framespacing","align","useHeight","width","side","minlabelspacing");d.width.match(/%$/)&&(f.width=d.width=Math.floor(h.cwidth*parseFloat(d.width)/100)+"px");var x=this.SVGgetScale(),v=this.SVGgetMu(f),c=[],l=[],n=[],k=[],C=[],a,b,t=-1,e,A,m,y,g,q,J=h.FONTDATA.baselineskip*x*d.useHeight,z=h.FONTDATA.lineH*x,D=h.FONTDATA.lineD*x;a=0;for(e=this.data.length;at&&(t=b),C[b]=F.G(),n[b]=-h.BIGDIMEN);g=y.data[b-m];k[a][b]=g.toSVG();if(g.isEmbellished()){q=g.CoreMO();var p=q.Get("minsize",!0);if(p)if(q.SVGcanStretch("Vertical")){if(g=q.SVGdata.h+q.SVGdata.d)p=h.length2em(p,v,g),p*q.SVGdata.h/g>c[b]&&(c[b]=p*q.SVGdata.h/g),p*q.SVGdata.d/g>l[b]&&(l[b]=p*q.SVGdata.d/g)}else q.SVGcanStretch("Horizontal")&&(p=h.length2em(p,v,q.SVGdata.w),p>n[b]&&(n[b]=p))}k[a][b].h>c[a]&&(c[a]=k[a][b].h);k[a][b].d>l[a]&&(l[a]=k[a][b].d);k[a][b].w>n[b]&&(n[b]=k[a][b].w)}c[0]+l[0]&&(c[0]=Math.max(c[0],z));c[k.length-1]+l[k.length-1]&&(l[k.length-1]=Math.max(l[k.length-1],D));var w=MathJax.Hub.SplitList,p=w(d.columnspacing),z=w(d.rowspacing);A=w(d.columnalign);var u=w(d.rowalign),I=w(d.columnlines),D=w(d.rowlines);b=w(d.columnwidth);var G=[];a=0;for(e=p.length;ae&&(e=k.length+1+e),1>e?e=1:e>k.length&&(e=k.length),w=0,x=-(g+a)+c[0],a=0,--e;am)for(r=(r-m)/g,a=0,e=B.length;a