﻿/*
AM.js (version 2.X.X.4 November 2009
==============
This version of ASCIIMathML has been modified with TeX conversion for 
IMG fallback (c) David Lippman http://www.pierce.ctc.edu/dlippman
Original LaTeXMathML modifications by Dr Douglas R. Woodall and Jeff Knisley
( http://math.etsu.edu/LaTeXMathML/ )

To use this script add the next line to your (X)HTML page with this file in the
same folder or in moodle to theme meta.php, header.html or footer.html:

<script type="text/javascript" src="pathtoyourscript/AM.js"></script>

Examples: `alpha` - $\alpha$ - GeM \alpha GeM

If browser supports MathML, it is used. Otherwise, image-based math rendering is used
(by AMTcgiloc renderer). GeMcgiloc forces image fallback for all browsers ( GeM ... GeM ).

Original version of AsciiMathML (c) Peter Jipsen http://www.chapman.edu/~jipsen
This version is based on ASCIIMathML.js with LaTeXMathML.js and
plugin based ASCIIsvg.js by David Lippman ( ASCIIsvgPI.js ).

Lots of new ideas given by Marc Grober, Matthias Ehmann and Alfred Wassermann.

Regards,

Mauno Korpelainen

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or (at
your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT 
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 
FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License 
(at http://www.gnu.org/licences/lgpl.html) for more details.
*/
var AMTcgiloc = "http://chart.apis.google.com/chart?cht=tx&chs=1x0&chf=bg,s,FFFFFF00&chco=000000&chl=";//Primary fallback
//var AMTcgiloc = "http://korpelainen.net/cgi-bin/mathtex.cgi?\\gammacorrection{1.4}";
var Gemcgiloc = "http://chart.apis.google.com/chart?cht=tx&chs=1x0&chf=bg,s,FFFFFF00&chco=000000&chl=";//Secondary "forced fallback"
var AMdelimiter1 = "`", AMescape1 = "\\\\`"; // can use other characters
var AMdocumentId = "wikitext" // PmWiki element containing math (default=body)
var isIE = !(navigator.oscpu && document.getElementsByClassName);
var AMtranslated = false;
var automathrecognize = false; // writing "amath" on page makes this true
var avoidinnerHTML = true;
var decimalsign = "."; // change to "," if you like, beware of `(1,2)`!
var displaystyle = true; // puts limits above and below large operators
var mathcolor = ""; // change it to "" (to inherit) or any other color
var mathfontfamily = 'STIXGeneral,Arial Unicode MS,"Lucida Sans Unicode","Lucida Grande",Garuda,sans-serif'; // change to "" to inherit (works in IE)
var mathfontsize = "1.2em"; // change to e.g. 1.2em for larger math
var noMathML = false;
var showasciiformulaonhover = true; // helps students learn ASCIIMath
var translateASCIIMath = true; // false to preserve `..`
var translated = false;
var translateLaTeX = true; // false to preserve $..$, $$..$$
var translateLaTeXformatting = true; // false to preserve \emph,\begin{},\end{}
var translateOnLoad = true; // set to false to do call translators from js

if (isIE) {
var AMcal = [0xEF35,0x212C,0xEF36,0xEF37,0x2130,0x2131,0xEF38,0x210B,0x2110,0xEF39,0xEF3A,0x2112,0x2133,0xEF3B,0xEF3C,0xEF3D,0xEF3E,0x211B,0xEF3F,0xEF40,0xEF41,0xEF42,0xEF43,0xEF44,0xEF45,0xEF46];
var AMfrk = [0xEF5D,0xEF5E,0x212D,0xEF5F,0xEF60,0xEF61,0xEF62,0x210C,0x2111,0xEF63,0xEF64,0xEF65,0xEF66,0xEF67,0xEF68,0xEF69,0xEF6A,0x211C,0xEF6B,0xEF6C,0xEF6D,0xEF6E,0xEF6F,0xEF70,0xEF71,0x2128];
var AMbbb = [0xEF8C,0xEF8D,0x2102,0xEF8E,0xEF8F,0xEF90,0xEF91,0x210D,0xEF92,0xEF93,0xEF94,0xEF95,0xEF96,0x2115,0xEF97,0x2119,0x211A,0x211D,0xEF98,0xEF99,0xEF9A,0xEF9B,0xEF9C,0xEF9D,0xEF9E,0x2124];
} else {
var AMcal = [0x1D49C,0x212C,0x1D49E,0x1D49F,0x2130,0x2131,0x1D4A2,0x210B,0x2110,0x1D4A5,0x1D4A6,0x2112,0x2133,0x1D4A9,0x1D4AA,0x1D4AB,0x1D4AC,0x211B,0x1D4AE,0x1D4AF,0x1D4B0,0x1D4B1,0x1D4B2,0x1D4B3,0x1D4B4,0x1D4B5];
var AMfrk = [0x1D504,0x1D505,0x212D,0x1D507,0x1D508,0x1D509,0x1D50A,0x210C,0x2111,0x1D50D,0x1D50E,0x1D50F,0x1D510,0x1D511,0x1D512,0x1D513,0x1D514,0x211C,0x1D516,0x1D517,0x1D518,0x1D519,0x1D51A,0x1D51B,0x1D51C,0x2128];
var AMbbb = [0x1D538,0x1D539,0x2102,0x1D53B,0x1D53C,0x1D53D,0x1D53E,0x210D,0x1D540,0x1D541,0x1D542,0x1D543,0x1D544,0x2115,0x1D546,0x2119,0x211A,0x211D,0x1D54A,0x1D54B,0x1D54C,0x1D54D,0x1D54E,0x1D54F,0x1D550,0x2124];
}

var CONST = 0, UNARY = 1, BINARY = 2, INFIX = 3, LEFTBRACKET = 4,
 RIGHTBRACKET = 5, SPACE = 6, UNDEROVER = 7, DEFINITION = 8,
 LEFTRIGHT = 9, TEXT = 10, BIG = 11, LONG = 12, STRETCHY = 13,
 MATRIX = 14; // token types

