20 lines
30 KiB
JavaScript
20 lines
30 KiB
JavaScript
|
/*
|
||
|
* ../SourceForge/trunk/mathjax/jax/input/TeX/jax.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([
|
||
|
['(','function','(d){var c=true,f=false,i,h=String.fromCharCode(160);var e','=MathJax.Object.Subclass({','Init',':function(k){','this.global','={};','this.data','=[b.','start','().With({global:',6,'})];if(k){',8,'[0].env','=k}','this.env','=',8,15,'},','Push',':function(){','var l,k,n,o;for(','l=0,k=arguments.length;l<k;l++){','n=','arguments[l','];if(n',' instanceof ','i.mbase){n=b.mml(n)}n.global=',6,';o=(',8,'.length','?this.Top().','checkItem','(n):c);if(o',29,'Array','){this.Pop();this.Push','.apply(this',',','o)}else{if(o',29,'b',40,'(',43,'){',8,'.push','(n);if(n.env){','for(var ','p',' in this.env){if(this.env.hasOwnProperty(','p)){n.env[p]=',17,'[p]}}',17,'=n.env}else{n.env=',17,'}}}}}},Pop',23,'var k=',8,'.pop();if(!k.isOpen){delete k.env}',17,'=(',8,34,35,'env:{});','return ','k},Top',5,'if(k==null){k=','1}if(',8,34,'<k){',73,'null}',73,8,'[',8,34,'-k]},Prev',5,'var l=this.Top();if(k){',73,'l.data[l.data',34,'-1]}else{',73,'l.Pop()}},toString',23,'return"stack[\\n "+',8,'.join("\\n ")+"\\n]"}});var b=e.Item',3,'type:"base",closeError:"Extra',' close brace',' or missing',' open brace','",rightError:"Missing \\\\left or extra',' \\\\right",',4,23,'if(','this.isOpen){',17,'={}}',8,'=[];this.',22,41,',arguments)},',22,23,8,51,'.apply(',8,118,'Pop',23,73,8,'.pop()},mmlData:',1,'(k,l){',76,'c}if(',8,34,'===1&&!l){',73,8,'[0]}',73,'i.mrow',123,'i,',8,').With((k?{inferred:c}:{}))},','checkItem:function(','k){if(k.type==="','over"&&',111,'k.num=','this.mmlData','(f);',8,'=[]}if(k','.type==="','cell"&&',111,'d.Error("Misplaced "+k.name)}if(k.isClose&&','this[k.type+"Error','"]){d.Error(',160,'"])}if(!k','.isNotStack){',73,'c}this.',22,'(k.data[0]);',73,'f},With',5,53,'l in k){if(k.hasOwnProperty(l)){this[l]=k[l]}}',73,'this},toString',23,73,'this.type+"["+',8,'.join("; ")+"]"}});b.',10,'=b.Subclass({type:"',10,'",isOpen:c,',147,148,'stop"){','return b.mml(',152,'())}','return this.SUPER(arguments).checkItem.call(this,','k)}});b.','stop',182,193,'",isClose:c});b.','open',182,'open',184,'stopError:"Extra',105,104,103,'",',147,'l){','if(l.type==="','close"){',64,152,'();',188,'i.TeXAtom(','k))}',191,'l)}});b.','close',182,218,196,'subsup',182,222,'",stopError:"Missing superscript or subscript argument",',147,'l){var k=["","subscript","superscript"][this.','position','];',208,'open"||l',156,'left"){',73,'c}',208,'mml"){',8,'[0].SetData(this.',228,',l.data[0]);',188,8,'[0])}if(','this.SUPER(arguments).',36,'.call(this,l)){','d.Error("Missing',105,' for "+k)}},Pop:',1,'(){}});b.over',182,'over",isClose:c,name:"\\\\over",',147,'m,k){if(m',156,'over"){d.Error("Ambiguous use of "+m.name)}if(m.isClose){var l=i.mfrac(this.num,',152,'(f));if(this.thickness!=null){l.linethickness=this.thickness}','if(this.open||this.close){','l.texClass=i.TEXCLASS.INNER;l.texWithDelims=c;l=i.mfenced(l',').With({open:this.open,close:this.close})}','return[b.mml(','l),m]}',191,'m)},toString',23,'return"over["+this.num+" / "+',8,180,'left',182,'left',184,'delim:"(",',201,' \\\\left',104,107,147,'l){',208,'right"){var ','k=i.mfenced(',8,34,'===1?',8,'[0]:i.mrow',123,'i,',8,'));',188,'k.With({open:this.delim,',218,':l.delim}))}',191,217,'right',182,'right",isClose:c,delim:")"});b.begin',182,'begin',184,147,148,'end"){if(k.name!==this.name){d.Error("\\\\begin{"+this.name+"} ended with \\\\end{"+k.name+"}")}if(!this.end){',188,152,'())}',73,'this.parse[this.end].call(this.parse,this,',8,')}if(k',156,187,248,' \\\\end{"+this.name+"}")}',191,192,'end',182,'end',196,'style',182,'style",',147,'l){if(!l.isClose){',191,'l)}',64,'i.mstyle',123,'i,',8,').With(this.','styles);',264,'k),l]}});b.',228,182,228,'",',147,'l){if(l.isClose){',248,' box for "+this.name)}if(l',164,64,'l.mmlData();switch(this.move){case"vertical":k=i.mpadded(k).With({height:this.dh,depth:this.dd,voffset:this.dh});',264,'k)];case"horizontal":',264,'this.left),l,b.mml(this.right)]}}',191,217,'array',182,'array',184,'arraydef:{},',4,23,'this.table','=[];','this.row','=[];',17,7,245,4,41,118,147,348,'if(l.isEntry','){this.EndEntry();this.','clearEnv();return f}','if(l.isCR',380,'EndRow();th
|
||
|
['ull,null,null,"c"],pmatrix',':["Array",null',',"(",")","c"],bmatrix',1,',"[","]","c"],Bmatrix',1,',"\\\\{","\\\\}","c"],vmatrix',1,',"\\\\vert","\\\\vert","c"],Vmatrix',1,',"\\\\Vert","\\\\Vert","c"],cases',1,',"\\\\{",".","ll",null,".1em"],','eqnarray',':["','Array",null,null,null,"rcl",i.LENGTH.THICKMATHSPACE,".5em","D','"],"',13,'*":["',15,'"],equation:[','null,"Equation',16,'equation*":[',21,'"],align:["','ExtensionEnv",null,"AMSmath',16,'align',18,26,'"],aligned:["',26,'"],','multline',':["',26,16,34,18,26,'"],split:["',26,'"],gather:["',26,16,'gather',18,26,'"],gathered:["',26,'"],alignat:["',26,16,'alignat',18,26,'"],alignedat:["',26,'"]},p_height:1.2/0.85});if(','this.config.Macros','){','var k=',60,';for(var l in k){if(k','.hasOwnProperty(','l)){if(typeof(k[l])==="','string"){','g.macros[l]=["Macro','",k[l]]}else{',68,'"].concat(k[l])}}}}};var a=MathJax.Object.Subclass({Init',':function(','l,m){','this.string=','l;this.i=0;var k;if(m){k={};for(var n in m){if(m',65,'n)){k[n]=m[n]}}}this.stack=d.Stack(k);this.Parse();','this.Push(','b.stop())},Parse',':function(){','var k;','while(this.i<this.string.length','){k=','this.string.charAt(this.i','++);if(g.special[k]){this[g.special[k]](k)}','else{if(','g.letter','.test(k)){this.','Variable','(k)}',86,'g.digit',88,'Number(k)}','else{this.','Other(k)}}}}},Push',80,'this.stack.','Push.apply(this','.stack,arguments)},mml',80,'if(',98,'Top().type!=="mml"){','return ','null}',105,98,'Top().data[0]},mmlToken',72,'k','){return ','k},ControlSequence',72,'q){',62,'this.GetCS','(),p,n;if(','g.macros[k',']){','var m=',119,'];if(!(m',' instanceof Array',')){m=[m]}','var l=','m[0];if(!(l instanceof Function)){l=this[l]}l.apply(this,["\\\\"+k].concat(m.slice(1)))}',86,'g.mathchar0mi[k',']){p=',129,'];n={','mathvariant:i.VARIANT.','ITALIC};if(p',124,'){n=p[1];p=p[0]}',78,'this.mmlToken(','i.mi','(i.entity("#x"+p)).With(n)))}else{if(g.','mathchar0mo[k',']){p=g.',141,132,'stretchy:','f};if(p',124,'){n=p[1];n.stretchy=f;p=p[0]}',78,138,'i.mo',140,'mathchar7[k',142,153,132,133,'NORMAL','};if(p',124,136,'if(','this.stack.env','.font){','n.','mathvariant','=',163,'.font}',78,138,'i.mi',140,'delimiter["\\\\"+k',']!=null){var o=g.',174,'];n={};if(o',124,'){n=o[1];o=o[0]}if(o.length===4){o=i.entity("#x"+o)}else{o=i.chars(o)}',78,138,'i.mo(o).With({','fence:f,',145,'f}).With(n)))}',95,'csUndefined','("\\\\"+k)}}}}}},',187,72,'k){','d.Error("','Undefined control sequence "+k)},',89,72,'l){var ','k={};if(',163,164,'k.',166,'=',163,169,78,138,'i.mi(i.chars(l)).With(k)))},Number',72,'m){var k,l=','this.string.slice(','this.i-1).match(g.number);if(l){k=i.mn(l[0].replace(/[{}]/g,""));this.i+=l[0].length-1}else{k=','i.mo(i.chars(','m))}if(',163,164,'k.',166,'=',163,169,78,138,'k))},Open',72,'k){',78,'b.open())},Close',72,'k){',78,'b.close())},Tilde',72,'k){',78,'i.mtext(i.chars(','h)))},Space',72,'k){},Superscript',72,'m){var k,l=this.stack.Prev();if(!l){l=i.mi("")}if(l.isEmbellishedWrapper){l=l.data[0].data[0]}if(l.type==="msubsup"){if(l.data[l.','sup]){if(!l.data[l.sup].isPrime){',192,'Double exponent',': use braces to clarify")}','l=i.msubsup(l,null,null',')}k=l.sup','}else{if(l.movesupsub){if(l.type!=="munderover"||l.data[l.','over',']){l=i.munderover(l,null,null).With({movesupsub:c})}k=l.','over}else{',245,');k=l.sup}}',78,'b.subsup(l).With({position:k}))},','Subscript',72,240,'sub]){',192,'Double subscripts',244,'k=l.sub',247,'under',249,'under}else{',245,');k=l.sub}}',78,254,'PRIME:','String.fromCharCode(','8242),SMARTQUOTE:',272,'8217),Prime',72,'m){',126,98,'Prev();if(!l){l=i.mi()}if(l.type==="msubsup"&&l.data[l.sup]){',192,'Prime causes double exponent',244,'var k="";this.i--;do{k+=this.PRIME;this.i++,m=','this.GetNext','()}while(m==="\'"||m===this.SMARTQUOTE);k=',138,212,'k)).With({','isPrime:c,variantForm:d.isSTIX}));',78,'i.msubsup(l,null,k))},Comment',72,'k){',82,'&&',84,')!="\\n"){this.i++}},Hash',72,'k){',192,'You can\'t use \'','macro parameter ','character #\' in math mode")},Other',72,'m){var l={',145,'false},k;if(',163,164,'l.',166,'=',163,169,'if(g.remap[m]){m=g.remap[m];if(
|
||
|
]);
|
||
|
|