UNPKG

mathpix-markdown-it

Version:

Mathpix-markdown-it is an open source implementation of the mathpix-markdown spec written in Typescript. It relies on the following open source libraries: MathJax v3 (to render math with SVGs), markdown-it (for standard Markdown parsing)

336 lines 32.2 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.findAmSymbolByTagStretchy = exports.findAmSymbolByTag = exports.regExpIsFunction = exports.getFunctions = exports.AMsymbols = exports.eSymbolType = void 0; 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,*/ UNARYUNDEROVER = 15; // token types var eSymbolType; (function (eSymbolType) { eSymbolType["operation"] = "operation"; eSymbolType["relation"] = "relation"; eSymbolType["logical"] = "logical"; eSymbolType["miscellaneous"] = "miscellaneous"; eSymbolType["arrow"] = "arrow"; })(eSymbolType = exports.eSymbolType || (exports.eSymbolType = {})); ; var fixphi = true; // character lists for Mozilla/Netscape fonts var AMcal = ["\uD835\uDC9C", "\u212C", "\uD835\uDC9E", "\uD835\uDC9F", "\u2130", "\u2131", "\uD835\uDCA2", "\u210B", "\u2110", "\uD835\uDCA5", "\uD835\uDCA6", "\u2112", "\u2133", "\uD835\uDCA9", "\uD835\uDCAA", "\uD835\uDCAB", "\uD835\uDCAC", "\u211B", "\uD835\uDCAE", "\uD835\uDCAF", "\uD835\uDCB0", "\uD835\uDCB1", "\uD835\uDCB2", "\uD835\uDCB3", "\uD835\uDCB4", "\uD835\uDCB5", "\uD835\uDCB6", "\uD835\uDCB7", "\uD835\uDCB8", "\uD835\uDCB9", "\u212F", "\uD835\uDCBB", "\u210A", "\uD835\uDCBD", "\uD835\uDCBE", "\uD835\uDCBF", "\uD835\uDCC0", "\uD835\uDCC1", "\uD835\uDCC2", "\uD835\uDCC3", "\u2134", "\uD835\uDCC5", "\uD835\uDCC6", "\uD835\uDCC7", "\uD835\uDCC8", "\uD835\uDCC9", "\uD835\uDCCA", "\uD835\uDCCB", "\uD835\uDCCC", "\uD835\uDCCD", "\uD835\uDCCE", "\uD835\uDCCF"]; var AMfrk = ["\uD835\uDD04", "\uD835\uDD05", "\u212D", "\uD835\uDD07", "\uD835\uDD08", "\uD835\uDD09", "\uD835\uDD0A", "\u210C", "\u2111", "\uD835\uDD0D", "\uD835\uDD0E", "\uD835\uDD0F", "\uD835\uDD10", "\uD835\uDD11", "\uD835\uDD12", "\uD835\uDD13", "\uD835\uDD14", "\u211C", "\uD835\uDD16", "\uD835\uDD17", "\uD835\uDD18", "\uD835\uDD19", "\uD835\uDD1A", "\uD835\uDD1B", "\uD835\uDD1C", "\u2128", "\uD835\uDD1E", "\uD835\uDD1F", "\uD835\uDD20", "\uD835\uDD21", "\uD835\uDD22", "\uD835\uDD23", "\uD835\uDD24", "\uD835\uDD25", "\uD835\uDD26", "\uD835\uDD27", "\uD835\uDD28", "\uD835\uDD29", "\uD835\uDD2A", "\uD835\uDD2B", "\uD835\uDD2C", "\uD835\uDD2D", "\uD835\uDD2E", "\uD835\uDD2F", "\uD835\uDD30", "\uD835\uDD31", "\uD835\uDD32", "\uD835\uDD33", "\uD835\uDD34", "\uD835\uDD35", "\uD835\uDD36", "\uD835\uDD37"]; var AMbbb = ["\uD835\uDD38", "\uD835\uDD39", "\u2102", "\uD835\uDD3B", "\uD835\uDD3C", "\uD835\uDD3D", "\uD835\uDD3E", "\u210D", "\uD835\uDD40", "\uD835\uDD41", "\uD835\uDD42", "\uD835\uDD43", "\uD835\uDD44", "\u2115", "\uD835\uDD46", "\u2119", "\u211A", "\u211D", "\uD835\uDD4A", "\uD835\uDD4B", "\uD835\uDD4C", "\uD835\uDD4D", "\uD835\uDD4E", "\uD835\uDD4F", "\uD835\uDD50", "\u2124", "\uD835\uDD52", "\uD835\uDD53", "\uD835\uDD54", "\uD835\uDD55", "\uD835\uDD56", "\uD835\uDD57", "\uD835\uDD58", "\uD835\uDD59", "\uD835\uDD5A", "\uD835\uDD5B", "\uD835\uDD5C", "\uD835\uDD5D", "\uD835\uDD5E", "\uD835\uDD5F", "\uD835\uDD60", "\uD835\uDD61", "\uD835\uDD62", "\uD835\uDD63", "\uD835\uDD64", "\uD835\uDD65", "\uD835\uDD66", "\uD835\uDD67", "\uD835\uDD68", "\uD835\uDD69", "\uD835\uDD6A", "\uD835\uDD6B"]; exports.AMsymbols = [ //some greek symbols { input: "alpha", tag: "mi", output: "\u03B1", tex: null, ttype: CONST }, { input: "beta", tag: "mi", output: "\u03B2", tex: null, ttype: CONST }, { input: "chi", tag: "mi", output: "\u03C7", tex: null, ttype: CONST }, { input: "delta", tag: "mi", output: "\u03B4", tex: null, ttype: CONST }, { input: "Delta", tag: "mo", output: "\u0394", tex: null, ttype: CONST }, { input: "Delta", tag: "mi", output: "\u0394", tex: null, ttype: CONST }, { input: "epsi", tag: "mi", output: "\u03B5", tex: "epsilon", ttype: CONST }, { input: "epsilon", tag: "mi", output: "\u03F5", tex: "epsilon", ttype: CONST }, { input: "varepsilon", tag: "mi", output: "\u025B", tex: null, ttype: CONST }, { input: "eta", tag: "mi", output: "\u03B7", 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: "iota", tag: "mi", output: "\u03B9", tex: null, ttype: CONST }, { input: "kappa", tag: "mi", output: "\u03BA", 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: "lamda", tag: "mi", output: "\u03BB", tex: null, ttype: CONST }, { input: "Lamda", tag: "mo", output: "\u039B", tex: null, ttype: CONST }, { input: "mu", tag: "mi", output: "\u03BC", tex: null, ttype: CONST }, { input: "nu", tag: "mi", output: "\u03BD", 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: "phi", tag: "mi", output: fixphi ? "\u03D5" : "\u03C6", tex: null, ttype: CONST }, { input: "varphi", tag: "mi", output: fixphi ? "\u03C6" : "\u03D5", tex: null, ttype: CONST }, { input: "Phi", tag: "mo", output: "\u03A6", tex: null, ttype: CONST }, { input: "Phi", tag: "mi", 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: "psi", tag: "mi", output: "\u03C8", tex: null, ttype: CONST }, { input: "Psi", tag: "mi", output: "\u03A8", tex: null, ttype: CONST }, { input: "rho", tag: "mi", output: "\u03C1", 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: "tau", tag: "mi", output: "\u03C4", tex: null, ttype: CONST }, { input: "theta", tag: "mi", output: "\u03B8", tex: null, ttype: CONST }, { input: "vartheta", tag: "mi", output: "\u03D1", tex: null, ttype: CONST }, { input: "Theta", tag: "mo", output: "\u0398", tex: null, ttype: CONST }, { input: "upsilon", tag: "mi", output: "\u03C5", tex: null, ttype: CONST }, { input: "xi", tag: "mi", output: "\u03BE", tex: null, ttype: CONST }, { input: "Xi", tag: "mo", output: "\u039E", tex: null, ttype: CONST }, { input: "zeta", tag: "mi", output: "\u03B6", tex: null, ttype: CONST }, //binary operation symbols //{input:"-", tag:"mo", output:"\u0096", tex:null, ttype:CONST}, { input: "-", tag: "mo", output: "\u2212", tex: null, ttype: CONST, symbolType: eSymbolType.operation }, { input: "*", tag: "mo", output: "\u22C5", tex: "cdot", ttype: CONST, symbolType: eSymbolType.operation }, { input: "**", tag: "mo", output: "\u2217", tex: "ast", ttype: CONST, symbolType: eSymbolType.operation }, { input: "***", tag: "mo", output: "\u22C6", tex: "star", ttype: CONST, symbolType: eSymbolType.operation }, { input: "//", tag: "mo", output: "/", tex: null, ttype: CONST, symbolType: eSymbolType.operation }, { input: "\\\\", tag: "mo", output: "\\", tex: "backslash", ttype: CONST, symbolType: eSymbolType.operation }, { input: "\\\\", tag: "mo", output: "\u2216", tex: "backslash", ttype: CONST, symbolType: eSymbolType.operation }, { input: "setminus", tag: "mo", output: "\\", tex: null, ttype: CONST, symbolType: eSymbolType.operation }, { input: "xx", tag: "mo", output: "\u00D7", tex: "times", ttype: CONST, symbolType: eSymbolType.operation }, { input: "|><", tag: "mo", output: "\u22C9", tex: "ltimes", ttype: CONST, symbolType: eSymbolType.operation }, { input: "><|", tag: "mo", output: "\u22CA", tex: "rtimes", ttype: CONST, symbolType: eSymbolType.operation }, { input: "|><|", tag: "mo", output: "\u22C8", tex: "bowtie", ttype: CONST, symbolType: eSymbolType.operation }, { input: "-:", tag: "mo", output: "\u00F7", tex: "div", ttype: CONST, symbolType: eSymbolType.operation }, { input: "divide", tag: "mo", output: "-:", tex: null, ttype: DEFINITION, symbolType: eSymbolType.operation }, { input: "@", tag: "mo", output: "\u2218", tex: "circ", ttype: CONST, symbolType: eSymbolType.operation }, { input: "o+", tag: "mo", output: "\u2295", tex: "oplus", ttype: CONST, symbolType: eSymbolType.operation }, { input: "ox", tag: "mo", output: "\u2297", tex: "otimes", ttype: CONST, symbolType: eSymbolType.operation }, { input: "o.", tag: "mo", output: "\u2299", tex: "odot", ttype: CONST, symbolType: eSymbolType.operation }, { input: "sum", tag: "mo", output: "\u2211", tex: null, ttype: UNDEROVER, symbolType: eSymbolType.operation }, { input: "prod", tag: "mo", output: "\u220F", tex: null, ttype: UNDEROVER, symbolType: eSymbolType.operation }, { input: "^^", tag: "mo", output: "\u2227", tex: "wedge", ttype: CONST, symbolType: eSymbolType.operation }, { input: "^^^", tag: "mo", output: "\u22C0", tex: "bigwedge", ttype: UNDEROVER, symbolType: eSymbolType.operation }, { input: "vv", tag: "mo", output: "\u2228", tex: "vee", ttype: CONST, symbolType: eSymbolType.operation }, { input: "vvv", tag: "mo", output: "\u22C1", tex: "bigvee", ttype: UNDEROVER, symbolType: eSymbolType.operation }, { input: "nn", tag: "mo", output: "\u2229", tex: "cap", ttype: CONST, symbolType: eSymbolType.operation }, { input: "nnn", tag: "mo", output: "\u22C2", tex: "bigcap", ttype: UNDEROVER, symbolType: eSymbolType.operation }, { input: "uu", tag: "mo", output: "\u222A", tex: "cup", ttype: CONST, symbolType: eSymbolType.operation }, { input: "uuu", tag: "mo", output: "\u22C3", tex: "bigcup", ttype: UNDEROVER, symbolType: eSymbolType.operation }, { input: "bigoplus", tag: "mo", output: "\u2A01", tex: "bigoplus", ttype: UNDEROVER, symbolType: eSymbolType.operation }, //binary relation symbols { input: "=", tag: "mo", output: "\u003D", tex: null, ttype: CONST, symbolType: eSymbolType.relation }, { input: "!=", tag: "mo", output: "\u2260", tex: "ne", ttype: CONST, symbolType: eSymbolType.relation }, { input: ":=", tag: "mo", output: ":=", tex: null, ttype: CONST, symbolType: eSymbolType.relation }, //{input:"lt", tag:"mo", output:"<", tex:null, ttype:CONST}, { input: " < ", tag: "mo", output: "<", tex: null, ttype: CONST, symbolType: eSymbolType.relation }, { input: " <= ", tag: "mo", output: "\u2264", tex: "le", ttype: CONST, symbolType: eSymbolType.relation }, { input: "lt=", tag: "mo", output: "\u2264", tex: "leq", ttype: CONST, symbolType: eSymbolType.relation }, // {input:"gt", tag:"mo", output:">", tex:null, ttype:CONST}, { input: " > ", tag: "mo", output: ">", tex: null, ttype: CONST, symbolType: eSymbolType.relation }, { input: " >= ", tag: "mo", output: "\u2265", tex: "ge", ttype: CONST, symbolType: eSymbolType.relation }, { input: "gt=", tag: "mo", output: "\u2265", tex: "geq", ttype: CONST, symbolType: eSymbolType.relation }, { input: " >= ", tag: "mo", output: "\u2267", tex: "geqq", ttype: CONST, symbolType: eSymbolType.relation }, { input: " <= ", tag: "mo", output: "\u2266", tex: "leqq", ttype: CONST, symbolType: eSymbolType.relation }, { input: " <= ", tag: "mo", output: "\u2A7D", tex: "leqslant", ttype: CONST, symbolType: eSymbolType.relation }, { input: " >= ", tag: "mo", output: "\u2A7E", tex: "geqslant", ttype: CONST, symbolType: eSymbolType.relation }, { input: "-<", tag: "mo", output: "\u227A", tex: "prec", ttype: CONST, symbolType: eSymbolType.relation }, { input: "-lt", tag: "mo", output: "\u227A", tex: null, ttype: CONST, symbolType: eSymbolType.relation }, { input: ">-", tag: "mo", output: "\u227B", tex: "succ", ttype: CONST, symbolType: eSymbolType.relation }, { input: "-<=", tag: "mo", output: "\u2AAF", tex: "preceq", ttype: CONST, symbolType: eSymbolType.relation }, { input: ">-=", tag: "mo", output: "\u2AB0", tex: "succeq", ttype: CONST, symbolType: eSymbolType.relation }, { input: "in", tag: "mo", output: "\u2208", tex: null, ttype: CONST, symbolType: eSymbolType.relation }, { input: "!in", tag: "mo", output: "\u2209", tex: "notin", ttype: CONST, symbolType: eSymbolType.relation }, { input: "sub", tag: "mo", output: "\u2282", tex: "subset", ttype: CONST, symbolType: eSymbolType.relation }, { input: "sup", tag: "mo", output: "\u2283", tex: "supset", ttype: CONST, symbolType: eSymbolType.relation }, { input: "sube", tag: "mo", output: "\u2286", tex: "subseteq", ttype: CONST, symbolType: eSymbolType.relation }, { input: "supe", tag: "mo", output: "\u2287", tex: "supseteq", ttype: CONST, symbolType: eSymbolType.relation }, { input: "-=", tag: "mo", output: "\u2261", tex: "equiv", ttype: CONST, symbolType: eSymbolType.relation }, { input: "~=", tag: "mo", output: "\u2245", tex: "cong", ttype: CONST, symbolType: eSymbolType.relation }, { input: "~~", tag: "mo", output: "\u2248", tex: "approx", ttype: CONST, symbolType: eSymbolType.relation }, { input: "prop", tag: "mo", output: "\u221D", tex: "propto", ttype: CONST, symbolType: eSymbolType.relation }, { input: "longrightarrow", tag: "mo", output: "\u27F6", tex: "longrightarrow", ttype: CONST, symbolType: eSymbolType.relation }, { input: "longleftarrow", tag: "mo", output: "\u27F5", tex: "longleftarrow", ttype: CONST, symbolType: eSymbolType.relation }, { input: "Longleftarrow", tag: "mo", output: "\u27F8", tex: "Longleftarrow", ttype: CONST, symbolType: eSymbolType.relation }, { input: "Longrightarrow", tag: "mo", output: "\u27F9", tex: "Longrightarrow", ttype: CONST, symbolType: eSymbolType.relation }, { input: "longleftrightarrow", tag: "mo", output: "\u27F7", tex: "longleftrightarrow", ttype: CONST, symbolType: eSymbolType.relation }, { input: "Longleftrightarrow", tag: "mo", output: "\u27FA", tex: "Longleftrightarrow", ttype: CONST, symbolType: eSymbolType.relation }, { input: "longmapsto", tag: "mo", output: "\u27FC", tex: "longmapsto", ttype: CONST, symbolType: eSymbolType.relation }, //logical symbols // {input:"and", tag:"mtext", output:"and", tex:null, ttype:SPACE}, // {input:"or", tag:"mtext", output:"or", tex:null, ttype:SPACE}, { input: "not", tag: "mo", output: "\u00AC", tex: "neg", ttype: CONST, symbolType: eSymbolType.logical }, { input: "=>", tag: "mo", output: "\u21D2", tex: "implies", ttype: CONST, symbolType: eSymbolType.logical }, { input: "if", tag: "mo", output: "if", tex: null, ttype: SPACE, symbolType: eSymbolType.logical }, { input: "<=>", tag: "mo", output: "\u21D4", tex: "iff", ttype: CONST, symbolType: eSymbolType.logical }, { input: "AA", tag: "mo", output: "\u2200", tex: "forall", ttype: CONST, symbolType: eSymbolType.logical }, { input: "EE", tag: "mo", output: "\u2203", tex: "exists", ttype: CONST, symbolType: eSymbolType.logical }, { input: "_|_", tag: "mo", output: "\u22A5", tex: "bot", ttype: CONST, symbolType: eSymbolType.logical }, { input: "TT", tag: "mo", output: "\u22A4", tex: "top", ttype: CONST, symbolType: eSymbolType.logical }, { input: "TT", tag: "mi", output: "\u22A4", tex: "top", ttype: CONST, symbolType: eSymbolType.logical }, { input: "|--", tag: "mo", output: "\u22A2", tex: "vdash", ttype: CONST, symbolType: eSymbolType.logical }, { input: "|==", tag: "mo", output: "\u22A8", tex: "models", ttype: CONST, symbolType: eSymbolType.logical }, //grouping brackets { input: "(", tag: "mo", output: "(", tex: null, ttype: LEFTBRACKET }, { input: ")", tag: "mo", output: ")", tex: null, ttype: RIGHTBRACKET }, { input: "[", tag: "mo", output: "[", tex: null, ttype: LEFTBRACKET }, { input: "]", tag: "mo", output: "]", tex: null, ttype: RIGHTBRACKET }, { input: "{", tag: "mo", output: "{", tex: null, ttype: LEFTBRACKET }, { input: "}", tag: "mo", output: "}", tex: null, ttype: RIGHTBRACKET }, { input: "|", tag: "mo", output: "|", tex: null, ttype: LEFTRIGHT }, { input: "||", tag: "mo", output: "∥", tex: null, ttype: LEFTRIGHT }, { input: "||", tag: "mo", output: "‖", tex: null, ttype: LEFTRIGHT }, { input: "|", tag: "mo", output: "\u2225", tex: null, ttype: LEFTRIGHT }, { input: "||", tag: "mo", output: "||", tex: null, ttype: LEFTRIGHT }, { input: "(:", tag: "mo", output: "\u2329", tex: "langle", ttype: LEFTBRACKET }, { input: "(:", tag: "mo", output: "\u27E8", tex: "langle", ttype: LEFTBRACKET }, { input: ":)", tag: "mo", output: "\u232A", tex: "rangle", ttype: RIGHTBRACKET }, { input: ":)", tag: "mo", output: "\u27E9", tex: "rangle", ttype: RIGHTBRACKET }, { input: "llcorner", tag: "mo", output: "\u231E", tex: "llcorner", ttype: LEFTBRACKET }, { input: "lrcorner", tag: "mo", output: "\u231F", tex: "lrcorner", ttype: RIGHTBRACKET }, { input: "ulcorner", tag: "mo", output: "\u231C", tex: "ulcorner", ttype: LEFTBRACKET }, { input: "urcorner", tag: "mo", output: "\u231D", tex: "urcorner", ttype: RIGHTBRACKET }, { input: "<<", tag: "mo", output: "\u2329", tex: null, ttype: LEFTBRACKET }, { input: ">>", tag: "mo", output: "\u232A", tex: null, ttype: RIGHTBRACKET }, { input: "{:", tag: "mo", output: "{:", tex: null, ttype: LEFTBRACKET, invisible: true }, { input: ":}", tag: "mo", output: ":}", tex: null, ttype: RIGHTBRACKET, invisible: true }, //miscellaneous symbols { input: "int", tag: "mo", output: "\u222B", tex: null, ttype: CONST, symbolType: eSymbolType.miscellaneous }, { 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: "dt", tag: "mi", output: "{:d t:}", tex: null, ttype: DEFINITION }, { input: "oint", tag: "mo", output: "\u222E", tex: null, ttype: CONST, symbolType: eSymbolType.miscellaneous }, { input: "oint", tag: "mtext", output: "\u222E", tex: null, ttype: CONST, symbolType: eSymbolType.miscellaneous }, { input: "del", tag: "mo", output: "\u2202", tex: "partial", ttype: CONST, symbolType: eSymbolType.miscellaneous }, { input: "del", tag: "mi", output: "\u2202", tex: "partial", ttype: CONST, symbolType: eSymbolType.miscellaneous }, { input: "grad", tag: "mo", output: "\u2207", tex: "nabla", ttype: CONST, symbolType: eSymbolType.miscellaneous }, { input: "+-", tag: "mo", output: "\u00B1", tex: "pm", ttype: CONST, symbolType: eSymbolType.miscellaneous }, { input: "O/", tag: "mo", output: "\u2205", tex: "emptyset", ttype: CONST, symbolType: eSymbolType.miscellaneous }, { input: "oo", tag: "mo", output: "\u221E", tex: "infty", ttype: CONST, symbolType: eSymbolType.miscellaneous }, { input: "aleph", tag: "mo", output: "\u2135", tex: null, ttype: CONST, symbolType: eSymbolType.miscellaneous }, { input: "...", tag: "mo", output: "...", tex: "ldots", ttype: CONST, symbolType: eSymbolType.miscellaneous }, { input: ":.", tag: "mo", output: "\u2234", tex: "therefore", ttype: CONST, symbolType: eSymbolType.miscellaneous }, { input: ":'", tag: "mo", output: "\u2235", tex: "because", ttype: CONST, symbolType: eSymbolType.miscellaneous }, { input: "/_", tag: "mo", output: "\u2220", tex: "angle", ttype: CONST, symbolType: eSymbolType.miscellaneous }, { input: "/_\\", tag: "mo", output: "\u25B3", tex: "triangle", ttype: CONST, symbolType: eSymbolType.miscellaneous }, { input: "'", tag: "mo", output: "\u2032", tex: "prime", ttype: CONST, symbolType: eSymbolType.miscellaneous }, { input: "tilde", tag: "mover", output: "~", tex: null, ttype: UNARY, acc: true, stretchy: false, symbolType: eSymbolType.miscellaneous }, { input: "widetilde", tag: "mover", output: "\u007E", tex: null, ttype: UNARY, acc: true, stretchy: true, symbolType: eSymbolType.miscellaneous }, { input: "\\ ", tag: "mo", output: "\u00A0", tex: null, ttype: CONST, symbolType: eSymbolType.miscellaneous }, { input: "frown", tag: "mo", output: "\u2322", tex: null, ttype: CONST, symbolType: eSymbolType.miscellaneous }, { input: "quad", tag: "mo", output: "\u00A0\u00A0", tex: null, ttype: CONST, symbolType: eSymbolType.miscellaneous }, { input: "qquad", tag: "mo", output: "\u00A0\u00A0\u00A0\u00A0", tex: null, ttype: CONST, symbolType: eSymbolType.miscellaneous }, { input: "cdots", tag: "mo", output: "\u22EF", tex: null, ttype: CONST, symbolType: eSymbolType.miscellaneous }, { input: "vdots", tag: "mo", output: "\u22EE", tex: null, ttype: CONST, symbolType: eSymbolType.miscellaneous }, { input: "ddots", tag: "mo", output: "\u22F1", tex: null, ttype: CONST, symbolType: eSymbolType.miscellaneous }, { input: "dots", tag: "mo", output: "\u2026", tex: null, ttype: CONST, symbolType: eSymbolType.miscellaneous }, { input: "diamond", tag: "mo", output: "\u22C4", tex: null, ttype: CONST, symbolType: eSymbolType.miscellaneous }, { input: "square", tag: "mo", output: "\u25A1", tex: null, ttype: CONST, symbolType: eSymbolType.miscellaneous }, { input: "|__", tag: "mo", output: "\u230A", tex: "lfloor", ttype: CONST, symbolType: eSymbolType.miscellaneous }, { input: "__|", tag: "mo", output: "\u230B", tex: "rfloor", ttype: CONST, symbolType: eSymbolType.miscellaneous }, { input: "|~", tag: "mo", output: "\u2308", tex: "lceiling", ttype: CONST, symbolType: eSymbolType.miscellaneous }, { input: "~|", tag: "mo", output: "\u2309", tex: "rceiling", ttype: CONST, symbolType: eSymbolType.miscellaneous }, { input: "CC", tag: "mo", output: "\u2102", tex: null, ttype: CONST, symbolType: eSymbolType.miscellaneous }, { input: "NN", tag: "mo", output: "\u2115", tex: null, ttype: CONST, symbolType: eSymbolType.miscellaneous }, { input: "QQ", tag: "mo", output: "\u211A", tex: null, ttype: CONST, symbolType: eSymbolType.miscellaneous }, { input: "RR", tag: "mo", output: "\u211D", tex: null, ttype: CONST, symbolType: eSymbolType.miscellaneous }, { input: "ZZ", tag: "mo", output: "\u2124", tex: null, ttype: CONST, symbolType: eSymbolType.miscellaneous }, { input: "f", tag: "mi", output: "f", tex: null, ttype: UNARY, func: true }, { input: "g", tag: "mi", output: "g", tex: null, ttype: UNARY, func: true }, //standard functions { input: "lim", tag: "mo", output: "lim", tex: null, ttype: UNDEROVER }, { input: "Lim", tag: "mo", output: "Lim", tex: null, ttype: UNDEROVER }, { input: "sin", tag: "mo", output: "sin", tex: null, ttype: UNARY, func: true }, { input: "cos", tag: "mo", output: "cos", tex: null, ttype: UNARY, func: true }, { input: "tan", tag: "mo", output: "tan", tex: null, ttype: UNARY, func: true }, { input: "sinh", tag: "mo", output: "sinh", tex: null, ttype: UNARY, func: true }, { input: "cosh", tag: "mo", output: "cosh", tex: null, ttype: UNARY, func: true }, { input: "tanh", tag: "mo", output: "tanh", tex: null, ttype: UNARY, func: true }, { input: "cot", tag: "mo", output: "cot", tex: null, ttype: UNARY, func: true }, { input: "sec", tag: "mo", output: "sec", tex: null, ttype: UNARY, func: true }, { input: "csc", tag: "mo", output: "csc", tex: null, ttype: UNARY, func: true }, { input: "arcsin", tag: "mo", output: "arcsin", tex: null, ttype: UNARY, func: true }, { input: "arccos", tag: "mo", output: "arccos", tex: null, ttype: UNARY, func: true }, { input: "arctan", tag: "mo", output: "arctan", tex: null, ttype: UNARY, func: true }, { input: "coth", tag: "mo", output: "coth", tex: null, ttype: UNARY, func: true }, { input: "sech", tag: "mo", output: "sech", tex: null, ttype: UNARY, func: true }, { input: "csch", tag: "mo", output: "csch", tex: null, ttype: UNARY, func: true }, { input: "exp", tag: "mo", output: "exp", tex: null, ttype: UNARY, func: true }, { input: "abs", tag: "mo", output: "abs", tex: null, ttype: UNARY, rewriteleftright: ["|", "|"] }, { input: "norm", tag: "mo", output: "norm", tex: null, ttype: UNARY, rewriteleftright: ["\u2225", "\u2225"] }, { input: "floor", tag: "mo", output: "floor", tex: null, ttype: UNARY, rewriteleftright: ["\u230A", "\u230B"] }, { input: "ceil", tag: "mo", output: "ceil", tex: null, ttype: UNARY, rewriteleftright: ["\u2308", "\u2309"] }, { input: "log", tag: "mo", output: "log", tex: null, ttype: UNARY, func: true }, { input: "ln", tag: "mo", output: "ln", tex: null, ttype: UNARY, func: true }, { input: "det", tag: "mo", output: "det", tex: null, ttype: UNARY, func: true }, { input: "dim", tag: "mo", output: "dim", tex: null, ttype: CONST }, { input: "mod", tag: "mo", output: "mod", tex: null, ttype: CONST }, { input: "gcd", tag: "mo", output: "gcd", tex: null, ttype: UNARY, func: true }, { input: "lcm", tag: "mo", output: "lcm", tex: null, ttype: UNARY, func: true }, { input: "lub", tag: "mo", output: "lub", tex: null, ttype: CONST }, { input: "glb", tag: "mo", output: "glb", tex: null, ttype: CONST }, { input: "min", tag: "mo", output: "min", tex: null, ttype: UNDEROVER }, { input: "max", tag: "mo", output: "max", tex: null, ttype: UNDEROVER }, //arrows { input: "uarr", tag: "mo", output: "\u2191", tex: "uparrow", ttype: CONST, symbolType: eSymbolType.arrow }, { input: "darr", tag: "mo", output: "\u2193", tex: "downarrow", ttype: CONST, symbolType: eSymbolType.arrow }, { input: "rarr", tag: "mo", output: "\u2192", tex: "rightarrow", ttype: CONST, symbolType: eSymbolType.arrow }, { input: "->", tag: "mo", output: "\u2192", tex: "to", ttype: CONST, symbolType: eSymbolType.arrow }, { input: ">->", tag: "mo", output: "\u21A3", tex: "rightarrowtail", ttype: CONST, symbolType: eSymbolType.arrow }, { input: "->>", tag: "mo", output: "\u21A0", tex: "twoheadrightarrow", ttype: CONST, symbolType: eSymbolType.arrow }, { input: ">->>", tag: "mo", output: "\u2916", tex: "twoheadrightarrowtail", ttype: CONST, symbolType: eSymbolType.arrow }, { input: "|->", tag: "mo", output: "\u21A6", tex: "mapsto", ttype: CONST, symbolType: eSymbolType.arrow }, { input: "larr", tag: "mo", output: "\u2190", tex: "leftarrow", ttype: CONST, symbolType: eSymbolType.arrow }, { input: "harr", tag: "mo", output: "\u2194", tex: "leftrightarrow", ttype: CONST, symbolType: eSymbolType.arrow }, { input: "rArr", tag: "mo", output: "\u21D2", tex: "Rightarrow", ttype: CONST, symbolType: eSymbolType.arrow }, { input: "lArr", tag: "mo", output: "\u21D0", tex: "Leftarrow", ttype: CONST, symbolType: eSymbolType.arrow }, { input: "hArr", tag: "mo", output: "\u21D4", tex: "Leftrightarrow", ttype: CONST, symbolType: eSymbolType.arrow }, //commands with argument { input: "sqrt", tag: "msqrt", output: "sqrt", tex: null, ttype: UNARY }, { input: "root", tag: "mroot", output: "root", tex: null, ttype: BINARY }, { input: "frac", tag: "mfrac", output: "/", tex: null, ttype: BINARY }, { input: "/", tag: "mfrac", output: "/", tex: null, ttype: INFIX }, { input: "stackrel", tag: "mover", output: "stackrel", tex: null, ttype: BINARY }, { input: "overset", tag: "mover", output: "stackrel", tex: null, ttype: BINARY }, { input: "underset", tag: "munder", output: "stackrel", tex: null, ttype: BINARY }, { input: "_", tag: "msub", output: "_", tex: null, ttype: INFIX }, { input: "^", tag: "msup", output: "^", tex: null, ttype: INFIX }, { input: "hat", tag: "mover", output: "\u005E", tex: null, ttype: UNARY, acc: true }, { input: "widehat", tag: "mover", output: "\u005E", tex: null, ttype: UNARY, acc: true, stretchy: true }, { input: "bar", tag: "mover", output: "\u00AF", tex: "overline", ttype: UNARY, acc: true }, { input: "bar", tag: "mover", output: "―", tex: "overline", ttype: UNARY, acc: true }, { input: "bar", tag: "mover", output: "macr", tex: "bar", ttype: CONST }, { input: "vec", tag: "mover", output: "\u2192", tex: null, ttype: UNARY, acc: true }, { input: "vec", tag: "mover", output: "rarr", output_linear: "\u2192", tex: "vec", ttype: CONST }, { input: "", tag: "mover", output: "larr", output_linear: "\u2190", tex: "overleftarrow", ttype: CONST }, { input: "dot", tag: "mover", output: ".", tex: null, ttype: UNARY, acc: true }, { input: "ddot", tag: "mover", output: "..", tex: null, ttype: UNARY, acc: true }, { input: "ul", tag: "munder", output: "\u0332", tex: "underline", ttype: UNARY, acc: true }, { input: "ubrace", tag: "munder", output: "\u23DF", tex: "underbrace", ttype: UNARYUNDEROVER, acc: true }, { input: "obrace", tag: "mover", output: "\u23DE", tex: "overbrace", ttype: UNARYUNDEROVER, acc: true }, { input: "color", tag: "mstyle", ttype: BINARY }, { input: "cancel", tag: "menclose", output: "cancel", tex: null, ttype: UNARY }, // AMquote, { input: "bb", tag: "mstyle", atname: "mathvariant", atval: "bold", output: "bb", tex: null, ttype: UNARY }, { input: "mathbf", tag: "mstyle", atname: "mathvariant", atval: "bold", output: "mathbf", tex: null, ttype: UNARY }, { input: "sf", tag: "mstyle", atname: "mathvariant", atval: "sans-serif", output: "sf", tex: null, ttype: UNARY }, { input: "mathsf", tag: "mstyle", atname: "mathvariant", atval: "sans-serif", output: "mathsf", tex: null, ttype: UNARY }, { input: "bbb", tag: "mstyle", atname: "mathvariant", atval: "double-struck", output: "bbb", tex: null, ttype: UNARY, codes: AMbbb }, { input: "mathbb", tag: "mstyle", atname: "mathvariant", atval: "double-struck", output: "mathbb", tex: null, ttype: UNARY, codes: AMbbb }, { input: "cc", tag: "mstyle", atname: "mathvariant", atval: "script", output: "cc", tex: null, ttype: UNARY, codes: AMcal }, { input: "mathcal", tag: "mstyle", atname: "mathvariant", atval: "script", output: "mathcal", tex: null, ttype: UNARY, codes: AMcal }, { input: "mathcal", tag: "mstyle", atname: "mathvariant", atval: "-tex-calligraphic", output: "mathcal", tex: null, ttype: UNARY, codes: AMcal }, // {input:"text", tag:"mstyle", atname:"mathvariant", atval:"normal", output:"mathcal", tex:null, ttype:UNARY, codes:AMcal}, { input: "tt", tag: "mstyle", atname: "mathvariant", atval: "monospace", output: "tt", tex: null, ttype: UNARY }, { input: "mathtt", tag: "mstyle", atname: "mathvariant", atval: "monospace", output: "mathtt", tex: null, ttype: UNARY }, { input: "fr", tag: "mstyle", atname: "mathvariant", atval: "fraktur", output: "fr", tex: null, ttype: UNARY, codes: AMfrk }, { input: "mathfrak", tag: "mstyle", atname: "mathvariant", atval: "fraktur", output: "mathfrak", tex: null, ttype: UNARY, codes: AMfrk } ]; var getFunctions = function () { var symbols = exports.AMsymbols.filter(function (item) { return item.func; }); var arr = []; for (var i = 0; i < (symbols === null || symbols === void 0 ? void 0 : symbols.length); i++) { arr.push(symbols[i].input); } return arr; }; exports.getFunctions = getFunctions; var listOfFunctions = (0, exports.getFunctions)(); exports.regExpIsFunction = new RegExp('(?:' + listOfFunctions.join('|') + ')$'); var findAmSymbolByTag = function (tag, output) { return exports.AMsymbols.find(function (item) { if (tag === 'mo' || tag === 'mi') { return (item.tag === 'mo' || item.tag === 'mi') && item.output === output; } else { return item.tag === tag && item.output === output; } }); }; exports.findAmSymbolByTag = findAmSymbolByTag; var findAmSymbolByTagStretchy = function (tag, output) { return exports.AMsymbols.find(function (item) { if (tag === 'mo' || tag === 'mi') { return (item.tag === 'mo' || item.tag === 'mi') && item.output === output && item.stretchy; } else { return item.tag === tag && item.output === output && item.stretchy; } }); }; exports.findAmSymbolByTagStretchy = findAmSymbolByTagStretchy; //# sourceMappingURL=helperA.js.map