var AMquote = {input:"\"", tag:"mtext", output:"mbox", tex:null, ttype:TEXT};
var AMsymbols = [
{input:"density",tag:"mstyle",atname:"mathvariant", atval:"mathsize", tex:null, ttype:BINARY},
{input:"varkappa", tag:"mi", output:"ϰ", tex:null, ttype:CONST},
{input:"digamma", tag:"mi", output:"Ϝ", tex:null, ttype:CONST},
{input:"!=", tag:"mo", output:"≠", tex:"ne", ttype:CONST},
{input:"!in", tag:"mo", output:"\u2209", tex:"notin", ttype:CONST},
{input:"'", tag:"mo", output:"\u02B9", tex:"hspace{0}{'}", ttype:CONST},
{input:"''", tag:"mo", output:"\u02BA", tex:"hspace{0}{''}", ttype:CONST},
{input:"'''", tag:"mo", output:"\u2034", tex:"hspace{0}{'''}", ttype:CONST},
{input:"''''", tag:"mo", output:"\u2057", tex:"hspace{0}{''''}", ttype:CONST},
{input:"#", tag:"mo", output:"#", tex:null, ttype:CONST},
{input:"%", tag:"mo", output:"\u0025", tex:null, ttype:CONST},
{input:"&", tag:"mo", output:"\u0026", tex:null, ttype:CONST},
{input:"(", tag:"mo", output:"(", tex:null, ttype:LEFTBRACKET},
{input:"(:", tag:"mo", output:"\u2329", tex:"langle", ttype:LEFTBRACKET},
{input:")", tag:"mo", output:")", tex:null, ttype:RIGHTBRACKET},
{input:"*", tag:"mo", output:"\u22C5", tex:"cdot", ttype:CONST},
{input:"**", tag:"mo", output:"\u22C6", tex:"star", ttype:CONST},
{input:"...", tag:"mo", output:"...", tex:"ldots", ttype:CONST},
{input:"/", tag:"mfrac", output:"/", tex:null, ttype:INFIX},
{input:"//", tag:"mo", output:"/", tex:"!/", ttype:CONST},
{input:"/_", tag:"mo", output:"\u2220", tex:"angle", ttype:CONST},
{input:"-:", tag:"mo", output:"\u00F7", tex:"div", ttype:CONST},
{input:":)", tag:"mo", output:"\u232A", tex:"rangle", ttype:RIGHTBRACKET},
{input:":.", tag:"mo", output:"\u2234", tex:"therefore", ttype:CONST},
{input:":}", tag:"mo", output:":}", tex:null, ttype:RIGHTBRACKET, invisible:true},
{input:":=", tag:"mo", output:":=", tex:"text{:=}", ttype:CONST},
{input:"@", tag:"mo", output:"\u2218", tex:"circ", ttype:CONST},
{input:"[", tag:"mo", output:"[", tex:null, ttype:LEFTBRACKET},
{input:"\\ ", tag:"mo", output:"\u00A0", tex:null, ttype:CONST, val:true},
{input:"\\\\", tag:"mo", output:"\\", tex:"backslash", ttype:CONST},
{input:"]", tag:"mo", output:"]", tex:null, ttype:RIGHTBRACKET},
{input:"^", tag:"msup", output:"^", tex:null, ttype:INFIX},
{input:"^", tag:"msup", output:"^", tex:null, ttype:INFIX},
{input:"^^", tag:"mo", output:"\u2227", tex:"wedge", ttype:CONST},
{input:"^^^", tag:"mo", output:"\u22C0", tex:"bigwedge", ttype:UNDEROVER},
{input:"_", tag:"msub", output:"_", tex:null, ttype:INFIX},
{input:"_", tag:"msub", output:"_", tex:null, ttype:INFIX},
{input:"__|", tag:"mo", output:"\u230B", tex:"rfloor", ttype:CONST},
{input:"_|_", tag:"mo", output:"\u22A5", tex:"bot", ttype:CONST},
{input:"{", tag:"mo", output:"{", tex:"lbrace", ttype:LEFTBRACKET},
{input:"{:", tag:"mo", output:"{:", tex:null, ttype:LEFTBRACKET, invisible:true},
{input:"|--", tag:"mo", output:"\u22A2", tex:"vdash", ttype:CONST},
{input:"|", tag:"mo", output:"|", tex:null, ttype:LEFTRIGHT},
{input:"|__", tag:"mo", output:"\u230A", tex:"lfloor", ttype:CONST},
{input:"|~", tag:"mo", output:"\u2308", tex:"lceil", ttype:CONST},
{input:"|==", tag:"mo", output:"\u22A8", tex:"models", ttype:CONST},
{input:"|->", tag:"mo", output:"\u21A6", tex:"mapsto", ttype:CONST},
{input:"}", tag:"mo", output:"}", tex:"rbrace", ttype:RIGHTBRACKET},
{input:"~|", tag:"mo", output:"\u2309", tex:"rceil", ttype:CONST},
{input:"~~", tag:"mo", output:"\u2248", tex:"approx", ttype:CONST},
{input:"~=", tag:"mo", output:"\u2245", tex:"cong", ttype:CONST},
{input:"+-", tag:"mo", output:"\u00B1", tex:"pm", ttype:CONST},
{input:"-<", tag:"mo", output:"\u227A", tex:"prec", ttype:CONST},
{input:"<<", tag:"mo", output:"\u2329", tex:"langle", ttype:LEFTBRACKET},
{input:"-<=", tag:"mo", output:"\u2AAF", tex:"preceq", ttype:CONST},
{input:"<=>", tag:"mo", output:"\u21D4", tex:"Leftrightarrow", ttype:CONST},
{input:"-=", tag:"mo", output:"\u2261", tex:"equiv", ttype:CONST},
{input:"=>", tag:"mo", output:"\u21D2", tex:"Rightarrow", ttype:CONST},
{input:"->", tag:"mo", output:"\u2192", tex:"to", ttype:CONST},
{input:">-", tag:"mo", output:"\u227B", tex:"succ", ttype:CONST},
{input:">=", tag:"mo", output:"\u2265", tex:"ge", ttype:CONST},
{input:">-=", tag:"mo", output:"\u2AB0", tex:"succeq", ttype:CONST},
{input:"->>", tag:"mo", output:"\u21A0", tex:"twoheadrightarrow", ttype:CONST},
{input:">->", tag:"mo", output:"\u21A3", tex:"rightarrowtail", ttype:CONST},
{input:">>", tag:"mo", output:"\u232A", tex:"rangle", ttype:RIGHTBRACKET},
{input:">->>", tag:"mo", output:"\u2916", tex:"twoheadrightarrowtail", ttype:CONST},
{input:"AA", tag:"mo", output:"Å", tex:null, ttype:CONST},
{input:"aa", tag:"mo", output:"å", tex:null, ttype:CONST},
{input:"abs", tag:"mo", output:"abs", tex:null, ttype:UNARY, func:true},
{input:"acute", tag:"mover", output:"´", tex:null, ttype:UNARY, acc:true},
{input:"AE", tag:"mo", output:"Æ", tex:null, ttype:CONST},
{input:"ae", tag:"mo", output:"æ", tex:null, ttype:CONST},
{input:"aleph", tag:"mo", output:"\u2135", tex:null, ttype:CONST},
{input:"alpha", tag:"mi", output:"α", tex:null, ttype:CONST},
{input:"amalg", tag:"mo", output:"\u2210", tex:null, ttype:CONST},
{input:"and", tag:"mtext", output:"and", tex:null, ttype:SPACE},
{input:"angle", tag:"mo", output:"\u2222", tex:null, ttype:CONST},
{input:"approx", tag:"mo", output:"\u2248", tex:null, ttype:CONST},
{input:"approxeq", tag:"mo", output:"\u224A", tex:null, ttype:CONST},
{input:"arccos", tag:"mo", output:"arccos", tex:null, ttype:UNARY, func:true},
{input:"arcsin", tag:"mo", output:"arcsin", tex:null, ttype:UNARY, func:true},
{input:"arctan", tag:"mo", output:"arctan", tex:null, ttype:UNARY, func:true},
{input:"arg", tag:"mi", output:"arg", tex:null, ttype:UNARY, func:true},
{input:"ast", tag:"mo", output:"\u002A", tex:null, ttype:CONST},
{input:"asymp", tag:"mo", output:"\u224D", tex:null, ttype:CONST},
{input:"atop", tag:"mfrac", output:"", tex:null, ttype:INFIX},
{input:"backprime", tag:"mo", output:"\u2035", tex:null, ttype:CONST},
{input:"backsim", tag:"mo", output:"\u223D", tex:null, ttype:CONST},
{input:"backsimeq", tag:"mo", output:"\u22CD", tex:null, ttype:CONST},
{input:"backslash", tag:"mo", output:"\u2216", atval:"1", tex:null, ttype:STRETCHY},
{input:"bar", tag:"mover", output:"\u00AF", tex:null, ttype:UNARY, acc:true},
{input:"barwedge", tag:"mo", output:"\u22BC", tex:null, ttype:CONST},
{input:"bb", tag:"mstyle", atname:"fontweight", atval:"bold", output:"bb", tex:null, ttype:UNARY},
{input:"bbb", tag:"mstyle", atname:"mathvariant", atval:"double-struck", output:"bbb", tex:null, ttype:UNARY, codes:AMbbb},
{input:"Bbb{A}", tag:"mo", output:"\uD835\uDD38", tex:"Bbb{A}", ttype:CONST},
{input:"because", tag:"mo", output:"\u2235", tex:null, ttype:CONST},
{input:"beta", tag:"mi", output:"\u03B2", tex:null, ttype:CONST},
{input:"beth", tag:"mo", output:"\u2136", tex:null, ttype:CONST},
{input:"between", tag:"mo", output:"\u226C", tex:null, ttype:CONST},
{input:"bigcap", tag:"mo", output:"\u22C2", tex:null, ttype:UNDEROVER},
{input:"bigcirc", tag:"mo", output:"\u25CB", tex:null, ttype:CONST},
{input:"bigcup", tag:"mo", output:"\u22C3", tex:null, ttype:UNDEROVER},
{input:"bigodot", tag:"mo", output:"\u2A00", tex:null, ttype:UNDEROVER},
{input:"bigoplus", tag:"mo", output:"\u2A01", tex:null, ttype:UNDEROVER},
{input:"bigotimes", tag:"mo", output:"\u2A02", tex:null, ttype:UNDEROVER},
{input:"bigsqcap", tag:"mo", output:"\u2A05", tex:null, ttype:UNDEROVER},
{input:"bigsqcup", tag:"mo", output:"\u2A06", tex:null, ttype:UNDEROVER},
{input:"bigstar", tag:"mo", output:"\u2605", tex:null, ttype:CONST},
{input:"bigtriangledown",tag:"mo",output:"\u25BD", tex:null, ttype:CONST},
{input:"bigtriangleup",tag:"mo",output:"\u25B3", tex:null, ttype:CONST},
{input:"biguplus", tag:"mo", output:"\u2A04", tex:null, ttype:UNDEROVER},
{input:"bigwedge", tag:"mo", output:"\u22C0", tex:null, ttype:UNDEROVER},
{input:"bigwedge", tag:"mo", output:"\u22C0", tex:null, ttype:UNDEROVER},
{input:"bigvee", tag:"mo", output:"\u22C1", tex:null, ttype:UNDEROVER},
{input:"blacktriangle", tag:"mo", output:"\u25B4", tex:null, ttype:CONST},
{input:"blacktriangledown", tag:"mo", output:"\u25BE", tex:null, ttype:CONST},
{input:"blacktriangleleft", tag:"mo", output:"\u25C0", tex:null, ttype:CONST},
{input:"blacktriangleright", tag:"mo", output:"\u25B6", tex:null, ttype:CONST},
{input:"bot", tag:"mo", output:"\u22A5", tex:null, ttype:CONST},
{input:"bowtie", tag:"mo", output:"\u22C8", tex:null, ttype:CONST},
{input:"Box", tag:"mo", output:"\u25A1", tex:null, ttype:CONST},
{input:"boxdot", tag:"mo", output:"\u22A1", tex:null, ttype:CONST},
{input:"boxminus", tag:"mo", output:"\u229F", tex:null, ttype:CONST},
{input:"boxplus", tag:"mo", output:"\u229E", tex:null, ttype:CONST},
{input:"boxtimes", tag:"mo", output:"\u22A0", tex:null, ttype:CONST},
{input:"breve", tag:"mover", output:"\u02D8", tex:null, ttype:UNARY, acc:true},
{input:"bullet", tag:"mo", output:"\u2022", tex:null, ttype:CONST},
{input:"Bumpeq", tag:"mo", output:"\u224E", tex:null, ttype:CONST},
{input:"bumpeq", tag:"mo", output:"\u224F", tex:null, ttype:CONST},
{input:"cap", tag:"mo", output:"\u2229", tex:null, ttype:CONST},
{input:"Cap", tag:"mo", output:"\u22D2", tex:null, ttype:CONST},
{input:"CC", tag:"mo", output:"\u2102", tex:"mathbb{C}", ttype:CONST, notexcopy:true},
{input:"cc", tag:"mstyle", atname:"mathvariant", atval:"script", output:"cc", tex:null, ttype:UNARY, codes:AMcal},
{input:"cdot", tag:"mo", output:"\u22C5", tex:null, ttype:CONST},
{input:"cdotp", tag:"mo", output:"\u00B7", tex:null, ttype:CONST},
{input:"cdots", tag:"mo", output:"\u22EF", tex:null, ttype:CONST},
{input:"check", tag:"mover", output:"\u02C7", tex:null, ttype:UNARY, acc:true},
{input:"checkmark", tag:"mo", output:"\u2713", tex:null, ttype:CONST},
{input:"chi", tag:"mi", output:"\u03C7", tex:null, ttype:CONST},
{input:"choose", tag:"mfrac", output:"", tex:null, ttype:INFIX},
{input:"circ", tag:"mo", output:"\u2218", tex:null, ttype:CONST},
{input:"circeq", tag:"mo", output:"\u2257", tex:null, ttype:CONST},
{input:"circledast", tag:"mo", output:"\u229B", tex:null, ttype:CONST},
{input:"circledcirc", tag:"mo", output:"\u229A", tex:null, ttype:CONST},
{input:"circleddash", tag:"mo", output:"\u229D", tex:null, ttype:CONST},
{input:"circledR", tag:"mo", output:"\u24C7", tex:null, ttype:CONST},
{input:"circledS", tag:"mo", output:"\u24C8", tex:null, ttype:CONST},
{input:"clubsuit", tag:"mo", output:"\u2663", tex:null, ttype:CONST},
{input:"colon", tag:"mo", output:"\u003A", tex:null, ttype:CONST},
{input:"complement", tag:"mo", output:"\u2201", tex:null, ttype:CONST},
{input:"cong", tag:"mo", output:"\u2245", tex:null, ttype:CONST},
{input:"coprod", tag:"mo", output:"\u2210", tex:null, ttype:UNDEROVER},
{input:"cos", tag:"mo", output:"cos", tex:null, ttype:UNARY, func:true},
{input:"cosh", tag:"mo", output:"cosh", tex:null, ttype:UNARY, func:true},
{input:"cot", tag:"mo", output:"cot", tex:null, ttype:UNARY, func:true},
{input:"coth", tag:"mo", output:"coth", tex:null, ttype:UNARY, func:true},
{input:"csc", tag:"mo", output:"csc", tex:null, ttype:UNARY, func:true},
{input:"cup", tag:"mo", output:"\u222A", tex:null, ttype:CONST},
{input:"Cup", tag:"mo", output:"\u22D3", tex:null, ttype:CONST},
{input:"curlyeqprec", tag:"mo", output:"\u22DE", tex:null, ttype:CONST},
{input:"curlyeqsucc", tag:"mo", output:"\u22DF", tex:null, ttype:CONST},
{input:"curlywedge", tag:"mo", output:"\u22CF", tex:null, ttype:CONST},
{input:"curlyvee", tag:"mo", output:"\u22CE", tex:null, ttype:CONST},
{input:"curvearrowleft", tag:"mo", output:"\u21B6", tex:null, ttype:CONST},
{input:"curvearrowright", tag:"mo", output:"\u21B7", tex:null, ttype:CONST},
{input:"dag", tag:"mo", output:"\u2020", tex:null, ttype:CONST},
{input:"dagger", tag:"mo", output:"\u2020", tex:null, ttype:CONST},
{input:"daleth", tag:"mo", output:"\u2138", tex:null, ttype:CONST},
{input:"darr", tag:"mo", output:"\u2193", tex:"downarrow", ttype:CONST},
{input:"dashv", tag:"mo", output:"\u22A3", tex:null, ttype:CONST},
{input:"ddag", tag:"mo", output:"\u2021", tex:null, ttype:CONST},
{input:"ddagger", tag:"mo", output:"\u2021", tex:null, ttype:CONST},
{input:"ddot", tag:"mover", output:"..", tex:null, ttype:UNARY, acc:true},
{input:"ddots", tag:"mo", output:"\u22F1", tex:null, ttype:CONST},
{input:"deg", tag:"mi", output:"deg", tex:null, ttype:UNARY, func:true},
{input:"del", tag:"mo", output:"\u2202", tex:"partial", ttype:CONST},
{input:"delta", tag:"mi", output:"\u03B4", tex:null, ttype:CONST},
{input:"Delta", tag:"mo", output:"\u0394", tex:null, ttype:CONST},
{input:"det", tag:"mo", output:"det", tex:null, ttype:UNARY, func:true},
{input:"diamond", tag:"mo", output:"\u22C4", tex:null, ttype:CONST},
{input:"Diamond", tag:"mo", output:"\u2662", tex:null, ttype:CONST},
{input:"diamondsuit", tag:"mo", output:"\u2662", tex:null, ttype:CONST},
{input:"dim", tag:"mo", output:"dim", tex:null, ttype:CONST},
{input:"displaystyle",tag:"mstyle",atname:"displaystyle",atval:"true", tex:null, ttype:UNARY},
{input:"div", tag:"mo", output:"\u00F7", tex:null, ttype:CONST},
{input:"divide", tag:"mo", output:"-:", tex:null, ttype:DEFINITION},
{input:"divideontimes", tag:"mo", output:"\u22C7", tex:null, ttype:CONST},
{input:"dot", tag:"mover", output:".", tex:null, ttype:UNARY, acc:true},
{input:"doteq", tag:"mo", output:"\u2250", tex:null, ttype:CONST},
{input:"Doteq", tag:"mo", output:"\u2251", tex:null, ttype:CONST},
{input:"dotplus", tag:"mo", output:"\u2214", tex:null, ttype:CONST},
{input:"dots", tag:"mo", output:"\u2026", tex:null, ttype:CONST},
{input:"doublebarwedge", tag:"mo", output:"\u2A5E", tex:null, ttype:CONST},
{input:"downarrow", tag:"mo", output:"\u2193", tex:null, ttype:CONST},
{input:"Downarrow", tag:"mo", output:"\u21D3", tex:null, ttype:CONST},
{input:"downdownarrows", tag:"mo", output:"\u21CA", tex:null, ttype:CONST},
{input:"downharpoonleft", tag:"mo", output:"\u21C3", tex:null, ttype:CONST},
{input:"downharpoonright", tag:"mo", output:"\u21C2", tex:null, ttype:CONST},
{input:"dt", tag:"mi", output:"{:d t:}", tex:null, ttype:DEFINITION},
{input:"dx", tag:"mi", output:"{:d x:}", tex:null, ttype:DEFINITION},
{input:"dy", tag:"mi", output:"{:d y:}", tex:null, ttype:DEFINITION},
{input:"dz", tag:"mi", output:"{:d z:}", tex:null, ttype:DEFINITION},
{input:"EE", tag:"mo", output:"\u2203", tex:"exists", ttype:CONST},
{input:"ell", tag:"mo", output:"\u2113", tex:null, ttype:CONST},
{input:"emptyset", tag:"mo", output:"\u2205", tex:null, ttype:CONST},
{input:"epsilon", tag:"mi", output:"\u03B5", tex:null, ttype:CONST},
{input:"eqcirc", tag:"mo", output:"\u2256", tex:null, ttype:CONST},
{input:"eqsim", tag:"mo", output:"\u2242", tex:null, ttype:CONST},
{input:"eqslantgtr", tag:"mo", output:"\u2A96", tex:null, ttype:CONST},
{input:"eqslantless", tag:"mo", output:"\u2A95", tex:null, ttype:CONST},
{input:"equiv", tag:"mo", output:"\u2261", tex:null, ttype:CONST},
{input:"eta", tag:"mi", output:"\u03B7", tex:null, ttype:CONST},
{input:"exists", tag:"mo", output:"\u2203", tex:null, ttype:CONST},
{input:"exp", tag:"mi", output:"exp", tex:null, ttype:UNARY, func:true},
//{input:"f", tag:"mi", output:"f", tex:null, ttype:UNARY, func:true, val:true},
{input:"fallingdotseq", tag:"mo", output:"\u2252", tex:null, ttype:CONST},
{input:"Finv", tag:"mo", output:"\u2132", tex:null, ttype:CONST},
{input:"flat", tag:"mo", output:"\u266D", tex:null, ttype:CONST},
{input:"forall", tag:"mo", output:"\u2200", tex:null, ttype:CONST},
{input:"fr", tag:"mstyle", atname:"mathvariant", atval:"fraktur", output:"fr", tex:null, ttype:UNARY, codes:AMfrk},
{input:"frac", tag:"mfrac", output:"/", tex:null, ttype:BINARY},
{input:"frac", tag:"mfrac", output:"/", tex:null, ttype:BINARY},
{input:"frac12", tag:"mo", output:"\u00BD", tex:null, ttype:CONST},
{input:"frac13", tag:"mo", output:"\u2153", tex:null, ttype:CONST},
{input:"frac14", tag:"mo", output:"\u00BC", tex:null, ttype:CONST},
{input:"frac15", tag:"mo", output:"\u2155", tex:null, ttype:CONST},
{input:"frac16", tag:"mo", output:"\u2159", tex:null, ttype:CONST},
{input:"frac18", tag:"mo", output:"\u215B", tex:null, ttype:CONST},
{input:"frac23", tag:"mo", output:"\u2154", tex:null, ttype:CONST},
{input:"frac25", tag:"mo", output:"\u2156", tex:null, ttype:CONST},
{input:"frac34", tag:"mo", output:"\u00BE", tex:null, ttype:CONST},
{input:"frac35", tag:"mo", output:"\u2157", tex:null, ttype:CONST},
{input:"frac38", tag:"mo", output:"\u215C", tex:null, ttype:CONST},
{input:"frac45", tag:"mo", output:"\u2158", tex:null, ttype:CONST},
{input:"frac56", tag:"mo", output:"\u215A", tex:null, ttype:CONST},
{input:"frac58", tag:"mo", output:"\u215D", tex:null, ttype:CONST},
{input:"frac78", tag:"mo", output:"\u215E", tex:null, ttype:CONST},
{input:"frown", tag:"mo", output:"\u2322", tex:null, ttype:CONST},
//{input:"g", tag:"mi", output:"g", tex:null, ttype:UNARY, func:true, val:true},
{input:"Game", tag:"mo", output:"\u2141", tex:null, ttype:CONST},
{input:"gamma", tag:"mi", output:"\u03B3", tex:null, ttype:CONST},
{input:"Gamma", tag:"mo", output:"\u0393", tex:null, ttype:CONST},
{input:"gcd", tag:"mo", output:"gcd", tex:null, ttype:UNARY, func:true},
{input:"ge", tag:"mo", output:"\u2265", tex:null, ttype:CONST},
{input:"geq", tag:"mo", output:"\u2265", tex:null, ttype:CONST},
{input:"geqq", tag:"mo", output:"\u2267", tex:null, ttype:CONST},
{input:"geqslant", tag:"mo", output:"\u2265", tex:null, ttype:CONST},
{input:"gets", tag:"mo", output:"\u2190", tex:null, ttype:CONST},
{input:"gg", tag:"mo", output:"\u226B", tex:null, ttype:CONST},
{input:"ggg", tag:"mo", output:"\u22D9", tex:null, ttype:CONST},
{input:"gimel", tag:"mo", output:"\u2137", tex:null, ttype:CONST},
{input:"glb", tag:"mo", output:"glb", tex:null, ttype:CONST},
{input:"gnapprox", tag:"mo", output:"\u2A8A", tex:null, ttype:CONST},
{input:"gneq", tag:"mo", output:"\u2A88", tex:null, ttype:CONST},
{input:"gneqq", tag:"mo", output:"\u2269", tex:null, ttype:CONST},
{input:"gnsim", tag:"mo", output:"\u22E7", tex:null, ttype:CONST},
{input:"grad", tag:"mo", output:"\u2207", tex:"nabla", ttype:CONST},
{input:"grave", tag:"mover", output:"\u0060", tex:null, ttype:UNARY, acc:true},
{input:"gt", tag:"mo", output:"\u003E", tex:null, ttype:CONST},
{input:"gt=", tag:"mo", output:"\u2265", tex:"geq", ttype:CONST},
{input:"gtrapprox", tag:"mo", output:"\u2A86", tex:null, ttype:CONST},
{input:"gtrdot", tag:"mo", output:"\u22D7", tex:null, ttype:CONST},
{input:"gtreqless", tag:"mo", output:"\u22DB", tex:null, ttype:CONST},
{input:"gtreqqless", tag:"mo", output:"\u2A8C", tex:null, ttype:CONST},
{input:"gtrless", tag:"mo", output:"\u2277", tex:null, ttype:CONST},
{input:"gtrsim", tag:"mo", output:"\u2273", tex:null, ttype:CONST},
{input:"harr", tag:"mo", output:"\u2194", tex:"leftrightarrow", ttype:CONST},
{input:"hArr", tag:"mo", output:"\u21D4", tex:"Leftrightarrow", ttype:CONST},
{input:"hat", tag:"mover", output:"\u005E", tex:null, ttype:UNARY, acc:true},
{input:"hbar", tag:"mo", output:"\u210F", tex:null, ttype:CONST},
{input:"Heart", tag:"mo", output:"\u2661", tex:"heartsuit", ttype:CONST},
{input:"heartsuit", tag:"mo", output:"\u2661", tex:null, ttype:CONST},
{input:"hom", tag:"mi", output:"hom", tex:null, ttype:UNARY, func:true},
{input:"hookleftarrow", tag:"mo", output:"\u21A9", tex:null, ttype:CONST},
{input:"hookrightarrow", tag:"mo", output:"\u21AA", tex:null, ttype:CONST},
{input:"hslash", tag:"mo", output:"\u210F", tex:null, ttype:CONST},
//{input:"i", tag:"mo", output:"\u0131", tex:null, ttype:CONST},
{input:"if", tag:"mo", output:"if", tex:null, ttype:SPACE},
{input:"iff", tag:"mo", output:"~\\Longleftrightarrow~", tex:null, ttype:DEFINITION},
{input:"iff", tag:"mo", output:"<=>", tex:null, ttype:DEFINITION},
{input:"iiiint", tag:"mo", output:"\u2A0C", tex:null, ttype:CONST},
{input:"iiint", tag:"mo", output:"\u222D", tex:null, ttype:CONST},
{input:"iint", tag:"mo", output:"\u222C", tex:null, ttype:CONST},
{input:"Im", tag:"mo", output:"\u2111", tex:null, ttype:CONST},
{input:"imath", tag:"mo", output:"\uD835\uDEA4", tex:null, ttype:CONST},
{input:"implies", tag:"mo", output:"\u21D2", tex:null, ttype:LONG},
{input:"in", tag:"mo", output:"\u2208", tex:null, ttype:CONST},
{input:"inf", tag:"mo", output:"inf", tex:null, ttype:UNDEROVER},
{input:"infty", tag:"mo", output:"\u221E", tex:null, ttype:CONST},
{input:"int", tag:"mo", output:"\u222B", tex:null, ttype:CONST},
{input:"intercal", tag:"mo", output:"\u22BA", tex:null, ttype:CONST},
{input:"iota", tag:"mi", output:"\u03B9", tex:null, ttype:CONST},
{input:"jmath", tag:"mo", output:"\uD835\uDEA5", tex:null, ttype:CONST},
{input:"Join", tag:"mo", output:"\u22C8", tex:null, ttype:CONST},
{input:"kappa", tag:"mi", output:"\u03BA", tex:null, ttype:CONST},
{input:"ker", tag:"mi", output:"ker", tex:null, ttype:UNARY, func:true},
//{input:"L", tag:"mo", output:"\u0141", tex:null, ttype:CONST},
//{input:"l", tag:"mo", output:"\u0142", tex:null, ttype:CONST},
{input:"lambda", tag:"mi", output:"\u03BB", tex:null, ttype:CONST},
{input:"Lambda", tag:"mo", output:"\u039B", tex:null, ttype:CONST},
{input:"land", tag:"mo", output:"\u2227", tex:null, ttype:CONST},
{input:"langle", tag:"mo", output:"\u2329", atval:"1", tex:null, ttype:STRETCHY},
{input:"larr", tag:"mo", output:"\u2190", tex:"leftarrow", ttype:CONST},
{input:"lArr", tag:"mo", output:"\u21D0", tex:"Leftarrow", ttype:CONST},
{input:"lbrace", tag:"mo", output:"{", atval:"1", tex:null, ttype:STRETCHY},
{input:"lbrack", tag:"mo", output:"[", tex:"[", ttype:LEFTBRACKET},
{input:"lceil", tag:"mo", output:"\u2308", atval:"1", tex:null, ttype:STRETCHY},
{input:"lceiling", tag:"mo", output:"|~", tex:null, ttype:DEFINITION},
{input:"lcm", tag:"mo", output:"lcm", tex:null, ttype:UNARY, func:true},
{input:"ldots", tag:"mo", output:"\u2026", tex:null, ttype:CONST},
{input:"le", tag:"mo", output:"\u2264", tex:null, ttype:CONST},
{input:"left", tag:"mo", output:"\left", tex:null, ttype:LEFTBRACKET},
{input:"leftarrow", tag:"mo", output:"\u2190", tex:null, ttype:CONST},
{input:"Leftarrow", tag:"mo", output:"\u21D0", tex:null, ttype:CONST},
{input:"leftarrowtail", tag:"mo", output:"\u21A2", tex:null, ttype:CONST},
{input:"leftharpoondown", tag:"mo", output:"\u21BD", tex:null, ttype:CONST},
{input:"leftharpoonup", tag:"mo", output:"\u21BC", tex:null, ttype:CONST},
{input:"leftleftarrows", tag:"mo", output:"\u21C7", tex:null, ttype:CONST},
{input:"leftrightarrow", tag:"mo", output:"\u2194", tex:null, ttype:CONST},
{input:"Leftrightarrow", tag:"mo", output:"\u21D4", tex:null, ttype:CONST},
{input:"leftrightarrows", tag:"mo", output:"\u21C6", tex:null, ttype:CONST},
{input:"leftrightharpoons", tag:"mo", output:"\u21CB", tex:null, ttype:CONST},
{input:"leftrightsquigarrow", tag:"mo", output:"\u21AD", tex:null, ttype:CONST},
{input:"leftthreetimes", tag:"mo", output:"\u22CB", tex:null, ttype:CONST},
{input:"leq", tag:"mo", output:"\u2264", tex:null, ttype:CONST},
{input:"leqq", tag:"mo", output:"\u2266", tex:null, ttype:CONST},
{input:"leqslant", tag:"mo", output:"\u2264", tex:null, ttype:CONST},
{input:"lessapprox", tag:"mo", output:"\u2A85", tex:null, ttype:CONST},
{input:"lessdot", tag:"mo", output:"\u22D6", tex:null, ttype:CONST},
{input:"lesseqgtr", tag:"mo", output:"\u22DA", tex:null, ttype:CONST},
{input:"lesseqqgtr", tag:"mo", output:"\u2A8B", tex:null, ttype:CONST},
{input:"lessgtr", tag:"mo", output:"\u2276", tex:null, ttype:CONST},
{input:"lesssim", tag:"mo", output:"\u2272", tex:null, ttype:CONST},
{input:"lfloor", tag:"mo", output:"\u230A", atval:"1", tex:null, ttype:STRETCHY},
{input:"lg", tag:"mi", output:"lg", tex:null, ttype:UNARY, func:true},
{input:"lhd", tag:"mo", output:"\u22B2", tex:null, ttype:CONST},
{input:"lim", tag:"mo", output:"lim", tex:null, ttype:UNDEROVER},
{input:"liminf", tag:"mo", output:"liminf", tex:null, ttype:UNDEROVER},
{input:"limsup", tag:"mo", output:"limsup", tex:null, ttype:UNDEROVER},
{input:"ll", tag:"mo", output:"\u226A", tex:null, ttype:CONST},
{input:"llcorner", tag:"mo", output:"\u231E", tex:null, ttype:CONST},
{input:"Lleftarrow", tag:"mo", output:"\u21DA", tex:null, ttype:CONST},
{input:"lll", tag:"mo", output:"\u22D8", tex:null, ttype:CONST},
{input:"lmoustache", tag:"mo", output:"\u23B0", tex:null, ttype:CONST},
{input:"ln", tag:"mo", output:"ln", tex:null, ttype:UNARY, func:true},
{input:"lnapprox", tag:"mo", output:"\u2A89", tex:null, ttype:CONST},
{input:"lneq", tag:"mo", output:"\u2A87", tex:null, ttype:CONST},
{input:"lneqq", tag:"mo", output:"\u2268", tex:null, ttype:CONST},
{input:"lnot", tag:"mo", output:"\u00AC", tex:null, ttype:CONST},
{input:"lnsim", tag:"mo", output:"\u22E6", tex:null, ttype:CONST},
{input:"log", tag:"mo", output:"log", tex:null, ttype:UNARY, func:true},
{input:"longleftarrow", tag:"mo", output:"\u2190", tex:null, ttype:LONG},
{input:"Longleftarrow", tag:"mo", output:"\u21D0", tex:null, ttype:LONG},
{input:"longleftrightarrow", tag:"mo", output:"\u2194", tex:null, ttype:LONG},
{input:"Longleftrightarrow", tag:"mo", output:"\u21D4", tex:null, ttype:LONG},
{input:"longmapsto", tag:"mo", output:"\u21A6", tex:null, ttype:CONST},
{input:"longrightarrow", tag:"mo", output:"\u2192", tex:null, ttype:LONG},
{input:"Longrightarrow", tag:"mo", output:"\u21D2", tex:null, ttype:LONG},
{input:"looparrowleft", tag:"mo", output:"\u21AB", tex:null, ttype:CONST},
{input:"looparrowright", tag:"mo", output:"\u21AC", tex:null, ttype:CONST},
{input:"lor", tag:"mo", output:"\u2228", tex:null, ttype:CONST},
{input:"lozenge", tag:"mo", output:"\u25CA", tex:null, ttype:CONST},
{input:"lrcorner", tag:"mo", output:"\u231F", tex:null, ttype:CONST},
{input:"Lsh", tag:"mo", output:"\u21B0", tex:null, ttype:CONST},
{input:"-lt", tag:"mo", output:"\u227A", tex:null, ttype:CONST},
{input:"lt", tag:"mo", output:"\u003C", tex:null, ttype:CONST},
{input:"lt=", tag:"mo", output:"\u2264", tex:"leq", ttype:CONST},
{input:"ltimes", tag:"mo", output:"\u22C9", tex:null, ttype:CONST},
{input:"lub", tag:"mo", output:"lub", tex:null, ttype:CONST},
{input:"maltese", tag:"mo", output:"\u2720", tex:null, ttype:CONST},
{input:"mapsto", tag:"mo", output:"\u21A6", tex:null, ttype:CONST},
{input:"mathbb", tag:"mstyle", atname:"mathvariant", atval:"double-struck", output:"mathbb", tex:null, ttype:UNARY, codes:AMbbb},
{input:"mathbf", tag:"mstyle", atname:"fontweight", atval:"bold", output:"mathbf", tex:null, ttype:UNARY},
{input:"mathcal", tag:"mstyle", atname:"mathvariant", atval:"script", output:"mathcal", tex:null, ttype:UNARY, codes:AMcal},
{input:"mathfrak", tag:"mstyle", atname:"mathvariant", atval:"fraktur", output:"mathfrak", tex:null, ttype:UNARY, codes:AMfrk},
{input:"mathit", tag:"mstyle", atname:"mathvariant", atval:"italic", tex:null, ttype:UNARY},
{input:"mathrm", tag:"mtext", output:"text", tex:null, ttype:TEXT},
{input:"mathsf", tag:"mstyle", atname:"fontfamily", atval:"sans-serif", output:"mathsf", tex:null, ttype:UNARY},
{input:"mathtt", tag:"mstyle", atname:"fontfamily", atval:"monospace", output:"mathtt", tex:null, ttype:UNARY},
{input:"max", tag:"mo", output:"max", tex:null, ttype:UNDEROVER},
{input:"mbox", tag:"mtext", output:"mbox", tex:null, ttype:TEXT},
{input:"measuredangle", tag:"mo", output:"\u2221", tex:null, ttype:CONST},
{input:"mho", tag:"mo", output:"\u2127", tex:null, ttype:CONST},
{input:"mid", tag:"mo", output:"\u2223", atval:"1", tex:null, ttype:STRETCHY},
{input:"min", tag:"mo", output:"min", tex:null, ttype:UNDEROVER},
{input:"mod", tag:"mo", output:"mod", tex:null, ttype:CONST},
{input:"models", tag:"mo", output:"\u22A8", tex:null, ttype:CONST},
{input:"mp", tag:"mo", output:"\u2213", tex:null, ttype:CONST},
{input:"mu", tag:"mi", output:"\u03BC", tex:null, ttype:CONST},
{input:"multimap", tag:"mo", output:"\u22B8", tex:null, ttype:CONST},
{input:"nabla", tag:"mo", output:"\u2207", tex:null, ttype:CONST},
{input:"natural", tag:"mo", output:"\u266E", tex:null, ttype:CONST},
{input:"ncong", tag:"mo", output:"\u2247", tex:null, ttype:CONST},
{input:"ne", tag:"mo", output:"\u2260", tex:null, ttype:CONST},
{input:"nearrow", tag:"mo", output:"\u2197", tex:null, ttype:CONST},
{input:"neg", tag:"mo", output:"\u00AC", tex:null, ttype:CONST},
{input:"neq", tag:"mo", output:"\u2260", tex:null, ttype:CONST},
{input:"nexists", tag:"mo", output:"\u2204", tex:null, ttype:CONST},
{input:"ngeq", tag:"mo", output:"\u2271", tex:null, ttype:CONST},
{input:"ngtr", tag:"mo", output:"\u226F", tex:null, ttype:CONST},
{input:"ni", tag:"mo", output:"\u220B", tex:null, ttype:CONST},
{input:"nleftarrow", tag:"mo", output:"\u219A", tex:null, ttype:CONST},
{input:"nLeftarrow", tag:"mo", output:"\u21CD", tex:null, ttype:CONST},
{input:"nleftrightarrow", tag:"mo", output:"\u21AE", tex:null, ttype:CONST},
{input:"nLeftrightarrow", tag:"mo", output:"\u21CE", tex:null, ttype:CONST},
{input:"nleq", tag:"mo", output:"\u2270", tex:null, ttype:CONST},
{input:"nless", tag:"mo", output:"\u226E", tex:null, ttype:CONST},
{input:"nmid", tag:"mo", output:"\u2224", tex:null, ttype:CONST},
{input:"NN", tag:"mo", output:"\u2115", tex:"mathbb{N}", ttype:CONST, notexcopy:true},
{input:"nn", tag:"mo", output:"\u2229", tex:"cap", ttype:CONST},
{input:"nnn", tag:"mo", output:"\u22C2", tex:"bigcap", ttype:UNDEROVER},
{input:"not", tag:"mo", output:"\u00AC", tex:"neg", ttype:CONST},
{input:"not\\leq", tag:"mo", output:"\u2270", tex:null, ttype:CONST},
{input:"not<", tag:"mo", output:"\u226E", tex:"not<", ttype:CONST},
{input:"not=", tag:"mo", output:"\u2260", tex:"not=", ttype:CONST},
{input:"not>", tag:"mo", output:"\u226F", tex:"not>", ttype:CONST},
{input:"notexist", tag:"mo", output:"\u2204", tex:"not\\exists", ttype:CONST},
{input:"notgeq", tag:"mo", output:"\u2271", tex:"not\\geq", ttype:CONST},
{input:"notin", tag:"mo", output:"\u2209", tex:null, ttype:CONST},
{input:"notleq", tag:"mo", output:"\u2270", tex:"not\\leq", ttype:CONST},
{input:"notni", tag:"mo", output:"\u220C", tex:"not\\ni", ttype:CONST},
{input:"notsubset", tag:"mo", output:"\u2284", tex:"not\\subset", ttype:CONST},
{input:"notsubseteq", tag:"mo", output:"\u2288", tex:"not\\subseteq", ttype:CONST},
{input:"notsupset", tag:"mo", output:"\u2285", tex:"not\\supset", ttype:CONST},
{input:"notsupseteq", tag:"mo", output:"\u2289", tex:"not\\supseteq", ttype:CONST},
{input:"nparallel", tag:"mo", output:"\u2226", tex:null, ttype:CONST},
{input:"nprec", tag:"mo", output:"\u2280", tex:null, ttype:CONST},
{input:"nrightarrow", tag:"mo", output:"\u219B", tex:null, ttype:CONST},
{input:"nRightarrow", tag:"mo", output:"\u21CF", tex:null, ttype:CONST},
{input:"nsim", tag:"mo", output:"\u2241", tex:null, ttype:CONST},
{input:"nsubseteq", tag:"mo", output:"\u2288", tex:null, ttype:CONST},
{input:"nsucc", tag:"mo", output:"\u2281", tex:null, ttype:CONST},
{input:"nsupseteq", tag:"mo", output:"\u2289", tex:null, ttype:CONST},
{input:"ntriangleleft", tag:"mo", output:"\u22EA", tex:null, ttype:CONST},
{input:"ntrianglelefteq", tag:"mo", output:"\u22EC", tex:null, ttype:CONST},
{input:"ntriangleright", tag:"mo", output:"\u22EB", tex:null, ttype:CONST},
{input:"ntrianglerighteq", tag:"mo", output:"\u22ED", tex:null, ttype:CONST},
{input:"nu", tag:"mi", output:"\u03BD", tex:null, ttype:CONST},
{input:"nwarrow", tag:"mo", output:"\u2196", tex:null, ttype:CONST},
{input:"nvdash", tag:"mo", output:"\u22AC", tex:null, ttype:CONST},
{input:"nvDash", tag:"mo", output:"\u22AD", tex:null, ttype:CONST},
{input:"nVdash", tag:"mo", output:"\u22AE", tex:null, ttype:CONST},
{input:"nVDash", tag:"mo", output:"\u22AF", tex:null, ttype:CONST},
//{input:"O", tag:"mo", output:"\u00D8", tex:null, ttype:CONST},
//{input:"o", tag:"mo", output:"\u00F8", tex:null, ttype:CONST},
{input:"o.", tag:"mo", output:"\u2299", tex:"odot", ttype:CONST},
{input:"O/", tag:"mo", output:"\u2205", tex:"emptyset", ttype:CONST},
{input:"o+", tag:"mo", output:"\u2295", tex:"oplus", ttype:CONST},
{input:"odot", tag:"mo", output:"\u2299", tex:null, ttype:CONST},
{input:"OE", tag:"mo", output:"Œ", tex:null, ttype:CONST},
{input:"oe", tag:"mo", output:"œ", tex:null, ttype:CONST},
{input:"oint", tag:"mo", output:"\u222E", tex:null, ttype:CONST},
{input:"omega", tag:"mi", output:"\u03C9", tex:null, ttype:CONST},
{input:"Omega", tag:"mo", output:"\u03A9", tex:null, ttype:CONST},
{input:"ominus", tag:"mo", output:"\u2296", tex:null, ttype:CONST},
{input:"oo", tag:"mo", output:"\u221E", tex:"infty", ttype:CONST},
{input:"oplus", tag:"mo", output:"\u2295", tex:null, ttype:CONST},
{input:"or", tag:"mtext", output:"or", tex:null, ttype:SPACE},
{input:"oslash", tag:"mo", output:"\u2298", tex:null, ttype:CONST},
{input:"otimes", tag:"mo", output:"\u2297", tex:null, ttype:CONST},
{input:"overbrace", tag:"mover", output:"\u23B4", tex:null, ttype:UNARY, acc:true},
{input:"overleftarrow",tag:"mover", output:"\u20D6", tex:null, ttype:UNARY, acc:true},
{input:"overleftrightarrow", tag:"mo", output:"\u20E1", tex:null, ttype:CONST},
{input:"overline", tag:"mover", output:"\u00AF", tex:null, ttype:UNARY, acc:true},
{input:"owns", tag:"mo", output:"\u220B", tex:"ni", ttype:CONST},
{input:"ox", tag:"mo", output:"\u2297", tex:"otimes", ttype:CONST},
{input:"parallel", tag:"mo", output:"\u2225", atval:"1", tex:null, ttype:STRETCHY},
{input:"partial", tag:"mo", output:"\u2202", tex:null, ttype:CONST},
{input:"perp", tag:"mo", output:"\u22A5", tex:null, ttype:CONST},
{input:"phi", tag:"mi", output:"\u03C6", tex:null, ttype:CONST},
{input:"Phi", tag:"mo", output:"\u03A6", tex:null, ttype:CONST},
{input:"pi", tag:"mi", output:"\u03C0", tex:null, ttype:CONST},
{input:"Pi", tag:"mo", output:"\u03A0", tex:null, ttype:CONST},
{input:"pitchfork", tag:"mo", output:"\u22D4", tex:null, ttype:CONST},
{input:"pm", tag:"mo", output:"\u00B1", tex:null, ttype:CONST},
{input:"Pr", tag:"mi", output:"Pr", tex:null, ttype:UNARY, func:true},
{input:"prec", tag:"mo", output:"\u227A", tex:null, ttype:CONST},
{input:"precapprox", tag:"mo", output:"\u2AB7", tex:null, ttype:CONST},
{input:"preccurlyeq", tag:"mo", output:"\u227C", tex:null, ttype:CONST},
{input:"preceq", tag:"mo", output:"\u227C", tex:null, ttype:CONST},
{input:"precnapprox", tag:"mo", output:"\u2AB9", tex:null, ttype:CONST},
{input:"precneqq", tag:"mo", output:"\u2AB5", tex:null, ttype:CONST},
{input:"precnsim", tag:"mo", output:"\u22E8", tex:null, ttype:CONST},
{input:"precsim", tag:"mo", output:"\u227E", tex:null, ttype:CONST},
{input:"prime", tag:"mo", output:"\u2032", tex:null, ttype:CONST},
{input:"prod", tag:"mo", output:"\u220F", tex:null, ttype:UNDEROVER},
{input:"prop", tag:"mo", output:"\u221D", tex:"propto", ttype:CONST},
{input:"propto", tag:"mo", output:"\u221D", tex:null, ttype:CONST},
{input:"Psi", tag:"mi", output:"\u03A8", tex:null, ttype:CONST},
{input:"psi", tag:"mi", output:"\u03C8", tex:null, ttype:CONST},
{input:"QQ", tag:"mo", output:"\u211A", tex:"mathbb{Q}", ttype:CONST, notexcopy:true},
{input:"qquad", tag:"mo", output:"\u00A0\u00A0\u00A0\u00A0", tex:null, ttype:CONST},
{input:"quad", tag:"mo", output:"\u00A0\u00A0", tex:null, ttype:CONST},
{input:"quad", tag:"mspace", atname:"width", atval:"1em", tex:null, ttype:SPACE},
{input:"rangle",tag:"mo",output:"\u232A", rtag:"mi",atval:"1", tex:"rangle", ttype:STRETCHY},
{input:"rarr", tag:"mo", output:"\u2192", tex:"rightarrow", ttype:CONST},
{input:"rArr", tag:"mo", output:"\u21D2", tex:"Rightarrow", ttype:CONST},
{input:"rbrace",tag:"mo",output:"}", rtag:"mi",atval:"1", tex:"rbrace", ttype:STRETCHY},
{input:"rbrack",tag:"mo",output:"]", tex:"]", ttype:RIGHTBRACKET},
{input:"rceil", tag:"mo",output:"\u2309", rtag:"mi",atval:"1", tex:"rceil", ttype:STRETCHY},
{input:"rceiling", tag:"mo", output:"~|", tex:null, ttype:DEFINITION},
{input:"Re", tag:"mo", output:"\u211C", tex:null, ttype:CONST},
{input:"rfloor",tag:"mo",output:"\u230B", rtag:"mi",atval:"1", tex:"rfloor", ttype:STRETCHY},
{input:"rhd", tag:"mo", output:"\u22B3", tex:null, ttype:CONST},
{input:"rho", tag:"mi", output:"\u03C1", tex:null, ttype:CONST},
{input:"right", tag:"mo", output:"\right", tex:null, ttype:RIGHTBRACKET},
{input:"rightarrow", tag:"mo", output:"\u2192", tex:null, ttype:CONST},
{input:"Rightarrow", tag:"mo", output:"\u21D2", tex:null, ttype:CONST},
{input:"rightarrowtail", tag:"mo", output:"\u21A3", tex:null, ttype:CONST},
{input:"rightharpoondown", tag:"mo", output:"\u21C1", tex:null, ttype:CONST},
{input:"rightharpoonup", tag:"mo", output:"\u21C0", tex:null, ttype:CONST},
{input:"rightleftarrows", tag:"mo", output:"\u21C4", tex:null, ttype:CONST},
{input:"rightleftharpoons", tag:"mo", output:"\u21CC", tex:null, ttype:CONST},
{input:"rightrightarrows", tag:"mo", output:"\u21C9", tex:null, ttype:CONST},
{input:"rightsquigarrow", tag:"mo", output:"\u21DD", tex:null, ttype:CONST},
{input:"rightthreetimes", tag:"mo", output:"\u22CC", tex:null, ttype:CONST},
{input:"risingdotseq", tag:"mo", output:"\u2253", tex:null, ttype:CONST},
{input:"rmoustache", tag:"mo", output:"\u23B1", tex:null, ttype:CONST},
{input:"root", tag:"mroot", output:"root", tex:null, ttype:BINARY},
{input:"RR", tag:"mo", output:"\u211D", tex:"mathbb{R}", ttype:CONST, notexcopy:true},
{input:"Rrightarrow", tag:"mo", output:"\u21DB", tex:null, ttype:CONST},
{input:"Rsh", tag:"mo", output:"\u21B1", tex:null, ttype:CONST},
{input:"rtimes", tag:"mo", output:"\u22CA", tex:null, ttype:CONST},
//{input:"S", tag:"mo", output:"\u00A7", tex:null, ttype:CONST},
{input:"s0s", tag:"mo", output:"\u200B", tex:"!", ttype:CONST},
{input:"s1s", tag:"mo", output:"\u200A", tex:"hspace{1}", ttype:CONST},
{input:"s2s", tag:"mo", output:"\u2009", tex:"hspace{2}", ttype:CONST},
{input:"s3s", tag:"mo", output:"\u2002", tex:"hspace{5}", ttype:CONST},
{input:"s4s", tag:"mo", output:"\u2003", tex:"hspace{10}", ttype:CONST},
{input:"scriptscriptstyle",tag:"mstyle",atname:"scriptlevel",atval:"2", tex:null, ttype:UNARY},
{input:"scriptstyle",tag:"mstyle",atname:"scriptlevel",atval:"1", tex:null, ttype:UNARY},
{input:"searrow", tag:"mo", output:"\u2198", tex:null, ttype:CONST},
{input:"sec", tag:"mo", output:"sec", tex:null, ttype:UNARY, func:true},
{input:"setminus", tag:"mo", output:"\\", tex:null, ttype:CONST},
{input:"setminus", tag:"mo", output:"\\", tex:null, ttype:CONST},
{input:"sf", tag:"mstyle", atname:"fontfamily", atval:"sans-serif", output:"sf", tex:null, ttype:UNARY},
{input:"sharp", tag:"mo", output:"\u266F", tex:null, ttype:CONST},
{input:"sigma", tag:"mi", output:"\u03C3", tex:null, ttype:CONST},
{input:"Sigma", tag:"mo", output:"\u03A3", tex:null, ttype:CONST},
{input:"sim", tag:"mo", output:"\u223C", tex:null, ttype:CONST},
{input:"simeq", tag:"mo", output:"\u2243", tex:null, ttype:CONST},
{input:"sin", tag:"mo", output:"sin", tex:null, ttype:UNARY, func:true},
{input:"sinh", tag:"mo", output:"sinh", tex:null, ttype:UNARY, func:true},
{input:"slash", tag:"mo", output:"\u2215", tex:null, ttype:CONST},
{input:"smallint", tag:"mo", output:"\u222B", tex:null, ttype:CONST},
{input:"smallsetminus", tag:"mo", output:"\u2216", tex:null, ttype:CONST},
{input:"smile", tag:"mo", output:"\u2323", tex:null, ttype:CONST},
{input:"spadesuit", tag:"mo", output:"\u2660", tex:null, ttype:CONST},
{input:"sphericalangle", tag:"mo", output:"\u2222", tex:null, ttype:CONST},
{input:"sqcap", tag:"mo", output:"\u2293", tex:null, ttype:CONST},
{input:"sqcup", tag:"mo", output:"\u2294", tex:null, ttype:CONST},
{input:"sqrt", tag:"msqrt", output:"sqrt", tex:null, ttype:UNARY},
{input:"sqsubset", tag:"mo", output:"\u228F", tex:null, ttype:CONST},//MimeTex bug
{input:"sqsubseteq", tag:"mo", output:"\u2291", tex:null, ttype:CONST},
{input:"sqsupset", tag:"mo", output:"\u2290", tex:null, ttype:CONST},//MimeTex bug
{input:"sqsupseteq", tag:"mo", output:"\u2292", tex:null, ttype:CONST},
{input:"square", tag:"mo", output:"\u25A1", tex:null, ttype:CONST},
{input:"ss", tag:"mo", output:"\u00DF", tex:null, ttype:CONST},
{input:"stackrel", tag:"mover", output:"stackrel", tex:null, ttype:BINARY},
{input:"stackrel", tag:"mover", output:"stackrel", tex:null, ttype:BINARY},
{input:"star", tag:"mo", output:"\u22C6", tex:null, ttype:CONST},
{input:"subset", tag:"mo", output:"\u2282", tex:null, ttype:CONST},
{input:"Subset", tag:"mo", output:"\u22D0", tex:null, ttype:CONST},
{input:"subseteq", tag:"mo", output:"\u2286", tex:null, ttype:CONST},
{input:"subseteqq", tag:"mo", output:"\u2AC5", tex:null, ttype:CONST},
{input:"subsetneq", tag:"mo", output:"\u228A", tex:null, ttype:CONST},
{input:"subsetneqq", tag:"mo", output:"\u2ACB", tex:null, ttype:CONST},
{input:"succ", tag:"mo", output:"\u227B", tex:null, ttype:CONST},
{input:"succapprox", tag:"mo", output:"\u2AB8", tex:null, ttype:CONST},
{input:"succcurlyeq", tag:"mo", output:"\u227D", tex:null, ttype:CONST},
{input:"succeq", tag:"mo", output:"\u227D", tex:null, ttype:CONST},
{input:"succnapprox", tag:"mo", output:"\u2ABA", tex:null, ttype:CONST},
{input:"succneqq", tag:"mo", output:"\u2AB6", tex:null, ttype:CONST},
{input:"succnsim", tag:"mo", output:"\u22E9", tex:null, ttype:CONST},
{input:"succsim", tag:"mo", output:"\u227F", tex:null, ttype:CONST},
{input:"sum", tag:"mo", output:"\u2211", tex:null, ttype:UNDEROVER},
{input:"sup", tag:"mo", output:"sup", tex:null, ttype:UNDEROVER},
{input:"supset", tag:"mo", output:"\u2283", tex:null, ttype:CONST},
{input:"Supset", tag:"mo", output:"\u22D1", tex:null, ttype:CONST},
{input:"supseteq", tag:"mo", output:"\u2287", tex:null, ttype:CONST},
{input:"supseteqq", tag:"mo", output:"\u2AC6", tex:null, ttype:CONST},
{input:"supsetneq", tag:"mo", output:"\u228B", tex:null, ttype:CONST},
{input:"supsetneqq", tag:"mo", output:"\u2ACC", tex:null, ttype:CONST},
{input:"surd", tag:"mo", output:"sqrt", tex:null, ttype:DEFINITION},
{input:"swarrow", tag:"mo", output:"\u2199", tex:null, ttype:CONST},
{input:"tan", tag:"mo", output:"tan", tex:null, ttype:UNARY, func:true},
{input:"tanh", tag:"mo", output:"tanh", tex:null, ttype:UNARY, func:true},
{input:"tau", tag:"mi", output:"\u03C4", tex:null, ttype:CONST},
{input:"text", tag:"mtext", output:"text", tex:null, ttype:TEXT},
{input:"textasciicircum", tag:"mo", output:"\u005E", tex:null, ttype:CONST},
{input:"textasciitilde", tag:"mo", output:"\u007E", tex:null, ttype:CONST},
{input:"textbf", tag:"mstyle", atname:"mathvariant", atval:"bold", tex:null, ttype:UNARY},
{input:"textcopyright", tag:"mo", output:"\u00A9", tex:null, ttype:CONST},
{input:"textdegree", tag:"mo", output:"\u00B0", tex:null, ttype:CONST},
{input:"textdollar", tag:"mo", output:"\u0024", tex:null, ttype:CONST},
{input:"textit", tag:"mstyle", atname:"mathvariant", atval:"italic", tex:null, ttype:UNARY},
{input:"textonehalf", tag:"mo", output:"\u00BD", tex:null, ttype:CONST},
{input:"textonequarter", tag:"mo", output:"\u00BC", tex:null, ttype:CONST},
{input:"textordfeminine", tag:"mo", output:"\u00AA", tex:null, ttype:CONST},
{input:"textordmasculine", tag:"mo", output:"\u00BA", tex:null, ttype:CONST},
{input:"textregistered", tag:"mo", output:"\u00AE", tex:null, ttype:CONST},
{input:"textrm", tag:"mstyle", output:"\\mathrm", tex:null, ttype: DEFINITION},
{input:"textstyle",tag:"mstyle",atname:"displaystyle",atval:"false", tex:null, ttype:UNARY},
{input:"textthreequarters", tag:"mo", output:"\u00BE", tex:null, ttype:CONST},
{input:"texttrademark", tag:"mo", output:"\u2122", tex:null, ttype:CONST},
{input:"texttt", tag:"mstyle", atname:"mathvariant", atval:"monospace", tex:null, ttype:UNARY},
{input:"therefore", tag:"mo", output:"\u2234", tex:null, ttype:CONST},
{input:"theta", tag:"mi", output:"\u03B8", tex:null, ttype:CONST},
{input:"Theta", tag:"mo", output:"\u0398", tex:null, ttype:CONST},
{input:"thickapprox", tag:"mo", output:"\u2248", tex:null, ttype:CONST},
{input:"thicksim", tag:"mo", output:"\u223C", tex:null, ttype:CONST},
{input:"tilde", tag:"mover", output:"~", tex:null, ttype:UNARY, acc:true},
{input:"times", tag:"mo", output:"\u00D7", tex:null, ttype:CONST},
{input:"to", tag:"mo", output:"\u2192", tex:null, ttype:CONST},
{input:"top", tag:"mo", output:"\u22A4", tex:null, ttype:CONST},
{input:"triangle", tag:"mo", output:"\u25B3", tex:null, ttype:CONST},
{input:"triangledown", tag:"mo", output:"\u25BF", tex:null, ttype:CONST},
{input:"triangleleft",tag:"mo", output:"\u22B2", tex:null, ttype:CONST},
{input:"trianglelefteq", tag:"mo", output:"\u22B4", tex:null, ttype:CONST},
{input:"triangleq", tag:"mo", output:"\u225C", tex:null, ttype:CONST},
{input:"triangleright",tag:"mo",output:"\u22B3", tex:null, ttype:CONST},
{input:"trianglerighteq", tag:"mo", output:"\u22B5", tex:null, ttype:CONST},
{input:"TT", tag:"mo", output:"\u22A4", tex:"top", ttype:CONST},
{input:"tt", tag:"mstyle", atname:"fontfamily", atval:"monospace", output:"tt", tex:null, ttype:UNARY},
{input:"twoheadleftarrow", tag:"mo", output:"\u219E", tex:null, ttype:CONST},
{input:"twoheadrightarrow", tag:"mo", output:"\u21A0", tex:null, ttype:CONST},
{input:"uarr", tag:"mo", output:"\u2191", tex:"uparrow", ttype:CONST},
{input:"ul", tag:"munder", output:"\u0332", tex:"underline", ttype:UNARY, acc:true},
{input:"ulcorner", tag:"mo", output:"\u231C", tex:null, ttype:CONST},
{input:"underbrace", tag:"munder", output:"\u23B5", tex:null, ttype:UNARY, acc:true},
{input:"underleftarrow", tag:"mo", output:"\u20EE", tex:null, ttype:CONST},
{input:"underline", tag:"munder", output:"\u00AF", tex:null, ttype:UNARY, acc:true},
{input:"underrightarrow", tag:"mo", output:"\u20EF", tex:null, ttype:CONST},
{input:"unlhd", tag:"mo", output:"\u22B4", tex:null, ttype:CONST},
{input:"unrhd", tag:"mo", output:"\u22B5", tex:null, ttype:CONST},
{input:"uparrow", tag:"mo", output:"\u2191", tex:null, ttype:CONST},
{input:"Uparrow", tag:"mo", output:"\u21D1", tex:null, ttype:CONST},
{input:"updownarrow", tag:"mo", output:"\u2195", tex:null, ttype:CONST},
{input:"Updownarrow", tag:"mo", output:"\u21D5", tex:null, ttype:CONST},
{input:"upharpoonleft", tag:"mo", output:"\u21BF", tex:null, ttype:CONST},
{input:"upharpoonright", tag:"mo", output:"\u21BE", tex:null, ttype:CONST},
{input:"uplus", tag:"mo", output:"\u228E", tex:null, ttype:CONST},
{input:"upsilon", tag:"mi", output:"\u03C5", tex:null, ttype:CONST},
{input:"Upsilon", tag:"mo", output:"\u03A5", tex:null, ttype:CONST},
{input:"upuparrows", tag:"mo", output:"\u21C8", tex:null, ttype:CONST},
{input:"urcorner", tag:"mo", output:"\u231D", tex:null, ttype:CONST},
{input:"uu", tag:"mo", output:"\u222A", tex:"cup", ttype:CONST},
{input:"uuu", tag:"mo", output:"\u22C3", tex:"bigcup", ttype:UNDEROVER},
{input:"varepsilon", tag:"mi", output:"\u025B", tex:null, ttype:CONST},
{input:"varnothing", tag:"mo", output:"\u2205", tex:null, ttype:CONST},
{input:"varphi", tag:"mi", output:"\u03D5", tex:null, ttype:CONST},
{input:"varpi", tag:"mi", output:"\u03D6", tex:null, ttype:CONST},
{input:"varpropto", tag:"mo", output:"\u221D", tex:null, ttype:CONST},
{input:"varrho", tag:"mi", output:"\u03F1", tex:null, ttype:CONST},
{input:"varsigma", tag:"mi", output:"\u03C2", tex:null, ttype:CONST},
{input:"vartheta", tag:"mi", output:"\u03D1", tex:null, ttype:CONST},
{input:"vartriangle", tag:"mo", output:"\u22B5", tex:null, ttype:CONST},
{input:"vartriangleleft", tag:"mo", output:"\u22B2", tex:null, ttype:CONST},
{input:"vartriangleright", tag:"mo", output:"\u22B3", tex:null, ttype:CONST},
{input:"vdash", tag:"mo", output:"\u22A2", tex:null, ttype:CONST},
{input:"vDash", tag:"mo", output:"\u22A8", tex:null, ttype:CONST},
{input:"Vdash", tag:"mo", output:"\u22A9", tex:null, ttype:CONST},
{input:"vdots", tag:"mo", output:"\u22EE", tex:null, ttype:CONST},
{input:"vec", tag:"mover", output:"\u2192", tex:null, ttype:UNARY, acc:true},
{input:"wedge", tag:"mo", output:"\u2227", tex:null, ttype:CONST},
{input:"vee", tag:"mo", output:"\u2228", tex:null, ttype:CONST},
{input:"veebar", tag:"mo", output:"\u22BB", text:null, ttype:CONST},
{input:"vert", tag:"mo", output:"\u007C", atval:"1", tex:null, ttype:STRETCHY},
{input:"Vert", tag:"mo", output:"\u2016", atval:"1", tex:null, ttype:STRETCHY},
{input:"widehat", tag:"mover", output:"\u0302", tex:null, ttype:UNARY, acc:true},
{input:"widetilde", tag:"mover", output:"\u02DC", tex:null, ttype:UNARY, acc:true},
{input:"wp", tag:"mo", output:"\u2118", tex:null, ttype:CONST},
{input:"wr", tag:"mo", output:"\u2240", tex:null, ttype:CONST},
{input:"vv", tag:"mo", output:"\u2228", tex:"vee", ttype:CONST},
{input:"Vvdash", tag:"mo", output:"\u22AA", tex:null, ttype:CONST},
{input:"vvv", tag:"mo", output:"\u22C1", tex:"bigvee", ttype:UNDEROVER},
{input:"xi", tag:"mi", output:"\u03BE", tex:null, ttype:CONST},
{input:"Xi", tag:"mo", output:"\u039E", tex:null, ttype:CONST},
{input:"xx", tag:"mo", output:"\u00D7", tex:"times", ttype:CONST},
{input:"yen", tag:"mo", output:"\u00A5", tex:null, ttype:CONST},
{input:"zeta", tag:"mi", output:"\u03B6", tex:null, ttype:CONST},
{input:"ZZ", tag:"mo", output:"\u2124", tex:"mathbb{Z}", ttype:CONST, notexcopy:true},
AMquote
];
var AMnames = []; //list of input symbols
var AMnestingDepth,AMpreviousSymbol,AMcurrentSymbol;
var LMcal = AMcal;
var LMfrk = AMfrk;
var LMbbb = AMbbb;
var LMsymbols = [
{input:"\\density",tag:"mstyle",atname:"mathvariant", atval:"mathsize", ttype:BINARY},
{input:"'", tag:"mo", output:"\u02B9", ttype:CONST},
{input:"''", tag:"mo", output:"\u02BA", ttype:CONST},
{input:"'''", tag:"mo", output:"\u2034", ttype:CONST},
{input:"''''", tag:"mo", output:"\u2057", ttype:CONST},
{input:"(", tag:"mo", output:"(", atval:"1", ttype:STRETCHY},
{input:")", tag:"mo",output:")", rtag:"mi",atval:"1",ttype:STRETCHY},
{input:"/", tag:"mo", output:"/", atval:"1.01", ttype:STRETCHY},
{input:":=", tag:"mo", output:":=", ttype:CONST},
{input:"[", tag:"mo", output:"[", atval:"1", ttype:STRETCHY},
{input:"\\!", tag:"mspace", atname:"width", atval:"-0.167em", ttype:SPACE},
{input:"\\#", tag:"mo", output:"\u0023", ttype:CONST},
{input:"\\%", tag:"mo", output:"\u0025", ttype:CONST},
{input:"\\&", tag:"mo", output:"\u0026", ttype:CONST},
{input:"\\,", tag:"mspace", atname:"width", atval:"0.167em", ttype:SPACE},
{input:"\\:", tag:"mspace", atname:"width", atval:"0.222em", ttype:SPACE},
{input:"\\;", tag:"mspace", atname:"width", atval:"0.278em", ttype:SPACE},
{input:"\\\\", output:"}&{", ttype:DEFINITION},
{input:"\\{", tag:"mo", output:"{", atval:"1", ttype:STRETCHY},
{input:"\\|", tag:"mo", output:"\u2225", atval:"1", ttype:STRETCHY},
{input:"\\}", tag:"mo",output:"}", rtag:"mi",atval:"1",ttype:STRETCHY},
{input:"\\>", tag:"mspace", atname:"width", atval:"0.222em", ttype:SPACE},
{input:"\\AA", tag:"mo", output:"\u00C5", ttype:CONST},
{input:"\\aa", tag:"mo", output:"\u00E5", ttype:CONST},
{input:"\\acute", tag:"mover", output:"\u00B4", ttype:UNARY, acc:true},
{input:"\\AE", tag:"mo", output:"\u00C6", ttype:CONST},
{input:"\\ae", tag:"mo", output:"\u00E6", ttype:CONST},
{input:"\\aleph", tag:"mo", output:"\u2135", ttype:CONST},
{input:"\\alpha", tag:"mi", output:"\u03B1", ttype:CONST},
{input:"\\amalg", tag:"mo", output:"\u2A3F", ttype:CONST},
{input:"\\angle", tag:"mo", output:"\u2220", ttype:CONST},
{input:"\\approx", tag:"mo", output:"\u2248", ttype:CONST},
{input:"\\approxeq", tag:"mo", output:"\u224A", ttype:CONST},
{input:"\\arccos", tag:"mi", output:"arccos", ttype:UNARY, func:true},
{input:"\\arcsin", tag:"mi", output:"arcsin", ttype:UNARY, func:true},
{input:"\\arctan", tag:"mi", output:"arctan", ttype:UNARY, func:true},
{input:"\\arg", tag:"mi", output:"arg", ttype:UNARY, func:true},
{input:"\\ast", tag:"mo", output:"\u002A", ttype:CONST},
{input:"\\asymp", tag:"mo", output:"\u224D", ttype:CONST},
{input:"\\atop", tag:"mfrac", output:"", ttype:INFIX},
{input:"\\backprime", tag:"mo", output:"\u2035", ttype:CONST},
{input:"\\backsim", tag:"mo", output:"\u223D", ttype:CONST},
{input:"\\backsimeq", tag:"mo", output:"\u22CD", ttype:CONST},
{input:"\\backslash", tag:"mo", output:"\u2216", atval:"1", ttype:STRETCHY},
{input:"\\bar", tag:"mover", output:"\u203E", ttype:UNARY, acc:true},
{input:"\\barwedge", tag:"mo", output:"\u22BC", ttype:CONST},
{input:"\\Bbb{A}", tag:"mo", output:"\uD835\uDD38", ttype:CONST},
{input:"\\because", tag:"mo", output:"\u2235", ttype:CONST},
{input:"\\begin{array}", output:"X", ttype:MATRIX, invisible:true},
{input:"\\begin{eqnarray}", output:"X", ttype:MATRIX, invisible:true},
{input:"\\beta", tag:"mi", output:"\u03B2", ttype:CONST},
{input:"\\beth", tag:"mo", output:"\u2136", ttype:CONST},
{input:"\\between", tag:"mo", output:"\u226C", ttype:CONST},
{input:"\\big", tag:"mo", output:"X", atval:"1.2", ieval:"2.2", ttype:BIG},
{input:"\\Big", tag:"mo", output:"X", atval:"1.6", ieval:"2.6", ttype:BIG},
{input:"\\bigcap", tag:"mo", output:"\u22C2", ttype:UNDEROVER},
{input:"\\bigcirc", tag:"mo", output:"\u25CB", ttype:CONST},
{input:"\\bigcup", tag:"mo", output:"\u22C3", ttype:UNDEROVER},
{input:"\\bigg", tag:"mo", output:"X", atval:"2.2", ieval:"3.2", ttype:BIG},
{input:"\\Bigg", tag:"mo", output:"X", atval:"2.9", ieval:"3.9", ttype:BIG},
{input:"\\bigodot", tag:"mo", output:"\u2A00", ttype:UNDEROVER},
{input:"\\bigoplus", tag:"mo", output:"\u2A01", ttype:UNDEROVER},
{input:"\\bigotimes", tag:"mo", output:"\u2A02", ttype:UNDEROVER},
{input:"\\bigsqcap", tag:"mo", output:"\u2A05", ttype:UNDEROVER},
{input:"\\bigsqcup", tag:"mo", output:"\u2A06", ttype:UNDEROVER},
{input:"\\bigstar", tag:"mo", output:"\u2605", ttype:CONST},
{input:"\\bigtriangledown",tag:"mo",output:"\u25BD", ttype:CONST},
{input:"\\bigtriangleup",tag:"mo",output:"\u25B3", ttype:CONST},
{input:"\\biguplus", tag:"mo", output:"\u2A04", ttype:UNDEROVER},
{input:"\\bigwedge", tag:"mo", output:"\u22C0", ttype:UNDEROVER},
{input:"\\bigvee", tag:"mo", output:"\u22C1", ttype:UNDEROVER},
{input:"\\blacktriangle", tag:"mo", output:"\u25B4", ttype:CONST},
{input:"\\blacktriangledown", tag:"mo", output:"\u25BE", ttype:CONST},
{input:"\\blacktriangleleft", tag:"mo", output:"\u25C0", ttype:CONST},
{input:"\\blacktriangleright", tag:"mo", output:"\u25B6", ttype:CONST},
{input:"\\bot", tag:"mo", output:"\u22A5", ttype:CONST},
{input:"\\bowtie", tag:"mo", output:"\u22C8", ttype:CONST},
{input:"\\Box", tag:"mo", output:"\u25A1", ttype:CONST},
{input:"\\boxdot", tag:"mo", output:"\u22A1", ttype:CONST},
{input:"\\boxminus", tag:"mo", output:"\u229F", ttype:CONST},
{input:"\\boxplus", tag:"mo", output:"\u229E", ttype:CONST},
{input:"\\boxtimes", tag:"mo", output:"\u22A0", ttype:CONST},
{input:"\\breve", tag:"mover", output:"\u02D8", ttype:UNARY, acc:true},
{input:"\\bullet", tag:"mo", output:"\u2022", ttype:CONST},
{input:"\\Bumpeq", tag:"mo", output:"\u224E", ttype:CONST},
{input:"\\bumpeq", tag:"mo", output:"\u224F", ttype:CONST},
{input:"\\cap", tag:"mo", output:"\u2229", ttype:CONST},
{input:"\\Cap", tag:"mo", output:"\u22D2", ttype:CONST},
{input:"\\cdot", tag:"mo", output:"\u22C5", ttype:CONST},
{input:"\\cdotp", tag:"mo", output:"\u00B7", ttype:CONST},
{input:"\\cdots", tag:"mo", output:"\u22EF", ttype:CONST},
{input:"\\check", tag:"mover", output:"\u02C7", ttype:UNARY, acc:true},
{input:"\\checkmark", tag:"mo", output:"\u2713", ttype:CONST},
{input:"\\chi", tag:"mi", output:"\u03C7", ttype:CONST},
{input:"\\choose", tag:"mfrac", output:"", ttype:INFIX},
{input:"\\circ", tag:"mo", output:"\u2218", ttype:CONST},
{input:"\\circeq", tag:"mo", output:"\u2257", ttype:CONST},
{input:"\\circledast", tag:"mo", output:"\u229B", ttype:CONST},
{input:"\\circledcirc", tag:"mo", output:"\u229A", ttype:CONST},
{input:"\\circleddash", tag:"mo", output:"\u229D", ttype:CONST},
{input:"\\circledR", tag:"mo", output:"\u24C7", ttype:CONST},
{input:"\\circledS", tag:"mo", output:"\u24C8", ttype:CONST},
{input:"\\clubsuit", tag:"mo", output:"\u2663", ttype:CONST},
{input:"\\colon", tag:"mo", output:"\u003A", ttype:CONST},
{input:"\\complement", tag:"mo", output:"\u2201", ttype:CONST},
{input:"\\cong", tag:"mo", output:"\u2245", ttype:CONST},
{input:"\\coprod", tag:"mo", output:"\u2210", ttype:UNDEROVER},
{input:"\\cos", tag:"mi", output:"cos", ttype:UNARY, func:true},
{input:"\\cosh", tag:"mi", output:"cosh", ttype:UNARY, func:true},
{input:"\\cot", tag:"mi", output:"cot", ttype:UNARY, func:true},
{input:"\\coth", tag:"mi", output:"coth", ttype:UNARY, func:true},
{input:"\\csc", tag:"mi", output:"csc", ttype:UNARY, func:true},
{input:"\\cup", tag:"mo", output:"\u222A", ttype:CONST},
{input:"\\Cup", tag:"mo", output:"\u22D3", ttype:CONST},
{input:"\\curlyeqprec", tag:"mo", output:"\u22DE", ttype:CONST},
{input:"\\curlyeqsucc", tag:"mo", output:"\u22DF", ttype:CONST},
{input:"\\curlywedge", tag:"mo", output:"\u22CF", ttype:CONST},
{input:"\\curlyvee", tag:"mo", output:"\u22CE", ttype:CONST},
{input:"\\curvearrowleft", tag:"mo", output:"\u21B6", ttype:CONST},
{input:"\\curvearrowright", tag:"mo", output:"\u21B7", ttype:CONST},
{input:"\\dag", tag:"mo", output:"\u2020", ttype:CONST},
{input:"\\dagger", tag:"mo", output:"\u2020", ttype:CONST},
{input:"\\daleth", tag:"mo", output:"\u2138", ttype:CONST},
{input:"\\dashv", tag:"mo", output:"\u22A3", ttype:CONST},
{input:"\\ddag", tag:"mo", output:"\u2021", ttype:CONST},
{input:"\\ddagger", tag:"mo", output:"\u2021", ttype:CONST},
{input:"\\ddot", tag:"mover", output:"..", ttype:UNARY, acc:true},
{input:"\\ddots", tag:"mo", output:"\u22F1", ttype:CONST},
{input:"\\deg", tag:"mi", output:"deg", ttype:UNARY, func:true},
{input:"\\delta", tag:"mi", output:"\u03B4", ttype:CONST},
{input:"\\Delta", tag:"mo", output:"\u0394", ttype:CONST},
{input:"\\det", tag:"mi", output:"det", ttype:UNARY, func:true},
{input:"\\diamond", tag:"mo", output:"\u22C4", ttype:CONST},
{input:"\\Diamond", tag:"mo", output:"\u25C7", ttype:CONST},
{input:"\\diamondsuit", tag:"mo", output:"\u2662", ttype:CONST},
{input:"\\dim", tag:"mi", output:"dim", ttype:UNARY, func:true}, //CONST?
{input:"\\displaystyle",tag:"mstyle",atname:"displaystyle",atval:"true", ttype:UNARY},
{input:"\\div", tag:"mo", output:"\u00F7", ttype:CONST},
{input:"\\divideontimes", tag:"mo", output:"\u22C7", ttype:CONST},
{input:"\\dot", tag:"mover", output:".", ttype:UNARY, acc:true},
{input:"\\doteq", tag:"mo", output:"\u2250", ttype:CONST},
{input:"\\Doteq", tag:"mo", output:"\u2251", ttype:CONST},
{input:"\\dotplus", tag:"mo", output:"\u2214", ttype:CONST},
{input:"\\dots", tag:"mo", output:"\u2026", ttype:CONST},
{input:"\\doublebarwedge", tag:"mo", output:"\u2A5E", ttype:CONST},
{input:"\\downarrow", tag:"mo", output:"\u2193", ttype:CONST},
{input:"\\Downarrow", tag:"mo", output:"\u21D3", ttype:CONST},
{input:"\\downdownarrows", tag:"mo", output:"\u21CA", ttype:CONST},
{input:"\\downharpoonleft", tag:"mo", output:"\u21C3", ttype:CONST},
{input:"\\downharpoonright", tag:"mo", output:"\u21C2", ttype:CONST},
{input:"\\ell", tag:"mo", output:"\u2113", ttype:CONST},
{input:"\\emptyset", tag:"mo", output:"\u2205", ttype:CONST},
{input:"\\end{array}", output:"}}", ttype:DEFINITION},
{input:"\\end{eqnarray}", output:"}}", ttype:DEFINITION},
{input:"\\epsilon", tag:"mi", output:"\u03B5", ttype:CONST},
{input:"\\eqcirc", tag:"mo", output:"\u2256", ttype:CONST},
{input:"\\eqsim", tag:"mo", output:"\u2242", ttype:CONST},
{input:"\\eqslantgtr", tag:"mo", output:"\u2A96", ttype:CONST},
{input:"\\eqslantless", tag:"mo", output:"\u2A95", ttype:CONST},
{input:"\\equiv", tag:"mo", output:"\u2261", ttype:CONST},
{input:"\\eta", tag:"mi", output:"\u03B7", ttype:CONST},
{input:"\\exists", tag:"mo", output:"\u2203", ttype:CONST},
{input:"\\exp", tag:"mi", output:"exp", ttype:UNARY, func:true},
{input:"\\fallingdotseq", tag:"mo", output:"\u2252", ttype:CONST},
{input:"\\Finv", tag:"mo", output:"\u2132", ttype:CONST},
{input:"\\flat", tag:"mo", output:"\u266D", ttype:CONST},
{input:"\\forall", tag:"mo", output:"\u2200", ttype:CONST},
{input:"\\frac", tag:"mfrac", output:"/", ttype:BINARY},
{input:"\\frac12", tag:"mo", output:"\u00BD", ttype:CONST},
{input:"\\frac13", tag:"mo", output:"\u2153", ttype:CONST},
{input:"\\frac14", tag:"mo", output:"\u00BC", ttype:CONST},
{input:"\\frac15", tag:"mo", output:"\u2155", ttype:CONST},
{input:"\\frac16", tag:"mo", output:"\u2159", ttype:CONST},
{input:"\\frac18", tag:"mo", output:"\u215B", ttype:CONST},
{input:"\\frac23", tag:"mo", output:"\u2154", ttype:CONST},
{input:"\\frac25", tag:"mo", output:"\u2156", ttype:CONST},
{input:"\\frac34", tag:"mo", output:"\u00BE", ttype:CONST},
{input:"\\frac35", tag:"mo", output:"\u2157", ttype:CONST},
{input:"\\frac38", tag:"mo", output:"\u215C", ttype:CONST},
{input:"\\frac45", tag:"mo", output:"\u2158", ttype:CONST},
{input:"\\frac56", tag:"mo", output:"\u215A", ttype:CONST},
{input:"\\frac58", tag:"mo", output:"\u215D", ttype:CONST},
{input:"\\frac78", tag:"mo", output:"\u215E", ttype:CONST},
{input:"\\frown", tag:"mo", output:"\u2322", ttype:CONST},
{input:"\\Game", tag:"mo", output:"\u2141", ttype:CONST},
{input:"\\gamma", tag:"mi", output:"\u03B3", ttype:CONST},
{input:"\\Gamma", tag:"mo", output:"\u0393", ttype:CONST},
{input:"\\gcd", tag:"mi", output:"gcd", ttype:UNARY, func:true}, //CONST?
{input:"\\ge", tag:"mo", output:"\u2265", ttype:CONST},
{input:"\\geq", tag:"mo", output:"\u2265", ttype:CONST},
{input:"\\geqq", tag:"mo", output:"\u2267", ttype:CONST},
{input:"\\geqslant", tag:"mo", output:"\u2265", ttype:CONST},
{input:"\\gets", tag:"mo", output:"\u2190", ttype:CONST},
{input:"\\gg", tag:"mo", output:"\u226B", ttype:CONST},
{input:"\\ggg", tag:"mo", output:"\u22D9", ttype:CONST},
{input:"\\gimel", tag:"mo", output:"\u2137", ttype:CONST},
{input:"\\gnapprox", tag:"mo", output:"\u2A8A", ttype:CONST},
{input:"\\gneq", tag:"mo", output:"\u2A88", ttype:CONST},
{input:"\\gneqq", tag:"mo", output:"\u2269", ttype:CONST},
{input:"\\gnsim", tag:"mo", output:"\u22E7", ttype:CONST},
{input:"\\grave", tag:"mover", output:"\u0060", ttype:UNARY, acc:true},
{input:"\\gt", tag:"mo", output:"\u003E", ttype:CONST},
{input:"\\gtrapprox", tag:"mo", output:"\u2A86", ttype:CONST},
{input:"\\gtrdot", tag:"mo", output:"\u22D7", ttype:CONST},
{input:"\\gtreqless", tag:"mo", output:"\u22DB", ttype:CONST},
{input:"\\gtreqqless", tag:"mo", output:"\u2A8C", ttype:CONST},
{input:"\\gtrless", tag:"mo", output:"\u2277", ttype:CONST},
{input:"\\gtrsim", tag:"mo", output:"\u2273", ttype:CONST},
{input:"\\hat", tag:"mover", output:"\u005E", ttype:UNARY, acc:true},
{input:"\\hbar", tag:"mo", output:"\u210F", ttype:CONST},
{input:"\\heartsuit", tag:"mo", output:"\u2661", ttype:CONST},
{input:"\\hom", tag:"mi", output:"hom", ttype:UNARY, func:true},
{input:"\\hookleftarrow", tag:"mo", output:"\u21A9", ttype:CONST},
{input:"\\hookrightarrow", tag:"mo", output:"\u21AA", ttype:CONST},
{input:"\\hslash", tag:"mo", output:"\u210F", ttype:CONST},
//{input:"\\i", tag:"mo", output:"\u0131", ttype:CONST},
{input:"\\iff", tag:"mo", output:"~\\Longleftrightarrow~", ttype:DEFINITION},
{input:"\\iiiint", tag:"mo", output:"\u2A0C", ttype:CONST},
{input:"\\iiint", tag:"mo", output:"\u222D", ttype:CONST},
{input:"\\iint", tag:"mo", output:"\u222C", ttype:CONST},
{input:"\\Im", tag:"mo", output:"\u2111", ttype:CONST},
{input:"\\implies", tag:"mo", output:"\u21D2", ttype:LONG},
{input:"\\in", tag:"mo", output:"\u2208", ttype:CONST},
{input:"\\inf", tag:"mo", output:"inf", ttype:UNDEROVER},
{input:"\\infty", tag:"mo", output:"\u221E", ttype:CONST},
{input:"\\int", tag:"mo", output:"\u222B", ttype:CONST},
{input:"\\intercal", tag:"mo", output:"\u22BA", ttype:CONST},
{input:"\\iota", tag:"mi", output:"\u03B9", ttype:CONST},
{input:"\\itx", tag:"mo", output:"\uD835\uDC65", ttype:CONST},
{input:"\\Join", tag:"mo", output:"\u22C8", ttype:CONST},
{input:"\\kappa", tag:"mi", output:"\u03BA", ttype:CONST},
{input:"\\varkappa", tag:"mi", output:"\u03F0", ttype:CONST},
{input:"\\digamma", tag:"mi", output:"\u03DC", ttype:CONST},
{input:"\\ker", tag:"mi", output:"ker", ttype:UNARY, func:true},
//{input:"\\L", tag:"mo", output:"\u0141", ttype:CONST},
//{input:"\\l", tag:"mo", output:"\u0142", ttype:CONST},
{input:"\\lambda", tag:"mi", output:"\u03BB", ttype:CONST},
{input:"\\Lambda", tag:"mo", output:"\u039B", ttype:CONST},
{input:"\\land", tag:"mo", output:"\u2227", ttype:CONST},
{input:"\\langle", tag:"mo", output:"\u2329", atval:"1", ttype:STRETCHY},
{input:"\\lbrace", tag:"mo", output:"{", atval:"1", ttype:STRETCHY},
{input:"\\lbrack", tag:"mo", output:"[", atval:"1", ttype:STRETCHY},
{input:"\\lceil", tag:"mo", output:"\u2308", atval:"1", ttype:STRETCHY},
{input:"\\ldots", tag:"mo", output:"\u2026", ttype:CONST},
{input:"\\le", tag:"mo", output:"\u2264", ttype:CONST},
{input:"\\left", tag:"mo", output:"X", ttype:LEFTBRACKET},
{input:"\\leftarrow", tag:"mo", output:"\u2190", ttype:CONST},
{input:"\\Leftarrow", tag:"mo", output:"\u21D0", ttype:CONST},
{input:"\\leftarrowtail", tag:"mo", output:"\u21A2", ttype:CONST},
{input:"\\leftharpoondown", tag:"mo", output:"\u21BD", ttype:CONST},
{input:"\\leftharpoonup", tag:"mo", output:"\u21BC", ttype:CONST},
{input:"\\leftleftarrows", tag:"mo", output:"\u21C7", ttype:CONST},
{input:"\\leftrightarrow", tag:"mo", output:"\u2194", ttype:CONST},
{input:"\\Leftrightarrow", tag:"mo", output:"\u21D4", ttype:CONST},
{input:"\\leftrightarrows", tag:"mo", output:"\u21C6", ttype:CONST},
{input:"\\leftrightharpoons", tag:"mo", output:"\u21CB", ttype:CONST},
{input:"\\leftrightsquigarrow", tag:"mo", output:"\u21AD", ttype:CONST},
{input:"\\leftthreetimes", tag:"mo", output:"\u22CB", ttype:CONST},
{input:"\\leq", tag:"mo", output:"\u2264", ttype:CONST},
{input:"\\leqq", tag:"mo", output:"\u2266", ttype:CONST},
{input:"\\leqslant", tag:"mo", output:"\u2264", ttype:CONST},
{input:"\\lessapprox", tag:"mo", output:"\u2A85", ttype:CONST},
{input:"\\lessdot", tag:"mo", output:"\u22D6", ttype:CONST},
{input:"\\lesseqgtr", tag:"mo", output:"\u22DA", ttype:CONST},
{input:"\\lesseqqgtr", tag:"mo", output:"\u2A8B", ttype:CONST},
{input:"\\lessgtr", tag:"mo", output:"\u2276", ttype:CONST},
{input:"\\lesssim", tag:"mo", output:"\u2272", ttype:CONST},
{input:"\\lfloor", tag:"mo", output:"\u230A", atval:"1", ttype:STRETCHY},
{input:"\\lg", tag:"mi", output:"lg", ttype:UNARY, func:true},
{input:"\\lhd", tag:"mo", output:"\u22B2", ttype:CONST},
{input:"\\lim", tag:"mo", output:"lim", ttype:UNDEROVER},
{input:"\\liminf", tag:"mo", output:"liminf", ttype:UNDEROVER},
{input:"\\limsup", tag:"mo", output:"limsup", ttype:UNDEROVER},
{input:"\\ll", tag:"mo", output:"\u226A", ttype:CONST},
{input:"\\llcorner", tag:"mo", output:"\u231E", ttype:CONST},
{input:"\\Lleftarrow", tag:"mo", output:"\u21DA", ttype:CONST},
{input:"\\lll", tag:"mo", output:"\u22D8", ttype:CONST},
{input:"\\lmoustache", tag:"mo", output:"\u23B0", ttype:CONST},
{input:"\\ln", tag:"mi", output:"ln", ttype:UNARY, func:true},
{input:"\\lnapprox", tag:"mo", output:"\u2A89", ttype:CONST},
{input:"\\lneq", tag:"mo", output:"\u2A87", ttype:CONST},
{input:"\\lneqq", tag:"mo", output:"\u2268", ttype:CONST},
{input:"\\lnot", tag:"mo", output:"\u00AC", ttype:CONST},
{input:"\\lnsim", tag:"mo", output:"\u22E6", ttype:CONST},
{input:"\\log", tag:"mi", output:"log", ttype:UNARY, func:true},
{input:"\\longleftarrow", tag:"mo", output:"\u2190", ttype:LONG},
{input:"\\Longleftarrow", tag:"mo", output:"\u21D0", ttype:LONG},
{input:"\\longleftrightarrow", tag:"mo", output:"\u2194", ttype:LONG},
{input:"\\Longleftrightarrow", tag:"mo", output:"\u21D4", ttype:LONG},
{input:"\\longmapsto", tag:"mo", output:"\u21A6", ttype:CONST},
{input:"\\longrightarrow", tag:"mo", output:"\u2192", ttype:LONG},
{input:"\\Longrightarrow", tag:"mo", output:"\u21D2", ttype:LONG},
{input:"\\looparrowleft", tag:"mo", output:"\u21AB", ttype:CONST},
{input:"\\looparrowright", tag:"mo", output:"\u21AC", ttype:CONST},
{input:"\\lor", tag:"mo", output:"\u2228", ttype:CONST},
{input:"\\lozenge", tag:"mo", output:"\u25CA", ttype:CONST},
{input:"\\lrcorner", tag:"mo", output:"\u231F", ttype:CONST},
{input:"\\Lsh", tag:"mo", output:"\u21B0", ttype:CONST},
{input:"\\lt", tag:"mo", output:"\u003C", ttype:CONST},
{input:"\\ltimes", tag:"mo", output:"\u22C9", ttype:CONST},
{input:"\\maltese", tag:"mo", output:"\u2720", ttype:CONST},
{input:"\\mapsto", tag:"mo", output:"\u21A6", ttype:CONST},
{input:"\\mathbb", tag:"mstyle", atname:"mathvariant", atval:"double-struck", ttype:UNARY, codes:LMbbb},
{input:"\\mathbf", tag:"mstyle", atname:"mathvariant", atval:"bold", ttype:UNARY},
{input:"\\mathcal",tag:"mstyle", atname:"mathvariant", atval:"script", ttype:UNARY, codes:LMcal},
{input:"\\mathfrak",tag:"mstyle",atname:"mathvariant", atval:"fraktur",ttype:UNARY, codes:LMfrk},
{input:"\\mathit", tag:"mstyle", atname:"mathvariant", atval:"italic", ttype:UNARY},
{input:"\\mathring", tag:"mover", output:"\u00B0", ttype:UNARY, acc:true},
{input:"\\mathrm", tag:"mtext", output:"text", ttype:TEXT},
{input:"\\mathsf", tag:"mstyle", atname:"mathvariant", atval:"sans-serif", ttype:UNARY},
{input:"\\mathtt", tag:"mstyle", atname:"mathvariant", atval:"monospace", ttype:UNARY},
{input:"\\max", tag:"mo", output:"max", ttype:UNDEROVER},
{input:"\\mbox", tag:"mtext", output:"mbox", ttype:TEXT},
{input:"\\measuredangle", tag:"mo", output:"\u2221", ttype:CONST},
{input:"\\mho", tag:"mo", output:"\u2127", ttype:CONST},
{input:"\\mid", tag:"mo", output:"\u2223", atval:"1", ttype:STRETCHY},
{input:"\\min", tag:"mo", output:"min", ttype:UNDEROVER},
{input:"\\models", tag:"mo", output:"\u22A8", ttype:CONST},
{input:"\\mp", tag:"mo", output:"\u2213", ttype:CONST},
{input:"\\mu", tag:"mi", output:"\u03BC", ttype:CONST},
{input:"\\multimap", tag:"mo", output:"\u22B8", ttype:CONST},
{input:"\\nabla", tag:"mo", output:"\u2207", ttype:CONST},
{input:"\\natural", tag:"mo", output:"\u266E", ttype:CONST},
{input:"\\ncong", tag:"mo", output:"\u2247", ttype:CONST},
{input:"\\ne", tag:"mo", output:"\u2260", ttype:CONST},
{input:"\\nearrow", tag:"mo", output:"\u2197", ttype:CONST},
{input:"\\neg", tag:"mo", output:"\u00AC", ttype:CONST},
{input:"\\neq", tag:"mo", output:"\u2260", ttype:CONST},
{input:"\\nexists", tag:"mo", output:"\u2204", ttype:CONST},
{input:"\\ngeq", tag:"mo", output:"\u2271", ttype:CONST},
{input:"\\ngtr", tag:"mo", output:"\u226F", ttype:CONST},
{input:"\\ni", tag:"mo", output:"\u220B", ttype:CONST},
{input:"\\nleftarrow", tag:"mo", output:"\u219A", ttype:CONST},
{input:"\\nLeftarrow", tag:"mo", output:"\u21CD", ttype:CONST},
{input:"\\nleftrightarrow", tag:"mo", output:"\u21AE", ttype:CONST},
{input:"\\nLeftrightarrow", tag:"mo", output:"\u21CE", ttype:CONST},
{input:"\\nleq", tag:"mo", output:"\u2270", ttype:CONST},
{input:"\\nless", tag:"mo", output:"\u226E", ttype:CONST},
{input:"\\nmid", tag:"mo", output:"\u2224", ttype:CONST},
{input:"\\not\\leq", tag:"mo", output:"\u2270", ttype:CONST},
{input:"\\notin", tag:"mo", output:"\u2209", ttype:CONST},
{input:"\\nparallel", tag:"mo", output:"\u2226", ttype:CONST},
{input:"\\nprec", tag:"mo", output:"\u2280", ttype:CONST},
{input:"\\nrightarrow", tag:"mo", output:"\u219B", ttype:CONST},
{input:"\\nRightarrow", tag:"mo", output:"\u21CF", ttype:CONST},
{input:"\\nsim", tag:"mo", output:"\u2241", ttype:CONST},
{input:"\\nsubseteq", tag:"mo", output:"\u2288", ttype:CONST},
{input:"\\nsucc", tag:"mo", output:"\u2281", ttype:CONST},
{input:"\\nsupseteq", tag:"mo", output:"\u2289", ttype:CONST},
{input:"\\ntriangleleft", tag:"mo", output:"\u22EA", ttype:CONST},
{input:"\\ntrianglelefteq", tag:"mo", output:"\u22EC", ttype:CONST},
{input:"\\ntriangleright", tag:"mo", output:"\u22EB", ttype:CONST},
{input:"\\ntrianglerighteq", tag:"mo", output:"\u22ED", ttype:CONST},
{input:"\\nu", tag:"mi", output:"\u03BD", ttype:CONST},
{input:"\\nwarrow", tag:"mo", output:"\u2196", ttype:CONST},
{input:"\\nvdash", tag:"mo", output:"\u22AC", ttype:CONST},
{input:"\\nvDash", tag:"mo", output:"\u22AD", ttype:CONST},
{input:"\\nVdash", tag:"mo", output:"\u22AE", ttype:CONST},
{input:"\\nVDash", tag:"mo", output:"\u22AF", ttype:CONST},
//{input:"\\O", tag:"mo", output:"\u00D8", ttype:CONST},
//{input:"\\o", tag:"mo", output:"\u00F8", ttype:CONST},
{input:"\\odot", tag:"mo", output:"\u2299", ttype:CONST},
{input:"\\OE", tag:"mo", output:"\u0152", ttype:CONST},
{input:"\\oe", tag:"mo", output:"\u0153", ttype:CONST},
{input:"\\oint", tag:"mo", output:"\u222E", ttype:CONST},
{input:"\\omega", tag:"mi", output:"\u03C9", ttype:CONST},
{input:"\\Omega", tag:"mo", output:"\u03A9", ttype:CONST},
{input:"\\ominus", tag:"mo", output:"\u2296", ttype:CONST},
{input:"\\oplus", tag:"mo", output:"\u2295", ttype:CONST},
{input:"\\oslash", tag:"mo", output:"\u2298", ttype:CONST},
{input:"\\otimes", tag:"mo", output:"\u2297", ttype:CONST},
{input:"\\overbrace", tag:"mover", output:"\uFE37", ttype:UNARY, acc:true}, //Changed unicode overbrace
{input:"\\overbracket", tag:"mover", output:"\u23B4", ttype:UNARY, acc:true}, //old overbrace = overbracket
{input:"\\overleftarrow",tag:"mover", output:"\u20D6", ttype:UNARY, acc:true},
{input:"\\overleftrightarrow", tag:"mo", output:"\u20E1", ttype:CONST},
{input:"\\overline", tag:"mover", output:"\u00AF", ttype:UNARY, acc:true},
{input:"\\overrightarrow",tag:"mover",output:"\u20D7", ttype:UNARY, acc:true},
{input:"\\owns", tag:"mo", output:"\u220B", ttype:CONST},
{input:"\\parallel", tag:"mo", output:"\u2225", atval:"1", ttype:STRETCHY},
{input:"\\partial", tag:"mo", output:"\u2202", ttype:CONST},
{input:"\\perp", tag:"mo", output:"\u22A5", ttype:CONST},
{input:"\\phi", tag:"mi", output:"\u03C6", ttype:CONST},
{input:"\\Phi", tag:"mo", output:"\u03A6", ttype:CONST},
{input:"\\pi", tag:"mi", output:"\u03C0", ttype:CONST},
{input:"\\Pi", tag:"mo", output:"\u03A0", ttype:CONST},
{input:"\\pitchfork", tag:"mo", output:"\u22D4", ttype:CONST},
{input:"\\pm", tag:"mo", output:"\u00B1", ttype:CONST},
{input:"\\Pr", tag:"mi", output:"Pr", ttype:UNARY, func:true},
{input:"\\prec", tag:"mo", output:"\u227A", ttype:CONST},
{input:"\\precapprox", tag:"mo", output:"\u2AB7", ttype:CONST},
{input:"\\preccurlyeq", tag:"mo", output:"\u227C", ttype:CONST},
{input:"\\preceq", tag:"mo", output:"\u227C", ttype:CONST},
{input:"\\precnapprox", tag:"mo", output:"\u2AB9", ttype:CONST},
{input:"\\precneqq", tag:"mo", output:"\u2AB5", ttype:CONST},
{input:"\\precnsim", tag:"mo", output:"\u22E8", ttype:CONST},
{input:"\\precsim", tag:"mo", output:"\u227E", ttype:CONST},
{input:"\\prime", tag:"mo", output:"\u2032", ttype:CONST},
{input:"\\prod", tag:"mo", output:"\u220F", ttype:UNDEROVER},
{input:"\\propto", tag:"mo", output:"\u221D", ttype:CONST},
{input:"\\psi", tag:"mi", output:"\u03C8", ttype:CONST},
{input:"\\Psi", tag:"mo", output:"\u03A8", ttype:CONST},
{input:"\\qquad", tag:"mspace", atname:"width", atval:"2em", ttype:SPACE},
{input:"\\quad", tag:"mspace", atname:"width", atval:"1em", ttype:SPACE},
{input:"\\rangle",tag:"mo",output:"\u232A", rtag:"mi",atval:"1",ttype:STRETCHY},
{input:"\\rbrace",tag:"mo",output:"}", rtag:"mi",atval:"1",ttype:STRETCHY},
{input:"\\rbrack",tag:"mo",output:"]", rtag:"mi",atval:"1",ttype:STRETCHY},
{input:"\\rceil", tag:"mo",output:"\u2309", rtag:"mi",atval:"1",ttype:STRETCHY},
{input:"\\Re", tag:"mo", output:"\u211C", ttype:CONST},
{input:"\\rfloor",tag:"mo",output:"\u230B", rtag:"mi",atval:"1",ttype:STRETCHY},
{input:"\\rhd", tag:"mo", output:"\u22B3", ttype:CONST},
{input:"\\rho", tag:"mi", output:"\u03C1", ttype:CONST},
{input:"\\right", tag:"mo", output:"X", ttype:RIGHTBRACKET},
{input:"\\rightarrow", tag:"mo", output:"\u2192", ttype:CONST},
{input:"\\Rightarrow", tag:"mo", output:"\u21D2", ttype:CONST},
{input:"\\rightarrowtail", tag:"mo", output:"\u21A3", ttype:CONST},
{input:"\\rightharpoondown", tag:"mo", output:"\u21C1", ttype:CONST},
{input:"\\rightharpoonup", tag:"mo", output:"\u21C0", ttype:CONST},
{input:"\\rightleftarrows", tag:"mo", output:"\u21C4", ttype:CONST},
{input:"\\rightleftharpoons", tag:"mo", output:"\u21CC", ttype:CONST},
{input:"\\rightrightarrows", tag:"mo", output:"\u21C9", ttype:CONST},
{input:"\\rightsquigarrow", tag:"mo", output:"\u21DD", ttype:CONST},
{input:"\\rightthreetimes", tag:"mo", output:"\u22CC", ttype:CONST},
{input:"\\risingdotseq", tag:"mo", output:"\u2253", ttype:CONST},
{input:"\\rmoustache", tag:"mo", output:"\u23B1", ttype:CONST},
{input:"\\root", tag:"mroot", output:"root", ttype:BINARY},
{input:"\\Rrightarrow", tag:"mo", output:"\u21DB", ttype:CONST},
{input:"\\Rsh", tag:"mo", output:"\u21B1", ttype:CONST},
{input:"\\rtimes", tag:"mo", output:"\u22CA", ttype:CONST},
//{input:"\\S", tag:"mo", output:"\u00A7", ttype:CONST},
{input:"\\scriptscriptstyle",tag:"mstyle",atname:"scriptlevel",atval:"2", ttype:UNARY},
{input:"\\scriptstyle",tag:"mstyle",atname:"scriptlevel",atval:"1", ttype:UNARY},
{input:"\\searrow", tag:"mo", output:"\u2198", ttype:CONST},
{input:"\\sec", tag:"mi", output:"sec", ttype:UNARY, func:true},
{input:"\\setminus", tag:"mo", output:"\\", ttype:CONST},
{input:"\\sharp", tag:"mo", output:"\u266F", ttype:CONST},
{input:"\\sigma", tag:"mi", output:"\u03C3", ttype:CONST},
{input:"\\Sigma", tag:"mo", output:"\u03A3", ttype:CONST},
{input:"\\sim", tag:"mo", output:"\u223C", ttype:CONST},
{input:"\\simeq", tag:"mo", output:"\u2243", ttype:CONST},
{input:"\\sin", tag:"mi", output:"sin", ttype:UNARY, func:true},
{input:"\\sinh", tag:"mi", output:"sinh", ttype:UNARY, func:true},
{input:"\\slash", tag:"mo", output:"\u2215", ttype:CONST},
{input:"\\smallint", tag:"mo", output:"\u222B", ttype:CONST},
{input:"\\smallsetminus", tag:"mo", output:"\u2216", ttype:CONST},
{input:"\\smile", tag:"mo", output:"\u2323", ttype:CONST},
{input:"\\spadesuit", tag:"mo", output:"\u2660", ttype:CONST},
{input:"\\sphericalangle", tag:"mo", output:"\u2222", ttype:CONST},
{input:"\\sqcap", tag:"mo", output:"\u2293", ttype:CONST},
{input:"\\sqcup", tag:"mo", output:"\u2294", ttype:CONST},
{input:"\\sqrt", tag:"msqrt", output:"sqrt", ttype:UNARY},
{input:"\\sqsubset", tag:"mo", output:"\u228F", ttype:CONST},
{input:"\\sqsubseteq", tag:"mo", output:"\u2291", ttype:CONST},
{input:"\\sqsupset", tag:"mo", output:"\u2290", ttype:CONST},
{input:"\\sqsupseteq", tag:"mo", output:"\u2292", ttype:CONST},
{input:"\\square", tag:"mo", output:"\u25AB", ttype:CONST},
{input:"\\ss", tag:"mo", output:"\u00DF", ttype:CONST},
{input:"\\stackrel", tag:"mover", output:"stackrel", ttype:BINARY},
{input:"\\star", tag:"mo", output:"\u22C6", ttype:CONST},
{input:"\\subset", tag:"mo", output:"\u2282", ttype:CONST},
{input:"\\Subset", tag:"mo", output:"\u22D0", ttype:CONST},
{input:"\\subseteq", tag:"mo", output:"\u2286", ttype:CONST},
{input:"\\subseteqq", tag:"mo", output:"\u2AC5", ttype:CONST},
{input:"\\subsetneq", tag:"mo", output:"\u228A", ttype:CONST},
{input:"\\subsetneqq", tag:"mo", output:"\u2ACB", ttype:CONST},
{input:"\\succ", tag:"mo", output:"\u227B", ttype:CONST},
{input:"\\succapprox", tag:"mo", output:"\u2AB8", ttype:CONST},
{input:"\\succcurlyeq", tag:"mo", output:"\u227D", ttype:CONST},
{input:"\\succeq", tag:"mo", output:"\u227D", ttype:CONST},
{input:"\\succnapprox", tag:"mo", output:"\u2ABA", ttype:CONST},
{input:"\\succneqq", tag:"mo", output:"\u2AB6", ttype:CONST},
{input:"\\succnsim", tag:"mo", output:"\u22E9", ttype:CONST},
{input:"\\succsim", tag:"mo", output:"\u227F", ttype:CONST},
{input:"\\sum", tag:"mo", output:"\u2211", ttype:UNDEROVER},
{input:"\\sup", tag:"mo", output:"sup", ttype:UNDEROVER},
{input:"\\supset", tag:"mo", output:"\u2283", ttype:CONST},
{input:"\\Supset", tag:"mo", output:"\u22D1", ttype:CONST},
{input:"\\supseteq", tag:"mo", output:"\u2287", ttype:CONST},
{input:"\\supseteqq", tag:"mo", output:"\u2AC6", ttype:CONST},
{input:"\\supsetneq", tag:"mo", output:"\u228B", ttype:CONST},
{input:"\\supsetneqq", tag:"mo", output:"\u2ACC", ttype:CONST},
{input:"\\surd", tag:"mo", output:"\\sqrt{}", ttype:DEFINITION},
{input:"\\swarrow", tag:"mo", output:"\u2199", ttype:CONST},
{input:"\\tan", tag:"mi", output:"tan", ttype:UNARY, func:true},
{input:"\\tanh", tag:"mi", output:"tanh", ttype:UNARY, func:true},
{input:"\\tau", tag:"mi", output:"\u03C4", ttype:CONST},
{input:"\\textasciicircum", tag:"mo", output:"\u005E", ttype:CONST},
{input:"\\textasciitilde", tag:"mo", output:"\u007E", ttype:CONST},
{input:"\\textbf", tag:"mstyle", atname:"mathvariant", atval:"bold", ttype:UNARY},
{input:"\\textcolor",tag:"mstyle",atname:"mathvariant", atval:"mathcolor", ttype:BINARY},
{input:"\\textcopyright", tag:"mo", output:"\u00A9", ttype:CONST},
{input:"\\textdegree", tag:"mo", output:"\u00B0", ttype:CONST},
{input:"\\textdollar", tag:"mo", output:"\u0024", ttype:CONST},
{input:"\\textit", tag:"mstyle", atname:"mathvariant", atval:"italic", ttype:UNARY},
{input:"\\textonehalf", tag:"mo", output:"\u00BD", ttype:CONST},
{input:"\\textonequarter", tag:"mo", output:"\u00BC", ttype:CONST},
{input:"\\textordfeminine", tag:"mo", output:"\u00AA", ttype:CONST},
{input:"\\textordmasculine", tag:"mo", output:"\u00BA", ttype:CONST},
{input:"\\textregistered", tag:"mo", output:"\u00AE", ttype:CONST},
{input:"\\textrm", tag:"mstyle", output:"\\mathrm", ttype: DEFINITION},
{input:"\\textstyle",tag:"mstyle",atname:"displaystyle",atval:"false", ttype:UNARY},
{input:"\\textthreequarters", tag:"mo", output:"\u00BE", ttype:CONST},
{input:"\\texttrademark", tag:"mo", output:"\u2122", ttype:CONST},
{input:"\\texttt", tag:"mstyle", atname:"mathvariant", atval:"monospace", ttype:UNARY},
{input:"\\therefore", tag:"mo", output:"\u2234", ttype:CONST},
{input:"\\theta", tag:"mi", output:"\u03B8", ttype:CONST},
{input:"\\Theta", tag:"mo", output:"\u0398", ttype:CONST},
{input:"\\thickapprox", tag:"mo", output:"\u2248", ttype:CONST},
{input:"\\thicksim", tag:"mo", output:"\u223C", ttype:CONST},
{input:"\\tilde", tag:"mover", output:"~", ttype:UNARY, acc:true},
{input:"\\times", tag:"mo", output:"\u00D7", ttype:CONST},
{input:"\\to", tag:"mo", output:"\u2192", ttype:CONST},
{input:"\\top", tag:"mo", output:"\u22A4", ttype:CONST},
{input:"\\triangle", tag:"mo", output:"\u25B3", ttype:CONST},
{input:"\\triangledown", tag:"mo", output:"\u25BF", ttype:CONST},
{input:"\\triangleleft",tag:"mo", output:"\u22B2", ttype:CONST},
{input:"\\trianglelefteq", tag:"mo", output:"\u22B4", ttype:CONST},
{input:"\\triangleq", tag:"mo", output:"\u225C", ttype:CONST},
{input:"\\triangleright",tag:"mo",output:"\u22B3", ttype:CONST},
{input:"\\trianglerighteq", tag:"mo", output:"\u22B5", ttype:CONST},
{input:"\\twoheadleftarrow", tag:"mo", output:"\u219E", ttype:CONST},
{input:"\\twoheadrightarrow", tag:"mo", output:"\u21A0", ttype:CONST},
{input:"\\ulcorner", tag:"mo", output:"\u231C", ttype:CONST},
{input:"\\underbrace", tag:"munder", output:"\uFE38", ttype:UNARY, acc:true},
{input:"\\underbracket",tag:"munder", output:"\u23B5", ttype:UNARY, acc:true}, //old underbrace = underbracket
{input:"\\underleftarrow", tag:"mo", output:"\u20EE", ttype:CONST},
{input:"\\underline", tag:"munder", output:"\u00AF", ttype:UNARY, acc:true},
{input:"\\underrightarrow", tag:"mo", output:"\u20EF", ttype:CONST},
{input:"\\unlhd", tag:"mo", output:"\u22B4", ttype:CONST},
{input:"\\unrhd", tag:"mo", output:"\u22B5", ttype:CONST},
{input:"\\uparrow", tag:"mo", output:"\u2191", ttype:CONST},
{input:"\\Uparrow", tag:"mo", output:"\u21D1", ttype:CONST},
{input:"\\updownarrow", tag:"mo", output:"\u2195", ttype:CONST},
{input:"\\Updownarrow", tag:"mo", output:"\u21D5", ttype:CONST},
{input:"\\upharpoonleft", tag:"mo", output:"\u21BF", ttype:CONST},
{input:"\\upharpoonright", tag:"mo", output:"\u21BE", ttype:CONST},
{input:"\\uplus", tag:"mo", output:"\u228E", ttype:CONST},
{input:"\\upsilon", tag:"mi", output:"\u03C5", ttype:CONST},
{input:"\\Upsilon", tag:"mo", output:"\u03A5", ttype:CONST},
{input:"\\upuparrows", tag:"mo", output:"\u21C8", ttype:CONST},
{input:"\\urcorner", tag:"mo", output:"\u231D", ttype:CONST},
{input:"\\varepsilon", tag:"mi", output:"\u025B", ttype:CONST},
{input:"\\varnothing", tag:"mo", output:"\u2205", ttype:CONST},
{input:"\\varphi", tag:"mi", output:"\u03D5", ttype:CONST},
{input:"\\varpi", tag:"mi", output:"\u03D6", ttype:CONST},
{input:"\\varpropto", tag:"mo", output:"\u221D", ttype:CONST},
{input:"\\varrho", tag:"mi", output:"\u03F1", ttype:CONST},
{input:"\\varsigma", tag:"mi", output:"\u03C2", ttype:CONST},
{input:"\\vartheta", tag:"mi", output:"\u03D1", ttype:CONST},
{input:"\\vartriangle", tag:"mo", output:"\u22B5", ttype:CONST},
{input:"\\vartriangleleft", tag:"mo", output:"\u22B2", ttype:CONST},
{input:"\\vartriangleright", tag:"mo", output:"\u22B3", ttype:CONST},
{input:"\\vdash", tag:"mo", output:"\u22A2", ttype:CONST},
{input:"\\vDash", tag:"mo", output:"\u22A8", ttype:CONST},
{input:"\\Vdash", tag:"mo", output:"\u22A9", ttype:CONST},
{input:"\\vdots", tag:"mo", output:"\u22EE", ttype:CONST},
{input:"\\vec", tag:"mover", output:"\u20D7", ttype:UNARY, acc:true},
{input:"\\wedge", tag:"mo", output:"\u2227", ttype:CONST},
{input:"\\vee", tag:"mo", output:"\u2228", ttype:CONST},
{input:"\\veebar", tag:"mo", output:"\u22BB", ttype:CONST},
{input:"\\vert", tag:"mo", output:"\u007C", atval:"1", ttype:STRETCHY},
{input:"\\Vert", tag:"mo", output:"\u2016", atval:"1", ttype:STRETCHY},
{input:"\\widehat", tag:"mover", output:"\u0302", ttype:UNARY, acc:true},
{input:"\\widetilde", tag:"mover", output:"\u02DC", ttype:UNARY, acc:true},
{input:"\\wp", tag:"mo", output:"\u2118", ttype:CONST},
{input:"\\wr", tag:"mo", output:"\u2240", ttype:CONST},
{input:"\\Vvdash", tag:"mo", output:"\u22AA", ttype:CONST},
{input:"\\xi", tag:"mi", output:"\u03BE", ttype:CONST},
{input:"\\Xi", tag:"mo", output:"\u039E", ttype:CONST},
{input:"\\yen", tag:"mo", output:"\u00A5", ttype:CONST},
{input:"\\zeta", tag:"mi", output:"\u03B6", ttype:CONST},
{input:"]", tag:"mo",output:"]", rtag:"mi",atval:"1",ttype:STRETCHY},
{input:"^", tag:"msup", output:"^", ttype:INFIX},
{input:"_", tag:"msub", output:"_", ttype:INFIX},
{input:"{", output:"{", ttype:LEFTBRACKET, invisible:true},
{input:"|", tag:"mo", output:"\u2223", atval:"1", ttype:STRETCHY},
{input:"}", output:"}", ttype:RIGHTBRACKET, invisible:true},
{input:"~", tag:"mspace", atname:"width", atval:"0.333em", ttype:SPACE},
{input:"\\usepackage[usenames]{color}",tag:"mstyle",atname:"mathvariant", output:"X", atval:"false", ttype:UNARY},
{input:"\\colorbox",tag:"mstyle",atname:"mathvariant", atval:"background", ttype:BINARY}
];

