17 lines
9.2 KiB
JavaScript
17 lines
9.2 KiB
JavaScript
/*
|
|
* /MathJax/extensions/TeX/AMSmath.js
|
|
*
|
|
* Copyright (c) 2010 Design Science, Inc.
|
|
*
|
|
* Part of the MathJax library.
|
|
* See http://www.mathjax.org for details.
|
|
*
|
|
* Licensed under the Apache License, Version 2.0;
|
|
* you may not use this file except in compliance with the License.
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*/
|
|
|
|
MathJax.Hub.Register.StartupHook("TeX Jax Ready",function(){var e="1.1";var a=MathJax.ElementJax.mml;var f=MathJax.InputJax.TeX;var c=f.Definitions;var d=f.Stack.Item;var b=function(g){return g.join("em ")+"em"};MathJax.Hub.Insert(c,{macros:{mathring:["Accent","2DA"],nobreakspace:"Tilde",negmedspace:["Spacer",a.LENGTH.NEGATIVEMEDIUMMATHSPACE],negthickspace:["Spacer",a.LENGTH.NEGATIVETHICKMATHSPACE],intI:["Macro","\\mathchoice{\\!}{}{}{}\\!\\!\\int"],iiiint:["MultiIntegral","\\int\\intI\\intI\\intI"],idotsint:["MultiIntegral","\\int\\cdots\\int"],dddot:["Macro","\\mathop{#1}\\limits^{\\textstyle \\mathord{.}\\mathord{.}\\mathord{.}}",1],ddddot:["Macro","\\mathop{#1}\\limits^{\\textstyle \\mathord{.}\\mathord{.}\\mathord{.}\\mathord{.}}",1],sideset:["Macro","\\mathop{\\mathop{\\rlap{\\phantom{#3}}}\\nolimits#1\\!\\mathop{#3}\\nolimits#2}",3],boxed:["Macro","\\fbox{$\\displaystyle{#1}$}",1],tag:"HandleTag",notag:"HandleNoTag",substack:["Macro","\\begin{subarray}{c}#1\\end{subarray}",1],injlim:["Macro","\\mathop{\\rm inj\\,lim}"],projlim:["Macro","\\mathop{\\rm proj\\,lim}"],varliminf:["Macro","\\mathop{\\underline{\\rm lim}}"],varlimsup:["Macro","\\mathop{\\overline{\\rm lim}}"],varinjlim:["Macro","\\mathop{\\underrightarrow{\\rm lim\\Rule{-1pt}{0pt}{1pt}}\\Rule{0pt}{0pt}{.45em}}"],varprojlim:["Macro","\\mathop{\\underleftarrow{\\rm lim\\Rule{-1pt}{0pt}{1pt}}\\Rule{0pt}{0pt}{.45em}}"],DeclareMathOperator:"HandleDeclareOp",operatorname:"HandleOperatorName",genfrac:"Genfrac",frac:["Genfrac","","","",""],tfrac:["Genfrac","","","",1],dfrac:["Genfrac","","","",0],binom:["Genfrac","(",")","0em",""],tbinom:["Genfrac","(",")","0em",1],dbinom:["Genfrac","(",")","0em",0],cfrac:"CFrac",shoveleft:["HandleShove",a.ALIGN.LEFT],shoveright:["HandleShove",a.ALIGN.RIGHT],xrightarrow:["xArrow",8594,5,6],xleftarrow:["xArrow",8592,7,3]},environment:{align:["AMSarray",null,true,true,"rlrlrlrlrlrl",b([5/18,2,5/18,2,5/18,2,5/18,2,5/18,2,5/18])],"align*":["AMSarray",null,false,true,"rlrlrlrlrlrl",b([5/18,2,5/18,2,5/18,2,5/18,2,5/18,2,5/18])],multline:["Multline",null,true],"multline*":["Multline",null,false],split:["AMSarray",null,false,false,"rl",b([5/18])],gather:["AMSarray",null,true,true,"c"],"gather*":["AMSarray",null,false,true,"c"],alignat:["AlignAt",null,true,true],"alignat*":["AlignAt",null,false,true],alignedat:["AlignAt",null,false,false],aligned:["Array",null,null,null,"rlrlrlrlrlrl",b([5/18,2,5/18,2,5/18,2,5/18,2,5/18,2,5/18]),".5em","D"],gathered:["Array",null,null,null,"c",null,".5em","D"],subarray:["Array",null,null,null,null,b([0,0,0,0]),"0.1em","S",1],smallmatrix:["Array",null,null,null,"c",b([1/3]),".2em","S",1]},delimiter:{"\\lvert":["2223",{texClass:a.TEXCLASS.OPEN}],"\\rvert":["2223",{texClass:a.TEXCLASS.CLOSE}],"\\lVert":["2225",{texClass:a.TEXCLASS.OPEN}],"\\rVert":["2225",{texClass:a.TEXCLASS.CLOSE}]}});f.Parse.Augment({HandleTag:function(h){var g=this.trimSpaces(this.GetArgument(h));if(g==="*"){g=this.GetArgument(h)}else{g="("+g+")"}if(this.stack.global.notag){f.Error(h+" not allowed in "+this.stack.global.notag+" environment")}if(this.stack.global.tag){f.Error("Multiple "+h)}this.stack.global.tag=a.mtd.apply(a,this.InternalMath(g))},HandleNoTag:function(g){if(this.stack.global.tag){delete this.stack.global.tag}},HandleDeclareOp:function(h){var g="";var i=this.trimSpaces(this.GetArgument(h));if(i=="*"){g="\\limits";i=this.trimSpaces(this.GetArgument(h))}if(i.charAt(0)=="\\"){i=i.substr(1)}var j=this.GetArgument(h);j=j.replace(/\*/g,"\\text{*}").replace(/-/g,"\\text{-}");f.Definitions.macros[i]=["Macro","\\mathop{\\rm "+j+"}"+g]},HandleOperatorName:function(h){var g="\\nolimits";var i=this.trimSpaces(this.GetArgument(h));if(i=="*"){g="\\limits";i=this.trimSpaces(this.GetArgument(h))}i=i.replace(/\*/g,"\\text{*}").replace(/-/g,"\\text{-}");this.string="\\mathop{\\rm "+i+"}"+g+" "+this.string.slice(this.i);this.i=0},HandleShove:function(h,g){var i=this.stack.Top();if(i.type!=="multline"||i.data.length){f.Error(h+" must come at the beginning of the line")}i.data.shove=g},CFrac:function(j){var g=this.trimSpaces(this.GetBrackets(j)),i=this.GetArgument(j),k=this.GetArgument(j);var h=a.mfrac(f.Parse("\\strut\\textstyle{"+i+"}",this.stack.env).mml(),f.Parse("\\strut\\textstyle{"+k+"}",this.stack.env).mml());g=({l:a.ALIGN.LEFT,r:a.ALIGN.RIGHT,"":""})[g];if(g==null){f.Error("Illegal alignment specified in "+j)}if(g){h.numalign=h.denomalign=g}this.Push(h)},Genfrac:function(h,j,o,l,g){if(j==null){j=this.GetDelimiterArg(h)}else{j=this.convertDelimiter(j)}if(o==null){o=this.GetDelimiterArg(h)}else{o=this.convertDelimiter(o)}if(l==null){l=this.GetArgument(h)}if(g==null){g=this.trimSpaces(this.GetArgument(h))}var k=this.ParseArg(h);var n=this.ParseArg(h);var i=a.mfrac(k,n);if(l!==""){i.linethickness=l}if(j||o){i=a.mfenced(i).With({open:j,close:o})}if(g!==""){var m=(["D","T","S","SS"])[g];if(m==null){f.Error("Bad math style for "+h)}i=a.mstyle(i);if(m==="D"){i.displaystyle=true;i.scriptlevel=0}else{i.displaystyle=false;i.scriptlevel=g-1}}this.Push(i)},Multline:function(h,g){this.Push(h);return d.multline().With({arraydef:{displaystyle:true,rowspacing:".5em",width:f.config.MultLineWidth,columnwidth:"100%",side:f.config.TagSide,minlabelspacing:f.config.TagIndent}})},AMSarray:function(i,h,g,k,j){this.Push(i);k=k.replace(/[^clr]/g,"").split("").join(" ");k=k.replace(/l/g,"left").replace(/r/g,"right").replace(/c/g,"center");return d.AMSarray(i.name,h,g,this.stack).With({arraydef:{displaystyle:true,rowspacing:".5em",columnalign:k,columnspacing:(j||"1em"),rowspacing:"3pt",side:f.config.TagSide,minlabelspacing:f.config.TagIndent}})},AlignAt:function(i,h,g){var j=this.GetArgument("\\begin{"+i.name+"}");if(j.match(/[^0-9]/)){f.Error("Argument to \\begin{"+i.name+"} must me a positive integer")}align="";spacing=[];while(j>0){align+="rl";spacing.push("0em 0em");j--}spacing=spacing.join(" ");if(g){return this.AMSarray(i,h,g,align,spacing)}return this.Array(i,null,null,align,spacing,".5em","D")},MultiIntegral:function(g,k){var j=this.GetNext();if(j==="\\"){var h=this.i;j=this.GetArgument(g);this.i=h;if(j==="\\limits"){if(g==="\\idotsint"){k="\\!\\!\\mathop{\\,\\,"+k+"}"}else{k="\\!\\!\\!\\mathop{\\,\\,\\,"+k+"}"}}}this.string=k+" "+this.string.slice(this.i);this.i=0},xArrow:function(i,m,k,g){var j={width:"+"+(k+g)+"mu",lspace:k+"mu"};var n=this.GetBrackets(i),o=this.ParseArg(i);var p=a.mo(a.chars(String.fromCharCode(m))).With({stretchy:true,texClass:a.TEXCLASS.REL});var h=a.munderover(p);h.SetData(h.over,a.mpadded(o).With(j).With({voffset:".15em"}));if(n){n=f.Parse(n,this.stack.env).mml();h.SetData(h.under,a.mpadded(n).With(j).With({voffset:"-.24em"}))}this.Push(h)},GetDelimiterArg:function(g){var h=this.trimSpaces(this.GetArgument(g));if(h==""){return null}if(!c.delimiter[h]){f.Error("Missing or unrecognized delimiter for "+g)}return this.convertDelimiter(h)}});d.multline=d.array.Subclass({type:"multline",EndEntry:function(){var g=a.mtd.apply(a,this.data);if(this.data.shove){g.columnalign=this.data.shove}this.row.push(g);this.data=[]},EndRow:function(){if(this.row.length!=1){f.Error("multline rows must have exactly one column")}this.table.push(this.row);this.row=[]},EndTable:function(){this.SUPER(arguments).EndTable.call(this);if(this.table.length){var h=this.table.length-1,j;if(!this.table[0][0].columnalign){this.table[0][0].columnalign=a.ALIGN.LEFT}if(!this.table[h][0].columnalign){this.table[h][0].columnalign=a.ALIGN.RIGHT}var g=a.mtr;if(this.global.tag){this.table[0]=[this.global.tag].concat(this.table[0]);delete this.global.tag;g=a.mlabeledtr}this.table[0]=g.apply(a,this.table[0]);for(j=1,h=this.table.length;j<h;j++){this.table[j]=a.mtr.apply(a,this.table[j])}}}});d.AMSarray=d.array.Subclass({type:"AMSarray",Init:function(j,i,h,g){this.SUPER(arguments).Init.apply(this);this.numbered=i;this.save_notag=g.global.notag;g.global.notag=(h?null:j)},EndRow:function(){var g=a.mtr;if(this.global.tag){this.row=[this.global.tag].concat(this.row);g=a.mlabeledtr;delete this.global.tag}this.table.push(g.apply(a,this.row));this.row=[]},EndTable:function(){this.SUPER(arguments).EndTable.call(this);this.global.notag=this.save_notag}});d.start.Augment({oldCheckItem:d.start.prototype.checkItem,checkItem:function(h){if(h.type==="stop"){var g=this.mmlData();if(this.global.tag){var j=[this.global.tag,a.mtd(g)];delete this.global.tag;var i={side:f.config.TagSide,minlabelspacing:f.config.TagIndent,columnalign:g.displayAlign};if(g.displayAlign===a.INDENTALIGN.LEFT){i.width="100%";if(g.displayIndent&&!String(g.displayIndent).match(/^0+(\.0*)?($|[a-z%])/)){i.columnwidth=g.displayIndent+" fit";i.columnspacing="0";j=[j[0],a.mtd(),j[1]]}}else{if(g.displayAlign===a.INDENTALIGN.RIGHT){i.width="100%";if(g.displayIndent&&!String(g.displayIndent).match(/^0+(\.0*)?($|[a-z%])/)){i.columnwidth="fit "+g.displayIndent;i.columnspacing="0";j[2]=a.mtd()}}}g=a.mtable(a.mlabeledtr.apply(a,j)).With(i)}return d.mml(g)}return this.SUPER(arguments).checkItem.call(this,h)}});MathJax.Hub.Startup.signal.Post("TeX AMSmath Ready")});MathJax.Ajax.loadComplete("[MathJax]/extensions/TeX/AMSmath.js");
|
|
|