instiki/public/MathJax/extensions/TeX/AMSmath.js
Jacques Distler 1663d9f5c8 MathJax
For those without MathML-capable browsers,
we present MathJax. It's crappy 'n slow,
but it's better than nothing.
2010-10-17 22:30:56 -05:00

18 lines
7.8 KiB
JavaScript

/*
* ../SourceForge/trunk/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.Unpack([
['MathJax.','Hub.','Register.StartupHook("TeX Jax Ready",','function(){var ','e="1.0";var a=',0,'ElementJax.mml;var f=',0,'InputJax.TeX;var c=','f.Definitions',';var d=f.Stack.Item;var b=','function(','g){','return ','g.join("em ")+"em"};',0,1,'Insert(c,{macros:{mathring:["Accent","2DA"],nobreakspace:"Tilde",negmedspace',':["Spacer",a.LENGTH.','NEGATIVEMEDIUMMATHSPACE],negthickspace',18,'NEGATIVETHICKMATHSPACE],intI',':["Macro","\\\\','mathchoice{\\\\!}{}{}{}\\\\!\\\\!\\\\int"],iiiint',':["MultiIntegral","\\\\int\\\\','intI\\\\intI\\\\intI"],idotsint',24,'cdots\\\\int"],dddot',':["Macro","\\\\mathop','{#1}\\\\limits^{\\\\textstyle \\\\mathord{.}\\\\mathord{.}\\\\mathord','{.}}",1],ddddot',28,29,'{.}\\\\mathord{.}}",1],sideset',28,'{\\\\mathop{\\\\rlap{\\\\phantom{#3}}}\\\\nolimits#1\\\\!\\\\mathop{#3}\\\\nolimits#2}",3],boxed',22,'fbox{$\\\\','displaystyle','{#1}$}",1],tag:"HandleTag",notag:"HandleNoTag",substack',22,'begin{subarray}{c}#1\\\\end{subarray}",1],injlim',28,'{\\\\rm inj\\\\,lim}"],projlim',28,'{\\\\rm proj\\\\,lim}"],varliminf',28,'{\\\\underline','{\\\\rm lim}}"],','varlimsup',28,'{\\\\overline',48,'varinjlim',28,'{\\\\underrightarrow','{\\\\rm lim\\\\Rule{-1pt}{0pt}{1pt}}\\\\Rule{0pt}{0pt}{.45em}}"],','varprojlim',28,'{\\\\underleftarrow',56,'DeclareMathOperator:"','HandleDeclareOp','",operatorname:"','HandleOperatorName','",genfrac:"Genfrac",frac:["Genfrac","","","",""],tfrac',':["Genfrac","","","",','1],dfrac',66,'0],binom',':["Genfrac","(",")","0em','",""],tbinom',70,'",1],dbinom',70,'",0],cfrac:"CFrac",shoveleft',':["HandleShove",a.ALIGN.','LEFT],shoveright',76,'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','*":["',80,'false,true',82,'])],','multline',':["','Multline",null,','true],"',89,84,91,'false],split:["',80,'false,false',',"rl",b([5/18])],gather:["',80,81,',"c"],"gather',84,80,86,',"c"],alignat:["','AlignAt",null,',81,'],"alignat',84,107,86,'],alignedat:["',107,98,'],aligned',':["Array",null,null,null',82,']),".5em","D"],gathered',117,',"c",null,".5em","D"],subarray',117,',null,b([0,0,0,0]),"0.1em","S",1],smallmatrix',117,',"c",b([1/3]),".2em","S",1]},delimiter:{"\\\\lvert":["2223",{','texClass:a.TEXCLASS.','OPEN}],"\\\\','rvert":["2223",{',126,'CLOSE}],"\\\\lVert":["2225",{',126,127,'rVert":["2225",{',126,'CLOSE}]}});f.Parse.Augment({HandleTag:',11,'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 "+',143,'notag+" environment")}if(',143,'tag','){f.Error("','Multiple "+h)}',143,'tag=a.mtd','.apply(a,this.','InternalMath(g))},HandleNoTag:',11,'g){if(',143,'tag){delete ',143,'tag}},',62,':',11,137,'="";var i',138,139,'i=="*"){g="\\\\limits";i',138,'h))}if(i.charAt(0)=="\\\\"){i=i.substr(1)}var j',141,'(h);j=j','.replace(/\\*/g,"\\\\text{*}").replace(/-/g,"\\\\text{-}");',9,'.macros[i]=["Macro","\\\\mathop{\\\\rm "+j+"}"+g]},',64,':',11,137,'="\\\\nolimits";var i',138,139,'i=="*"){g="\\\\limits";i',138,'h))}i=i',175,'this.string="\\\\mathop{\\\\rm "+i+"}"+g','+" "+this.string.slice(this.i);this.i=0},','HandleShove:',11,'h,g){var i=this.stack.Top();if(i.type!=="',89,'"||i.data','.length',145,'must come at the beginning of the line")}i.data.shove=g},CFrac:',11,'j){var g=this.trimSpaces(','this.GetBrackets(','j)),i',141,'(j),k',141,'(j);var h=a.mfrac(','f.Parse("\\\\strut\\\\textstyle{"+','i+"}",','this.stack.env).mml','(),',207,'k+"}",',209,'());g=({l:a.ALIGN.LEFT,r:a.ALIGN.RIGHT,"":""})[g];if(g==null',151,'Illegal alignment specified in "+j)}if(g){h.numalign=h.denomalign=g}','this.Push(','h)},Genfrac:',11,'h,j,o,l,g){if(j==null){j','=this.GetDelimiterArg(h)}else{','j=','this.convertDelimiter(','j)}if(o==null){o',221,'o=',223,'o)}if(l==null){l',141,'(h)}if(g==null){g',138,'h))}var k','=this.ParseArg(','h);var n',233,'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',151,'Bad math style for "+h)}i=a.mstyle(i);if(m==="D"){i.',38,'=true',';i.scriptlevel=','0}else{i.',38,'=false',241,'g-1}}',217,'i)},Multline:',11,'h,g){',217,'h);',13,'d.',89,'().','With({arraydef:{displaystyle:true,rowspacing:".5em",','width:f.config.MultLineWidth,columnwidth:"100%",','side:f.config.TagSide,minlabelspacing:f.config.TagIndent','}})},AMSarray:',11,'i,h,g,k,j){',217,'i);k=k.replace(/[^clr]/g,"").split("").join(" ");k=k.replace(/l/g,"left").replace(/r/g,"right").replace(/c/g,"center");',13,'d.AMSarray','(i.name,h,g,this.stack).',257,'columnalign',':k,columnspacing:(j||"1em"),rowspacing:"3pt",',259,'}})},AlignAt:',11,'i,h,g){var j',141,'("\\\\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){',13,'this.AMSarray(i,h,g,align,spacing)}',13,'this.Array(i,null,null,align,spacing,".5em","D")},MultiIntegral:',11,'g,k){var j=this.GetNext();if(j==="\\\\"){var h=this.i;j',141,'(g);this.i=h;if(j==="\\\\limits"){if(g==="\\\\idotsint"){k="\\\\!\\\\!\\\\mathop{\\\\,\\\\,"+k+"}"}else{k="\\\\!\\\\!\\\\!\\\\mathop{\\\\,\\\\,\\\\,"+k+"}"}}}this.string=k',190,'xArrow:',11,'i,m,k,g){var j={width:"+"+(k+g)+"mu",lspace:k+"mu"};var n=',201,'i),o',233,'i);var p=a.mo(a.chars(String.fromCharCode(m))).With({stretchy:true,',126,'REL});var h=a.munderover(p);h.SetData(h.over,a.mpadded(o',').With(j).With({voffset',':".15em"}));if(n){n=f.Parse(n,',209,'();h.SetData(h.under,a.mpadded(n',295,':"-.24em"}))}',217,'h)},GetDelimiterArg:',11,'g){var h',138,'g));if(h==""){',13,'null}if(!c.delimiter[h]){f.Error("Missing or unrecognized delimiter for "+g)}',13,223,'h)}});d.',89,'=d.array.Subclass({type:"',89,'",EndEntry:',3,'g=a.mtd',155,'data);if(','this.data.shove','){g.',269,'=',320,'}this.row.push(g);this.data=[]},EndRow:function(){if(this.row',196,'!=1',151,89,' rows must have exactly one column")}','this.table','.push(this.row);','this.row=[]},EndTable:function(){this.SUPER(arguments).EndTable.call(this);','if(',331,196,'){var h=',331,196,'-1,j;if(!',331,'[0','][0].columnalign','){',331,'[0',343,'=a.ALIGN.','LEFT}if(!',331,'[h',343,'){',331,'[h',343,348,'RIGHT}var g=a.mtr;if(','this.global.tag','){',331,'[0]=[',359,'].concat(',331,'[0]);delete ',359,';g=','a.mlabeledtr','}',331,'[0]=g',155,'table[0]);for(j=1,h=',331,196,';j<h;j++){',331,'[j]=a.mtr',155,'table[j])}}}});',266,313,'AMSarray",Init:',11,'j,i,h,g){','this.SUPER(arguments).','Init.apply(this);this.numbered=i;','this.save_notag','=g','.global.notag',';g',391,'=(h?null:j)},EndRow:',3,'g=a.mtr;if(',359,'){this.row=[',359,'].concat(this.row);g=',369,';delete ',359,'}',331,'.push(g',155,'row));',333,'this',391,'=',389,'}});d.start.Augment({oldCheckItem:d.start.prototype.checkItem,checkItem:',11,'h){if(h.type==="stop"){var g=this.mmlData();if(',359,'){var j=[',359,',a.mtd(g)];delete ',359,';var i={',259,',',269,':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{',427,'RIGHT',429,'="fit "+',431,';',433,'[2]=a.mtd()}}}g=a.mtable(',369,'.apply(a,j)).With(i)}',13,'d.mml(g)}',13,387,'checkItem.call(this,h)}});',0,1,'Startup.signal.Post("TeX AMSmath Ready")});',0,'Ajax.loadComplete("[MathJax]/extensions/TeX/AMSmath.js");']
]);