var LMnames = []; //list of input symbols
var LMmathml = "http://www.w3.org/1998/Math/MathML";
var LMpreviousSymbol,LMcurrentSymbol;
var LaTeXColor = [];
LaTeXColor["greenyellow"] = "#D9FF4F";
LaTeXColor["yellow"] = "#FFFF00";
LaTeXColor["goldenrod"] = "#FFE529";
LaTeXColor["dandelion"] = "#FFB529";
LaTeXColor["apricot"] = "#FFAD7A";
LaTeXColor["peach"] = "#FF804D";
LaTeXColor["melon"] = "#FF8A80";
LaTeXColor["yelloworange"] = "#FF9400";
LaTeXColor["orange"] = "#FF6321";
LaTeXColor["burntorange"] = "#FF7D00";
LaTeXColor["bittersweet"] = "#C20300";
LaTeXColor["redorange"] = "#FF3B21";
LaTeXColor["mahogany"] = "#A60000";
LaTeXColor["maroon"] = "#AD0000";
LaTeXColor["brickred"] = "#B80000";
LaTeXColor["red"] = "#FF0000";
LaTeXColor["orangered"] = "#FF0080";
LaTeXColor["rubinered"] = "#FF00DE";
LaTeXColor["wildstrawberry"] = "#FF0A9C";
LaTeXColor["salmon"] = "#FF789E";
LaTeXColor["carnationpink"] = "#FF5EFF";
LaTeXColor["magenta"] = "#FF00FF";
LaTeXColor["violetred"] = "#FF30FF";
LaTeXColor["rhodamine"] = "#FF2EFF";
LaTeXColor["mulberry"] = "#A314FA";
LaTeXColor["redviolet"] = "#9600A8";
LaTeXColor["fuchsia"] = "#7303EB";
LaTeXColor["lavender"] = "#FF85FF";
LaTeXColor["thistle"] = "#E069FF";
LaTeXColor["orchid"] = "#AD5CFF";
LaTeXColor["darkorchid"] = "#9933CC";
LaTeXColor["purple"] = "#8C24FF";
LaTeXColor["plum"] = "#8000FF";
LaTeXColor["violet"] = "#361FFF";
LaTeXColor["royalpurple"] = "#401AFF";
LaTeXColor["blueviolet"] = "#1A0DF5";
LaTeXColor["periwinkle"] = "#6E73FF";
LaTeXColor["cadetblue"] = "#616EC4";
LaTeXColor["cornflowerblue"] = "#59DEFF";
LaTeXColor["midnightblue"] = "#007091";
LaTeXColor["navyblue"] = "#0F75FF";
LaTeXColor["royalblue"] = "#0080FF";
LaTeXColor["blue"] = "#0000FF";
LaTeXColor["cerulean"] = "#0FE3FF";
LaTeXColor["cyan"] = "#00FFFF";
LaTeXColor["processblue"] = "#0AFFFF";
LaTeXColor["skyblue"] = "#61FFE0";
LaTeXColor["turquoise"] = "#26FFCC";
LaTeXColor["tealblue"] = "#1FFAA3";
LaTeXColor["aquamarine"] = "#2EFFB2";
LaTeXColor["bluegreen"] = "#26FFAB";
LaTeXColor["emerald"] = "#00FF80";
LaTeXColor["junglegreen"] = "#03FF7A";
LaTeXColor["seagreen"] = "#4FFF80";
LaTeXColor["green"] = "#00FF00";
LaTeXColor["forestgreen"] = "#00E000";
LaTeXColor["pinegreen"] = "#00BF29";
LaTeXColor["limegreen"] = "#80FF00";
LaTeXColor["yellowgreen"] = "#8FFF42";
LaTeXColor["springgreen"] = "#BDFF3D";
LaTeXColor["olivegreen"] = "#009900";
LaTeXColor["rawsienna"] = "#8C0000";
LaTeXColor["sepia"] = "#4D0000";
LaTeXColor["brown"] = "#660000";
LaTeXColor["tan"] = "#DB9470";
LaTeXColor["gray"] = "#808080";
LaTeXColor["grey"] = "#808080";
LaTeXColor["black"] = "#000000";
LaTeXColor["white"] = "#FFFFFF";
var IsColorName = /^(?:greenyellow|yellow|goldenrod|dandelion|apricot|peach|melon|yelloworange|orange|burntorange|bittersweet|redorange|mahogany|maroon|brickred|red|orangered|rubinered|wildstrawberry|salmon|carnationpink|magenta|violetred|rhodamine|mulberry|redviolet|fuchsia|lavender|thistle|orchid|darkorchid|purple|plum|violet|royalpurple|blueviolet|periwinkle|cadetblue|cornflowerblue|midnightblue|navyblue|royalblue|blue|cerulean|cyan|processblue|skyblue|turquoise|tealblue|aquamarine|bluegreen|emerald|junglegreen|seagreen|green|forestgreen|pinegreen|limegreen|yellowgreen|springgreen|olivegreen|rawsienna|sepia|brown|tan|gray|grey|black|white)$/;

