jax.js 47 KB

123456789101112131415161718192021222324252627
  1. /* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */
  2. /* vim: set ts=2 et sw=2 tw=80: */
  3. /*************************************************************
  4. *
  5. * MathJax/jax/input/TeX/jax.js
  6. *
  7. * Implements the TeX InputJax that reads mathematics in
  8. * TeX and LaTeX format and converts it to the MML ElementJax
  9. * internal format.
  10. *
  11. * ---------------------------------------------------------------------
  12. *
  13. * Copyright (c) 2009-2013 The MathJax Consortium
  14. *
  15. * Licensed under the Apache License, Version 2.0 (the "License");
  16. * you may not use this file except in compliance with the License.
  17. * You may obtain a copy of the License at
  18. *
  19. * http://www.apache.org/licenses/LICENSE-2.0
  20. *
  21. * Unless required by applicable law or agreed to in writing, software
  22. * distributed under the License is distributed on an "AS IS" BASIS,
  23. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  24. * See the License for the specific language governing permissions and
  25. * limitations under the License.
  26. */(function(g,p,r){var c,t=function(a){return MathJax.Localization._.apply(MathJax.Localization,[["TeX",a]].concat([].slice.call(arguments,1)))},u=MathJax.Object.Subclass({Init:function(a,b){this.global={isInner:b};this.data=[f.start(this.global)];a&&(this.data[0].env=a);this.env=this.data[0].env},Push:function(){var a,b,e,d;a=0;for(b=arguments.length;a<b;a++)if(e=arguments[a],e instanceof c.mbase&&(e=f.mml(e)),e.global=this.global,d=this.data.length?this.Top().checkItem(e):!0,d instanceof Array)this.Pop(),this.Push.apply(this,d);else if(d instanceof f)this.Pop(),this.Push(d);else if(d)if(this.data.push(e),e.env){for(var k in this.env)this.env.hasOwnProperty(k)&&(e.env[k]=this.env[k]);this.env=e.env}else e.env=this.env},Pop:function(){var a=this.data.pop();a.isOpen||delete a.env;this.env=this.data.length?this.Top().env:{};return a},Top:function(a){null==a&&(a=1);return this.data.length<a?null:this.data[this.data.length-a]},Prev:function(a){var b=this.Top();return a?b.data[b.data.length-1]:b.Pop()},toString:function(){return"stack[\n "+this.data.join("\n ")+"\n]"}}),f=u.Item=MathJax.Object.Subclass({type:"base",endError:["ExtraOpenMissingClose","Extra open brace or missing close brace"],closeError:["ExtraCloseMissingOpen","Extra close brace or missing open brace"],rightError:["MissingLeftExtraRight","Missing \\left or extra \\right"],Init:function(){this.isOpen&&(this.env={});this.data=[];this.Push.apply(this,arguments)},Push:function(){this.data.push.apply(this.data,arguments)},Pop:function(){return this.data.pop()},mmlData:function(a,b){null==a&&(a=!0);return 1!==this.data.length||b?c.mrow.apply(c,this.data).With(a?{inferred:!0}:{}):this.data[0]},checkItem:function(a){"over"===a.type&&this.isOpen&&(a.num=this.mmlData(!1),this.data=[]);if("cell"===a.type&&this.isOpen){if(a.linebreak)return!1;g.Error(["Misplaced","Misplaced %1",a.name])}a.isClose&&this[a.type+"Error"]&&g.Error(this[a.type+"Error"]);if(!a.isNotStack)return!0;this.Push(a.data[0]);return!1},With:function(a){for(var b in a)a.hasOwnProperty(b)&&(this[b]=a[b]);return this},toString:function(){return this.type+"["+this.data.join("; ")+"]"}});f.start=f.Subclass({type:"start",isOpen:!0,Init:function(a){this.SUPER(arguments).Init.call(this);this.global=a},checkItem:function(a){return"stop"===a.type?f.mml(this.mmlData()):this.SUPER(arguments).checkItem.call(this,a)}});f.stop=f.Subclass({type:"stop",isClose:!0});f.open=f.Subclass({type:"open",isOpen:!0,stopError:["ExtraOpenMissingClose","Extra open brace or missing close brace"],checkItem:function(a){if("close"===a.type){var b=this.mmlData();return f.mml(c.TeXAtom(b))}return this.SUPER(arguments).checkItem.call(this,a)}});f.close=f.Subclass({type:"close",isClose:!0});f.prime=f.Subclass({type:"prime",checkItem:function(a){if("msubsup"!==this.data[0].type)return[c.msup(this.data[0],this.data[1]),a];this.data[0].SetData(this.data[0].sup,this.data[1]);return[this.data[0],a]}});f.subsup=f.Subclass({type:"subsup",stopError:["MissingScript","Missing superscript or subscript argument"],supError:["MissingOpenForSup","Missing open brace for superscript"],subError:["MissingOpenForSup","Missing open brace for subscript"],checkItem:function(a){if("open"===a.type||"left"===a.type)return!0;if("mml"===a.type)return this.primes&&(2!==this.position?this.data[0].SetData(2,this.primes):a.data[0]=c.mrow(this.primes.With({variantForm:!0}),a.data[0])),this.data[0].SetData(this.position,a.data[0]),f.mml(this.data[0]);this.SUPER(arguments).checkItem.call(this,a)&&g.Error(this[["","subError","supError"][this.position]])},Pop:function(){}});f.over=f.Subclass({type:"over",isClose:!0,name:"\\over",checkItem:function(a,b){"over"===a.type&&g.Error(["AmbiguousUseOf","Ambiguous use of %1",a.name]);if(a.isClose){var e=c.mfrac(this.num,this.mmlData(!1));null!=this.thickness&&(e.linethickness=this.thickness);if(this.open||this.close)e.texClass=c.TEXCLASS.INNER,e.texWithDelims=!0,e=g.fenced(this.open,e,this.close);return[f.mml(e),a]}return this.SUPER(arguments).checkItem.call(this,a)},toString:function(){return"over["+this.num+" / "+this.data.join("; ")+"]"}});f.left=f.Subclass({type:"left",isOpen:!0,delim:"(",stopError:["ExtraLeftMissingRight","Extra \\left or missing \\right"],checkItem:function(a){return"right"===a.type?f.mml(g.fenced(this.delim,this.mmlData(),a.delim)):this.SUPER(arguments).checkItem.call(this,a)}});f.right=f.Subclass({type:"right",isClose:!0,delim:")"});f.begin=f.Subclass({type:"begin",isOpen:!0,checkItem:function(a){if("end"===a.type)return a.name!==this.name&&g.Error(["EnvBadEnd","\\begin{%1} ended with \\end{%2}",this.name,a.name]),this.end?this.parse[this.end].call(this.parse,this,this.data):f.mml(this.mmlData());"stop"===a.type&&g.Error(["EnvMissingEnd","Missing \\end{%1}",this.name]);return this.SUPER(arguments).checkItem.call(this,a)}});f.end=f.Subclass({type:"end",isClose:!0});f.style=f.Subclass({type:"style",checkItem:function(a){if(!a.isClose)return this.SUPER(arguments).checkItem.call(this,a);var b=c.mstyle.apply(c,this.data).With(this.styles);return[f.mml(b),a]}});f.position=f.Subclass({type:"position",checkItem:function(a){a.isClose&&g.Error(["MissingBoxFor","Missing box for %1",name]);if(a.isNotStack){var b=a.mmlData();switch(this.move){case "vertical":return b=c.mpadded(b).With({height:this.dh,depth:this.dd,voffset:this.dh}),[f.mml(b)];case "horizontal":return[f.mml(this.left),a,f.mml(this.right)]}}return this.SUPER(arguments).checkItem.call(this,a)}});f.array=f.Subclass({type:"array",isOpen:!0,arraydef:{},Init:function(){this.table=[];this.row=[];this.env={};this.frame=[];this.SUPER(arguments).Init.apply(this,arguments)},checkItem:function(a){if(a.isClose&&"over"!==a.type){if(a.isEntry)return this.EndEntry(),this.clearEnv(),!1;if(a.isCR)return this.EndEntry(),this.EndRow(),this.clearEnv(),!1;this.EndTable();this.clearEnv();var b=c.mtable.apply(c,this.table).With(this.arraydef);4===this.frame.length?b.frame=this.frame.dashed?"dashed":"solid":this.frame.length&&(b.hasFrame=!0,this.arraydef.rowlines&&(this.arraydef.rowlines=this.arraydef.rowlines.replace(/none( none)+$/,"none")),b=c.menclose(b).With({notation:this.frame.join(" "),isFrame:!0}),"none"!=(this.arraydef.columnlines||"none")||"none"!=(this.arraydef.rowlines||"none"))&&(b.padding=0);if(this.open||this.close)b=g.fenced(this.open,b,this.close);b=f.mml(b);if(this.requireClose){if("close"===a.type)return b;g.Error(["MissingCloseBrace","Missing close brace"])}return[b,a]}return this.SUPER(arguments).checkItem.call(this,a)},EndEntry:function(){this.row.push(c.mtd.apply(c,this.data));this.data=[]},EndRow:function(){this.table.push(c.mtr.apply(c,this.row));this.row=[]},EndTable:function(){if(this.data.length||this.row.length)this.EndEntry(),this.EndRow();this.checkLines()},checkLines:function(){if(this.arraydef.rowlines){var a=this.arraydef.rowlines.split(/ /);a.length===this.table.length?(this.frame.push("bottom"),a.pop(),this.arraydef.rowlines=a.join(" ")):a.length<this.table.length-1&&(this.arraydef.rowlines+=" none")}if(this.rowspacing){for(a=this.arraydef.rowspacing.split(/ /);a.length<this.table.length;)a.push(this.rowspacing+"em");this.arraydef.rowspacing=a.join(" ")}},clearEnv:function(){for(var a in this.env)this.env.hasOwnProperty(a)&&delete this.env[a]}});f.cell=f.Subclass({type:"cell",isClose:!0});f.mml=f.Subclass({type:"mml",isNotStack:!0,Add:function(){this.data.push.apply(this.data,arguments);return this}});f.fn=f.Subclass({type:"fn",checkItem:function(a){if(this.data[0]){if("mml"!==a.type||!a.data[0]||a.data[0].isa(c.mspace))return[this.data[0],a];var b=a.data[0];b.isEmbellished()&&(b=b.CoreMO());return[0,0,1,1,0,1,1,0,0,0][b.Get("texClass")]?[this.data[0],a]:[this.data[0],c.mo(c.entity("#x2061")).With({texClass:c.TEXCLASS.NONE}),a]}return this.SUPER(arguments).checkItem.apply(this,arguments)}});f.not=f.Subclass({type:"not",checkItem:function(a){var b,e;if("open"===a.type||"left"===a.type)return!0;if("mml"===a.type&&a.data[0].type.match(/^(mo|mi|mtext)$/)&&(b=a.data[0],e=b.data.join(""),1===e.length&&!b.movesupsub))return(e=f.not.remap[e.charCodeAt(0)])?b.SetData(0,c.chars(String.fromCharCode(e))):b.Append(c.chars("\u0338")),a;b=c.mpadded(c.mtext("\u29f8")).With({width:0});b=c.TeXAtom(b).With({texClass:c.TEXCLASS.REL});return[b,a]}});f.not.remap={8592:8602,8594:8603,8596:8622,8656:8653,8658:8655,8660:8654,8712:8713,8715:8716,8739:8740,8741:8742,8764:8769,126:8769,8771:8772,8773:8775,8776:8777,8781:8813,61:8800,8801:8802,60:8814,62:8815,8804:8816,8805:8817,8818:8820,8819:8821,8822:8824,8823:8825,8826:8832,8827:8833,8834:8836,8835:8837,8838:8840,8839:8841,8866:8876,8872:8877,8873:8878,8875:8879,8828:8928,8829:8929,8849:8930,8850:8931,8882:8938,8883:8939,8884:8940,8885:8941,8707:8708};f.dots=f.Subclass({type:"dots",checkItem:function(a){if("open"===a.type||"left"===a.type)return!0;var b=this.ldots;if("mml"===a.type&&a.data[0].isEmbellished()){var e=a.data[0].CoreMO().Get("texClass");if(e===c.TEXCLASS.BIN||e===c.TEXCLASS.REL)b=this.cdots}return[b,a]}});var h={Add:function(a,b,c){b||(b=this);for(var d in a)a.hasOwnProperty(d)&&("object"!==typeof a[d]||a[d]instanceof Array||"object"!==typeof b[d]&&"function"!==typeof b[d]?b[d]&&b[d].isUser&&c||(b[d]=a[d]):this.Add(a[d],b[d],a[d],c));return b}},v=MathJax.Object.Subclass({Init:function(a,b){this.string=a;this.macroCount=this.i=0;var c;if(b){c={};for(var d in b)b.hasOwnProperty(d)&&(c[d]=b[d])}this.stack=g.Stack(c,!!b);this.Parse();this.Push(f.stop())},Parse:function(){for(var a,b;this.i<this.string.length;)if(a=this.string.charAt(this.i++),b=a.charCodeAt(0),55296<=b&&56320>b&&(a+=this.string.charAt(this.i++)),h.special[a])this[h.special[a]](a);else h.letter.test(a)?this.Variable(a):h.digit.test(a)?this.Number(a):this.Other(a)},Push:function(){this.stack.Push.apply(this.stack,arguments)},mml:function(){return"mml"!==this.stack.Top().type?null:this.stack.Top().data[0]},mmlToken:function(a){return a},ControlSequence:function(a){var b=this.GetCS(),c=this.csFindMacro(b);if(c){c instanceof Array||(c=[c]);var d=c[0];d instanceof Function||(d=this[d]);d.apply(this,[a+b].concat(c.slice(1)))}else h.mathchar0mi[b]?this.csMathchar0mi(b,h.mathchar0mi[b]):h.mathchar0mo[b]?this.csMathchar0mo(b,h.mathchar0mo[b]):h.mathchar7[b]?this.csMathchar7(b,h.mathchar7[b]):null!=h.delimiter["\\"+b]?this.csDelimiter(b,h.delimiter["\\"+b]):this.csUndefined(a+b)},csFindMacro:function(a){return h.macros[a]},csMathchar0mi:function(a,b){var e={mathvariant:c.VARIANT.ITALIC};b instanceof Array&&(e=b[1],b=b[0]);this.Push(this.mmlToken(c.mi(c.entity("#x"+b)).With(e)))},csMathchar0mo:function(a,b){var e={stretchy:!1};b instanceof Array&&(e=b[1],e.stretchy=!1,b=b[0]);this.Push(this.mmlToken(c.mo(c.entity("#x"+b)).With(e)))},csMathchar7:function(a,b){var e={mathvariant:c.VARIANT.NORMAL};b instanceof Array&&(e=b[1],b=b[0]);this.stack.env.font&&(e.mathvariant=this.stack.env.font);this.Push(this.mmlToken(c.mi(c.entity("#x"+b)).With(e)))},csDelimiter:function(a,b){var e={};b instanceof Array&&(e=b[1],b=b[0]);b=4===b.length?c.entity("#x"+b):c.chars(b);this.Push(this.mmlToken(c.mo(b).With({fence:!1,stretchy:!1}).With(e)))},csUndefined:function(a){g.Error(["UndefinedControlSequence","Undefined control sequence %1",a])},Variable:function(a){var b={};this.stack.env.font&&(b.mathvariant=this.stack.env.font);this.Push(this.mmlToken(c.mi(c.chars(a)).With(b)))},Number:function(a){var b=this.string.slice(this.i-1).match(h.number);b?(a=c.mn(b[0].replace(/[{}]/g,"")),this.i+=b[0].length-1):a=c.mo(c.chars(a));this.stack.env.font&&(a.mathvariant=this.stack.env.font);this.Push(this.mmlToken(a))},Open:function(a){this.Push(f.open())},Close:function(a){this.Push(f.close())},Tilde:function(a){this.Push(c.mtext(c.chars("\u00a0")))},Space:function(a){},Superscript:function(a){this.GetNext().match(/\d/)&&(this.string=this.string.substr(0,this.i+1)+" "+this.string.substr(this.i+1));var b,e;b=this.stack.Top();"prime"===b.type?(a=b.data[0],e=b.data[1],this.stack.Pop()):(a=this.stack.Prev())||(a=c.mi(""));a.isEmbellishedWrapper&&(a=a.data[0].data[0]);if("msubsup"===a.type)a.data[a.sup]&&g.Error(["DoubleExponent","Double exponent: use braces to clarify"]),b=a.sup;else if(a.movesupsub){if("munderover"!==a.type||a.data[a.over])a.movablelimits&&a.isa(c.mi)&&(a=this.mi2mo(a)),a=c.munderover(a,null,null).With({movesupsub:!0});b=a.over}else a=c.msubsup(a,null,null),b=a.sup;this.Push(f.subsup(a).With({position:b,primes:e}))},Subscript:function(a){this.GetNext().match(/\d/)&&(this.string=this.string.substr(0,this.i+1)+" "+this.string.substr(this.i+1));var b,e;b=this.stack.Top();"prime"===b.type?(a=b.data[0],e=b.data[1],this.stack.Pop()):(a=this.stack.Prev())||(a=c.mi(""));a.isEmbellishedWrapper&&(a=a.data[0].data[0]);if("msubsup"===a.type)a.data[a.sub]&&g.Error(["DoubleSubscripts","Double subscripts: use braces to clarify"]),b=a.sub;else if(a.movesupsub){if("munderover"!==a.type||a.data[a.under])a.movablelimits&&a.isa(c.mi)&&(a=this.mi2mo(a)),a=c.munderover(a,null,null).With({movesupsub:!0});b=a.under}else a=c.msubsup(a,null,null),b=a.sub;this.Push(f.subsup(a).With({position:b,primes:e}))},PRIME:"\u2032",SMARTQUOTE:"\u2019",Prime:function(a){var b=this.stack.Prev();b||(b=c.mi());"msubsup"===b.type&&b.data[b.sup]&&g.Error(["DoubleExponentPrime","Prime causes double exponent: use braces to clarify"]);var e="";this.i--;do e+=this.PRIME,this.i++,a=this.GetNext();while("'"===a||a===this.SMARTQUOTE);e=["","\u2032","\u2033","\u2034","\u2057"][e.length]||e;this.Push(f.prime(b,this.mmlToken(c.mo(e))))},mi2mo:function(a){var b=c.mo();b.Append.apply(b,a.data);for(var e in b.defaults)b.defaults.hasOwnProperty(e)&&null!=a[e]&&(b[e]=a[e]);for(e in c.copyAttributes)c.copyAttributes.hasOwnProperty(e)&&null!=a[e]&&(b[e]=a[e]);return b},Comment:function(a){for(;this.i<this.string.length&&"\n"!=this.string.charAt(this.i);)this.i++},Hash:function(a){g.Error(["CantUseHash1","You can't use 'macro parameter character #' in math mode"])},Other:function(a){var b={stretchy:!1};this.stack.env.font&&(b.mathvariant=this.stack.env.font);h.remap[a]?(a=h.remap[a],a instanceof Array&&(b=a[1],a=a[0]),a=c.mo(c.entity("#x"+a)).With(b)):a=c.mo(a).With(b);""==a.autoDefault("texClass",!0)&&(a=c.TeXAtom(a));this.Push(this.mmlToken(a))},SetFont:function(a,b){this.stack.env.font=b},SetStyle:function(a,b,c,d){this.stack.env.style=b;this.stack.env.level=d;this.Push(f.style().With({styles:{displaystyle:c,scriptlevel:d}}))},SetSize:function(a,b){this.stack.env.size=b;this.Push(f.style().With({styles:{mathsize:b+"em"}}))},Color:function(a){var b=this.GetArgument(a),e=this.stack.env.color;this.stack.env.color=b;a=this.ParseArg(a);e?this.stack.env.color:delete this.stack.env.color;this.Push(c.mstyle(a).With({mathcolor:b}))},Spacer:function(a,b){this.Push(c.mspace().With({width:b,mathsize:c.SIZE.NORMAL,scriptlevel:0}))},LeftRight:function(a){this.Push(f[a.substr(1)]().With({delim:this.GetDelimiter(a)}))},Middle:function(a){var b=this.GetDelimiter(a);"left"!==this.stack.Top().type&&g.Error(["MisplacedMiddle","%1 must be within \\left and \\right",a]);this.Push(c.mo(b).With({stretchy:!0}))},NamedFn:function(a,b){b||(b=a.substr(1));var e=c.mi(b).With({texClass:c.TEXCLASS.OP});this.Push(f.fn(this.mmlToken(e)))},NamedOp:function(a,b){b||(b=a.substr(1));b=b.replace(/&thinsp;/,"\u2006");var e=c.mo(b).With({movablelimits:!0,movesupsub:!0,form:c.FORM.PREFIX,texClass:c.TEXCLASS.OP});e.useMMLspacing&=~e.SPACE_ATTR.form;this.Push(this.mmlToken(e))},Limits:function(a,b){var e=this.stack.Prev("nopop");e&&e.texClass===c.TEXCLASS.OP||g.Error(["MisplacedLimits","%1 is allowed only on operators",a]);e.movesupsub=b?!0:!1;e.movablelimits=!1},Over:function(a,b,c){var d=f.over().With({name:a});b||c?(d.open=b,d.close=c):a.match(/withdelims$/)&&(d.open=this.GetDelimiter(a),d.close=this.GetDelimiter(a));if(a.match(/^\\above/))d.thickness=this.GetDimen(a);else if(a.match(/^\\atop/)||b||c)d.thickness=0;this.Push(d)},Frac:function(a){var b=this.ParseArg(a);a=this.ParseArg(a);this.Push(c.mfrac(b,a))},Sqrt:function(a){var b=this.GetBrackets(a);a=this.GetArgument(a);"\\frac"===a&&(a+="{"+this.GetArgument(a)+"}{"+this.GetArgument(a)+"}");a=g.Parse(a,this.stack.env).mml();a=b?c.mroot(a,this.parseRoot(b)):c.msqrt.apply(c,a.array());this.Push(a)},Root:function(a){var b=this.GetUpTo(a,"\\of");a=this.ParseArg(a);this.Push(c.mroot(a,this.parseRoot(b)))},parseRoot:function(a){var b=this.stack.env,e=b.inRoot;b.inRoot=!0;var d=g.Parse(a,b);a=d.mml();d=d.stack.global;if(d.leftRoot||d.upRoot)a=c.mpadded(a),d.leftRoot&&(a.width=d.leftRoot),d.upRoot&&(a.voffset=d.upRoot,a.height=d.upRoot);b.inRoot=e;return a},MoveRoot:function(a,b){this.stack.env.inRoot||g.Error(["MisplacedMoveRoot","%1 can appear only within a root",a]);this.stack.global[b]&&g.Error(["MultipleMoveRoot","Multiple use of %1",a]);var c=this.GetArgument(a);c.match(/-?[0-9]+/)||g.Error(["IntegerArg","The argument to %1 must be an integer",a]);c=c/15+"em";"-"!==c.substr(0,1)&&(c="+"+c);this.stack.global[b]=c},Accent:function(a,b,e){a=this.ParseArg(a);var d={accent:!0};this.stack.env.font&&(d.mathvariant=this.stack.env.font);b=this.mmlToken(c.mo(c.entity("#x"+b)).With(d));b.stretchy=e?!0:!1;this.Push(c.TeXAtom(c.munderover(a,null,b).With({accent:!0})))},UnderOver:function(a,b,e){var d={o:"over",u:"under"}[a.charAt(1)];a=this.ParseArg(a);a.Get("movablelimits")&&(a.movablelimits=!1);a=c.munderover(a,null,null);e&&(a.movesupsub=!0);a.data[a[d]]=this.mmlToken(c.mo(c.entity("#x"+b)).With({stretchy:!0,accent:"under"==d}));this.Push(a)},Overset:function(a){var b=this.ParseArg(a);a=this.ParseArg(a);this.Push(c.mover(a,b))},Underset:function(a){var b=this.ParseArg(a);a=this.ParseArg(a);this.Push(c.munder(a,b))},TeXAtom:function(a,b){var e={texClass:b};if(b==c.TEXCLASS.OP){e.movesupsub=e.movablelimits=!0;var d=this.GetArgument(a),k=d.match(/^\s*\\rm\s+([a-zA-Z0-9 ]+)$/);k?(e.mathvariant=c.VARIANT.NORMAL,e=f.fn(this.mmlToken(c.mi(k[1]).With(e)))):e=f.fn(c.TeXAtom(g.Parse(d,this.stack.env).mml()).With(e))}else e=c.TeXAtom(this.ParseArg(a)).With(e);this.Push(e)},MmlToken:function(a){var b=this.GetArgument(a),e=this.GetBrackets(a,"").replace(/^\s+/,"");a=this.GetArgument(a);var d={attrNames:[]},k;for(c[b]&&c[b].prototype.isToken||g.Error(["NotMathMLToken","%1 is not a token element",b]);""!==e;){(k=e.match(/^([a-z]+)\s*=\s*(\'[^']*'|"[^"]*"|[^ ]*)\s*/i))||g.Error("InvalidMathMLAttr","Invalid MathML attribute: %1",e);c[b].prototype.defaults[k[1]]||this.MmlTokenAllow[k[1]]||g.Error(["UnknownAttrForElement","%1 is not a recognized attribute for %2",k[1],b]);var f=this.MmlFilterAttribute(k[1],k[2].replace(/^(['"])(.*)\1$/,"$2"));f&&("true"===f.toLowerCase()?f=!0:"false"===f.toLowerCase()&&(f=!1),d[k[1]]=f,d.attrNames.push(k[1]));e=e.substr(k[0].length)}this.Push(this.mmlToken(c[b](a).With(d)))},MmlFilterAttribute:function(a,b){return b},MmlTokenAllow:{fontfamily:1,fontsize:1,fontweight:1,fontstyle:1,color:1,background:1,id:1,"class":1,href:1,style:1},Strut:function(a){this.Push(c.mpadded(c.mrow()).With({height:"8.6pt",depth:"3pt",width:0}))},Phantom:function(a,b,e){a=c.mphantom(this.ParseArg(a));if(b||e)a=c.mpadded(a),e&&(a.height=a.depth=0),b&&(a.width=0);this.Push(c.TeXAtom(a))},Smash:function(a){var b=this.trimSpaces(this.GetBrackets(a,""));a=c.mpadded(this.ParseArg(a));switch(b){case "b":a.depth=0;break;case "t":a.height=0;break;default:a.height=a.depth=0}this.Push(c.TeXAtom(a))},Lap:function(a){var b=c.mpadded(this.ParseArg(a)).With({width:0});"\\llap"===a&&(b.lspace="-1 width");this.Push(c.TeXAtom(b))},RaiseLower:function(a){var b=this.GetDimen(a),c=f.position().With({name:a,move:"vertical"});"-"===b.charAt(0)&&(b=b.slice(1),a={raise:"\\lower",lower:"\\raise"}[a.substr(1)]);"\\lower"===a?(c.dh="-"+b,c.dd="+"+b):(c.dh="+"+b,c.dd="-"+b);this.Push(c)},MoveLeftRight:function(a){var b=this.GetDimen(a),e="-"===b.charAt(0)?b.slice(1):"-"+b;if("\\moveleft"===a)var d=b,b=e,e=d;this.Push(f.position().With({name:a,move:"horizontal",left:c.mspace().With({width:b,mathsize:c.SIZE.NORMAL}),right:c.mspace().With({width:e,mathsize:c.SIZE.NORMAL})}))},Hskip:function(a){this.Push(c.mspace().With({width:this.GetDimen(a),mathsize:c.SIZE.NORMAL}))},Rule:function(a,b){var e=this.GetDimen(a),d=this.GetDimen(a),f=this.GetDimen(a),g={width:e,height:d,depth:f};"blank"!==b?(parseFloat(e)&&parseFloat(d)+parseFloat(f)&&(g.mathbackground=this.stack.env.color||"black"),e=c.mpadded(c.mrow()).With(g)):e=c.mspace().With(g);this.Push(e)},MakeBig:function(a,b,e){e*=h.p_height;e=String(e).replace(/(\.\d\d\d).+/,"$1")+"em";a=this.GetDelimiter(a);this.Push(c.TeXAtom(c.mo(a).With({minsize:e,maxsize:e,fence:!0,stretchy:!0,symmetric:!0})).With({texClass:b}))},BuildRel:function(a){var b=this.ParseUpTo(a,"\\over");a=this.ParseArg(a);this.Push(c.TeXAtom(c.munderover(a,null,b)).With({mclass:c.TEXCLASS.REL}))},HBox:function(a,b){this.Push.apply(this,this.InternalMath(this.GetArgument(a),b))},FBox:function(a){this.Push(c.menclose.apply(c,this.InternalMath(this.GetArgument(a))).With({notation:"box"}))},Not:function(a){this.Push(f.not())},Dots:function(a){this.Push(f.dots().With({ldots:this.mmlToken(c.mo(c.entity("#x2026")).With({stretchy:!1})),cdots:this.mmlToken(c.mo(c.entity("#x22EF")).With({stretchy:!1}))}))},Require:function(a){a=this.GetArgument(a).replace(/.*\//,"").replace(/[^a-z0-9_.-]/ig,"");this.Extension(null,a)},Extension:function(a,b,c){b=g.extensionDir+"/"+b;b.match(/\.js$/)||(b+=".js");r.loaded[r.fileURL(b)]||(null!=a&&delete h[c||"macros"][a.replace(/^\\/,"")],p.RestartAfter(r.Require(b)))},Macro:function(a,b,c,d){if(c){var f=[];if(null!=d){var q=this.GetBrackets(a);f.push(null==q?d:q)}for(d=f.length;d<c;d++)f.push(this.GetArgument(a));b=this.SubstituteArgs(f,b)}this.string=this.AddArgs(b,this.string.slice(this.i));this.i=0;++this.macroCount>g.config.MAXMACROS&&g.Error(["MaxMacroSub1","MathJax maximum macro substitution count exceeded; is there a recursive macro call?"])},Matrix:function(a,b,c,d,k,q,h,n){var m=this.GetNext();""===m&&g.Error(["MissingArgFor","Missing argument for %1",a]);"{"===m?this.i++:(this.string=m+"}"+this.string.slice(this.i+1),this.i=0);a=f.array().With({requireClose:!0,arraydef:{rowspacing:q||"4pt",columnspacing:k||"1em"}});n&&(a.isCases=!0);if(b||c)a.open=b,a.close=c;"D"===h&&(a.arraydef.displaystyle=!0);null!=d&&(a.arraydef.columnalign=d);this.Push(a)},Entry:function(a){this.Push(f.cell().With({isEntry:!0,name:a}));if(this.stack.Top().isCases){var b=this.string,c=0;a=this.i;for(var d=b.length;a<d;){var k=b.charAt(a);"{"===k?(c++,a++):"}"===k?0===c?d=0:(c--,a++):"\x26"===k&&0===c?g.Error(["ExtraAlignTab","Extra alignment tab in \\cases text"]):"\\"===k?b.substr(a).match(/^((\\cr)[^a-zA-Z]|\\\\)/)?d=0:a+=2:a++}b=b.substr(this.i,a-this.i);b.match(/^\s*\\text[^a-zA-Z]/)||(this.Push.apply(this,this.InternalMath(b)),this.i=a)}},Cr:function(a){this.Push(f.cell().With({isCR:!0,name:a}))},CrLaTeX:function(a){var b;"["===this.string.charAt(this.i)&&(b=this.GetBrackets(a,"").replace(/ /g,""))&&!b.match(/^((-?(\.\d+|\d+(\.\d*)?))(pt|em|ex|mu|mm|cm|in|pc))$/)&&g.Error(["BracketMustBeDimension","Bracket argument to %1 must be a dimension",a]);this.Push(f.cell().With({isCR:!0,name:a,linebreak:!0}));a=this.stack.Top();if(a.isa(f.array)){if(b&&a.arraydef.rowspacing){var e=a.arraydef.rowspacing.split(/ /);a.rowspacing||(a.rowspacing=this.dimen2em(e[0]));for(;e.length<a.table.length;)e.push(this.Em(a.rowspacing));e[a.table.length-1]=this.Em(Math.max(0,a.rowspacing+this.dimen2em(b)));a.arraydef.rowspacing=e.join(" ")}}else b&&this.Push(c.mspace().With({depth:b})),this.Push(c.mo().With({linebreak:c.LINEBREAK.NEWLINE}))},emPerInch:7.2,dimen2em:function(a){var b=a.match(/^(-?(?:\.\d+|\d+(?:\.\d*)?))(pt|em|ex|mu|pc|in|mm|cm)/);a=parseFloat(b[1]||"1");b=b[2];return"em"===b?a:"ex"===b?.43*a:"pt"===b?a/10:"pc"===b?1.2*a:"in"===b?a*this.emPerInch:"cm"===b?a*this.emPerInch/2.54:"mm"===b?a*this.emPerInch/25.4:"mu"===b?a/18:0},Em:function(a){return 6E-4>Math.abs(a)?"0em":a.toFixed(3).replace(/\.?0+$/,"")+"em"},HLine:function(a,b){null==b&&(b="solid");var c=this.stack.Top();c.isa(f.array)&&!c.data.length||g.Error(["Misplaced","Misplaced %1",a]);if(0==c.table.length)c.frame.push("top");else{for(var d=c.arraydef.rowlines?c.arraydef.rowlines.split(/ /):[];d.length<c.table.length;)d.push("none");d[c.table.length-1]=b;c.arraydef.rowlines=d.join(" ")}},Begin:function(a){var b=this.GetArgument(a);b.match(/[^a-z*]/i)&&g.Error(["InvalidEnv","Invalid environment name '%1'",b]);(a=this.envFindName(b))||g.Error(["UnknownEnv","Unknown environment '%1'",b]);++this.macroCount>g.config.MAXMACROS&&g.Error(["MaxMacroSub2","MathJax maximum substitution count exceeded; is there a recursive latex environment?"]);a instanceof Array||(a=[a]);b=f.begin().With({name:b,end:a[1],parse:this});a[0]&&this[a[0]]&&(b=this[a[0]].apply(this,[b].concat(a.slice(2))));this.Push(b)},End:function(a){this.Push(f.end().With({name:this.GetArgument(a)}))},envFindName:function(a){return h.environment[a]},Equation:function(a,b){return b},ExtensionEnv:function(a,b){this.Extension(a.name,b,"environment")},Array:function(a,b,c,d,k,g,h,n){d||(d=this.GetArgument("\\begin{"+a.name+"}"));var m=("c"+d).replace(/[^clr|:]/g,"").replace(/[^|:]([|:])+/g,"$1");d=d.replace(/[^clr]/g,"").split("").join(" ");d=d.replace(/l/g,"left").replace(/r/g,"right").replace(/c/g,"center");d=f.array().With({arraydef:{columnalign:d,columnspacing:k||"1em",rowspacing:g||"4pt"}});m.match(/[|:]/)&&(m.charAt(0).match(/[|:]/)&&(d.frame.push("left"),d.frame.dashed=":"===m.charAt(0)),m.charAt(m.length-1).match(/[|:]/)&&d.frame.push("right"),m=m.substr(1,m.length-2),d.arraydef.columnlines=m.split("").join(" ").replace(/[^|: ]/g,"none").replace(/\|/g,"solid").replace(/:/g,"dashed"));b&&(d.open=this.convertDelimiter(b));c&&(d.close=this.convertDelimiter(c));"D"===h&&(d.arraydef.displaystyle=!0);"S"===h&&(d.arraydef.scriptlevel=1);n&&(d.arraydef.useHeight=!1);this.Push(a);return d},AlignedArray:function(a){var b=this.GetBrackets("\\begin{"+a.name+"}");return this.setArrayAlign(this.Array.apply(this,arguments),b)},setArrayAlign:function(a,b){b=this.trimSpaces(b||"");"t"===b?a.arraydef.align="baseline 1":"b"===b?a.arraydef.align="baseline -1":"c"===b?a.arraydef.align="center":b&&(a.arraydef.align=b);return a},convertDelimiter:function(a){a&&(a=h.delimiter[a]);if(null==a)return null;a instanceof Array&&(a=a[0]);4===a.length&&(a=String.fromCharCode(parseInt(a,16)));return a},trimSpaces:function(a){return"string"!=typeof a?a:a.replace(/^\s+|\s+$/g,"")},nextIsSpace:function(){return this.string.charAt(this.i).match(/[ \n\r\t]/)},GetNext:function(){for(;this.nextIsSpace();)this.i++;return this.string.charAt(this.i)},GetCS:function(){var a=this.string.slice(this.i).match(/^([a-z]+|.) ?/i);if(a)return this.i+=a[1].length,a[1];this.i++;return" "},GetArgument:function(a,b){switch(this.GetNext()){case "":return b||g.Error(["MissingArgFor","Missing argument for %1",a]),null;case "}":return b||g.Error(["ExtraCloseMissingOpen","Extra close brace or missing open brace"]),null;case "\\":return this.i++,"\\"+this.GetCS();case "{":for(var c=++this.i,d=1;this.i<this.string.length;)switch(this.string.charAt(this.i++)){case "\\":this.i++;break;case "{":d++;break;case "}":if(0==d&&g.Error(["ExtraClose","Extra close brace"]),0==--d)return this.string.slice(c,this.i-1)}g.Error(["MissingCloseBrace","Missing close brace"])}return this.string.charAt(this.i++)},GetBrackets:function(a,b){if("["!=this.GetNext())return b;for(var c=++this.i,d=0;this.i<this.string.length;)switch(this.string.charAt(this.i++)){case "{":d++;break;case "\\":this.i++;break;case "}":0>=d--&&g.Error(["ExtraCloseLooking","Extra close brace while looking for %1","']'"]);break;case "]":if(0==d)return this.string.slice(c,this.i-1)}g.Error(["MissingCloseBracket","Couldn't find closing ']' for argument to %1",a])},GetDelimiter:function(a){for(;this.nextIsSpace();)this.i++;var b=this.string.charAt(this.i);if(this.i<this.string.length&&(this.i++,"\\"==b&&(b+=this.GetCS(a)),null!=h.delimiter[b]))return this.convertDelimiter(b);g.Error(["MissingOrUnrecognizedDelim","Missing or unrecognized delimiter for %1",a])},GetDimen:function(a){var b;this.nextIsSpace()&&this.i++;if("{"==this.string.charAt(this.i)){if(b=this.GetArgument(a),b.match(/^\s*([-+]?(\.\d+|\d+(\.\d*)?))\s*(pt|em|ex|mu|px|mm|cm|in|pc)\s*$/))return b.replace(/ /g,"")}else if(b=this.string.slice(this.i),b=b.match(/^\s*(([-+]?(\.\d+|\d+(\.\d*)?))\s*(pt|em|ex|mu|px|mm|cm|in|pc)) ?/))return this.i+=b[0].length,b[1].replace(/ /g,"");g.Error(["MissingDimOrUnits","Missing dimension or its units for %1",a])},GetUpTo:function(a,b){for(;this.nextIsSpace();)this.i++;for(var c=this.i,d,f,h=0;this.i<this.string.length;){d=this.i;f=this.string.charAt(this.i++);switch(f){case "\\":f+=this.GetCS();break;case "{":h++;break;case "}":0==h&&g.Error(["ExtraCloseLooking","Extra close brace while looking for %1",b]),h--}if(0==h&&f==b)return this.string.slice(c,d)}g.Error(["TokenNotFoundForCommand","Couldn't find %1 for %2",b,a])},ParseArg:function(a){return g.Parse(this.GetArgument(a),this.stack.env).mml()},ParseUpTo:function(a,b){return g.Parse(this.GetUpTo(a,b),this.stack.env).mml()},InternalMath:function(a,b){var e={displaystyle:!1};null!=b&&(e.scriptlevel=b);this.stack.env.font&&(e.mathvariant=this.stack.env.font);if(!a.match(/\\?\$|\\\(|\\(eq)?ref\s*\{/))return[this.InternalText(a,e)];for(var d=0,f=0,h,l="",n=[];d<a.length;)h=a.charAt(d++),"$"===h?"$"===l?(n.push(c.TeXAtom(g.Parse(a.slice(f,d-1),{}).mml().With(e))),l="",f=d):""===l&&(f<d-1&&n.push(this.InternalText(a.slice(f,d-1),e)),l="$",f=d):"}"===h&&"}"===l?(n.push(c.TeXAtom(g.Parse(a.slice(f,d),{}).mml().With(e))),l="",f=d):"\\"===h&&(""===l&&a.substr(d).match(/^(eq)?ref\s*\{/)?(f<d-1&&n.push(this.InternalText(a.slice(f,d-1),e)),l="}",f=d-1):(h=a.charAt(d++),"("===h&&""===l?(f<d-2&&n.push(this.InternalText(a.slice(f,d-2),e)),l=")",f=d):")"===h&&")"===l?(n.push(c.TeXAtom(g.Parse(a.slice(f,d-2),{}).mml().With(e))),l="",f=d):"$"===h&&""===l&&(d--,a=a.substr(0,d-1)+a.substr(d))));""!==l&&g.Error(["MathNotTerminated","Math not terminated in text box"]);f<a.length&&n.push(this.InternalText(a.slice(f),e));return n},InternalText:function(a,b){a=a.replace(/^\s+/,"\u00a0").replace(/\s+$/,"\u00a0");return c.mtext(c.chars(a)).With(b)},SubstituteArgs:function(a,b){for(var c="",d="",f,h=0;h<b.length;)f=b.charAt(h++),"\\"===f?c+=f+b.charAt(h++):"#"===f?(f=b.charAt(h++),"#"===f?c+=f:((!f.match(/[1-9]/)||f>a.length)&&g.Error(["IllegalMacroParam","Illegal macro parameter reference"]),d=this.AddArgs(this.AddArgs(d,c),a[f-1]),c="")):c+=f;return this.AddArgs(d,c)},AddArgs:function(a,b){b.match(/^[a-z]/i)&&a.match(/(^|[^\\])(\\\\)*\\[a-z]+$/i)&&(a+=" ");a.length+b.length>g.config.MAXBUFFER&&g.Error(["MaxBufferSize","MathJax internal buffer size exceeded; is there a recursive macro call?"]);return a+b}});g.Augment({Stack:u,Parse:v,Definitions:h,Startup:function(){c=MathJax.ElementJax.mml;p.Insert(h,{letter:/[a-z]/i,digit:/[0-9.]/,number:/^(?:[0-9]+(?:\{,\}[0-9]{3})*(?:\.[0-9]*)*|\.[0-9]+)/,special:{"\\":"ControlSequence","{":"Open","}":"Close","~":"Tilde","^":"Superscript",_:"Subscript"," ":"Space","\t":"Space","\r":"Space","\n":"Space","'":"Prime","%":"Comment","\x26":"Entry","#":"Hash","\u2019":"Prime"},remap:{"-":"2212","*":"2217","`":"2018"},mathchar0mi:{alpha:"03B1",beta:"03B2",gamma:"03B3",delta:"03B4",epsilon:"03F5",zeta:"03B6",eta:"03B7",theta:"03B8",iota:"03B9",kappa:"03BA",lambda:"03BB",mu:"03BC",nu:"03BD",xi:"03BE",omicron:"03BF",pi:"03C0",rho:"03C1",sigma:"03C3",tau:"03C4",upsilon:"03C5",phi:"03D5",chi:"03C7",psi:"03C8",omega:"03C9",varepsilon:"03B5",vartheta:"03D1",varpi:"03D6",varrho:"03F1",varsigma:"03C2",varphi:"03C6",S:["00A7",{mathvariant:c.VARIANT.NORMAL}],aleph:["2135",{mathvariant:c.VARIANT.NORMAL}],hbar:["210F",{variantForm:!0}],imath:"0131",jmath:"0237",ell:"2113",wp:["2118",{mathvariant:c.VARIANT.NORMAL}],Re:["211C",{mathvariant:c.VARIANT.NORMAL}],Im:["2111",{mathvariant:c.VARIANT.NORMAL}],partial:["2202",{mathvariant:c.VARIANT.NORMAL}],infty:["221E",{mathvariant:c.VARIANT.NORMAL}],prime:["2032",{mathvariant:c.VARIANT.NORMAL,variantForm:!0}],emptyset:["2205",{mathvariant:c.VARIANT.NORMAL}],nabla:["2207",{mathvariant:c.VARIANT.NORMAL}],top:["22A4",{mathvariant:c.VARIANT.NORMAL}],bot:["22A5",{mathvariant:c.VARIANT.NORMAL}],angle:["2220",{mathvariant:c.VARIANT.NORMAL}],triangle:["25B3",{mathvariant:c.VARIANT.NORMAL}],backslash:["2216",{mathvariant:c.VARIANT.NORMAL,variantForm:!0}],forall:["2200",{mathvariant:c.VARIANT.NORMAL}],exists:["2203",{mathvariant:c.VARIANT.NORMAL}],neg:["00AC",{mathvariant:c.VARIANT.NORMAL}],lnot:["00AC",{mathvariant:c.VARIANT.NORMAL}],flat:["266D",{mathvariant:c.VARIANT.NORMAL}],natural:["266E",{mathvariant:c.VARIANT.NORMAL}],sharp:["266F",{mathvariant:c.VARIANT.NORMAL}],clubsuit:["2663",{mathvariant:c.VARIANT.NORMAL}],diamondsuit:["2662",{mathvariant:c.VARIANT.NORMAL}],heartsuit:["2661",{mathvariant:c.VARIANT.NORMAL}],spadesuit:["2660",{mathvariant:c.VARIANT.NORMAL}]},mathchar0mo:{surd:"221A",coprod:["2210",{texClass:c.TEXCLASS.OP,movesupsub:!0}],bigvee:["22C1",{texClass:c.TEXCLASS.OP,movesupsub:!0}],bigwedge:["22C0",{texClass:c.TEXCLASS.OP,movesupsub:!0}],biguplus:["2A04",{texClass:c.TEXCLASS.OP,movesupsub:!0}],bigcap:["22C2",{texClass:c.TEXCLASS.OP,movesupsub:!0}],bigcup:["22C3",{texClass:c.TEXCLASS.OP,movesupsub:!0}],"int":["222B",{texClass:c.TEXCLASS.OP}],intop:["222B",{texClass:c.TEXCLASS.OP,movesupsub:!0,movablelimits:!0}],iint:["222C",{texClass:c.TEXCLASS.OP}],iiint:["222D",{texClass:c.TEXCLASS.OP}],prod:["220F",{texClass:c.TEXCLASS.OP,movesupsub:!0}],sum:["2211",{texClass:c.TEXCLASS.OP,movesupsub:!0}],bigotimes:["2A02",{texClass:c.TEXCLASS.OP,movesupsub:!0}],bigoplus:["2A01",{texClass:c.TEXCLASS.OP,movesupsub:!0}],bigodot:["2A00",{texClass:c.TEXCLASS.OP,movesupsub:!0}],oint:["222E",{texClass:c.TEXCLASS.OP}],bigsqcup:["2A06",{texClass:c.TEXCLASS.OP,movesupsub:!0}],smallint:["222B",{largeop:!1}],triangleleft:"25C3",triangleright:"25B9",bigtriangleup:"25B3",bigtriangledown:"25BD",wedge:"2227",land:"2227",vee:"2228",lor:"2228",cap:"2229",cup:"222A",ddagger:"2021",dagger:"2020",sqcap:"2293",sqcup:"2294",uplus:"228E",amalg:"2A3F",diamond:"22C4",bullet:"2219",wr:"2240",div:"00F7",odot:["2299",{largeop:!1}],oslash:["2298",{largeop:!1}],otimes:["2297",{largeop:!1}],ominus:["2296",{largeop:!1}],oplus:["2295",{largeop:!1}],mp:"2213",pm:"00B1",circ:"2218",bigcirc:"25EF",setminus:["2216",{variantForm:!0}],cdot:"22C5",ast:"2217",times:"00D7",star:"22C6",propto:"221D",sqsubseteq:"2291",sqsupseteq:"2292",parallel:"2225",mid:"2223",dashv:"22A3",vdash:"22A2",leq:"2264",le:"2264",geq:"2265",ge:"2265",lt:"003C",gt:"003E",succ:"227B",prec:"227A",approx:"2248",succeq:"2AB0",preceq:"2AAF",supset:"2283",subset:"2282",supseteq:"2287",subseteq:"2286","in":"2208",ni:"220B",notin:"2209",owns:"220B",gg:"226B",ll:"226A",sim:"223C",simeq:"2243",perp:"22A5",equiv:"2261",asymp:"224D",smile:"2323",frown:"2322",ne:"2260",neq:"2260",cong:"2245",doteq:"2250",bowtie:"22C8",models:"22A8",notChar:"29F8",Leftrightarrow:"21D4",Leftarrow:"21D0",Rightarrow:"21D2",leftrightarrow:"2194",leftarrow:"2190",gets:"2190",rightarrow:"2192",to:"2192",mapsto:"21A6",leftharpoonup:"21BC",leftharpoondown:"21BD",rightharpoonup:"21C0",rightharpoondown:"21C1",nearrow:"2197",searrow:"2198",nwarrow:"2196",swarrow:"2199",rightleftharpoons:"21CC",hookrightarrow:"21AA",hookleftarrow:"21A9",longleftarrow:"27F5",Longleftarrow:"27F8",longrightarrow:"27F6",Longrightarrow:"27F9",Longleftrightarrow:"27FA",longleftrightarrow:"27F7",longmapsto:"27FC",ldots:"2026",cdots:"22EF",vdots:"22EE",ddots:"22F1",dotsc:"2026",dotsb:"22EF",dotsm:"22EF",dotsi:"22EF",dotso:"2026",ldotp:["002E",{texClass:c.TEXCLASS.PUNCT}],cdotp:["22C5",{texClass:c.TEXCLASS.PUNCT}],colon:["003A",{texClass:c.TEXCLASS.PUNCT}]},mathchar7:{Gamma:"0393",Delta:"0394",Theta:"0398",Lambda:"039B",Xi:"039E",Pi:"03A0",Sigma:"03A3",Upsilon:"03A5",Phi:"03A6",Psi:"03A8",Omega:"03A9",_:"005F","#":"0023",$:"0024","%":"0025","\x26":"0026",And:"0026"},delimiter:{"(":"(",")":")","[":"[","]":"]","\x3c":"27E8","\x3e":"27E9","\\lt":"27E8","\\gt":"27E9","/":"/","|":["|",{texClass:c.TEXCLASS.ORD}],".":"","\\\\":"\\","\\lmoustache":"23B0","\\rmoustache":"23B1","\\lgroup":"27EE","\\rgroup":"27EF","\\arrowvert":"23D0","\\Arrowvert":"2016","\\bracevert":"23AA","\\Vert":["2225",{texClass:c.TEXCLASS.ORD}],"\\|":["2225",{texClass:c.TEXCLASS.ORD}],"\\vert":["|",{texClass:c.TEXCLASS.ORD}],"\\uparrow":"2191","\\downarrow":"2193","\\updownarrow":"2195","\\Uparrow":"21D1","\\Downarrow":"21D3","\\Updownarrow":"21D5","\\backslash":"\\","\\rangle":"27E9","\\langle":"27E8","\\rbrace":"}","\\lbrace":"{","\\}":"}","\\{":"{","\\rceil":"2309","\\lceil":"2308","\\rfloor":"230B","\\lfloor":"230A","\\lbrack":"[","\\rbrack":"]"},macros:{displaystyle:["SetStyle","D",!0,0],textstyle:["SetStyle","T",!1,0],scriptstyle:["SetStyle","S",!1,1],scriptscriptstyle:["SetStyle","SS",!1,2],rm:["SetFont",c.VARIANT.NORMAL],mit:["SetFont",c.VARIANT.ITALIC],oldstyle:["SetFont",c.VARIANT.OLDSTYLE],cal:["SetFont",c.VARIANT.CALIGRAPHIC],it:["SetFont","-tex-mathit"],bf:["SetFont",c.VARIANT.BOLD],bbFont:["SetFont",c.VARIANT.DOUBLESTRUCK],scr:["SetFont",c.VARIANT.SCRIPT],frak:["SetFont",c.VARIANT.FRAKTUR],sf:["SetFont",c.VARIANT.SANSSERIF],tt:["SetFont",c.VARIANT.MONOSPACE],tiny:["SetSize",.5],Tiny:["SetSize",.6],scriptsize:["SetSize",.7],small:["SetSize",.85],normalsize:["SetSize",1],large:["SetSize",1.2],Large:["SetSize",1.44],LARGE:["SetSize",1.73],huge:["SetSize",2.07],Huge:["SetSize",2.49],arcsin:["NamedFn"],arccos:["NamedFn"],arctan:["NamedFn"],arg:["NamedFn"],cos:["NamedFn"],cosh:["NamedFn"],cot:["NamedFn"],coth:["NamedFn"],csc:["NamedFn"],deg:["NamedFn"],det:"NamedOp",dim:["NamedFn"],exp:["NamedFn"],gcd:"NamedOp",hom:["NamedFn"],inf:"NamedOp",ker:["NamedFn"],lg:["NamedFn"],lim:"NamedOp",liminf:["NamedOp","lim\x26thinsp;inf"],limsup:["NamedOp","lim\x26thinsp;sup"],ln:["NamedFn"],log:["NamedFn"],max:"NamedOp",min:"NamedOp",Pr:"NamedOp",sec:["NamedFn"],sin:["NamedFn"],sinh:["NamedFn"],sup:"NamedOp",tan:["NamedFn"],tanh:["NamedFn"],limits:["Limits",1],nolimits:["Limits",0],overline:["UnderOver","00AF"],underline:["UnderOver","005F"],overbrace:["UnderOver","23DE",1],underbrace:["UnderOver","23DF",1],overrightarrow:["UnderOver","2192"],underrightarrow:["UnderOver","2192"],overleftarrow:["UnderOver","2190"],underleftarrow:["UnderOver","2190"],overleftrightarrow:["UnderOver","2194"],underleftrightarrow:["UnderOver","2194"],overset:"Overset",underset:"Underset",stackrel:["Macro","\\mathrel{\\mathop{#2}\\limits^{#1}}",2],over:"Over",overwithdelims:"Over",atop:"Over",atopwithdelims:"Over",above:"Over",abovewithdelims:"Over",brace:["Over","{","}"],brack:["Over","[","]"],choose:["Over","(",")"],frac:"Frac",sqrt:"Sqrt",root:"Root",uproot:["MoveRoot","upRoot"],leftroot:["MoveRoot","leftRoot"],left:"LeftRight",right:"LeftRight",middle:"Middle",llap:"Lap",rlap:"Lap",raise:"RaiseLower",lower:"RaiseLower",moveleft:"MoveLeftRight",moveright:"MoveLeftRight",",":["Spacer",c.LENGTH.THINMATHSPACE],":":["Spacer",c.LENGTH.MEDIUMMATHSPACE],"\x3e":["Spacer",c.LENGTH.MEDIUMMATHSPACE],";":["Spacer",c.LENGTH.THICKMATHSPACE],"!":["Spacer",c.LENGTH.NEGATIVETHINMATHSPACE],enspace:["Spacer",".5em"],quad:["Spacer","1em"],qquad:["Spacer","2em"],thinspace:["Spacer",c.LENGTH.THINMATHSPACE],negthinspace:["Spacer",c.LENGTH.NEGATIVETHINMATHSPACE],hskip:"Hskip",hspace:"Hskip",kern:"Hskip",mskip:"Hskip",mspace:"Hskip",mkern:"Hskip",Rule:["Rule"],Space:["Rule","blank"],big:["MakeBig",c.TEXCLASS.ORD,.85],Big:["MakeBig",c.TEXCLASS.ORD,1.15],bigg:["MakeBig",c.TEXCLASS.ORD,1.45],Bigg:["MakeBig",c.TEXCLASS.ORD,1.75],bigl:["MakeBig",c.TEXCLASS.OPEN,.85],Bigl:["MakeBig",c.TEXCLASS.OPEN,1.15],biggl:["MakeBig",c.TEXCLASS.OPEN,1.45],Biggl:["MakeBig",c.TEXCLASS.OPEN,1.75],bigr:["MakeBig",c.TEXCLASS.CLOSE,.85],Bigr:["MakeBig",c.TEXCLASS.CLOSE,1.15],biggr:["MakeBig",c.TEXCLASS.CLOSE,1.45],Biggr:["MakeBig",c.TEXCLASS.CLOSE,1.75],bigm:["MakeBig",c.TEXCLASS.REL,.85],Bigm:["MakeBig",c.TEXCLASS.REL,1.15],biggm:["MakeBig",c.TEXCLASS.REL,1.45],Biggm:["MakeBig",c.TEXCLASS.REL,1.75],mathord:["TeXAtom",c.TEXCLASS.ORD],mathop:["TeXAtom",c.TEXCLASS.OP],mathopen:["TeXAtom",c.TEXCLASS.OPEN],mathclose:["TeXAtom",c.TEXCLASS.CLOSE],mathbin:["TeXAtom",c.TEXCLASS.BIN],mathrel:["TeXAtom",c.TEXCLASS.REL],mathpunct:["TeXAtom",c.TEXCLASS.PUNCT],mathinner:["TeXAtom",c.TEXCLASS.INNER],vcenter:["TeXAtom",c.TEXCLASS.VCENTER],mathchoice:["Extension","mathchoice"],buildrel:"BuildRel",hbox:["HBox",0],text:"HBox",mbox:["HBox",0],fbox:"FBox",strut:"Strut",mathstrut:["Macro","\\vphantom{(}"],phantom:"Phantom",vphantom:["Phantom",1,0],hphantom:["Phantom",0,1],smash:"Smash",acute:["Accent","00B4"],grave:["Accent","0060"],ddot:["Accent","00A8"],tilde:["Accent","007E"],bar:["Accent","00AF"],breve:["Accent","02D8"],check:["Accent","02C7"],hat:["Accent","005E"],vec:["Accent","2192"],dot:["Accent","02D9"],widetilde:["Accent","007E",1],widehat:["Accent","005E",1],matrix:"Matrix",array:"Matrix",pmatrix:["Matrix","(",")"],cases:["Matrix","{","","left left",null,".1em",null,!0],eqalign:["Matrix",null,null,"right left",c.LENGTH.THICKMATHSPACE,".5em","D"],displaylines:["Matrix",null,null,"center",null,".5em","D"],cr:"Cr","\\":"CrLaTeX",newline:"Cr",hline:["HLine","solid"],hdashline:["HLine","dashed"],eqalignno:["Matrix",null,null,"right left right",c.LENGTH.THICKMATHSPACE+" 3em",".5em","D"],leqalignno:["Matrix",null,null,"right left right",c.LENGTH.THICKMATHSPACE+" 3em",".5em","D"],bmod:["Macro","\\mathbin{\\mmlToken{mo}{mod}}"],pmod:["Macro","\\pod{\\mmlToken{mi}{mod}\\kern 6mu #1}",1],mod:["Macro","\\mathchoice{\\kern18mu}{\\kern12mu}{\\kern12mu}{\\kern12mu}\\mmlToken{mi}{mod}\\,\\,#1",1],pod:["Macro","\\mathchoice{\\kern18mu}{\\kern8mu}{\\kern8mu}{\\kern8mu}(#1)",1],iff:["Macro","\\;\\Longleftrightarrow\\;"],skew:["Macro","{{#2{#3\\mkern#1mu}\\mkern-#1mu}{}}",3],mathcal:["Macro","{\\cal #1}",1],mathscr:["Macro","{\\scr #1}",1],mathrm:["Macro","{\\rm #1}",1],mathbf:["Macro","{\\bf #1}",1],mathbb:["Macro","{\\bbFont #1}",1],Bbb:["Macro","{\\bbFont #1}",1],mathit:["Macro","{\\it #1}",1],mathfrak:["Macro","{\\frak #1}",1],mathsf:["Macro","{\\sf #1}",1],mathtt:["Macro","{\\tt #1}",1],textrm:["Macro","\\mathord{\\rm\\text{#1}}",1],textit:["Macro","\\mathord{\\it{\\text{#1}}}",1],textbf:["Macro","\\mathord{\\bf{\\text{#1}}}",1],pmb:["Macro","\\rlap{#1}\\kern1px{#1}",1],TeX:["Macro","T\\kern-.14em\\lower.5ex{E}\\kern-.115em X"],LaTeX:["Macro","L\\kern-.325em\\raise.21em{\\scriptstyle{A}}\\kern-.17em\\TeX"]," ":["Macro","\\text{ }"],not:"Not",dots:"Dots",space:"Tilde",begin:"Begin",end:"End",newcommand:["Extension","newcommand"],renewcommand:["Extension","newcommand"],newenvironment:["Extension","newcommand"],renewenvironment:["Extension","newcommand"],def:["Extension","newcommand"],let:["Extension","newcommand"],verb:["Extension","verb"],boldsymbol:["Extension","boldsymbol"],tag:["Extension","AMSmath"],notag:["Extension","AMSmath"],label:["Extension","AMSmath"],ref:["Extension","AMSmath"],eqref:["Extension","AMSmath"],nonumber:["Macro","\\notag"],unicode:["Extension","unicode"],color:"Color",href:["Extension","HTML"],"class":["Extension","HTML"],style:["Extension","HTML"],cssId:["Extension","HTML"],bbox:["Extension","bbox"],mmlToken:"MmlToken",require:"Require"},environment:{array:["AlignedArray"],matrix:["Array",null,null,null,"c"],pmatrix:["Array",null,"(",")","c"],bmatrix:["Array",null,"[","]","c"],Bmatrix:["Array",null,"\\{","\\}","c"],vmatrix:["Array",null,"\\vert","\\vert","c"],Vmatrix:["Array",null,"\\Vert","\\Vert","c"],cases:["Array",null,"\\{",".","ll",null,".1em"],equation:[null,"Equation"],"equation*":[null,"Equation"],eqnarray:["ExtensionEnv",null,"AMSmath"],"eqnarray*":["ExtensionEnv",null,"AMSmath"],align:["ExtensionEnv",null,"AMSmath"],"align*":["ExtensionEnv",null,"AMSmath"],aligned:["ExtensionEnv",null,"AMSmath"],multline:["ExtensionEnv",null,"AMSmath"],"multline*":["ExtensionEnv",null,"AMSmath"],split:["ExtensionEnv",null,"AMSmath"],gather:["ExtensionEnv",null,"AMSmath"],"gather*":["ExtensionEnv",null,"AMSmath"],gathered:["ExtensionEnv",null,"AMSmath"],alignat:["ExtensionEnv",null,"AMSmath"],"alignat*":["ExtensionEnv",null,"AMSmath"],alignedat:["ExtensionEnv",null,"AMSmath"]},p_height:1.2/.85});if(this.config.Macros){var a=this.config.Macros,b;for(b in a)a.hasOwnProperty(b)&&(h.macros[b]="string"===typeof a[b]?["Macro",a[b]]:["Macro"].concat(a[b]),h.macros[b].isUser=!0)}},config:{MAXMACROS:1E4,MAXBUFFER:5120},sourceMenuTitle:["TeXCommands","TeX Commands"],prefilterHooks:MathJax.Callback.Hooks(!0),postfilterHooks:MathJax.Callback.Hooks(!0),Config:function(){this.SUPER(arguments).Config.apply(this,arguments);"none"!==this.config.equationNumbers.autoNumber&&(this.config.extensions||(this.config.extensions=[]),this.config.extensions.push("AMSmath.js"))},Translate:function(a){var b,e=!1,d=MathJax.HTML.getScript(a),f=null!=a.type.replace(/\n/g," ").match(/(;|\s|\n)mode\s*=\s*display(;|\s|\n|$)/),h={math:d,display:f,script:a};this.prefilterHooks.Execute(h);d=h.math;try{b=g.Parse(d).mml()}catch(l){if(!l.texError)throw l;b=this.formatError(l,d,f,a);e=!0}b=b.inferred?c.apply(MathJax.ElementJax,b.data):c(b);f&&(b.root.display="block");e&&(b.texError=!0);h.math=b;this.postfilterHooks.Execute(h);return h.math},prefilterMath:function(a,b,c){return a},postfilterMath:function(a,b,c){this.combineRelations(a.root);return a},formatError:function(a,b,e,d){a=a.message.replace(/\n.*/,"");p.signal.Post(["TeX Jax - parse error",a,b,e,d]);return c.merror(a)},Error:function(a){a instanceof Array&&(a=t.apply(t,a));throw p.Insert(Error(a),{texError:!0});},Macro:function(a,b,c){h.macros[a]=["Macro"].concat([].slice.call(arguments,1));h.macros[a].isUser=!0},fenced:function(a,b,e){var d=c.mrow();d.open=a;d.close=e;a&&d.Append(c.mo(a).With({fence:!0,stretchy:!0,texClass:c.TEXCLASS.OPEN}));"mrow"===b.type?d.Append.apply(d,b.data):d.Append(b);e&&d.Append(c.mo(e).With({fence:!0,stretchy:!0,texClass:c.TEXCLASS.CLOSE}));return d},combineRelations:function(a){var b,e,d,f;b=0;for(e=a.data.length;b<e;b++)if(a.data[b]){if(a.isa(c.mrow))for(;b+1<e&&(d=a.data[b])&&(f=a.data[b+1])&&d.isa(c.mo)&&f.isa(c.mo)&&d.Get("texClass")===c.TEXCLASS.REL&&f.Get("texClass")===c.TEXCLASS.REL;)d.variantForm!=f.variantForm||d.Get("mathvariant")!=f.Get("mathvariant")||d.style!=f.style||d["class"]!=f["class"]||d.id||f.id?(d.rspace=f.lspace="0pt",b++):(d.Append.apply(d,f.data),a.data.splice(b+1,1),e--);a.data[b].isToken||this.combineRelations(a.data[b])}}});g.prefilterHooks.Add(function(a){a.math=g.prefilterMath(a.math,a.display,a.script)});g.postfilterHooks.Add(function(a){a.math=g.postfilterMath(a.math,a.display,a.script)});g.loadComplete("jax.js")})(MathJax.InputJax.TeX,MathJax.Hub,MathJax.Ajax);