12345678910111213141516171819202122232425 |
- /* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */
- /* vim: set ts=2 et sw=2 tw=80: */
- /*************************************************************
- *
- * MathJax/extensions/TeX/AMScd.js
- *
- * Implements the CD environment for commutative diagrams.
- *
- * ---------------------------------------------------------------------
- *
- * Copyright (c) 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.Extension["TeX/AMScd"]={version:"2.2",config:MathJax.Hub.CombineConfig("TeX.CD",{colspace:"5pt",rowspace:"5pt",harrowsize:"2.25em",varrowsize:"1.75em",hideHorizontalLabels:!1})};MathJax.Hub.Register.StartupHook("TeX Jax Ready",function(){var e=MathJax.ElementJax.mml,g=MathJax.InputJax.TeX,n=g.Stack.Item,h=g.Definitions,l=MathJax.Extension["TeX/AMScd"].config;h.environment.CD="CD_env";h.special["@"]="CD_arrow";h.macros.minCDarrowwidth="CD_minwidth";h.macros.minCDarrowheight="CD_minheight";g.Parse.Augment({CD_env:function(b){this.Push(b);return n.array().With({arraydef:{columnalign:"center",columnspacing:l.colspace,rowspacing:l.rowspace,displaystyle:!0},minw:this.stack.env.CD_minw||l.harrowsize,minh:this.stack.env.CD_minh||l.varrowsize})},CD_arrow:function(b){var c=this.string[this.i];if(c.match(/[><VA.|=]/))this.i++;else return this.Other(b);var k=this.stack.Top();k.isa(n.array)&&!k.data.length||this.CD_cell(b);for(var d=(k.row.length+(1===k.table.length%2?0:1))%2;d;)this.CD_cell(b),d--;var a,h={minsize:k.minw,stretchy:!0},p={minsize:k.minh,stretchy:!0,symmetric:!0};if("."!==c)if("|"===c)a=this.mmlToken(e.mo("\u2225").With(p));else if("\x3d"===c)a=this.mmlToken(e.mo("\x3d").With(h));else{var m={"\x3e":"\u2192","\x3c":"\u2190",V:"\u2193",A:"\u2191"}[c],d=this.GetUpTo(b+c,c),f=this.GetUpTo(b+c,c);if("\x3e"===c||"\x3c"===c){if(a=e.mo(m).With(h),d||(d="\\kern "+k.minw),d||f)c={width:"+11mu",lspace:"6mu"},a=e.munderover(this.mmlToken(a)),d&&(d=g.Parse(d,this.stack.env).mml(),a.SetData(a.over,e.mpadded(d).With(c).With({voffset:".1em"}))),f&&(f=g.Parse(f,this.stack.env).mml(),a.SetData(a.under,e.mpadded(f).With(c))),l.hideHorizontalLabels&&(a=e.mpadded(a).With({depth:0,height:".67em"}))}else if(a=m=this.mmlToken(e.mo(m).With(p)),d||f)a=e.mrow(),d&&a.Append(g.Parse("\\scriptstyle\\llap{"+d+"}",this.stack.env).mml()),a.Append(m.With({texClass:e.TEXCLASS.ORD})),f&&a.Append(g.Parse("\\scriptstyle\\rlap{"+f+"}",this.stack.env).mml())}a&&this.Push(a);this.CD_cell(b)},CD_cell:function(b){this.Push(n.cell().With({isEntry:!0,name:b}))},CD_minwidth:function(b){this.stack.env.CD_minw=this.GetDimen(b)},CD_minheight:function(b){this.stack.env.CD_minh=this.GetDimen(b)}})});MathJax.Ajax.loadComplete("[MathJax]/extensions/TeX/AMScd.js");
|