function AMinit(){
 var msg, warnings = new Array();
 if (document.getElementById==null){
 alert("This webpage requires a recent browser such as Firefox");
 return null;
 }
 initSymbols();
 return true;
}

function AMtranslate(spanclassAM) {
 if (!AMtranslated) { // run this only once
 AMtranslated = true;
 var body = document.getElementsByTagName("body")[0];
 var processN = document.getElementById(AMdocumentId);
 if (translateLaTeX) {LMprocessNode((processN!=null?processN:body));GeMprocessNode((processN!=null?processN:body));}
 if (translateASCIIMath) AMprocessNode((processN!=null?processN:body), false, spanclassAM);
 }
}

function initSymbols() {
 var texsymbols = [], i;
 for (i=0; i<AMsymbols.length; i++)
 if (AMsymbols[i].tex && !(typeof AMsymbols[i].notexcopy == "boolean" && AMsymbols[i].notexcopy)) 
 texsymbols[texsymbols.length] = {input:AMsymbols[i].tex, 
 tag:AMsymbols[i].tag, output:AMsymbols[i].output, ttype:AMsymbols[i].ttype};
 AMsymbols = AMsymbols.concat(texsymbols);
 refreshSymbols();
}

function refreshSymbols(){
 var i;
 AMsymbols.sort(compareNames);
 for (i=0; i<AMsymbols.length; i++) AMnames[i] = AMsymbols[i].input;
 LMsymbols.sort(compareNames);
 for (i=0; i<LMsymbols.length; i++) LMnames[i] = LMsymbols[i].input;
}

