123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158 |
- MathJax.Extension["TeX/AMScd"] = {
- version: "2.7.2",
- config: MathJax.Hub.CombineConfig("TeX.CD",{
- colspace: "5pt",
- rowspace: "5pt",
- harrowsize: "2.75em",
- varrowsize: "1.75em",
- hideHorizontalLabels: false
- })
- };
- MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
- var MML = MathJax.ElementJax.mml,
- TEX = MathJax.InputJax.TeX,
- STACKITEM = TEX.Stack.Item,
- TEXDEF = TEX.Definitions,
- CONFIG = MathJax.Extension["TeX/AMScd"].config;
- TEXDEF.environment.CD = "CD_env";
- TEXDEF.special["@"] = "CD_arrow";
- TEXDEF.macros.minCDarrowwidth = "CD_minwidth";
- TEXDEF.macros.minCDarrowheight = "CD_minheight";
- TEX.Parse.Augment({
-
-
-
- CD_env: function (begin) {
- this.Push(begin);
- return STACKITEM.array().With({
- arraydef: {
- columnalign: "center",
- columnspacing: CONFIG.colspace,
- rowspacing: CONFIG.rowspace,
- displaystyle: true
- },
- minw: this.stack.env.CD_minw || CONFIG.harrowsize,
- minh: this.stack.env.CD_minh || CONFIG.varrowsize
- });
- },
- CD_arrow: function (name) {
- var c = this.string.charAt(this.i);
- if (!c.match(/[><VA.|=]/)) {return this.Other(name)} else {this.i++}
- var top = this.stack.Top();
- if (!top.isa(STACKITEM.array) || top.data.length) {
- this.CD_cell(name);
- top = this.stack.Top();
- }
-
-
-
- var arrowRow = ((top.table.length % 2) === 1);
- var n = (top.row.length + (arrowRow ? 0 : 1)) % 2;
- while (n) {this.CD_cell(name); n--}
- var mml;
- var hdef = {minsize: top.minw, stretchy:true},
- vdef = {minsize: top.minh, stretchy:true, symmetric:true, lspace:0, rspace:0};
- if (c === ".") {}
- else if (c === "|") {mml = this.mmlToken(MML.mo("\u2225").With(vdef))}
- else if (c === "=") {mml = this.mmlToken(MML.mo("=").With(hdef))}
- else {
-
-
-
- var arrow = {">":"\u2192", "<":"\u2190", V:"\u2193", A:"\u2191"}[c];
- var a = this.GetUpTo(name+c,c),
- b = this.GetUpTo(name+c,c);
- if (c === ">" || c === "<") {
-
-
-
- mml = MML.mo(arrow).With(hdef);
- if (!a) {a = "\\kern "+top.minw}
- if (a || b) {
- var pad = {width:"+11mu", lspace:"6mu"};
- mml = MML.munderover(this.mmlToken(mml));
- if (a) {
- a = TEX.Parse(a,this.stack.env).mml();
- mml.SetData(mml.over,MML.mpadded(a).With(pad).With({voffset:".1em"}));
- }
- if (b) {
- b = TEX.Parse(b,this.stack.env).mml();
- mml.SetData(mml.under,MML.mpadded(b).With(pad));
- }
- if (CONFIG.hideHorizontalLabels)
- {mml = MML.mpadded(mml).With({depth:0, height:".67em"})}
- }
- } else {
-
-
-
- mml = arrow = this.mmlToken(MML.mo(arrow).With(vdef));
- if (a || b) {
- mml = MML.mrow();
- if (a) {mml.Append(TEX.Parse("\\scriptstyle\\llap{"+a+"}",this.stack.env).mml())}
- mml.Append(arrow.With({texClass: MML.TEXCLASS.ORD}));
- if (b) {mml.Append(TEX.Parse("\\scriptstyle\\rlap{"+b+"}",this.stack.env).mml())}
- }
- }
- }
- if (mml) {this.Push(mml)};
- this.CD_cell(name);
- },
- CD_cell: function (name) {
- var top = this.stack.Top();
- if ((top.table||[]).length % 2 === 0 && (top.row||[]).length === 0) {
-
-
-
-
- this.Push(MML.mpadded().With({height:"8.5pt",depth:"2pt"}));
- }
- this.Push(STACKITEM.cell().With({isEntry:true, name:name}));
- },
- CD_minwidth: function (name) {
- this.stack.env.CD_minw = this.GetDimen(name);
- },
- CD_minheight: function (name) {
- this.stack.env.CD_minh = this.GetDimen(name);
- }
- });
- });
- MathJax.Ajax.loadComplete("[MathJax]/extensions/TeX/AMScd.js");
|