jax.js 27 KB

12345678910111213141516171819202122232425262728293031323334353637
  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/AsciiMath/jax.js
  6. *
  7. * An Input Jax for AsciiMath notation
  8. * (see http://www1.chapman.edu/~jipsen/mathml/asciimath.html).
  9. *
  10. * Originally adapted for MathJax by David Lippman.
  11. * Additional work done by Davide P. Cervone.
  12. *
  13. * A portion of this file is taken from
  14. * ASCIIMathML.js Version 1.4.7 Aug 30, 2005, (c) Peter Jipsen http://www.chapman.edu/~jipsen
  15. * and is used by permission of Peter Jipsen, who has agreed to allow us to
  16. * release it under the Apache2 license (see below). That portion is indicated
  17. * via comments.
  18. *
  19. * The remainder falls under the copyright that follows.
  20. *
  21. * ---------------------------------------------------------------------
  22. *
  23. * Copyright (c) 2012-2013 The MathJax Consortium
  24. *
  25. * Licensed under the Apache License, Version 2.0 (the "License");
  26. * you may not use this file except in compliance with the License.
  27. * You may obtain a copy of the License at
  28. *
  29. * http://www.apache.org/licenses/LICENSE-2.0
  30. *
  31. * Unless required by applicable law or agreed to in writing, software
  32. * distributed under the License is distributed on an "AS IS" BASIS,
  33. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  34. * See the License for the specific language governing permissions and
  35. * limitations under the License.
  36. */(function(u){function x(a){return A?k.createElement(a):k.createElementNS("http://www.w3.org/1999/xhtml",a)}function m(a,b){return a.input>b.input?1:-1}function q(){var a=[],b;for(b=0;b<h.length;b++)h[b].tex&&(a[a.length]={input:h[b].tex,tag:h[b].tag,output:h[b].output,ttype:h[b].ttype});h=h.concat(a);h.sort(m);for(b=0;b<h.length;b++)r[b]=h[b].input}function n(a){return A?k.createElement("m:"+a):k.createElementNS("http://www.w3.org/1998/Math/MathML",a)}function g(a,b){var d=A?k.createElement("m:"+a):k.createElementNS("http://www.w3.org/1998/Math/MathML",a);d.appendChild(b);return d}function p(a,b){var d;d="\\"==a.charAt(b)&&"\\"!=a.charAt(b+1)&&" "!=a.charAt(b+1)?a.slice(b+1):a.slice(b);for(var c=0;c<d.length&&32>=d.charCodeAt(c);c+=1);return d.slice(c)}function G(a,b,d){if(0==d){var c,e;d=-1;for(c=a.length;d+1<c;)e=d+c>>1,a[e]<b?d=e:c=e;return c}for(;d<a.length&&a[d]<b;d++);return d}function v(a){var b=0,d,c,e="";c=!0;for(var f=1;f<=a.length&&c;f++)c=a.slice(0,f),b=G(r,c,b),b<r.length&&a.slice(0,r[b].length)==r[b]&&(e=r[b],d=b,f=e.length),c=b<r.length&&a.slice(0,r[b].length)>=r[b];L=E;if(""!=e)return E=h[d].ttype,h[d];E=0;b=1;c=a.slice(0,1);for(d=!0;"0"<=c&&"9">=c&&b<=a.length;)c=a.slice(b,b+1),b++;if(c==M&&(c=a.slice(b,b+1),"0"<=c&&"9">=c))for(d=!1,b++;"0"<=c&&"9">=c&&b<=a.length;)c=a.slice(b,b+1),b++;d&&1<b||2<b?(c=a.slice(0,b-1),a="mn"):(c=a.slice(0,1),a=("A">c||"Z"<c)&&("a">c||"z"<c)?"mo":"mi");return"-"==c&&3==L?(E=3,{input:c,tag:a,output:c,ttype:1,func:!0}):{input:c,tag:a,output:c,ttype:0}}function w(a){var b;"mrow"==a.nodeName&&(b=a.firstChild.firstChild.nodeValue,"("!=b&&"["!=b&&"{"!=b||a.removeChild(a.firstChild));"mrow"==a.nodeName&&(b=a.lastChild.firstChild.nodeValue,")"!=b&&"]"!=b&&"}"!=b||a.removeChild(a.lastChild))}function t(a){var b,d,c,e,f,l=k.createDocumentFragment();a=p(a,0);b=v(a);if(null==b||5==b.ttype&&0<y)return[null,a];8==b.ttype&&(a=b.output+p(a,b.input.length),b=v(a));switch(b.ttype){case 7:case 0:return a=p(a,b.input.length),[g(b.tag,k.createTextNode(b.output)),a];case 4:return y++,a=p(a,b.input.length),c=B(a,!0),y--,"boolean"==typeof b.invisible&&b.invisible?d=g("mrow",c[0]):(d=g("mo",k.createTextNode(b.output)),d=g("mrow",d),d.appendChild(c[0])),[d,c[1]];case 10:return b!=H&&(a=p(a,b.input.length)),e="{"==a.charAt(0)?a.indexOf("}"):"("==a.charAt(0)?a.indexOf(")"):"["==a.charAt(0)?a.indexOf("]"):b==H?a.slice(1).indexOf('"')+1:0,-1==e&&(e=a.length),f=a.slice(1,e)," "==f.charAt(0)&&(d=n("mspace"),d.setAttribute("width","1ex"),l.appendChild(d)),l.appendChild(g(b.tag,k.createTextNode(f)))," "==f.charAt(f.length-1)&&(d=n("mspace"),d.setAttribute("width","1ex"),l.appendChild(d)),a=p(a,e+1),[g("mrow",l),a];case 1:a=p(a,b.input.length);c=t(a);if(null==c[0])return[g(b.tag,k.createTextNode(b.output)),a];if("boolean"==typeof b.func&&b.func){f=a.charAt(0);if("^"==f||"_"==f||"/"==f||"|"==f||","==f)return[g(b.tag,k.createTextNode(b.output)),a];d=g("mrow",g(b.tag,k.createTextNode(b.output)));d.appendChild(c[0]);return[d,c[1]]}w(c[0]);if("sqrt"==b.input)return[g(b.tag,c[0]),c[1]];if("boolean"==typeof b.acc&&b.acc)d=g(b.tag,c[0]),d.appendChild(g("mo",k.createTextNode(b.output)));else{if(!A&&"undefined"!=typeof b.codes)for(e=0;e<c[0].childNodes.length;e++)if("mi"==c[0].childNodes[e].nodeName||"mi"==c[0].nodeName){f="mi"==c[0].nodeName?c[0].firstChild.nodeValue:c[0].childNodes[e].firstChild.nodeValue;a=[];for(l=0;l<f.length;l++)a=64<f.charCodeAt(l)&&91>f.charCodeAt(l)?a+String.fromCharCode(b.codes[f.charCodeAt(l)-65]):a+f.charAt(l);"mi"==c[0].nodeName?c[0]=n("mo").appendChild(k.createTextNode(a)):c[0].replaceChild(n("mo").appendChild(k.createTextNode(a)),c[0].childNodes[e])}d=g(b.tag,c[0]);d.setAttribute(b.atname,b.atval)}return[d,c[1]];case 2:a=p(a,b.input.length);c=t(a);if(null==c[0])return[g("mo",k.createTextNode(b.input)),a];w(c[0]);e=t(c[1]);if(null==e[0])return[g("mo",k.createTextNode(b.input)),a];w(e[0]);"root"!=b.input&&"stackrel"!=b.input||l.appendChild(e[0]);l.appendChild(c[0]);"frac"==b.input&&l.appendChild(e[0]);return[g(b.tag,l),e[1]];case 3:return a=p(a,b.input.length),[g("mo",k.createTextNode(b.output)),a];case 6:return a=p(a,b.input.length),d=n("mspace"),d.setAttribute("width","1ex"),l.appendChild(d),l.appendChild(g(b.tag,k.createTextNode(b.output))),d=n("mspace"),d.setAttribute("width","1ex"),l.appendChild(d),[g("mrow",l),a];case 9:y++;a=p(a,b.input.length);c=B(a,!1);y--;f="";null!=c[0].lastChild&&(f=c[0].lastChild.firstChild.nodeValue);if("|"==f)return d=g("mo",k.createTextNode(b.output)),d=g("mrow",d),d.appendChild(c[0]),[d,c[1]];d=g("mo",k.createTextNode(b.output));d=g("mrow",d);return[d,a];default:return a=p(a,b.input.length),[g(b.tag,k.createTextNode(b.output)),a]}}function F(a){var b,d,c,e;a=p(a,0);d=v(a);e=t(a);c=e[0];a=e[1];b=v(a);3==b.ttype&&"/"!=b.input&&(a=p(a,b.input.length),e=t(a),null==e[0]?e[0]=g("mo",k.createTextNode("\u25a1")):w(e[0]),a=e[1],"_"==b.input?(b=v(a),d=7==d.ttype,"^"==b.input?(a=p(a,b.input.length),b=t(a),w(b[0]),a=b[1],c=g(d?"munderover":"msubsup",c),c.appendChild(e[0]),c.appendChild(b[0]),c=g("mrow",c)):(c=g(d?"munder":"msub",c),c.appendChild(e[0]))):(c=g(b.tag,c),c.appendChild(e[0])));return[c,a]}function B(a,b){var d,c,e,f=k.createDocumentFragment();do a=p(a,0),e=F(a),c=e[0],a=e[1],d=v(a),3==d.ttype&&"/"==d.input?(a=p(a,d.input.length),e=F(a),null==e[0]?e[0]=g("mo",k.createTextNode("\u25a1")):w(e[0]),a=e[1],w(c),c=g(d.tag,c),c.appendChild(e[0]),f.appendChild(c),d=v(a)):void 0!=c&&f.appendChild(c);while((5!=d.ttype&&(9!=d.ttype||b)||0==y)&&null!=d&&""!=d.output);if(5==d.ttype||9==d.ttype){c=f.childNodes.length;if(0<c&&"mrow"==f.childNodes[c-1].nodeName&&1<c&&"mo"==f.childNodes[c-2].nodeName&&","==f.childNodes[c-2].firstChild.nodeValue){var l=f.childNodes[c-1].lastChild.firstChild.nodeValue;if(")"==l||"]"==l){var h=f.childNodes[c-1].firstChild.firstChild.nodeValue;if("("==h&&")"==l&&"}"!=d.output||"["==h&&"]"==l){var m=[],n=!0,r=f.childNodes.length;for(e=0;n&&e<r;e+=2){m[e]=[];c=f.childNodes[e];n&&(n="mrow"==c.nodeName&&(e==r-1||"mo"==c.nextSibling.nodeName&&","==c.nextSibling.firstChild.nodeValue)&&c.firstChild.firstChild.nodeValue==h&&c.lastChild.firstChild.nodeValue==l);if(n)for(var q=0;q<c.childNodes.length;q++)","==c.childNodes[q].firstChild.nodeValue&&(m[e][m[e].length]=q);n&&1<e&&(n=m[e].length==m[e-2].length)}if(n){var t,u=k.createDocumentFragment();for(e=0;e<r;e+=2){l=k.createDocumentFragment();h=k.createDocumentFragment();c=f.firstChild;n=c.childNodes.length;t=0;c.removeChild(c.firstChild);for(q=1;q<n-1;q++)"undefined"!=typeof m[e][t]&&q==m[e][t]?(c.removeChild(c.firstChild),l.appendChild(g("mtd",h)),t++):h.appendChild(c.firstChild);l.appendChild(g("mtd",h));2<f.childNodes.length&&(f.removeChild(f.firstChild),f.removeChild(f.firstChild));u.appendChild(g("mtr",l))}c=g("mtable",u);"boolean"==typeof d.invisible&&d.invisible&&c.setAttribute("columnalign","left");f.replaceChild(c,f.firstChild)}}}}a=p(a,d.input.length);"boolean"==typeof d.invisible&&d.invisible||(c=g("mo",k.createTextNode(d.output)),f.appendChild(c))}return[f,a]}function N(a){var b=n("mstyle");""!=I&&b.setAttribute("mathcolor",I);J&&b.setAttribute("displaystyle","true");""!=z&&b.setAttribute("fontfamily",z);y=0;b.appendChild(B(a.replace(/^\s+/g,""),!1)[0]);b=g("math",b);O&&b.setAttribute("title",a.replace(/\s+/g," "));return""==z||!A&&"serif"==z?b:(a=x("font"),a.setAttribute("face",z),a.appendChild(b),a)}var C,K=MathJax.Object.Subclass({firstChild:null,lastChild:null,Init:function(){this.childNodes=[]},appendChild:function(a){a.parent&&a.parent.removeChild(a);this.lastChild&&(this.lastChild.nextSibling=a);this.firstChild||(this.firstChild=a);this.childNodes.push(a);a.parent=this;return this.lastChild=a},removeChild:function(a){for(var b=0,d=this.childNodes.length;b<d&&this.childNodes[b]!==a;b++);if(b!==d)return this.childNodes.splice(b,1),a===this.firstChild&&(this.firstChild=a.nextSibling),a===this.lastChild&&(this.lastChild=this.childNodes.length?this.childNodes[this.childNodes.length-1]:null),b&&(this.childNodes[b-1].nextSibling=a.nextSibling),a.nextSibling=a.parent=null,a},replaceChild:function(a,b){for(var d=0,c=this.childNodes.length;d<c&&this.childNodes[d]!==b;d++);d?this.childNodes[d-1].nextSibling=a:this.firstChild=a;d>=c-1&&(this.lastChild=a);this.childNodes[d]=a;a.nextSibling=b.nextSibling;b.nextSibling=b.parent=null;return b},toString:function(){return"{"+this.childNodes.join("")+"}"}}),S=function(){C=MathJax.ElementJax.mml;var a=C.mbase.prototype.Init;C.mbase.Augment({firstChild:null,lastChild:null,nodeValue:"",nextSibling:null,Init:function(){var b=a.apply(this,arguments)||this;b.childNodes=b.data;b.nodeName=b.type;return b},appendChild:function(b){b.parent&&b.parent.removeChild(b);var a=arguments;b.isa(K)&&(a=b.childNodes,b.data=b.childNodes=[],b.firstChild=b.lastChild=null);for(var c=0,e=a.length;c<e;c++)b=a[c],this.lastChild&&(this.lastChild.nextSibling=b),this.firstChild||(this.firstChild=b),this.Append(b),this.lastChild=b,this.nodeValue+=b.nodeValue;return b},removeChild:function(b){for(var a=0,c=this.childNodes.length;a<c&&this.childNodes[a]!==b;a++);if(a!==c){this.childNodes.splice(a,1);b===this.firstChild&&(this.firstChild=b.nextSibling);b===this.lastChild&&(this.lastChild=this.childNodes.length?this.childNodes[this.childNodes.length-1]:null);a&&(this.childNodes[a-1].nextSibling=b.nextSibling);this.nodeValue="";a=0;for(c=this.childNodes.length;a<c;a++)this.nodeValue+=this.childNodes[a].nodeValue;b.nextSibling=b.parent=null;return b}},replaceChild:function(b,a){for(var c=0,e=this.childNodes.length;c<e&&this.childNodes[c]!==a;c++);c?this.childNodes[c-1].nextSibling=b:this.firstChild=b;c>=e-1&&(this.lastChild=b);this.SetData(c,b);b.nextSibling=a.nextSibling;this.nodeValue="";c=0;for(e=this.childNodes.length;c<e;c++)this.nodeValue+=this.childNodes[c].nodeValue;a.nextSibling=a.parent=null;return a},setAttribute:function(a,d){this[a]=d}})},k={getElementById:!0,createElementNS:function(a,b){return C[b]()},createTextNode:function(a){return C.chars(a).With({nodeValue:a})},createDocumentFragment:function(){return K()}},D,I="red",z="serif",J=!0,O=!0,M=".",A=null==k.createElementNS,P=[61237,8492,61238,61239,8496,8497,61240,8459,8464,61241,61242,8466,8499,61243,61244,61245,61246,8475,61247,61248,61249,61250,61251,61252,61253,61254],Q=[61277,61278,8493,61279,61280,61281,61282,8460,8465,61283,61284,61285,61286,61287,61288,61289,61290,8476,61291,61292,61293,61294,61295,61296,61297,8488],R=[61324,61325,8450,61326,61327,61328,61329,8461,61330,61331,61332,61333,61334,8469,61335,8473,8474,8477,61336,61337,61338,61339,61340,61341,61342,8484],H={input:'"',tag:"mtext",output:"mbox",tex:null,ttype:10},h=[{input:"alpha",tag:"mi",output:"\u03b1",tex:null,ttype:0},{input:"beta",tag:"mi",output:"\u03b2",tex:null,ttype:0},{input:"chi",tag:"mi",output:"\u03c7",tex:null,ttype:0},{input:"delta",tag:"mi",output:"\u03b4",tex:null,ttype:0},{input:"Delta",tag:"mo",output:"\u0394",tex:null,ttype:0},{input:"epsi",tag:"mi",output:"\u03b5",tex:"epsilon",ttype:0},{input:"varepsilon",tag:"mi",output:"\u025b",tex:null,ttype:0},{input:"eta",tag:"mi",output:"\u03b7",tex:null,ttype:0},{input:"gamma",tag:"mi",output:"\u03b3",tex:null,ttype:0},{input:"Gamma",tag:"mo",output:"\u0393",tex:null,ttype:0},{input:"iota",tag:"mi",output:"\u03b9",tex:null,ttype:0},{input:"kappa",tag:"mi",output:"\u03ba",tex:null,ttype:0},{input:"lambda",tag:"mi",output:"\u03bb",tex:null,ttype:0},{input:"Lambda",tag:"mo",output:"\u039b",tex:null,ttype:0},{input:"mu",tag:"mi",output:"\u03bc",tex:null,ttype:0},{input:"nu",tag:"mi",output:"\u03bd",tex:null,ttype:0},{input:"omega",tag:"mi",output:"\u03c9",tex:null,ttype:0},{input:"Omega",tag:"mo",output:"\u03a9",tex:null,ttype:0},{input:"phi",tag:"mi",output:"\u03c6",tex:null,ttype:0},{input:"varphi",tag:"mi",output:"\u03d5",tex:null,ttype:0},{input:"Phi",tag:"mo",output:"\u03a6",tex:null,ttype:0},{input:"pi",tag:"mi",output:"\u03c0",tex:null,ttype:0},{input:"Pi",tag:"mo",output:"\u03a0",tex:null,ttype:0},{input:"psi",tag:"mi",output:"\u03c8",tex:null,ttype:0},{input:"Psi",tag:"mi",output:"\u03a8",tex:null,ttype:0},{input:"rho",tag:"mi",output:"\u03c1",tex:null,ttype:0},{input:"sigma",tag:"mi",output:"\u03c3",tex:null,ttype:0},{input:"Sigma",tag:"mo",output:"\u03a3",tex:null,ttype:0},{input:"tau",tag:"mi",output:"\u03c4",tex:null,ttype:0},{input:"theta",tag:"mi",output:"\u03b8",tex:null,ttype:0},{input:"vartheta",tag:"mi",output:"\u03d1",tex:null,ttype:0},{input:"Theta",tag:"mo",output:"\u0398",tex:null,ttype:0},{input:"upsilon",tag:"mi",output:"\u03c5",tex:null,ttype:0},{input:"xi",tag:"mi",output:"\u03be",tex:null,ttype:0},{input:"Xi",tag:"mo",output:"\u039e",tex:null,ttype:0},{input:"zeta",tag:"mi",output:"\u03b6",tex:null,ttype:0},{input:"*",tag:"mo",output:"\u22c5",tex:"cdot",ttype:0},{input:"**",tag:"mo",output:"\u22c6",tex:"star",ttype:0},{input:"//",tag:"mo",output:"/",tex:null,ttype:0},{input:"\\\\",tag:"mo",output:"\\",tex:"backslash",ttype:0},{input:"setminus",tag:"mo",output:"\\",tex:null,ttype:0},{input:"xx",tag:"mo",output:"\u00d7",tex:"times",ttype:0},{input:"-:",tag:"mo",output:"\u00f7",tex:"divide",ttype:0},{input:"@",tag:"mo",output:"\u2218",tex:"circ",ttype:0},{input:"o+",tag:"mo",output:"\u2295",tex:"oplus",ttype:0},{input:"ox",tag:"mo",output:"\u2297",tex:"otimes",ttype:0},{input:"o.",tag:"mo",output:"\u2299",tex:"odot",ttype:0},{input:"sum",tag:"mo",output:"\u2211",tex:null,ttype:7},{input:"prod",tag:"mo",output:"\u220f",tex:null,ttype:7},{input:"^^",tag:"mo",output:"\u2227",tex:"wedge",ttype:0},{input:"^^^",tag:"mo",output:"\u22c0",tex:"bigwedge",ttype:7},{input:"vv",tag:"mo",output:"\u2228",tex:"vee",ttype:0},{input:"vvv",tag:"mo",output:"\u22c1",tex:"bigvee",ttype:7},{input:"nn",tag:"mo",output:"\u2229",tex:"cap",ttype:0},{input:"nnn",tag:"mo",output:"\u22c2",tex:"bigcap",ttype:7},{input:"uu",tag:"mo",output:"\u222a",tex:"cup",ttype:0},{input:"uuu",tag:"mo",output:"\u22c3",tex:"bigcup",ttype:7},{input:"!\x3d",tag:"mo",output:"\u2260",tex:"ne",ttype:0},{input:":\x3d",tag:"mo",output:":\x3d",tex:null,ttype:0},{input:"lt",tag:"mo",output:"\x3c",tex:null,ttype:0},{input:"\x3c\x3d",tag:"mo",output:"\u2264",tex:"le",ttype:0},{input:"lt\x3d",tag:"mo",output:"\u2264",tex:"leq",ttype:0},{input:"\x3e\x3d",tag:"mo",output:"\u2265",tex:"ge",ttype:0},{input:"geq",tag:"mo",output:"\u2265",tex:null,ttype:0},{input:"-\x3c",tag:"mo",output:"\u227a",tex:"prec",ttype:0},{input:"-lt",tag:"mo",output:"\u227a",tex:null,ttype:0},{input:"\x3e-",tag:"mo",output:"\u227b",tex:"succ",ttype:0},{input:"in",tag:"mo",output:"\u2208",tex:null,ttype:0},{input:"!in",tag:"mo",output:"\u2209",tex:"notin",ttype:0},{input:"sub",tag:"mo",output:"\u2282",tex:"subset",ttype:0},{input:"sup",tag:"mo",output:"\u2283",tex:"supset",ttype:0},{input:"sube",tag:"mo",output:"\u2286",tex:"subseteq",ttype:0},{input:"supe",tag:"mo",output:"\u2287",tex:"supseteq",ttype:0},{input:"-\x3d",tag:"mo",output:"\u2261",tex:"equiv",ttype:0},{input:"~\x3d",tag:"mo",output:"\u2245",tex:"cong",ttype:0},{input:"~~",tag:"mo",output:"\u2248",tex:"approx",ttype:0},{input:"prop",tag:"mo",output:"\u221d",tex:"propto",ttype:0},{input:"and",tag:"mtext",output:"and",tex:null,ttype:6},{input:"or",tag:"mtext",output:"or",tex:null,ttype:6},{input:"not",tag:"mo",output:"\u00ac",tex:"neg",ttype:0},{input:"\x3d\x3e",tag:"mo",output:"\u21d2",tex:"implies",ttype:0},{input:"if",tag:"mo",output:"if",tex:null,ttype:6},{input:"\x3c\x3d\x3e",tag:"mo",output:"\u21d4",tex:"iff",ttype:0},{input:"AA",tag:"mo",output:"\u2200",tex:"forall",ttype:0},{input:"EE",tag:"mo",output:"\u2203",tex:"exists",ttype:0},{input:"_|_",tag:"mo",output:"\u22a5",tex:"bot",ttype:0},{input:"TT",tag:"mo",output:"\u22a4",tex:"top",ttype:0},{input:"|--",tag:"mo",output:"\u22a2",tex:"vdash",ttype:0},{input:"|\x3d\x3d",tag:"mo",output:"\u22a8",tex:"models",ttype:0},{input:"(",tag:"mo",output:"(",tex:null,ttype:4},{input:")",tag:"mo",output:")",tex:null,ttype:5},{input:"[",tag:"mo",output:"[",tex:null,ttype:4},{input:"]",tag:"mo",output:"]",tex:null,ttype:5},{input:"{",tag:"mo",output:"{",tex:null,ttype:4},{input:"}",tag:"mo",output:"}",tex:null,ttype:5},{input:"|",tag:"mo",output:"|",tex:null,ttype:9},{input:"(:",tag:"mo",output:"\u2329",tex:"langle",ttype:4},{input:":)",tag:"mo",output:"\u232a",tex:"rangle",ttype:5},{input:"\x3c\x3c",tag:"mo",output:"\u2329",tex:null,ttype:4},{input:"\x3e\x3e",tag:"mo",output:"\u232a",tex:null,ttype:5},{input:"{:",tag:"mo",output:"{:",tex:null,ttype:4,invisible:!0},{input:":}",tag:"mo",output:":}",tex:null,ttype:5,invisible:!0},{input:"int",tag:"mo",output:"\u222b",tex:null,ttype:0},{input:"dx",tag:"mi",output:"{:d x:}",tex:null,ttype:8},{input:"dy",tag:"mi",output:"{:d y:}",tex:null,ttype:8},{input:"dz",tag:"mi",output:"{:d z:}",tex:null,ttype:8},{input:"dt",tag:"mi",output:"{:d t:}",tex:null,ttype:8},{input:"oint",tag:"mo",output:"\u222e",tex:null,ttype:0},{input:"del",tag:"mo",output:"\u2202",tex:"partial",ttype:0},{input:"grad",tag:"mo",output:"\u2207",tex:"nabla",ttype:0},{input:"+-",tag:"mo",output:"\u00b1",tex:"pm",ttype:0},{input:"O/",tag:"mo",output:"\u2205",tex:"emptyset",ttype:0},{input:"oo",tag:"mo",output:"\u221e",tex:"infty",ttype:0},{input:"aleph",tag:"mo",output:"\u2135",tex:null,ttype:0},{input:"...",tag:"mo",output:"...",tex:"ldots",ttype:0},{input:":.",tag:"mo",output:"\u2234",tex:"therefore",ttype:0},{input:"/_",tag:"mo",output:"\u2220",tex:"angle",ttype:0},{input:"\\ ",tag:"mo",output:"\u00a0",tex:null,ttype:0},{input:"quad",tag:"mo",output:"\u00a0\u00a0",tex:null,ttype:0},{input:"qquad",tag:"mo",output:"\u00a0\u00a0\u00a0\u00a0",tex:null,ttype:0},{input:"cdots",tag:"mo",output:"\u22ef",tex:null,ttype:0},{input:"vdots",tag:"mo",output:"\u22ee",tex:null,ttype:0},{input:"ddots",tag:"mo",output:"\u22f1",tex:null,ttype:0},{input:"diamond",tag:"mo",output:"\u22c4",tex:null,ttype:0},{input:"square",tag:"mo",output:"\u25a1",tex:null,ttype:0},{input:"|__",tag:"mo",output:"\u230a",tex:"lfloor",ttype:0},{input:"__|",tag:"mo",output:"\u230b",tex:"rfloor",ttype:0},{input:"|~",tag:"mo",output:"\u2308",tex:"lceiling",ttype:0},{input:"~|",tag:"mo",output:"\u2309",tex:"rceiling",ttype:0},{input:"CC",tag:"mo",output:"\u2102",tex:null,ttype:0},{input:"NN",tag:"mo",output:"\u2115",tex:null,ttype:0},{input:"QQ",tag:"mo",output:"\u211a",tex:null,ttype:0},{input:"RR",tag:"mo",output:"\u211d",tex:null,ttype:0},{input:"ZZ",tag:"mo",output:"\u2124",tex:null,ttype:0},{input:"f",tag:"mi",output:"f",tex:null,ttype:1,func:!0},{input:"g",tag:"mi",output:"g",tex:null,ttype:1,func:!0},{input:"lim",tag:"mo",output:"lim",tex:null,ttype:7},{input:"Lim",tag:"mo",output:"Lim",tex:null,ttype:7},{input:"sin",tag:"mo",output:"sin",tex:null,ttype:1,func:!0},{input:"cos",tag:"mo",output:"cos",tex:null,ttype:1,func:!0},{input:"tan",tag:"mo",output:"tan",tex:null,ttype:1,func:!0},{input:"sinh",tag:"mo",output:"sinh",tex:null,ttype:1,func:!0},{input:"cosh",tag:"mo",output:"cosh",tex:null,ttype:1,func:!0},{input:"tanh",tag:"mo",output:"tanh",tex:null,ttype:1,func:!0},{input:"cot",tag:"mo",output:"cot",tex:null,ttype:1,func:!0},{input:"sec",tag:"mo",output:"sec",tex:null,ttype:1,func:!0},{input:"csc",tag:"mo",output:"csc",tex:null,ttype:1,func:!0},{input:"log",tag:"mo",output:"log",tex:null,ttype:1,func:!0},{input:"ln",tag:"mo",output:"ln",tex:null,ttype:1,func:!0},{input:"det",tag:"mo",output:"det",tex:null,ttype:1,func:!0},{input:"dim",tag:"mo",output:"dim",tex:null,ttype:0},{input:"mod",tag:"mo",output:"mod",tex:null,ttype:0},{input:"gcd",tag:"mo",output:"gcd",tex:null,ttype:1,func:!0},{input:"lcm",tag:"mo",output:"lcm",tex:null,ttype:1,func:!0},{input:"lub",tag:"mo",output:"lub",tex:null,ttype:0},{input:"glb",tag:"mo",output:"glb",tex:null,ttype:0},{input:"min",tag:"mo",output:"min",tex:null,ttype:7},{input:"max",tag:"mo",output:"max",tex:null,ttype:7},{input:"uarr",tag:"mo",output:"\u2191",tex:"uparrow",ttype:0},{input:"darr",tag:"mo",output:"\u2193",tex:"downarrow",ttype:0},{input:"rarr",tag:"mo",output:"\u2192",tex:"rightarrow",ttype:0},{input:"-\x3e",tag:"mo",output:"\u2192",tex:"to",ttype:0},{input:"|-\x3e",tag:"mo",output:"\u21a6",tex:"mapsto",ttype:0},{input:"larr",tag:"mo",output:"\u2190",tex:"leftarrow",ttype:0},{input:"harr",tag:"mo",output:"\u2194",tex:"leftrightarrow",ttype:0},{input:"rArr",tag:"mo",output:"\u21d2",tex:"Rightarrow",ttype:0},{input:"lArr",tag:"mo",output:"\u21d0",tex:"Leftarrow",ttype:0},{input:"hArr",tag:"mo",output:"\u21d4",tex:"Leftrightarrow",ttype:0},{input:"sqrt",tag:"msqrt",output:"sqrt",tex:null,ttype:1},{input:"root",tag:"mroot",output:"root",tex:null,ttype:2},{input:"frac",tag:"mfrac",output:"/",tex:null,ttype:2},{input:"/",tag:"mfrac",output:"/",tex:null,ttype:3},{input:"stackrel",tag:"mover",output:"stackrel",tex:null,ttype:2},{input:"_",tag:"msub",output:"_",tex:null,ttype:3},{input:"^",tag:"msup",output:"^",tex:null,ttype:3},{input:"hat",tag:"mover",output:"^",tex:null,ttype:1,acc:!0},{input:"bar",tag:"mover",output:"\u00af",tex:"overline",ttype:1,acc:!0},{input:"vec",tag:"mover",output:"\u2192",tex:null,ttype:1,acc:!0},{input:"dot",tag:"mover",output:".",tex:null,ttype:1,acc:!0},{input:"ddot",tag:"mover",output:"..",tex:null,ttype:1,acc:!0},{input:"ul",tag:"munder",output:"\u0332",tex:"underline",ttype:1,acc:!0},{input:"text",tag:"mtext",output:"text",tex:null,ttype:10},{input:"mbox",tag:"mtext",output:"mbox",tex:null,ttype:10},H,{input:"bb",tag:"mstyle",atname:"fontweight",atval:"bold",output:"bb",tex:null,ttype:1},{input:"mathbf",tag:"mstyle",atname:"fontweight",atval:"bold",output:"mathbf",tex:null,ttype:1},{input:"sf",tag:"mstyle",atname:"fontfamily",atval:"sans-serif",output:"sf",tex:null,ttype:1},{input:"mathsf",tag:"mstyle",atname:"fontfamily",atval:"sans-serif",output:"mathsf",tex:null,ttype:1},{input:"bbb",tag:"mstyle",atname:"mathvariant",atval:"double-struck",output:"bbb",tex:null,ttype:1,codes:R},{input:"mathbb",tag:"mstyle",atname:"mathvariant",atval:"double-struck",output:"mathbb",tex:null,ttype:1,codes:R},{input:"cc",tag:"mstyle",atname:"mathvariant",atval:"script",output:"cc",tex:null,ttype:1,codes:P},{input:"mathcal",tag:"mstyle",atname:"mathvariant",atval:"script",output:"mathcal",tex:null,ttype:1,codes:P},{input:"tt",tag:"mstyle",atname:"fontfamily",atval:"monospace",output:"tt",tex:null,ttype:1},{input:"mathtt",tag:"mstyle",atname:"fontfamily",atval:"monospace",output:"mathtt",tex:null,ttype:1},{input:"fr",tag:"mstyle",atname:"mathvariant",atval:"fraktur",output:"fr",tex:null,ttype:1,codes:Q},{input:"mathfrak",tag:"mstyle",atname:"mathvariant",atval:"fraktur",output:"mathfrak",tex:null,ttype:1,codes:Q}],r=[],y,L,E,O=!1,I=z="";(function(){for(var a=0,b=h.length;a<b;a++)if(h[a].codes&&delete h[a].codes,h[a].func&&(h[a].tag="mi"),"fontfamily"===h[a].atname||"fontweight"===h[a].atname)h[a].atname="mathvariant"})();h.push({input:"gt",tag:"mo",output:"\x3e",tex:null,ttype:0},{input:"gt\x3d",tag:"mo",output:"\u2265",tex:"geq",ttype:0},{input:"-\x3c\x3d",tag:"mo",output:"\u2aaf",tex:"preceq",ttype:0},{input:"\x3e-\x3d",tag:"mo",output:"\u2ab0",tex:"succeq",ttype:0},{input:"'",tag:"mo",output:"\u2032",tex:"prime",ttype:0},{input:"arcsin",tag:"mi",output:"arcsin",tex:null,ttype:1,func:!0},{input:"arccos",tag:"mi",output:"arccos",tex:null,ttype:1,func:!0},{input:"arctan",tag:"mi",output:"arctan",tex:null,ttype:1,func:!0},{input:"coth",tag:"mi",output:"coth",tex:null,ttype:1,func:!0},{input:"sech",tag:"mi",output:"sech",tex:null,ttype:1,func:!0},{input:"csch",tag:"mi",output:"csch",tex:null,ttype:1,func:!0},{input:"abs",tag:"mi",output:"abs",tex:null,ttype:1,func:!0},{input:"exp",tag:"mi",output:"exp",tex:null,ttype:1,func:!0},{input:"tilde",tag:"mover",output:"~",tex:null,ttype:1,acc:!0});u.Augment({AM:{Init:function(){J=u.config.displaystyle;M=u.config.decimal||u.config.decimalsign;S();q()},Augment:function(a){for(var b in a)if(a.hasOwnProperty(b)){switch(b){case "displaystyle":J=a[b];break;case "decimal":decimal=a[b];break;case "parseMath":N=a[b];break;case "parseExpr":B=a[b];break;case "parseIexpr":F=a[b];break;case "parseSexpr":t=a[b];break;case "removeBrackets":w=a[b];break;case "getSymbol":v=a[b];break;case "position":G=a[b];break;case "removeCharsAndBlanks":p=a[b];break;case "createMmlNode":g=a[b];break;case "createElementMathML":n=a[b];break;case "createElementXHTML":x=a[b];break;case "initSymbols":q=a[b];break;case "compareNames":comareNames=a[b]}this[b]=a[b]}},parseMath:N,parseExpr:B,parseIexpr:F,parseSexr:t,removeBrackets:w,getSymbol:v,position:G,removeCharsAndBlanks:p,createMmlNode:g,createElementMathML:n,createElementXHTML:x,initSymbols:q,compareNames:m,createDocumentFragment:K,document:k,define:function(a,b){h=h.concat([{input:a,tag:"mo",output:b,tex:null,ttype:8}]);h.sort(m);for(D=0;D<h.length;D++)r[D]=h[D].input},symbols:h,names:r,TOKEN:{CONST:0,UNARY:1,BINARY:2,INFIX:3,LEFTBRACKET:4,RIGHTBRACKET:5,SPACE:6,UNDEROVER:7,DEFINITION:8,LEFTRIGHT:9,TEXT:10}}})})(MathJax.InputJax.AsciiMath);(function(u){var x;u.Augment({sourceMenuTitle:["AsciiMathInput","AsciiMath Input"],prefilterHooks:MathJax.Callback.Hooks(!0),postfilterHooks:MathJax.Callback.Hooks(!0),Translate:function(m){var q,n=MathJax.HTML.getScript(m);m={math:n,script:m};this.prefilterHooks.Execute(m);n=m.math;try{q=this.AM.parseMath(n)}catch(g){if(!g.asciimathError)throw g;q=this.formatError(g,n)}m.math=x(q);this.postfilterHooks.Execute(m);return m.math},formatError:function(m,q,n){m=m.message.replace(/\n.*/,"");MathJax.Hub.signal.Post(["AsciiMath Jax - parse error",m,q,n]);return x.merror(m)},Error:function(m){throw MathJax.Hub.Insert(Error(m),{asciimathError:!0});},Startup:function(){x=MathJax.ElementJax.mml;this.AM.Init()}});u.loadComplete("jax.js")})(MathJax.InputJax.AsciiMath);