function AMremoveCharsAndBlanks(str,n) {
//remove n characters and any following blanks
 var st;
 if (str.charAt(n)=="\\" && str.charAt(n+1)!="\\" && str.charAt(n+1)!=" ") 
 st = str.slice(n+1);
 else st = str.slice(n);
 for (var i=0; i<st.length && st.charCodeAt(i)<=32; i=i+1);
 return st.slice(i);
}

function position(arr, str, n) { 
// return position >=n where str appears or would be inserted
// assumes arr is sorted
 if (n==0) {
 var h,m;
 n = -1;
 h = arr.length;
 while (n+1<h) {
 m = (n+h) >> 1;
 if (arr[m]<str) n = m; else h = m;
 }
 return h;
 } else
 for (var i=n; i<arr.length && arr[i]<str; i++);
 return i; // i=arr.length || arr[i]>=str
}

function AMgetSymbol(str) {
//return maximal initial substring of str that appears in names
//return null if there is none
 var k = 0; //new pos
 var j = 0; //old pos
 var mk; //match pos
 var st;
 var tagst;
 var match = "";
 var more = true;
 for (var i=1; i<=str.length && more; i++) {
 st = str.slice(0,i); //initial substring of length i
 j = k;
 k = position(AMnames, st, j);
 if (k<AMnames.length && str.slice(0,AMnames[k].length)==AMnames[k]){
 match = AMnames[k];
 mk = k;
 i = match.length;
 }
 more = k<AMnames.length && str.slice(0,AMnames[k].length)>=AMnames[k];
 }
 AMpreviousSymbol=AMcurrentSymbol;
 if (match!=""){
 AMcurrentSymbol=AMsymbols[mk].ttype;
 return AMsymbols[mk]; 
 }
// if str[0] is a digit or - return maxsubstring of digits.digits
 AMcurrentSymbol=CONST;
 k = 1;
 st = str.slice(0,1);
 var integ = true;
 while ("0"<=st && st<="9" && k<=str.length) {
 st = str.slice(k,k+1);
 k++;
 }
 if (st == decimalsign) {
 st = str.slice(k,k+1);
 if ("0"<=st && st<="9") {
 integ = false;
 k++;
 while ("0"<=st && st<="9" && k<=str.length) {
 st = str.slice(k,k+1);
 k++;
 }
 }
 }
 if ((integ && k>1) || k>2) {
 st = str.slice(0,k-1);
 tagst = "mn";
 } else {
 k = 2;
 st = str.slice(0,1); //take 1 character
 tagst = (("A">st || st>"Z") && ("a">st || st>"z")?"mo":"mi");
 }
 if (st=="-" && AMpreviousSymbol==INFIX) {
 AMcurrentSymbol = INFIX; //trick "/" into recognizing "-" on second parse
 return {input:st, tag:tagst, output:st, ttype:UNARY, func:true, val:true};
 }
 return {input:st, tag:tagst, output:st, ttype:CONST, val:true};
}

function AMremoveBrackets(node) {
 var st;
 if (node.nodeName=="mrow") {
 st = node.firstChild.firstChild.nodeValue;
 if (st=="(" || st=="[" || st=="{") node.removeChild(node.firstChild);
 }
 if (node.nodeName=="mrow") {
 st = node.lastChild.firstChild.nodeValue;
 if (st==")" || st=="]" || st=="}") node.removeChild(node.lastChild);
 }
}

function AMTremoveBrackets(node) {
 var st;
 if (node.charAt(0)=='{' && node.charAt(node.length-1)=='}') {
 st = node.charAt(1);
 if (st=="(" || st=="[") node = '{'+node.substr(2);
 st = node.substr(1,6);
 if (st=="\\left(" || st=="\\left[" || st=="\\left{") node = '{'+node.substr(7);
 st = node.substr(1,12);
 if (st=="\\left\\lbrace" || st=="\\left\\langle") node = '{'+node.substr(13);
 st = node.charAt(node.length-2);
 if (st==")" || st=="]") node = node.substr(0,node.length-8)+'}';
 st = node.substr(node.length-8,7)
 if (st=="\\rbrace" || st=="\\rangle") node = node.substr(0,node.length-14) + '}';
 } 
 return node;
}

function AMTgetTeXsymbol(symb) {
 if (typeof symb.val == "boolean" && symb.val) {
 pre = '';
 } else {
 pre = '\\';
 }
 if (symb.tex==null) {
 return (pre+symb.input);
 } else {
 return (pre+symb.tex);
 }
}
function AMTgetTeXbracket(symb) {
 if (symb.tex==null) {
 return (symb.input);
 } else {
 return ('\\'+symb.tex);
 }
}

function AMTparseSexpr(str) { //parses str and returns [node,tailstr]
 var symbol, node, result, i, st,// rightvert = false,
 newFrag = '';
 str = AMremoveCharsAndBlanks(str,0);
 symbol = AMgetSymbol(str); //either a token or a bracket or empty
 if (symbol == null || symbol.ttype == RIGHTBRACKET && AMnestingDepth > 0) {
 return [null,str];
 }
 if (symbol.ttype == DEFINITION) {
 str = symbol.output+AMremoveCharsAndBlanks(str,symbol.input.length); 
 symbol = AMgetSymbol(str);
 }
 switch (symbol.ttype) {
 case UNDEROVER:
 case CONST:
 str = AMremoveCharsAndBlanks(str,symbol.input.length); 
 var texsymbol = AMTgetTeXsymbol(symbol);
 if (texsymbol.charAt(0)=="\\" || symbol.tag=="mo") return [texsymbol,str];
 else return ['{'+texsymbol+'}',str];
 
 case LEFTBRACKET: //read (expr+)
 AMnestingDepth++;
 str = AMremoveCharsAndBlanks(str,symbol.input.length); 
 
 result = AMTparseExpr(str,true);
 AMnestingDepth--;
 if (typeof symbol.invisible == "boolean" && symbol.invisible) 
 node = '{\\left.'+result[0]+'}';
 else {
 node = '{\\left'+AMTgetTeXbracket(symbol) + result[0]+'}';
 }
 return [node,result[1]];
 case TEXT:
 if (symbol!=AMquote) str = AMremoveCharsAndBlanks(str,symbol.input.length);
 if (str.charAt(0)=="{") i=str.indexOf("}");
 else if (str.charAt(0)=="(") i=str.indexOf(")");
 else if (str.charAt(0)=="[") i=str.indexOf("]");
 else if (symbol==AMquote) i=str.slice(1).indexOf("\"")+1;
 else i = 0;
 if (i==-1) i = str.length;
 st = str.slice(1,i);
 if (st.charAt(0) == " ") {
 newFrag = '\\ ';
 }
 newFrag += '\\text{'+st+'}';
 if (st.charAt(st.length-1) == " ") {
 newFrag += '\\ ';
 }
 str = AMremoveCharsAndBlanks(str,i+1);
 return [newFrag,str];
 case UNARY:
 str = AMremoveCharsAndBlanks(str,symbol.input.length); 
 result = AMTparseSexpr(str);
 if (result[0]==null) return ['{'+AMTgetTeXsymbol(symbol)+'}',str];
 if (typeof symbol.func == "boolean" && symbol.func) { // functions hack
 st = str.charAt(0);
 if (st=="^" || st=="_" || st=="/" || st=="|" || st==",") {
 return ['{'+AMTgetTeXsymbol(symbol)+'}',str];
 } else {
 node = '{'+AMTgetTeXsymbol(symbol)+'{'+result[0]+'}}';
 return [node,result[1]];
 }
 }
 result[0] = AMTremoveBrackets(result[0]);
 if (symbol.input == "sqrt") { // sqrt
 return ['\\sqrt{'+result[0]+'}',result[1]];
 } else if (typeof symbol.acc == "boolean" && symbol.acc) { // accent
 return ['{'+AMTgetTeXsymbol(symbol)+'{'+result[0]+'}}',result[1]];
 } else { // font change command 
 return ['{'+AMTgetTeXsymbol(symbol)+'{'+result[0]+'}}',result[1]];
 }
 case BINARY:
 str = AMremoveCharsAndBlanks(str,symbol.input.length);
 result = AMTparseSexpr(str);
 if (result[0]==null) return ['{'+AMTgetTeXsymbol(symbol)+'}',str];
 result[0] = AMTremoveBrackets(result[0]);
 var result2 = AMTparseSexpr(result[1]);
 if (result2[0]==null) return ['{'+AMTgetTeXsymbol(symbol)+'}',str];
 result2[0] = AMTremoveBrackets(result2[0]);
 if (symbol.input=="density") {
 newFrag = '{\\density{'+result[0]+'}{'+result2[0]+'}}';
 newFrag = newFrag.replace(/{{{/g,"{");
 newFrag = newFrag.replace(/}}}/g,"}");
 }
 if (symbol.input=="root") {
 newFrag = '{\\sqrt['+result[0]+']{'+result2[0]+'}}';
 }
 if (symbol.input=="stackrel") {
 newFrag = '{'+AMTgetTeXsymbol(symbol)+'{'+result[0]+'}{'+result2[0]+'}}';
 }
 if (symbol.input=="frac") {
 newFrag = '{\\frac{'+result[0]+'}{'+result2[0]+'}}';
 }
 return [newFrag,result2[1]];
 case INFIX:
 str = AMremoveCharsAndBlanks(str,symbol.input.length); 
 return [symbol.output,str];
 case SPACE:
 str = AMremoveCharsAndBlanks(str,symbol.input.length);
 return ['{\\quad\\text{'+symbol.input+'}\\quad}',str];
 case LEFTRIGHT:
// if (rightvert) return [null,str]; else rightvert = true;
 AMnestingDepth++;
 str = AMremoveCharsAndBlanks(str,symbol.input.length); 
 result = AMTparseExpr(str,false);
 AMnestingDepth--;
 var st = "";
 st = result[0].charAt(result[0].length -1);
//alert(result[0].lastChild+"***"+st);
 if (st == "|") { // its an absolute value subterm
 node = '{\\left|'+result[0]+'}';
 return [node,result[1]];
 } else { // the "|" is a \mid
 node = '{\\mid}';
 return [node,str];
 }
 
 default:
//alert("default");
 str = AMremoveCharsAndBlanks(str,symbol.input.length); 
 return ['{'+AMTgetTeXsymbol(symbol)+'}',str];
 }
}

function AMTparseIexpr(str) {
 var symbol, sym1, sym2, node, result, underover;
 str = AMremoveCharsAndBlanks(str,0);
 sym1 = AMgetSymbol(str);
 result = AMTparseSexpr(str);
 node = result[0];
 str = result[1];
 symbol = AMgetSymbol(str);
 if (symbol.ttype == INFIX && symbol.input != "/") {
 str = AMremoveCharsAndBlanks(str,symbol.input.length);
 // if (symbol.input == "/") result = AMTparseIexpr(str); else 
 result = AMTparseSexpr(str);
 if (result[0] == null) // show box in place of missing argument
 result[0] = '{}';
 else result[0] = AMTremoveBrackets(result[0]);
 str = result[1];
// if (symbol.input == "/") AMTremoveBrackets(node);
 if (symbol.input == "_") {
 sym2 = AMgetSymbol(str);
 underover = (sym1.ttype == UNDEROVER);
 if (sym2.input == "^") {
 str = AMremoveCharsAndBlanks(str,sym2.input.length);
 var res2 = AMTparseSexpr(str);
 res2[0] = AMTremoveBrackets(res2[0]);
 str = res2[1];
 node = '{' + node;
 node += '_{'+result[0]+'}';
 node += '^{'+res2[0]+'}';
 node += '}';
 } else {
 node += '_{'+result[0]+'}';
 }
 } else { //must be ^
 node = '{'+node+'}^{'+result[0]+'}';
 }
 } 
 
 return [node,str];
}

function AMTparseExpr(str,rightbracket) {
 var symbol, node, result, i, nodeList = [],
 newFrag = '';
 var addedright = false;
 do {
 str = AMremoveCharsAndBlanks(str,0);
 result = AMTparseIexpr(str);
 node = result[0];
 str = result[1];
 symbol = AMgetSymbol(str);
 if (symbol.ttype == INFIX && symbol.input == "/") {
 str = AMremoveCharsAndBlanks(str,symbol.input.length);
 result = AMTparseIexpr(str);
 
 if (result[0] == null) // show box in place of missing argument
 result[0] = '{}';
 else result[0] = AMTremoveBrackets(result[0]);
 str = result[1];
 node = AMTremoveBrackets(node);
 node = '\\frac' + '{'+ node + '}';
 node += '{'+result[0]+'}';
 newFrag += node;
 symbol = AMgetSymbol(str);
 } else if (node!=undefined) newFrag += node;
 } while ((symbol.ttype != RIGHTBRACKET && 
 (symbol.ttype != LEFTRIGHT || rightbracket)
 || AMnestingDepth == 0) && symbol!=null && symbol.output!="");
 if (symbol.ttype == RIGHTBRACKET || symbol.ttype == LEFTRIGHT) {
// if (AMnestingDepth > 0) AMnestingDepth--;
 var len = newFrag.length;
 if (len>2 && newFrag.charAt(0)=='{' && newFrag.indexOf(',')>0) { //could be matrix (total rewrite from .js)
 var right = newFrag.charAt(len - 2);
 if (right==')' || right==']') {
 var left = newFrag.charAt(6);
 if ((left=='(' && right==')' && symbol.output != '}') || (left=='[' && right==']')) {
 var mxout = '\\begin{array}{cc}';
 var pos = new Array(); //position of commas
 pos.push(0);
 var matrix = true;
 var mxnestingd = 0;
 for (i=1; i<len-1; i++) {
 if (newFrag.charAt(i)==left) mxnestingd++;
 if (newFrag.charAt(i)==right) {
 mxnestingd--;
 if (mxnestingd==0 && newFrag.charAt(i+2)==',' && newFrag.charAt(i+3)=='{') pos.push(i+2);
 }
 }
 pos.push(len);
 var lastmxsubcnt = -1;
 if (mxnestingd==0 && pos.length>0) {
 for (i=0;i<pos.length-1;i++) {
 if (i>0) mxout += '\\\\';
 if (i==0) {
 var subarr = newFrag.substr(pos[i]+7,pos[i+1]-pos[i]-15).split(',');
 } else {
 var subarr = newFrag.substr(pos[i]+8,pos[i+1]-pos[i]-16).split(',');
 }
 if (lastmxsubcnt>0 && subarr.length!=lastmxsubcnt) {
 matrix = false;
 } else if (lastmxsubcnt==-1) {
 lastmxsubcnt=subarr.length;
 }
 mxout += subarr.join('&');
 }
 }
 mxout += '\\end{array}';
 if (matrix) { newFrag = mxout;}
 }
 }
 }
 
 str = AMremoveCharsAndBlanks(str,symbol.input.length);
 if (typeof symbol.invisible != "boolean" || !symbol.invisible) {
 node = '\\right'+AMTgetTeXbracket(symbol);
 newFrag += node;
 addedright = true;
 } else {
 newFrag += '\\right.';
 addedright = true;
 }
 
 }
 if(AMnestingDepth>0 && !addedright) {
 newFrag += '\\right.'; //adjust for non-matching left brackets
 //todo: adjust for non-matching right brackets
 }
 
 return [newFrag,str];
}

function AMTparseAMtoTeX(str) {
 AMnestingDepth = 0;
 return AMTparseExpr(str.replace(/^\s+/g,""),false)[0];
}

function AMparseSexpr(str) { //parses str and returns [node,tailstr]
 var symbol, node, result, i, st,// rightvert = false,
 newFrag = document.createDocumentFragment();
 str = AMremoveCharsAndBlanks(str,0);
 symbol = AMgetSymbol(str); //either a token or a bracket or empty
 if (symbol == null || symbol.ttype == RIGHTBRACKET && AMnestingDepth > 0) {
 return [null,str];
 }
 if (symbol.ttype == DEFINITION) {
 str = symbol.output+AMremoveCharsAndBlanks(str,symbol.input.length); 
 symbol = AMgetSymbol(str);
 }
 switch (symbol.ttype) { case UNDEROVER:
 case CONST:
 str = AMremoveCharsAndBlanks(str,symbol.input.length); 
 return [createMmlNode(symbol.tag, //its a constant
 document.createTextNode(symbol.output)),str];
 case LEFTBRACKET: //read (expr+)
 AMnestingDepth++;
 str = AMremoveCharsAndBlanks(str,symbol.input.length); 
 result = AMparseExpr(str,true);
 AMnestingDepth--;
 if (typeof symbol.invisible == "boolean" && symbol.invisible) 
 node = createMmlNode("mrow",result[0]);
 else {
 node = createMmlNode("mo",document.createTextNode(symbol.output));
 node = createMmlNode("mrow",node);
 node.appendChild(result[0]);
 }
 return [node,result[1]];
 case TEXT:
 if (symbol!=AMquote) str = AMremoveCharsAndBlanks(str,symbol.input.length);
 if (str.charAt(0)=="{") i=str.indexOf("}");
 else if (str.charAt(0)=="(") i=str.indexOf(")");
 else if (str.charAt(0)=="[") i=str.indexOf("]");
 else if (symbol==AMquote) i=str.slice(1).indexOf("\"")+1;
 else i = 0;
 if (i==-1) i = str.length;
 st = str.slice(1,i);
 if (st.charAt(0) == " ") {
 node = createMmlNode("mspace");
 node.setAttribute("width","1ex");
 newFrag.appendChild(node);
 }
 newFrag.appendChild(
 createMmlNode(symbol.tag,document.createTextNode(st)));
 if (st.charAt(st.length-1) == " ") {
 node = createMmlNode("mspace");
 node.setAttribute("width","1ex");
 newFrag.appendChild(node);
 }
 str = AMremoveCharsAndBlanks(str,i+1);
 return [createMmlNode("mrow",newFrag),str];
 case UNARY:
 str = AMremoveCharsAndBlanks(str,symbol.input.length); 
 result = AMparseSexpr(str);
 if (result[0]==null) return [createMmlNode(symbol.tag,
 document.createTextNode(symbol.output)),str];
 if (typeof symbol.func == "boolean" && symbol.func) { // functions hack
 st = str.charAt(0);
 if (st=="^" || st=="_" || st=="/" || st=="|" || st==",") {
 return [createMmlNode(symbol.tag,
 document.createTextNode(symbol.output)),str];
 } else {
 node = createMmlNode("mrow",
 createMmlNode(symbol.tag,document.createTextNode(symbol.output)));
 node.appendChild(result[0]);
 return [node,result[1]];
 }
 }
 AMremoveBrackets(result[0]);
 if (symbol.input == "sqrt") { // sqrt
 return [createMmlNode(symbol.tag,result[0]),result[1]];
 } else if (typeof symbol.acc == "boolean" && symbol.acc) { // accent
 node = createMmlNode(symbol.tag,result[0]);
 node.appendChild(createMmlNode("mo",document.createTextNode(symbol.output)));
 return [node,result[1]];
 } else { // font change command
 if (!isIE && typeof symbol.codes != "undefined") {
 for (i=0; i<result[0].childNodes.length; i++)
 if (result[0].childNodes[i].nodeName=="mi" || result[0].nodeName=="mi") {
 st = (result[0].nodeName=="mi"?result[0].firstChild.nodeValue:
 result[0].childNodes[i].firstChild.nodeValue);
 var newst = [];
 for (var j=0; j<st.length; j++)
 if (st.charCodeAt(j)>64 && st.charCodeAt(j)<91) {newst = newst + fixedFromCharCode(symbol.codes[st.charCodeAt(j)-65]);} else newst = newst + st.charAt(j);
 if (result[0].nodeName=="mi")
 result[0]=createMmlNode("mo").
 appendChild(document.createTextNode(newst));
 else result[0].replaceChild(createMmlNode("mo").
 appendChild(document.createTextNode(newst)),
 result[0].childNodes[i]);
 }
 }
 node = createMmlNode(symbol.tag,result[0]);
 node.setAttribute(symbol.atname,symbol.atval);
 return [node,result[1]];
 }
 case BINARY:
 str = AMremoveCharsAndBlanks(str,symbol.input.length); 
 result = AMparseSexpr(str);
 if (result[0]==null) return [createMmlNode("mo",
 document.createTextNode(symbol.input)),str];
 AMremoveBrackets(result[0]);
 var result2 = AMparseSexpr(result[1]);
 if (result2[0]==null) return [createMmlNode("mo",
 document.createTextNode(symbol.input)),str];
 AMremoveBrackets(result2[0]);
 if (symbol.input=="density") { 
 var tclrf = str.match(/\{\s*([#\w]+)\s*\}/); //get's size from beginning of str
 str = str.replace(/\{\s*[#\w]+\s*\}/,""); 
 if(tclrf!=null) {
 if(tclrf[1]>1000) {
 tclrf=1000+'%';
 } else {
 tclrf=tclrf[1]+'%';
 }
 node = LMcreateElementMathML("mstyle");
 node.setAttribute(symbol.atval,tclrf);
 node.appendChild(result2[0]); 
 return [node,result2[1],symbol.tag]; 
 } 
 }
 if (symbol.input=="root" || symbol.input=="stackrel") 
 newFrag.appendChild(result2[0]);
 newFrag.appendChild(result[0]);
 if (symbol.input=="frac") newFrag.appendChild(result2[0]);
 return [createMmlNode(symbol.tag,newFrag),result2[1]];
 case INFIX:
 str = AMremoveCharsAndBlanks(str,symbol.input.length); 
 return [createMmlNode("mo",document.createTextNode(symbol.output)),str];
 case SPACE:
 str = AMremoveCharsAndBlanks(str,symbol.input.length); 
 node = createMmlNode("mspace");
 node.setAttribute("width","1ex");
 newFrag.appendChild(node);
 newFrag.appendChild(
 createMmlNode(symbol.tag,document.createTextNode(symbol.output)));
 node = createMmlNode("mspace");
 node.setAttribute("width","1ex");
 newFrag.appendChild(node);
 return [createMmlNode("mrow",newFrag),str];
 case LEFTRIGHT:
// if (rightvert) return [null,str]; else rightvert = true;
 AMnestingDepth++;
 str = AMremoveCharsAndBlanks(str,symbol.input.length); 
 result = AMparseExpr(str,false);
 AMnestingDepth--;
 var st = "";
 if (result[0].lastChild!=null)
 st = result[0].lastChild.firstChild.nodeValue;
 if (st == "|") { // its an absolute value subterm
 node = createMmlNode("mo",document.createTextNode(symbol.output));
 node = createMmlNode("mrow",node);
 node.appendChild(result[0]);
 return [node,result[1]];
 } else { // the "|" is a \mid so use unicode 2223 (divides) for spacing
 node = createMmlNode("mo",document.createTextNode("\u2223"));
 node = createMmlNode("mrow",node);
 return [node,str];
 }
 default:
//alert("default");
 str = AMremoveCharsAndBlanks(str,symbol.input.length); 
 return [createMmlNode(symbol.tag, //its a constant
 document.createTextNode(symbol.output)),str];
 }
}

function AMparseIexpr(str) {
 var symbol, sym1, sym2, node, result, underover;
 str = AMremoveCharsAndBlanks(str,0);
 sym1 = AMgetSymbol(str);
 result = AMparseSexpr(str);
 node = result[0];
 str = result[1];
 symbol = AMgetSymbol(str);
 if (symbol.ttype == INFIX && symbol.input != "/") {
 str = AMremoveCharsAndBlanks(str,symbol.input.length);
// if (symbol.input == "/") result = AMparseIexpr(str); else ...
 result = AMparseSexpr(str);
 if (result[0] == null) // show box in place of missing argument
 result[0] = createMmlNode("mo",document.createTextNode("\u25A1"));
 else AMremoveBrackets(result[0]);
 str = result[1];
// if (symbol.input == "/") AMremoveBrackets(node);
 if (symbol.input == "_") {
 sym2 = AMgetSymbol(str);
 underover = (sym1.ttype == UNDEROVER);
 if (sym2.input == "^") {
 str = AMremoveCharsAndBlanks(str,sym2.input.length);
 var res2 = AMparseSexpr(str);
 AMremoveBrackets(res2[0]);
 str = res2[1];
 node = createMmlNode((underover?"munderover":"msubsup"),node);
 node.appendChild(result[0]);
 node.appendChild(res2[0]);
 node = createMmlNode("mrow",node); // so sum does not stretch
 } else {
 node = createMmlNode((underover?"munder":"msub"),node);
 node.appendChild(result[0]);
 }
 } else {
 node = createMmlNode(symbol.tag,node);
 node.appendChild(result[0]);
 }
 }
 return [node,str];
}

function AMparseExpr(str,rightbracket) {
 var symbol, node, result, i, nodeList = [],
 newFrag = document.createDocumentFragment();
 do {
 str = AMremoveCharsAndBlanks(str,0);
 result = AMparseIexpr(str);
 node = result[0];
 str = result[1];
 symbol = AMgetSymbol(str);
 if (symbol.ttype == INFIX && symbol.input == "/") {
 str = AMremoveCharsAndBlanks(str,symbol.input.length);
 result = AMparseIexpr(str);
 if (result[0] == null) // show box in place of missing argument
 result[0] = createMmlNode("mo",document.createTextNode("\u25A1"));
 else AMremoveBrackets(result[0]);
 str = result[1];
 AMremoveBrackets(node);
 node = createMmlNode(symbol.tag,node);
 node.appendChild(result[0]);
 newFrag.appendChild(node);
 symbol = AMgetSymbol(str);
 } 
 else if (node!=undefined) newFrag.appendChild(node);
 } while ((symbol.ttype != RIGHTBRACKET && 
 (symbol.ttype != LEFTRIGHT || rightbracket)
 || AMnestingDepth == 0) && symbol!=null && symbol.output!="");
 if (symbol.ttype == RIGHTBRACKET || symbol.ttype == LEFTRIGHT) {
// if (AMnestingDepth > 0) AMnestingDepth--;
 var len = newFrag.childNodes.length;
 if (len>0 && newFrag.childNodes[len-1].nodeName == "mrow" && len>1 &&
 newFrag.childNodes[len-2].nodeName == "mo" &&
 newFrag.childNodes[len-2].firstChild.nodeValue == ",") { //matrix
 var right = newFrag.childNodes[len-1].lastChild.firstChild.nodeValue;
 if (right==")" || right=="]") {
 var left = newFrag.childNodes[len-1].firstChild.firstChild.nodeValue;
 if (left=="(" && right==")" && symbol.output != "}" || 
 left=="[" && right=="]") {
 var pos = []; // positions of commas
 var matrix = true;
 var m = newFrag.childNodes.length;
 for (i=0; matrix && i<m; i=i+2) {
 pos[i] = [];
 node = newFrag.childNodes[i];
 if (matrix) matrix = node.nodeName=="mrow" && 
 (i==m-1 || node.nextSibling.nodeName=="mo" && 
 node.nextSibling.firstChild.nodeValue==",")&&
 node.firstChild.firstChild.nodeValue==left &&
 node.lastChild.firstChild.nodeValue==right;
 if (matrix) 
 for (var j=0; j<node.childNodes.length; j++)
 if (node.childNodes[j].firstChild.nodeValue==",")
 pos[i][pos[i].length]=j;
 if (matrix && i>1) matrix = pos[i].length == pos[i-2].length;
 }
 if (matrix) {
 var row, frag, n, k, table = document.createDocumentFragment();
 for (i=0; i<m; i=i+2) {
 row = document.createDocumentFragment();
 frag = document.createDocumentFragment();
 node = newFrag.firstChild; // <mrow>(-,-,...,-,-)</mrow>
 n = node.childNodes.length;
 k = 0;
 node.removeChild(node.firstChild); //remove (
 for (j=1; j<n-1; j++) {
 if (typeof pos[i][k] != "undefined" && j==pos[i][k]){
 node.removeChild(node.firstChild); //remove ,
 row.appendChild(createMmlNode("mtd",frag));
 k++;
 } else frag.appendChild(node.firstChild);
 }
 row.appendChild(createMmlNode("mtd",frag));
 if (newFrag.childNodes.length>2) {
 newFrag.removeChild(newFrag.firstChild); //remove <mrow>)</mrow>
 newFrag.removeChild(newFrag.firstChild); //remove <mo>,</mo>
 }
 table.appendChild(createMmlNode("mtr",row));
 }
 node = createMmlNode("mtable",table);
 if (typeof symbol.invisible == "boolean" && symbol.invisible) node.setAttribute("columnalign","left");
 newFrag.replaceChild(node,newFrag.firstChild);
 }
 }
 }
 }
 str = AMremoveCharsAndBlanks(str,symbol.input.length);
 if (typeof symbol.invisible != "boolean" || !symbol.invisible) {
 node = createMmlNode("mo",document.createTextNode(symbol.output));
 newFrag.appendChild(node);
 }
 }
 return [newFrag,str];
}
function  AMTparseMath(str,istex) {
 str = str.replace(/&nbsp;/g,"");
 str = str.replace(/&gt;/g,">");
 str = str.replace(/&lt;/g,"<");
 str = str.replace(/ /g," ");
 if (istex) { 
 var texstring = str;
 } else {
 var texstring = AMTparseAMtoTeX(str);
 }
 //alert(texstring);
 if (mathcolor!="") {
 texstring = "\\"+mathcolor + texstring;
 }
 if (displaystyle) {
 texstring = "\\displaystyle" + texstring;
 } else {
 texstring = "\\textstyle" + texstring;
 }
 var node = createElementXHTML("img");
 if (typeof encodeURIComponent == "function") {
 texstring = encodeURIComponent(texstring);
 } else {
 texstring = escape(texstring);
 }
 node.src = AMTcgiloc + texstring;
 node.style.verticalAlign = "middle";
 if (showasciiformulaonhover) //fixed by djhsu so newline
 node.setAttribute("title",str.replace(/\s+/g," "));//does not show in Gecko
 
 return node;
}

function  GeMTparseMath(str,istex) {
 str = str.replace(/&nbsp;/g,"");
 str = str.replace(/&gt;/g,">");
 str = str.replace(/&lt;/g,"<");
 str = str.replace(/ /g," ");
 if (istex) { 
 var texstring = str;
 } else {
 var texstring = AMTparseAMtoTeX(str);
 }
 if (texstring=="") {texstring = "\\hspace{0}";
 } else {
 //alert(texstring);
 if (mathcolor!="") {
 texstring = "\\"+mathcolor + " " + texstring;
 }
 }
 var node = createElementXHTML("img");
 if (typeof encodeURIComponent == "function") {
 texstring = encodeURIComponent(texstring);
 } else {
 texstring = escape(texstring);
 }
 node.src = Gemcgiloc + texstring;
 node.style.verticalAlign = "middle";
 if (showasciiformulaonhover) //fixed by djhsu so newline
 node.setAttribute("title",str.replace(/\s+/g," "));//does not show in Gecko
 
 return node;
}

function AMparseMath(str,latex) {
 var frag, node;
 AMnestingDepth = 0;
 frag = latex ? LMparseExpr(str.replace(/^\s+/g,""),false,false)[0] : AMparseExpr(str.replace(/^\s+/g,""),false)[0];
 node = createMmlNode("mstyle",frag);
 node.setAttribute("mathcolor",mathcolor);
 node.setAttribute("fontfamily",mathfontfamily);
 node.setAttribute("mathsize",mathfontsize);
 if (displaystyle) node.setAttribute("displaystyle","true");
 node = createMmlNode("math",node);
 if (showasciiformulaonhover) //fixed by djhsu so newline
 node.setAttribute("title",str.replace(/\s+/g," "));//does not show in Gecko
 return node;
}

function AMautomathrec(str) {
//formula is a space (or start of str) followed by a maximal sequence of *two* or more tokens, possibly separated by runs of digits and/or space.
//tokens are single letters (except a, A, I) and ASCIIMathML tokens
 var texcommand = "\\\\[a-zA-Z]+|\\\\\\s|";
 var ambigAMtoken = "\\b(?:oo|lim|ln|int|oint|del|grad|aleph|prod|prop|sinh|cosh|tanh|cos|sec|pi|tt|fr|sf|sube|supe|sub|sup|det|mod|gcd|lcm|min|max|vec|ddot|ul|chi|eta|nu|mu)(?![a-z])|";
 var englishAMtoken = "\\b(?:sum|ox|log|sin|tan|dim|hat|bar|dot)(?![a-z])|";
 var secondenglishAMtoken = "|\\bI\\b|\\bin\\b|\\btext\\b"; // took if and or not out
 var simpleAMtoken = "NN|ZZ|QQ|RR|CC|TT|AA|EE|sqrt|dx|dy|dz|dt|xx|vv|uu|nn|bb|cc|csc|cot|alpha|beta|delta|Delta|epsilon|gamma|Gamma|kappa|lambda|Lambda|omega|phi|Phi|Pi|psi|Psi|rho|sigma|Sigma|tau|theta|Theta|xi|Xi|zeta"; // uuu nnn?
 var letter = "[a-zA-HJ-Z](?=(?:[^a-zA-Z]|$|"+ambigAMtoken+englishAMtoken+simpleAMtoken+"))|";
 var token = letter+texcommand+"\\d+|[-()[\\]{}+=*&^_%\\\@/<>,\\|!:;'~]|\\.(?!(?:\x20|$))|"+ambigAMtoken+englishAMtoken+simpleAMtoken;
 var re = new RegExp("(^|\\s)((("+token+")\\s?)(("+token+secondenglishAMtoken+")\\s?)+)([,.?]?(?=\\s|$))","g");
 str = str.replace(re," `$2`$7");
 var arr = str.split(AMdelimiter1);
 var re1 = new RegExp("(^|\\s)([b-zB-HJ-Z+*<>]|"+texcommand+ambigAMtoken+simpleAMtoken+")(\\s|\\n|$)","g");
 var re2 = new RegExp("(^|\\s)([a-z]|"+texcommand+ambigAMtoken+simpleAMtoken+")([,.])","g"); // removed |\d+ for now
 for (i=0; i<arr.length; i++) //single nonenglish tokens
 if (i%2==0) {
 arr[i] = arr[i].replace(re1," `$2`$3");
 arr[i] = arr[i].replace(re2," `$2`$3");
 arr[i] = arr[i].replace(/([{}[\]])/,"`$1`");
 }
 str = arr.join(AMdelimiter1);
 str = str.replace(/((^|\s)\([a-zA-Z]{2,}.*?)\)`/g,"$1`)"); //fix parentheses
 str = str.replace(/`(\((a\s|in\s))(.*?[a-zA-Z]{2,}\))/g,"$1`$3"); //fix parentheses
 str = str.replace(/\sin`/g,"` in");
 str = str.replace(/`(\(\w\)[,.]?(\s|\n|$))/g,"$1`");
 str = str.replace(/`([0-9.]+|e.g|i.e)`(\.?)/gi,"$1$2");
 str = str.replace(/`([0-9.]+:)`/g,"$1");
 return str;
}

function processNodeR(n, linebreaks,latex) {
 var mtch, str, arr, frg, i;
 if (n.childNodes.length == 0) {
 if ((n.nodeType!=8 || linebreaks) &&
 n.parentNode.nodeName!="form" && n.parentNode.nodeName!="FORM" &&
 n.parentNode.nodeName!="textarea" && n.parentNode.nodeName!="TEXTAREA" /*&&
 n.parentNode.nodeName!="pre" && n.parentNode.nodeName!="PRE"*/) {
 str = n.nodeValue;
 if (!(str == null)) {
 str = str.replace(/\r\n\r\n/g,"\n\n");
 str = str.replace(/\x20+/g," ");
 str = str.replace(/\s*\r\n/g," ");
 if(latex) {
// DELIMITERS:
 mtch = (str.indexOf("\$")==-1 ? false : true);
 str = str.replace(/([^\\])\$/g,"$1 \$");
 str = str.replace(/^\$/," \$"); // in case \$ at start of string
 arr = str.split(" \$");
 for (i=0; i<arr.length; i++)
 arr[i]=arr[i].replace(/\\\$/g,"\$");
 } else {
 mtch = false;
 str = str.replace(new RegExp(AMescape1, "g"),
 function(){mtch = true; return "AMescape1"});
 str = str.replace(/\\?end{?a?math}?/i,
 function(){automathrecognize = false; mtch = true; return ""});
 str = str.replace(/amath\b|\\begin{a?math}/i,
 function(){automathrecognize = true; mtch = true; return ""});
 arr = str.split(AMdelimiter1);
 if (automathrecognize)
 for (i=0; i<arr.length; i++)
 if (i%2==0) arr[i] = AMautomathrec(arr[i]);
 str = arr.join(AMdelimiter1);
 arr = str.split(AMdelimiter1);
 for (i=0; i<arr.length; i++) // this is a problem ************
 arr[i]=arr[i].replace(/AMescape1/g,AMdelimiter1);
 }
 if (arr.length>1 || mtch) {
 frg = strarr2docFrag(arr,n.nodeType==8,latex);
 var len = frg.childNodes.length;
 n.parentNode.replaceChild(frg,n);
 return len-1;
 }
 }
 } else return 0;
 } else if (n.nodeName!="math") {
 for (i=0; i<n.childNodes.length; i++)
 i += processNodeR(n.childNodes[i], linebreaks,latex);
 }
 return 0;
}

function AMprocessNode(n, linebreaks, spanclassAM) {
 var frag,st;
 if (spanclassAM!=null) {
 frag = document.getElementsByTagName("span")
 for (var i=0;i<frag.length;i++)
 if (frag[i].className == "AM") 
 processNodeR(frag[i],linebreaks,false);
 } else {
 try {
 st = n.innerHTML; // look for AMdelimiter on page
 } catch(err) {}
//alert(st)
 if (st==null || /amath\b|\\begin{a?math}/i.test(st) ||
 st.indexOf(AMdelimiter1+" ")!=-1 || st.slice(-1)==AMdelimiter1 ||
 st.indexOf(AMdelimiter1+"<")!=-1 || st.indexOf(AMdelimiter1+"\n")!=-1) {
 processNodeR(n,linebreaks,false);
 }
 }
}

function LMcreateElementMathML(t) {
 if (!isIE) return document.createElementNS(LMmathml,t);
}
function LMremoveCharsAndBlanks(str,n) {
//remove n characters and any following blanks
 var st;
 st = str.slice(n);
 for (var i=0; i<st.length && st.charCodeAt(i)<=32; i=i+1);
 return st.slice(i);
}

function LMgetSymbol(str) {
//return maximal initial substring of str that appears in names
//return null if there is none
 var k = 0; //new pos
 var j = 0; //old pos
 var mk; //match pos
 var st;
 var tagst;
 var match = "";
 var more = true;
 for (var i=1; i<=str.length && more; i++) {
 st = str.slice(0,i); //initial substring of length i
 j = k;
 k = position(LMnames, st, j);
 if (k<LMnames.length && str.slice(0,LMnames[k].length)==LMnames[k]){
 match = LMnames[k];
 mk = k;
 i = match.length;
 }
 more = k<LMnames.length && str.slice(0,LMnames[k].length)>=LMnames[k];
 }
 LMpreviousSymbol=LMcurrentSymbol;
 if (match!=""){
 LMcurrentSymbol=LMsymbols[mk].ttype;
 return LMsymbols[mk];
 }
 LMcurrentSymbol=CONST;
 k = 1;
 st = str.slice(0,1); //take 1 character
 if ("0"<=st && st<="9") tagst = "mn";
 else tagst = (("A">st || st>"Z") && ("a">st || st>"z")?"mo":"mi");
 return {input:st, tag:tagst, output:st, ttype:CONST};
}

function LMparseSexpr(str) { //parses str and returns [node,tailstr,(node)tag]
 var symbol, node, result, result2, i, st,// rightvert = false,
 newFrag = document.createDocumentFragment();
 str = LMremoveCharsAndBlanks(str,0);
 symbol = LMgetSymbol(str); //either a token or a bracket or empty
 if (symbol == null || symbol.ttype == RIGHTBRACKET)
 return [null,str,null];
 if (symbol.ttype == DEFINITION) {
 str = symbol.output+LMremoveCharsAndBlanks(str,symbol.input.length);
 symbol = LMgetSymbol(str);
 if (symbol == null || symbol.ttype == RIGHTBRACKET)
 return [null,str,null];
 }
 str = LMremoveCharsAndBlanks(str,symbol.input.length);
 switch (symbol.ttype) {
 case SPACE:
 node = LMcreateElementMathML(symbol.tag);
 node.setAttribute(symbol.atname,symbol.atval);
 return [node,str,symbol.tag];
 case UNDEROVER:
 if (isIE) {
 if (symbol.input.substr(0,4) == "\\big") { // botch for missing symbols
 str = "\\"+symbol.input.substr(4)+str; // make \bigcup = \cup etc.
 symbol = LMgetSymbol(str);
 symbol.ttype = UNDEROVER;
 str = LMremoveCharsAndBlanks(str,symbol.input.length);
 }
 }
 return [createMmlNode(symbol.tag,
 document.createTextNode(symbol.output)),str,symbol.tag];
 case CONST:
 var output = symbol.output;
 if (isIE) {
 if (symbol.input == "'")
 output = "\u2032";
 else if (symbol.input == "''")
 output = "\u2033";
 else if (symbol.input == "'''")
 output = "\u2033\u2032";
 else if (symbol.input == "''''")
 output = "\u2033\u2033";
 else if (symbol.input == "\\square")
 output = "\u25A1"; // same as \Box
 else if (symbol.input.substr(0,5) == "\\frac") {
 // botch for missing fractions
 var denom = symbol.input.substr(6,1);
 if (denom == "5" || denom == "6") {
 str = symbol.input.replace(/\\frac/,"\\frac ")+str;
 return [node,str,symbol.tag];
 }
 }
 }
 node = createMmlNode(symbol.tag,document.createTextNode(output));
 return [node,str,symbol.tag];
 case LONG: // added by DRW
 node = createMmlNode(symbol.tag,document.createTextNode(symbol.output));
 node.setAttribute("minsize","1.5");
 node.setAttribute("maxsize","1.5");
 node = createMmlNode("mover",node);
 node.appendChild(LMcreateElementMathML("mspace"));
 return [node,str,symbol.tag];
 case STRETCHY: // added by DRW
 if (isIE && symbol.input == "\\backslash")
 symbol.output = "\\"; // doesn't expand, but then nor does "\u2216"
 node = createMmlNode(symbol.tag,document.createTextNode(symbol.output));
 if (symbol.input == "|" || symbol.input == "\\vert" ||
 symbol.input == "\\|" || symbol.input == "\\Vert") {
 node.setAttribute("lspace","0em");
 node.setAttribute("rspace","0em");
 }
 node.setAttribute("maxsize",symbol.atval); // don't allow to stretch here
 if (symbol.rtag != null)
 return [node,str,symbol.rtag];
 else
 return [node,str,symbol.tag];
 case BIG: // added by DRW
 var atval = symbol.atval;
 if (isIE)
 atval = symbol.ieval;
 symbol = LMgetSymbol(str);
 if (symbol == null)
 return [null,str,null];
 str = LMremoveCharsAndBlanks(str,symbol.input.length);
 node = createMmlNode(symbol.tag,document.createTextNode(symbol.output));
 if (isIE) { // to get brackets to expand
 var space = LMcreateElementMathML("mspace");
 space.setAttribute("height",atval+"ex");
 node = createMmlNode("mrow",node);
 node.appendChild(space);
 } else { // ignored in IE
 node.setAttribute("minsize",atval);
 node.setAttribute("maxsize",atval);
 }
 return [node,str,symbol.tag];
 case LEFTBRACKET: //read (expr+)
 if (symbol.input == "\\left") { // left what?
 symbol = LMgetSymbol(str);
 if (symbol != null) {
 if (symbol.input == ".")
 symbol.invisible = true;
 str = LMremoveCharsAndBlanks(str,symbol.input.length);
 }
 }
 result = LMparseExpr(str,true,false);
 if (symbol==null ||
 (typeof symbol.invisible == "boolean" && symbol.invisible))
 node = createMmlNode("mrow",result[0]);
 else {
 node = createMmlNode("mo",document.createTextNode(symbol.output));
 node = createMmlNode("mrow",node);
 node.appendChild(result[0]);
 }
 return [node,result[1],result[2]];
 case MATRIX: //read (expr+)
 if (symbol.input == "\\begin{array}") {
 var mask = "";
 symbol = LMgetSymbol(str);
 str = LMremoveCharsAndBlanks(str,0);
 if (symbol == null)
 mask = "l";
 else {
 str = LMremoveCharsAndBlanks(str,symbol.input.length);
 if (symbol.input != "{")
 mask = "l";
 else do {
 symbol = LMgetSymbol(str);
 if (symbol != null) {
 str = LMremoveCharsAndBlanks(str,symbol.input.length);
 if (symbol.input != "}")
 mask = mask+symbol.input;
 }
 } while (symbol != null && symbol.input != "" && symbol.input != "}");
 }
 result = LMparseExpr("{"+str,true,true);
// if (result[0]==null) return [createMmlNode("mo",
// document.createTextNode(symbol.input)),str];
 node = createMmlNode("mtable",result[0]);
 mask = mask.replace(/l/g,"left ");
 mask = mask.replace(/r/g,"right ");
 mask = mask.replace(/c/g,"center ");
 node.setAttribute("columnalign",mask);
 node.setAttribute("displaystyle","false");
 var lspace = LMcreateElementMathML("mspace");
 lspace.setAttribute("width","0.167em");
 var rspace = LMcreateElementMathML("mspace");
 rspace.setAttribute("width","0.167em");
 var node1 = createMmlNode("mrow",lspace);
 node1.appendChild(node);
 node1.appendChild(rspace);
 return [node1,result[1],null];
 } else { // eqnarray
 result = LMparseExpr("{"+str,true,true);
 node = createMmlNode("mtable",result[0]);
 node.setAttribute("columnspacing","0.167em"); // correct (but ignored?)
 node.setAttribute("columnalign","right center left");
 node.setAttribute("displaystyle","true");
 node = createMmlNode("mrow",node);
 return [node,result[1],null];
 }
 case TEXT:
 if (str.charAt(0)=="{") i=str.indexOf("}");
 else i = 0;
 if (i==-1)
 i = str.length;
 st = str.slice(1,i);
 if (st.charAt(0) == " ") {
 node = LMcreateElementMathML("mspace");
 node.setAttribute("width","0.33em"); // was 1ex
 newFrag.appendChild(node);
 }
 newFrag.appendChild(
 createMmlNode(symbol.tag,document.createTextNode(st)));
 if (st.charAt(st.length-1) == " ") {
 node = LMcreateElementMathML("mspace");
 node.setAttribute("width","0.33em"); // was 1ex
 newFrag.appendChild(node);
 }
 str = LMremoveCharsAndBlanks(str,i+1);
 return [createMmlNode("mrow",newFrag),str,null];
 case UNARY:
 result = LMparseSexpr(str);
 if (result[0]==null) return [createMmlNode(symbol.tag,document.createTextNode(symbol.output)),str];
 if (typeof symbol.func == "boolean" && symbol.func) { // functions hack
 st = str.charAt(0);
// if (st=="^" || st=="_" || st=="/" || st=="|" || st==",") {
 if (st=="^" || st=="_" || st==",") {
 return [createMmlNode(symbol.tag,document.createTextNode(symbol.output)),str,symbol.tag];
 } else {
 node = createMmlNode("mrow",createMmlNode(symbol.tag,document.createTextNode(symbol.output)));
 node.appendChild(result[0]);
 return [node,result[1],symbol.tag];
 }
 }
 if (symbol.input == "\\sqrt") { // sqrt
 return [createMmlNode(symbol.tag,result[0]),result[1],symbol.tag];
 } else if (typeof symbol.acc == "boolean" && symbol.acc) { // accent
 node = createMmlNode(symbol.tag,result[0]);
 var output = symbol.output;
 if (isIE) {
 if (symbol.input == "\\hat")
 output = "\u0302";
 else if (symbol.input == "\\widehat")
 output = "\u005E";
 else if (symbol.input == "\\bar")
 output = "\u00AF";
 else if (symbol.input == "\\grave")
 output = "\u0300";
 else if (symbol.input == "\\tilde")
 output = "\u0303";
 }
 var node1 = createMmlNode("mo",document.createTextNode(output));
 if (symbol.input == "\\vec" || symbol.input == "\\check")
 // don't allow to stretch
 node1.setAttribute("maxsize","1.2");
 // why doesn't "1" work? \vec nearly disappears in firefox
 if (isIE && symbol.input == "\\bar")
 node1.setAttribute("maxsize","0.5");
 if (symbol.input == "\\underbrace" || symbol.input == "\\underline")
 node1.setAttribute("accentunder","true");
 else
 node1.setAttribute("accent","true");
 node.appendChild(node1);
 if (symbol.input == "\\overbrace" || symbol.input == "\\underbrace")
 node.ttype = UNDEROVER;
 return [node,result[1],symbol.tag];
 } else { // font change or displaystyle command
 if (!isIE && typeof symbol.codes != "undefined") {
 for (i=0; i<result[0].childNodes.length; i++)
 if (result[0].childNodes[i].nodeName=="mi" || result[0].nodeName=="mi") {
 st = (result[0].nodeName=="mi"?result[0].firstChild.nodeValue:
 result[0].childNodes[i].firstChild.nodeValue);
 var newst = [];
 for (var j=0; j<st.length; j++)
 if (st.charCodeAt(j)>64 && st.charCodeAt(j)<91) {newst = newst + fixedFromCharCode(symbol.codes[st.charCodeAt(j)-65]);} else newst = newst + st.charAt(j);
 if (result[0].nodeName=="mi")
 result[0]=LMcreateElementMathML("mo").
 appendChild(document.createTextNode(newst));
 else result[0].replaceChild(LMcreateElementMathML("mo").
 appendChild(document.createTextNode(newst)),result[0].childNodes[i]);
 }
 }
 node = createMmlNode(symbol.tag,result[0]);
 node.setAttribute(symbol.atname,symbol.atval);
 if (symbol.input == "\\scriptstyle" ||
 symbol.input == "\\scriptscriptstyle")
 node.setAttribute("displaystyle","false");
 return [node,result[1],symbol.tag];
 }
 case BINARY:
 result = LMparseSexpr(str);
 if (result[0]==null) return [createMmlNode("mo",document.createTextNode(symbol.input)),str,null];
 result2 = LMparseSexpr(result[1]);
 if (result2[0]==null) return [createMmlNode("mo",document.createTextNode(symbol.input)),str,null];
 if (symbol.input=="\\textcolor" || symbol.input=="\\colorbox") { 
 var tclr = str.match(/\{\s*([#\w]+)\s*\}/); //get's color from beginning of str
 str = str.replace(/\{\s*[#\w]+\s*\}/,""); 
 if(tclr!=null) {
 if(IsColorName.test(tclr[1].toLowerCase())) {
 tclr=LaTeXColor[tclr[1].toLowerCase()];
 } else {
 tclr=tclr[1]; // no checking for valid color!!
 } 
 node = LMcreateElementMathML("mstyle");
 node.setAttribute(symbol.atval,tclr);
 node.appendChild(result2[0]); 
 return [node,result2[1],symbol.tag]; 
 } 
 }
if (symbol.input=="\\density") { 
 var tclrf = str.match(/\{\s*([#\w]+)\s*\}/); //get's size from beginning of str
 str = str.replace(/\{\s*[#\w]+\s*\}/,""); 
 if(tclrf!=null) {
 if(tclrf[1]>1000) {
 tclrf=1000+'%';
 } else {
 tclrf=tclrf[1]+'%';
 }
 node = LMcreateElementMathML("mstyle");
 node.setAttribute(symbol.atval,tclrf);
 node.appendChild(result2[0]); 
 return [node,result2[1],symbol.tag]; 
 } 
 }
 if (symbol.input=="\\root" || symbol.input=="\\stackrel") newFrag.appendChild(result2[0]);
 newFrag.appendChild(result[0]);
 if (symbol.input=="\\frac") newFrag.appendChild(result2[0]);
 return [createMmlNode(symbol.tag,newFrag),result2[1],symbol.tag];
 case INFIX:
 str = LMremoveCharsAndBlanks(str,symbol.input.length);
 return [createMmlNode("mo",document.createTextNode(symbol.output)),
 str,symbol.tag];
 default:
 return [createMmlNode(symbol.tag, //its a constant
 document.createTextNode(symbol.output)),str,symbol.tag];
 }
}

function LMparseIexpr(str) {
 var symbol, sym1, sym2, node, result, tag, underover;
 str = LMremoveCharsAndBlanks(str,0);
 sym1 = LMgetSymbol(str);
 result = LMparseSexpr(str);
 node = result[0];
 str = result[1];
 tag = result[2];
 symbol = LMgetSymbol(str);
 if (symbol.ttype == INFIX) {
 str = LMremoveCharsAndBlanks(str,symbol.input.length);
 result = LMparseSexpr(str);
 if (result[0] == null) // show box in place of missing argument
 result[0] = createMmlNode("mo",document.createTextNode("\u25A1"));
 str = result[1];
 tag = result[2];
 if (symbol.input == "_" || symbol.input == "^") {
 sym2 = LMgetSymbol(str);
 tag = null; // no space between x^2 and a following sin, cos, etc.
// This is for \underbrace and \overbrace
 underover = ((sym1.ttype == UNDEROVER) || (node.ttype == UNDEROVER));
// underover = (sym1.ttype == UNDEROVER);
 if (symbol.input == "_" && sym2.input == "^") {
 str = LMremoveCharsAndBlanks(str,sym2.input.length);
 var res2 = LMparseSexpr(str);
 str = res2[1];
 tag = res2[2]; // leave space between x_1^2 and a following sin etc.
 node = createMmlNode((underover?"munderover":"msubsup"),node);
 node.appendChild(result[0]);
 node.appendChild(res2[0]);
 } else if (symbol.input == "_") {
 node = createMmlNode((underover?"munder":"msub"),node);
 node.appendChild(result[0]);
 } else {
 node = createMmlNode((underover?"mover":"msup"),node);
 node.appendChild(result[0]);
 }
 node = createMmlNode("mrow",node); // so sum does not stretch
 } else {
 node = createMmlNode(symbol.tag,node);
 if (symbol.input == "\\atop" || symbol.input == "\\choose")
 node.setAttribute("linethickness","0ex");
 node.appendChild(result[0]);
 if (symbol.input == "\\choose")
 node = createMmlNode("mfenced",node);
 }
 }
 return [node,str,tag];
}

function LMparseExpr(str,rightbracket,matrix) {
 var symbol, node, result, i, tag,
 newFrag = document.createDocumentFragment();
 do {
 str = LMremoveCharsAndBlanks(str,0);
 result = LMparseIexpr(str);
 node = result[0];
 str = result[1];
 tag = result[2];
 symbol = LMgetSymbol(str);
 if (node!=undefined) {
 if ((tag == "mn" || tag == "mi") && symbol!=null &&
 typeof symbol.func == "boolean" && symbol.func) {
 // Add space before \sin in 2\sin x or x\sin x
 var space = LMcreateElementMathML("mspace");
 space.setAttribute("width","0.167em");
 node = createMmlNode("mrow",node);
 node.appendChild(space);
 }
 newFrag.appendChild(node);
 }
 } while ((symbol.ttype != RIGHTBRACKET)
 && symbol!=null && symbol.output!="");
 tag = null;
 if (symbol.ttype == RIGHTBRACKET) {
 if (symbol.input == "\\right") { // right what?
 str = LMremoveCharsAndBlanks(str,symbol.input.length);
 symbol = LMgetSymbol(str);
 if (symbol != null && symbol.input == ".")
 symbol.invisible = true;
 if (symbol != null)
 tag = symbol.rtag;
 }
 if (symbol!=null)
 str = LMremoveCharsAndBlanks(str,symbol.input.length); // ready to return
 var len = newFrag.childNodes.length;
 if (matrix &&
 len>0 && newFrag.childNodes[len-1].nodeName == "mrow" && len>1 &&
 newFrag.childNodes[len-2].nodeName == "mo" &&
 newFrag.childNodes[len-2].firstChild.nodeValue == "&") { //matrix
 var pos = []; // positions of ampersands
 var m = newFrag.childNodes.length;
 for (i=0; matrix && i<m; i=i+2) {
 pos[i] = [];
 node = newFrag.childNodes[i];
 for (var j=0; j<node.childNodes.length; j++)
 if (node.childNodes[j].firstChild.nodeValue=="&")
 pos[i][pos[i].length]=j;
 }
 var row, frag, n, k, table = document.createDocumentFragment();
 for (i=0; i<m; i=i+2) {
 row = document.createDocumentFragment();
 frag = document.createDocumentFragment();
 node = newFrag.firstChild; // <mrow> -&-&...&-&- </mrow>
 n = node.childNodes.length;
 k = 0;
 for (j=0; j<n; j++) {
 if (typeof pos[i][k] != "undefined" && j==pos[i][k]){
 node.removeChild(node.firstChild); //remove &
 row.appendChild(createMmlNode("mtd",frag));
 k++;
 } else frag.appendChild(node.firstChild);
 }
 row.appendChild(createMmlNode("mtd",frag));
 if (newFrag.childNodes.length>2) {
 newFrag.removeChild(newFrag.firstChild); //remove <mrow> </mrow>
 newFrag.removeChild(newFrag.firstChild); //remove <mo>&</mo>
 }
 table.appendChild(createMmlNode("mtr",row));
 }
 return [table,str];
 }
 if (typeof symbol.invisible != "boolean" || !symbol.invisible) {
 node = createMmlNode("mo",document.createTextNode(symbol.output));
 newFrag.appendChild(node);
 }
 }
 return [newFrag,str,tag];
}
var tcnt = 0, dcnt = 0; //theorem and definition counters
function simpleLaTeXformatting(st) {
 st = st.replace(/\$\$((.|\n)*?)\$\$/g,"$ $1 $");
 st = st.replace(/\\begin{(theorem|lemma|proposition|corollary)}((.|\n)*?)\\end{\1}/g,function(r,s,t){tcnt++; return "<b>"+s.charAt(0).toUpperCase()+s.slice(1)+" "+tcnt+".</b> <i>"+t.replace(/^\s*<\/?\w+\/?>|\s*<\/?\w+\/?>$/g,"")+"</i>"});
 st = st.replace(/\\begin{(definition|example|remark|problem|exercise|conjecture|solution)}((.|\n)*?)\\end{\1}/g,function(r,s,t){dcnt++; return "<b>"+s.charAt(0).toUpperCase()+s.slice(1)+" "+dcnt+".</b> "+t.replace(/^\s*<\/?\w+\/?>|\s*<\/?\w+\/?>$/g,"")});
 st = st.replace(/\\begin{proof}((.|\n)*?)\\end{proof}/g,function(s,t){return "<i>Proof:</i> "+t.replace(/^\s*<\/?\w+\/?>|\s*<\/?\w+\/?>$/g,"")+" &#x25A1;"});
 st = st.replace(/\\emph{(.*?)}/g,"<em>$1</em>");
 st = st.replace(/\\textbf{(.*?)}/g,"<b>$1</b>");
 st = st.replace(/\\cite{(.*?)}/g,"[$1]");
 st = st.replace(/\\chapter{(.*?)}/g,"<h2>$1</h2>");
 st = st.replace(/\\section{(.*?)}(\s*<\/?(br|p)\s?\/?>)?/g,"<h3>$1</h3>");
 st = st.replace(/\\subsection{((.|\n)*?)}/g,"<h4>$1</h4>");
 st = st.replace(/\\begin{itemize}(\s*<\/?(br|p)\s?\/?>)?/g,"<ul>");
 st = st.replace(/\\item\s((.|\n)*?)(?=(\\item|\\end))/g,"<li>$1");
 st = st.replace(/\\end{itemize}(\s*<\/?(br|p)\s?\/?>)?/g,"</li></ul>");
 st = st.replace(/\\begin{enumerate}(\s*<\/?(br|p)\s?\/?>)?/g,"<ol>");
 st = st.replace(/\\end{enumerate}(\s*<\/?(br|p)\s?\/?>)?/g,"</li></ol>");
 st = st.replace(/\\item\[(.*?)]{(.*?)}/g,"<dt>$1</dt><dd>$2</dd>");
 st = st.replace(/\\begin{description}/g,"<dl>");
 st = st.replace(/\\end{description}/g,"</dl>");
 st = st.replace(/\\newline\b/g,"<br/>");
 st = st.replace(/\\newpage\b/g,"<br style=\"page-break-after:always;\">");
 st = st.replace(/\\par\b/g,"<p>&nbsp;</p>");
 st = st.replace(/\\bigskip/g,"<p style=\"margin-bottom:0.5in\">&nbsp;</p>");
 st = st.replace(/\\medskip/g,"<p style=\"margin-bottom:0.3in\">&nbsp;</p>");
 st = st.replace(/\\smallskip/g,"<p style=\"margin-bottom:0.15in\">&nbsp;</p>");
 st = st.replace(/\\begin{center}((.|\n)*?)\\end{center}/g,"<center>$1</center>");
 return st
}

function LMprocessNode(n) {
 var frag,st;
 try {
 st = n.innerHTML;
 } catch(err) {}
 var am = /amath\b|graph/i.test(st);
 if ((st==null || st.indexOf("\$ ")!=-1 || st.indexOf("\$<")!=-1 || 
 st.indexOf("\\begin")!=-1 || am || st.slice(-1)=="$" ||
 st.indexOf("\$\n")!=-1)&& !/edit-content|HTMLArea|wikiedit|wpTextbox1/.test(st)){
 if (!avoidinnerHTML && translateLaTeXformatting) 
 st = simpleLaTeXformatting(st);
 if (st!=null && am && !avoidinnerHTML) {
 st = ASCIIandgraphformatting(st);
 }
 st = st.replace(/%7E/g,"~"); // else PmWiki has url issues
 if (!avoidinnerHTML) n.innerHTML = st;
 processNodeR(n,false,true);
 }
}

function LMAMpNode(nlm) {
 var st;
 try {
 st = nlm.innerHTML;
 } catch(err) {}
 if ((st==null || st.indexOf("\$ ")!=-1 || st.indexOf("\$<")!=-1 || 
 st.indexOf("\\begin")!=-1 || st.slice(-1)=="$" ||
 st.indexOf("\$\n")!=-1)&& !/edit-content|HTMLArea|wikiedit|wpTextbox1/.test(st)){
 processNodeR(nlm,false,true);
 }
}

function fixedFromCharCode (codePt) {
 if (codePt > 0xFFFF) {
 codePt -= 0x10000;
 return String.fromCharCode(0xD800 + (codePt >> 10), 0xDC00 +
(codePt & 0x3FF));
 }
 else {
 return String.fromCharCode(codePt);
 }

}

function init(){
 var msg, warnings = new Array();
 if (document.getElementById==null){
 alert("This webpage requires a recent browser such as Firefox");
 return null;
 }
 initSymbols();
 return true;
}

function createElementXHTML(t) {
  if (isIE) return document.createElement(t);
  else return document.createElementNS("http://www.w3.org/1999/xhtml",t);
}

function createMmlNode(t,frag) {
 var node = document.createElementNS("http://www.w3.org/1998/Math/MathML",t);
 if (frag) node.appendChild(frag);
 return node;
}

function compareNames(s1,s2) {
 if (s1.input > s2.input) return 1
 else return -1;
}

function strarr2docFrag(arr, linebreaks, latex) {
 var newFrag=document.createDocumentFragment();
 var expr = false;
 for (var i=0; i<arr.length; i++) {
 if (expr && isIE) newFrag.appendChild(AMTparseMath(arr[i],latex));
 else if (expr) newFrag.appendChild(AMparseMath(arr[i],latex));
 else {
 var arri = (linebreaks ? arr[i].split("\n\n") : [arr[i]]);
 newFrag.appendChild(createElementXHTML("span").
 appendChild(document.createTextNode(arri[0])));
 for (var j=1; j<arri.length; j++) {
 newFrag.appendChild(createElementXHTML("p"));
 newFrag.appendChild(createElementXHTML("span").
 appendChild(document.createTextNode(arri[j])));
 }
 }
 expr = !expr;
 }
 return newFrag;
}

function GeMstrarr2docFrag(arr, linebreaks, latex) {
 var newFrag=document.createDocumentFragment();
 var expr = false;
 for (var i=0; i<arr.length; i++) {
 if (expr) newFrag.appendChild(GeMTparseMath(arr[i],latex));
 else {
 var arri = (linebreaks ? arr[i].split("\n\n") : [arr[i]]);
 newFrag.appendChild(createElementXHTML("span").
 appendChild(document.createTextNode(arri[0])));
 for (var j=1; j<arri.length; j++) {
 newFrag.appendChild(createElementXHTML("p"));
 newFrag.appendChild(createElementXHTML("span").
 appendChild(document.createTextNode(arri[j])));
 }
 }
 expr = !expr;
 }
 return newFrag;
}

function  GeMprocessNodeR(n, linebreaks,latex) {
 var mtch, str, arr, frg, i;
 if (n.childNodes.length == 0) {
 if ((n.nodeType!=8 || linebreaks) &&
 n.parentNode.nodeName!="form" && n.parentNode.nodeName!="FORM" &&
 n.parentNode.nodeName!="textarea" && n.parentNode.nodeName!="TEXTAREA" /*&&
 n.parentNode.nodeName!="pre" && n.parentNode.nodeName!="PRE"*/) {
 str = n.nodeValue;
 if (!(str == null)) {
 str = str.replace(/\r\n\r\n/g,"\n\n");
 str = str.replace(/\x20+/g," ");
 str = str.replace(/\s*\r\n/g," ");
 if(latex) {
// DELIMITERS:
 mtch = (str.indexOf("GeM")==-1 ? false : true);
 str = str.replace(/([^\\])GeM/g,"$1 GeM");
 str = str.replace(/^GeM/," GeM"); // in case GeM at start of string
 arr = str.split(" GeM");
 for (i=0; i<arr.length; i++)
 arr[i]=arr[i].replace(/\\GeM/g,"GeM");
 } else {
 mtch = false;
 str = str.replace(new RegExp(AMescape1, "g"),
 function(){mtch = true; return "AMescape1"});
 str = str.replace(/\\?end{?a?math}?/i,
 function(){automathrecognize = false; mtch = true; return ""});
 str = str.replace(/amath\b|\\begin{a?math}/i,
 function(){automathrecognize = true; mtch = true; return ""});
 arr = str.split(AMdelimiter1);
 if (automathrecognize)
 for (i=0; i<arr.length; i++)
 if (i%2==0) arr[i] = AMautomathrec(arr[i]);
 str = arr.join(AMdelimiter1);
 arr = str.split(AMdelimiter1);
 for (i=0; i<arr.length; i++) // this is a problem ************
 arr[i]=arr[i].replace(/AMescape1/g,AMdelimiter1);
 }
 if (arr.length>1 || mtch) {
 frg = GeMstrarr2docFrag(arr,n.nodeType==8,latex);
 var len = frg.childNodes.length;
 n.parentNode.replaceChild(frg,n);
 return len-1;
 }
 }
 } else return 0;
 } else if (n.nodeName!="math") {
 for (i=0; i<n.childNodes.length; i++)
 i += GeMprocessNodeR(n.childNodes[i], linebreaks,latex);
 }
 return 0;
}


function ASCIIandgraphformatting(st) {
 st = st.replace(/(Proof:)/g,"<i>$1</i>");
 st = st.replace(/QED/g,"&nbsp; &nbsp; &#x25A1;");
 st = st.replace(/(\\?end{?a?math}?)/ig,"<span></span>$1");
 st = st.replace(/(\bamath\b|\\begin{a?math})/ig,"<span></span>$1");
 st = st.replace(/([>\n])(Theorem|Lemma|Proposition|Corollary|Definition|Example|Remark|Problem|Exercise|Conjecture|Solution)(:|\W\W?(\w|\s|-|\.)*?\W?:)/g,"$1<b>$2$3</b>");
 return st
}

function GeMprocessNode(n) {
 var frag,st;
 try {
 st = n.innerHTML;
 } catch(err) {}
 var am = /amath\b|graph/i.test(st);
 if ((st==null || st.indexOf("GeM ")!=-1 || st.indexOf("GeM<")!=-1 || 
 st.indexOf("\\begin")!=-1 || am || st.slice(-1)==" GeM" ||
 st.indexOf("GeM\n")!=-1)&& !/edit-content|HTMLArea|wikiedit|wpTextbox1/.test(st)){
 if (!avoidinnerHTML && translateLaTeXformatting) 
 st = simpleLaTeXformatting(st);
 if (st!=null && am && !avoidinnerHTML) {
 st = ASCIIandgraphformatting(st);
 }
 st = st.replace(/%7E/g,"~"); // else PmWiki has url issues
 if (!avoidinnerHTML) n.innerHTML = st;
 GeMprocessNodeR(n,false,true);
 }

}

function generic()
{
 if(!init()) return;
 if (translateOnLoad) {
 var nd = document.getElementById("processasciimathinmoodle");
 AMtranslate();
 }
};
//setup onload function
if(typeof window.addEventListener != 'undefined')
{
 //.. gecko, safari, konqueror and standard
 window.addEventListener('load', generic, false);
}
else if(typeof document.addEventListener != 'undefined')
{
 //.. opera 7
 document.addEventListener('load', generic, false);
}
else if(typeof window.attachEvent != 'undefined')
{
 //.. win/ie
 window.attachEvent('onload', generic);
}
//** remove this condition to degrade older browsers
else
{
 //.. mac/ie5 and anything else that gets this far
 //if there's an existing onload function
 if(typeof window.onload == 'function')
 {
 //store it
 var existing = onload;
 //add new onload handler
 window.onload = function()
 {
 //call existing onload function
 existing();
 //call generic onload function
 generic();
 };
 }
 else
 {
 //setup onload function
 window.onload = generic;
 }
}