UNPKG

tex2typst

Version:

JavaScript library for converting TeX code to Typst

1,091 lines (1,065 loc) 35.2 kB
const symbolMap = new Map<string, string>([ ['displaystyle', 'display'], [',', 'thin'], [':', 'med'], [';', 'thick'], ['cos', 'cos'], ['sin', 'sin'], ['tan', 'tan'], ['cot', 'cot'], ['sec', 'sec'], ['csc', 'csc'], ['mod', 'mod'], ['omicron', 'omicron'], ['Xi', 'Xi'], ['Upsilon', 'Upsilon'], ['lim', 'lim'], ['nonumber', ''], ['vec', 'arrow'], ['neq', 'eq.not'], ['dot', 'dot'], ['ddot', 'dot.double'], ['doteq', 'dot(eq)'], ['dots', 'dots.h'], ['vdots', 'dots.v'], ['ddots', 'dots.down'], ['widehat', 'hat'], // Ideally, the result of \widehat should be longer than \hat. But it is not implemented now. ['widetilde', 'tilde'], // Ideally, the result of \widetilde should be longer than \tilde. But it is not implemented now. ['quad', 'quad'], ['qquad', 'wide'], ['overbrace', 'overbrace'], // same ['underbrace', 'underbrace'], // same ['overline', 'overline'], // same ['underline', 'underline'], // same ['bar', 'macron'], ['dbinom', 'binom'], ['tbinom', 'binom'], ['dfrac', 'frac'], ['tfrac', 'frac'], ['operatorname', 'op'], ['boldsymbol', 'bold'], ['mathbb', 'bb'], ['mathbf', 'bold'], ['mathcal', 'cal'], ['mathit', 'italic'], ['mathfrak', 'frak'], ['mathrm', 'upright'], ['mathsf', 'sans'], ['mathtt', 'mono'], ['rm', 'upright'], // TODO: \pmb need special logic to handle but it is not implemented now. See the commented test case. ['pmb', 'bold'], ['leadsto', 'arrow.r.squiggly'], ['P', 'pilcrow'], ['S', 'section'], ['aleph', 'alef'], ['infin', 'infinity'], ['Delta', 'Delta'], ['Gamma', 'Gamma'], ['Lambda', 'Lambda'], ['Omega', 'Omega'], ['Phi', 'Phi'], ['Pi', 'Pi'], ['Psi', 'Psi'], ['Sigma', 'Sigma'], ['Theta', 'Theta'], ['alpha', 'alpha'], // ['amalg', 'product.co'], ['beta', 'beta'], ['bigcirc', 'circle.big'], // ['bowtie', 'join'], ['bullet', 'bullet'], ['cdot', 'dot.op'], // 'dot.op' or 'dot.c' ['cdots', 'dots.c'], ['checkmark', 'checkmark'], ['chi', 'chi'], ['circ', 'circle.small'], // 'circle.small' or 'compose' ['colon', 'colon'], ['cong', 'tilde.equiv'], ['coprod', 'product.co'], ['copyright', 'copyright'], ['cup', 'union'], ['curlyvee', 'or.curly'], ['curlywedge', 'and.curly'], ['dagger', 'dagger'], ['dashv', 'tack.l'], ['ddagger', 'dagger.double'], ['delta', 'delta'], ['ddots', 'dots.down'], ['diamond', 'diamond'], ['div', 'div'], ['divideontimes', 'times.div'], ['dotplus', 'plus.dot'], ['ell', 'ell'], ['emptyset', 'nothing'], ['epsilon', 'epsilon.alt'], ['equiv', 'equiv'], ['eta', 'eta'], ['exists', 'exists'], ['forall', 'forall'], // ['frown', 'paren.t'], ['gamma', 'gamma'], ['ge', 'gt.eq'], ['geq', 'gt.eq'], ['geqslant', 'gt.eq.slant'], ['gg', 'gt.double'], ['hbar', 'planck.reduce'], ['imath', 'dotless.i'], ['iiiint', 'integral.quad'], ['iiint', 'integral.triple'], ['iint', 'integral.double'], ['in', 'in'], ['infty', 'infinity'], ['int', 'integral'], ['intercal', 'top'], // 'top' or 'tack.b' ['iota', 'iota'], ['jmath', 'dotless.j'], ['kappa', 'kappa'], ['lambda', 'lambda'], ['land', 'and'], ['langle', 'angle.l'], ['lbrace', 'brace.l'], ['lbrack', 'bracket.l'], ['ldots', 'dots.h'], ['le', 'lt.eq'], ['leftthreetimes', 'times.three.l'], ['leftrightarrow', 'arrow.l.r'], ['leq', 'lt.eq'], ['leqslant', 'lt.eq.slant'], ['lhd', 'triangle.l'], ['ll', 'lt.double'], // ['longmapsto', 'arrow.bar.long'], // ['longrightarrow', 'arrow.long'], ['lor', 'or'], ['ltimes', 'times.l'], // ['mapsto', 'arrow.bar'], ['measuredangle', 'angle.arc'], ['mid', 'divides'], ['models', 'models'], ['mp', 'minus.plus'], ['mu', 'mu'], // ['nRightarrow', 'arrow.double.not'], ['nabla', 'nabla'], ['ncong', 'tilde.equiv.not'], ['ne', 'eq.not'], ['neg', 'not'], ['neq', 'eq.not'], ['nexists', 'exists.not'], ['ni', "in.rev"], ['nleftarrow', "arrow.l.not"], ['nleq', "lt.eq.not"], ['nparallel', "parallel.not"], ['ngeq', 'gt.eq.not'], ['nmid', 'divides.not'], ['notin', 'in.not'], // ['nrightarrow', 'arrow.not'], ['nsim', 'tilde.not'], ['nsubseteq', 'subset.eq.not'], ['nu', 'nu'], ['ntriangleleft', 'lt.tri.not'], ['ntriangleright', 'gt.tri.not'], ['odot', 'dot.circle'], ['oint', 'integral.cont'], ['oiint', 'integral.surf'], ['oiiint', 'integral.vol'], ['omega', 'omega'], ['ominus', 'minus.circle'], // ['oplus', 'xor'], // or 'plus.circle' ['otimes', 'times.circle'], ['parallel', 'parallel'], ['partial', 'diff'], ['perp', 'perp'], ['phi', 'phi.alt'], ['pi', 'pi'], ['pm', 'plus.minus'], ['pounds', 'pound'], ['prec', 'prec'], ['preceq', 'prec.eq'], ['prime', 'prime'], ['prod', 'product'], ['propto', 'prop'], ['psi', 'psi'], ['rangle', 'angle.r'], ['rbrace', 'brace.r'], ['rbrack', 'bracket.r'], ['rhd', 'triangle'], ['rho', 'rho'], ['rightarrow', 'arrow.r'], ['rightthreetimes', 'times.three.r'], ['rtimes', 'times.r'], ['setminus', 'without'], ['sigma', 'sigma'], ['sim', 'tilde.op'], ['simeq', 'tilde.eq'], ['slash', 'slash'], ['smallsetminus', 'without'], // ['smile', 'paren.b'], ['spadesuit', 'suit.spade'], ['sqsubseteq', 'subset.eq.sq'], ['sqsupseteq', 'supset.eq.sq'], // ['star', 'star'], ['subset', 'subset'], ['subseteq', 'subset.eq'], ['subsetneq', 'subset.neq'], ['succ', 'succ'], ['succeq', 'succ.eq'], ['sum', 'sum'], ['supset', 'supset'], ['supseteq', 'supset.eq'], ['supsetneq', 'supset.neq'], ['tau', 'tau'], ['theta', 'theta'], ['times', 'times'], ['to', 'arrow.r'], ['top', 'top'], ['triangle', 'triangle.t'], // ['triangledown', 'triangle.b.small'], // ['triangleleft', 'triangle.l.small'], // ['triangleright', 'triangle.r.small'], ['twoheadrightarrow', 'arrow.r.twohead'], ['upharpoonright', 'harpoon.tr'], ['uplus', 'union.plus'], ['upsilon', 'upsilon'], ['varepsilon', 'epsilon'], ['varnothing', 'diameter'], // empty set ['varphi', 'phi'], ['varpi', 'pi.alt'], ['varrho', 'rho.alt'], ['varsigma', 'sigma.alt'], ['vartheta', 'theta.alt'], ['vdash', 'tack.r'], ['vdots', 'dots.v'], ['vee', 'or'], ['wedge', 'and'], ['wr', 'wreath'], ['xi', 'xi'], ['yen', 'yen'], ['zeta', 'zeta'], // extended ['mathscr', 'scr'], ['LaTeX', '#LaTeX'], ['TeX', '#TeX'], ]); // The following are from Typst documentation website, augo-generated by the script const map_from_official_docs: Map<string, string> = new Map([ ['acwopencirclearrow', 'arrow.ccw'], ['adots', 'dots.up'], ['angdnr', 'angle.acute'], ['angle', 'angle'], ['angles', 'angle.s'], ['approx', 'approx'], ['approxeq', 'approx.eq'], ['approxident', 'tilde.triple'], ['assert', 'tack.r.short'], ['ast', 'ast.op'], ['asymp', 'asymp'], ['awint', 'integral.ccw'], ['backcong', 'tilde.rev.equiv'], ['backdprime', 'prime.double.rev'], ['backprime', 'prime.rev'], ['backsim', 'tilde.rev'], ['backsimeq', 'tilde.eq.rev'], ['backslash', 'backslash'], ['backtrprime', 'prime.triple.rev'], ['bardownharpoonleft', 'harpoon.bl.bar'], ['bardownharpoonright', 'harpoon.br.bar'], ['barleftarrow', 'arrow.l.stop'], ['barleftarrowrightarrowbar', 'arrows.lr.stop'], ['barleftharpoondown', 'harpoon.lb.stop'], ['barleftharpoonup', 'harpoon.lt.stop'], ['barrightharpoondown', 'harpoon.rb.bar'], ['barrightharpoonup', 'harpoon.rt.bar'], ['baruparrow', 'arrow.t.stop'], ['barupharpoonleft', 'harpoon.tl.stop'], ['barupharpoonright', 'harpoon.tr.stop'], ['barV', 'tack.b.double'], ['BbbA', 'AA'], ['BbbB', 'BB'], ['BbbC', 'CC'], ['BbbD', 'DD'], ['BbbE', 'EE'], ['BbbF', 'FF'], ['BbbG', 'GG'], ['BbbH', 'HH'], ['BbbI', 'II'], ['BbbJ', 'JJ'], ['BbbK', 'KK'], ['BbbL', 'LL'], ['BbbM', 'MM'], ['BbbN', 'NN'], ['BbbO', 'OO'], ['BbbP', 'PP'], ['BbbQ', 'QQ'], ['BbbR', 'RR'], ['BbbS', 'SS'], ['BbbT', 'TT'], ['BbbU', 'UU'], ['BbbV', 'VV'], ['BbbW', 'WW'], ['BbbX', 'XX'], ['BbbY', 'YY'], ['BbbZ', 'ZZ'], ['because', 'because'], ['bigblacktriangledown', 'triangle.filled.b'], ['bigblacktriangleup', 'triangle.filled.t'], ['bigbot', 'tack.t.big'], ['bigcap', 'inter.big'], ['bigcup', 'union.big'], ['bigcupdot', 'union.dot.big'], ['biginterleave', 'interleave.big'], ['bigodot', 'dot.circle.big'], ['bigoplus', 'plus.circle.big'], // or 'xor.big' ['bigotimes', 'times.circle.big'], ['bigsqcap', 'inter.sq.big'], ['bigsqcup', 'union.sq.big'], ['bigstar', 'star.filled'], ['bigtimes', 'times.big'], ['bigtop', 'tack.b.big'], ['bigtriangledown', 'triangle.stroked.b'], // or 'triangle.b' ['bigtriangleup', 'triangle.stroked.t'], // or 'triangle.t' ['biguplus', 'union.plus.big'], ['bigvee', 'or.big'], ['bigwedge', 'and.big'], ['bigwhitestar', 'star.stroked'], ['blackhourglass', 'hourglass.filled'], ['blacktriangle', 'triangle.filled.small.t'], ['blacktriangledown', 'triangle.filled.small.b'], ['blacktriangleleft', 'triangle.filled.l'], ['blacktriangleright', 'triangle.filled.r'], ['blkhorzoval', 'ellipse.filled.h'], ['blkvertoval', 'ellipse.filled.v'], ['bot', 'bot'], ['boxast', 'ast.square'], ['boxdot', 'dot.square'], ['boxminus', 'minus.square'], ['boxplus', 'plus.square'], ['boxtimes', 'times.square'], ['cap', 'inter'], ['Cap', 'inter.double'], ['capdot', 'inter.dot'], ['capwedge', 'inter.and'], ['caretinsert', 'caret'], ['cdot', 'dot.op'], ['cdotp', 'dot.c'], ['checkmark', 'checkmark'], ['circledast', 'ast.circle'], ['circledcirc', 'circle.nested'], ['circleddash', 'dash.circle'], ['circledequal', 'eq.circle'], ['circledparallel', 'parallel.circle'], ['circledvert', 'bar.v.circle'], ['clubsuit', 'suit.club.filled'], ['Colon', 'colon.double'], ['coloneq', 'colon.eq'], ['Coloneq', 'colon.double.eq'], ['complement', 'complement'], ['cong', 'tilde.equiv'], ['coprod', 'product.co'], ['cup', 'union'], ['Cup', 'union.double'], ['cupdot', 'union.dot'], ['cupleftarrow', 'union.arrow'], ['cupvee', 'union.or'], ['curlyeqprec', 'eq.prec'], ['curlyeqsucc', 'eq.succ'], ['curlyvee', 'or.curly'], ['curlywedge', 'and.curly'], ['curvearrowleft', 'arrow.ccw.half'], ['curvearrowright', 'arrow.cw.half'], ['cwopencirclearrow', 'arrow.cw'], ['dagger', 'dagger'], ['dashcolon', 'dash.colon'], ['dashv', 'tack.l'], ['Dashv', 'tack.l.double'], ['dashVdash', 'tack.l.r'], ['ddagger', 'dagger.double'], ['ddddot', 'dot.quad'], ['dddot', 'dot.triple'], ['ddots', 'dots.down'], ['DDownarrow', 'arrow.b.quad'], ['Ddownarrow', 'arrow.b.triple'], ['diameter', 'diameter'], ['diamondcdot', 'diamond.stroked.dot'], ['diamondsuit', 'suit.diamond.stroked'], ['dicei', 'die.one'], ['diceii', 'die.two'], ['diceiii', 'die.three'], ['diceiv', 'die.four'], ['dicev', 'die.five'], ['dicevi', 'die.six'], ['div', 'div'], ['divideontimes', 'times.div'], ['Doteq', 'eq.dots'], ['dotminus', 'minus.dot'], ['dotplus', 'plus.dot'], ['dotsim', 'tilde.dot'], ['dottedcircle', 'circle.dotted'], ['dottedsquare', 'square.stroked.dotted'], ['doubleplus', 'plus.double'], ['downarrow', 'arrow.b'], ['Downarrow', 'arrow.b.double'], ['downarrowbar', 'arrow.b.stop'], ['downdasharrow', 'arrow.b.dashed'], ['downdownarrows', 'arrows.bb'], ['downharpoonleft', 'harpoon.bl'], ['downharpoonleftbar', 'harpoon.bl.stop'], ['downharpoonright', 'harpoon.br'], ['downharpoonrightbar', 'harpoon.br.stop'], ['downharpoonsleftright', 'harpoons.blbr'], ['downrightcurvedarrow', 'arrow.b.curve'], ['downuparrows', 'arrows.bt'], ['downupharpoonsleftright', 'harpoons.bltr'], ['downwhitearrow', 'arrow.b.stroked'], ['downzigzagarrow', 'arrow.zigzag'], ['dprime', 'prime.double'], ['dualmap', 'multimap.double'], ['eighthnote', 'note.eighth.alt'], ['ell', 'ell'], ['emptysetoarr', 'emptyset.arrow.r'], ['emptysetoarrl', 'emptyset.arrow.l'], ['emptysetobar', 'emptyset.bar'], ['emptysetocirc', 'emptyset.circle'], ['eparsl', 'parallel.slanted.eq'], ['eqcolon', 'eq.colon'], ['eqdef', 'eq.def'], // \usepackage{mathtools} defines \eqdef ['eqgtr', 'eq.gt'], ['eqless', 'eq.lt'], ['eqsim', 'minus.tilde'], ['equal', 'eq'], ['equalparallel', 'parallel.eq'], ['equiv', 'eq.triple'], ['Equiv', 'eq.quad'], ['equivVert', 'parallel.equiv'], ['eqvparsl', 'parallel.slanted.equiv'], ['errbarblackcircle', 'errorbar.circle.filled'], ['errbarblackdiamond', 'errorbar.diamond.filled'], ['errbarblacksquare', 'errorbar.square.filled'], ['errbarcircle', 'errorbar.circle.stroked'], ['errbardiamond', 'errorbar.diamond.stroked'], ['errbarsquare', 'errorbar.square.stroked'], ['euro', 'euro'], ['Exclam', 'excl.double'], ['exists', 'exists'], ['fallingdotseq', 'eq.dots.down'], ['fint', 'integral.slash'], ['flat', 'flat'], ['forall', 'forall'], ['fourvdots', 'fence.dotted'], ['fullouterjoin', 'join.l.r'], ['geq', 'gt.eq'], ['geqq', 'gt.equiv'], ['geqslant', 'gt.eq.slant'], ['gg', 'gt.double'], ['ggg', 'gt.triple'], ['gggnest', 'gt.triple.nested'], ['gnapprox', 'gt.napprox'], ['gneq', 'gt.neq'], ['gneqq', 'gt.nequiv'], ['gnsim', 'gt.ntilde'], ['greater', 'gt'], ['gtlpar', 'angle.spheric.rev'], ['gtrapprox', 'gt.approx'], ['gtrdot', 'gt.dot'], ['gtreqless', 'gt.eq.lt'], ['gtrless', 'gt.lt'], ['gtrsim', 'gt.tilde'], ['heartsuit', 'suit.heart.stroked'], ['hknearrow', 'arrow.tr.hook'], ['hknwarrow', 'arrow.tl.hook'], ['hksearrow', 'arrow.br.hook'], ['hkswarrow', 'arrow.bl.hook'], ['hookleftarrow', 'arrow.l.hook'], ['hookrightarrow', 'arrow.r.hook'], ['horizbar', 'bar.h'], ['hourglass', 'hourglass.stroked'], ['hrectangle', 'rect.stroked.h'], ['hrectangleblack', 'rect.filled.h'], ['hslash', 'planck.reduce'], ['hzigzag', 'dash.wave.double'], ['iiiint', 'integral.quad'], ['iiint', 'integral.triple'], ['iinfin', 'infinity.incomplete'], ['iint', 'integral.double'], ['Im', 'Im'], ['imageof', 'image'], ['in', 'in'], ['increment', 'laplace'], ['infty', 'infinity'], ['int', 'integral'], ['intbar', 'integral.dash'], ['intBar', 'integral.dash.double'], ['intcap', 'integral.inter'], ['intclockwise', 'integral.cw'], ['intcup', 'integral.union'], ['interleave', 'interleave'], ['intlarhk', 'integral.arrow.hook'], ['intx', 'integral.times'], ['Join', 'join'], ['langle', 'angle.l'], ['lAngle', 'angle.l.double'], ['langledot', 'angle.l.dot'], ['lat', 'lat'], ['late', 'lat.eq'], ['lbrace', 'brace.l'], ['lBrace', 'brace.l.double'], ['lbrack', 'bracket.l'], ['lBrack', 'bracket.l.double'], ['lbrbrak', 'shell.l'], ['Lbrbrak', 'shell.l.double'], ['lceil', 'ceil.l'], ['lcurvyangle', 'angle.l.curly'], ['leftarrow', 'arrow.l'], ['Leftarrow', 'arrow.l.double'], ['leftarrowtail', 'arrow.l.tail'], ['leftdasharrow', 'arrow.l.dashed'], ['leftdotarrow', 'arrow.l.dotted'], ['leftdowncurvedarrow', 'arrow.l.curve'], ['leftharpoondown', 'harpoon.lb'], ['leftharpoondownbar', 'harpoon.lb.bar'], ['leftharpoonsupdown', 'harpoons.ltlb'], ['leftharpoonup', 'harpoon.lt'], ['leftharpoonupbar', 'harpoon.lt.bar'], ['leftleftarrows', 'arrows.ll'], ['leftouterjoin', 'join.l'], ['leftrightarrow', 'arrow.l.r'], ['Leftrightarrow', 'arrow.l.r.double'], ['leftrightarrows', 'arrows.lr'], ['leftrightharpoondowndown', 'harpoon.lb.rb'], ['leftrightharpoondownup', 'harpoon.lb.rt'], ['leftrightharpoons', 'harpoons.ltrb'], ['leftrightharpoonsdown', 'harpoons.lbrb'], ['leftrightharpoonsup', 'harpoons.ltrt'], ['leftrightharpoonupdown', 'harpoon.lt.rb'], ['leftrightharpoonupup', 'harpoon.lt.rt'], ['leftrightsquigarrow', 'arrow.l.r.wave'], ['leftsquigarrow', 'arrow.l.squiggly'], ['leftthreearrows', 'arrows.lll'], ['leftthreetimes', 'times.three.l'], ['leftwavearrow', 'arrow.l.wave'], ['leftwhitearrow', 'arrow.l.stroked'], ['leq', 'lt.eq'], ['leqq', 'lt.equiv'], ['leqslant', 'lt.eq.slant'], ['less', 'lt'], ['lessapprox', 'lt.approx'], ['lessdot', 'lt.dot'], ['lesseqgtr', 'lt.eq.gt'], ['lessgtr', 'lt.gt'], ['lesssim', 'lt.tilde'], ['lfloor', 'floor.l'], ['lgblkcircle', 'circle.filled.big'], ['lgblksquare', 'square.filled.big'], ['lgwhtcircle', 'circle.stroked.big'], ['lgwhtsquare', 'square.stroked.big'], ['ll', 'lt.double'], ['llblacktriangle', 'triangle.filled.bl'], ['LLeftarrow', 'arrow.l.quad'], ['Lleftarrow', 'arrow.l.triple'], ['lll', 'lt.triple'], ['lllnest', 'lt.triple.nested'], ['lltriangle', 'triangle.stroked.bl'], ['lnapprox', 'lt.napprox'], ['lneq', 'lt.neq'], ['lneqq', 'lt.nequiv'], ['lnsim', 'lt.ntilde'], ['longdashv', 'tack.l.long'], ['Longleftarrow', 'arrow.l.double.long'], ['longleftarrow', 'arrow.l.long'], ['Longleftrightarrow', 'arrow.l.r.double.long'], ['longleftrightarrow', 'arrow.l.r.long'], ['longleftsquigarrow', 'arrow.l.long.squiggly'], ['Longmapsfrom', 'arrow.l.double.long.bar'], ['longmapsfrom', 'arrow.l.long.bar'], ['longmapsto', 'arrow.r.long.bar'], ['Longmapsto', 'arrow.r.double.long.bar'], ['Longrightarrow', 'arrow.r.double.long'], ['longrightarrow', 'arrow.r.long'], ['longrightsquigarrow', 'arrow.r.long.squiggly'], ['looparrowleft', 'arrow.l.loop'], ['looparrowright', 'arrow.r.loop'], ['lparen', 'paren.l'], ['lParen', 'paren.l.double'], ['lrblacktriangle', 'triangle.filled.br'], ['lrtriangle', 'triangle.stroked.br'], ['ltimes', 'times.l'], ['lvzigzag', 'fence.l'], ['Lvzigzag', 'fence.l.double'], ['maltese', 'maltese'], ['mapsdown', 'arrow.b.bar'], ['mapsfrom', 'arrow.l.bar'], ['Mapsfrom', 'arrow.l.double.bar'], ['mapsto', 'arrow.r.bar'], ['Mapsto', 'arrow.r.double.bar'], ['mapsup', 'arrow.t.bar'], ['mathampersand', 'amp'], ['mathatsign', 'at'], ['mathcolon', 'colon'], ['mathcomma', 'comma'], ['mathdollar', 'dollar'], ['mathexclam', 'excl'], // ['mathhyphen', 'hyph'], // \mathhyphen is not defined in standard amsmath package ['mathoctothorpe', 'hash'], ['mathparagraph', 'pilcrow'], ['mathpercent', 'percent'], ['mathperiod', 'dot.basic'], ['mathplus', 'plus'], ['mathquestion', 'quest'], ['mathratio', 'ratio'], ['mathsection', 'section'], ['mathsemicolon', 'semi'], ['mathslash', 'slash'], ['mathsterling', 'pound'], ['mathyen', 'yen'], ['mdblkdiamond', 'diamond.filled.medium'], ['mdblklozenge', 'lozenge.filled.medium'], ['mdblksquare', 'square.filled.medium'], ['mdlgblkcircle', 'circle.filled'], ['mdlgblkdiamond', 'diamond.filled'], ['mdlgblklozenge', 'lozenge.filled'], ['mdlgblksquare', 'square.filled'], ['mdlgwhtcircle', 'circle.stroked'], ['mdlgwhtdiamond', 'diamond.stroked'], ['mdlgwhtlozenge', 'lozenge.stroked'], ['mdlgwhtsquare', 'square.stroked'], ['mdsmblkcircle', 'circle.filled.tiny'], ['mdsmblksquare', 'square.filled.small'], ['mdsmwhtcircle', 'circle.stroked.small'], ['mdsmwhtsquare', 'square.stroked.small'], ['mdwhtdiamond', 'diamond.stroked.medium'], ['mdwhtlozenge', 'lozenge.stroked.medium'], ['mdwhtsquare', 'square.stroked.medium'], ['measeq', 'eq.m'], ['measuredangle', 'angle.arc'], ['measuredangleleft', 'angle.arc.rev'], ['measuredrightangle', 'angle.right.arc'], ['mho', 'Omega.inv'], ['mid', 'divides'], ['minus', 'minus'], ['models', 'models'], ['mp', 'minus.plus'], ['multimap', 'multimap'], /* ['mupAlpha', 'Alpha'], ['mupalpha', 'alpha'], ['mupBeta', 'Beta'], ['mupbeta', 'beta'], ['mupChi', 'Chi'], ['mupchi', 'chi'], ['mupDelta', 'Delta'], ['mupdelta', 'delta'], ['mupEpsilon', 'Epsilon'], ['mupepsilon', 'epsilon.alt'], ['mupEta', 'Eta'], ['mupeta', 'eta'], ['mupGamma', 'Gamma'], ['mupgamma', 'gamma'], ['mupIota', 'Iota'], ['mupiota', 'iota'], ['mupKappa', 'Kappa'], ['mupkappa', 'kappa'], ['mupLambda', 'Lambda'], ['muplambda', 'lambda'], ['mupMu', 'Mu'], ['mupmu', 'mu'], ['mupNu', 'Nu'], ['mupnu', 'nu'], ['mupOmega', 'Omega'], ['mupomega', 'omega'], ['mupOmicron', 'Omicron'], ['mupomicron', 'omicron'], ['mupPhi', 'Phi'], ['mupphi', 'phi.alt'], ['mupPi', 'Pi'], ['muppi', 'pi'], ['mupPsi', 'Psi'], ['muppsi', 'psi'], ['mupRho', 'Rho'], ['muprho', 'rho'], ['mupSigma', 'Sigma'], ['mupsigma', 'sigma'], ['mupTau', 'Tau'], ['muptau', 'tau'], ['mupTheta', 'Theta'], ['muptheta', 'theta'], ['mupUpsilon', 'Upsilon'], ['mupupsilon', 'upsilon'], ['mupvarepsilon', 'epsilon'], ['mupvarkappa', 'kappa.alt'], ['mupvarphi', 'phi'], ['mupvarpi', 'pi.alt'], ['mupvarrho', 'rho.alt'], ['mupvarsigma', 'sigma.alt'], ['mupvartheta', 'theta.alt'], ['mupXi', 'Xi'], ['mupxi', 'xi'], ['mupZeta', 'Zeta'], ['mupzeta', 'zeta'], */ ['nabla', 'gradient'], ['napprox', 'approx.not'], ['nasymp', 'asymp.not'], ['natural', 'natural'], ['ncong', 'tilde.equiv.not'], ['ne', 'eq.not'], ['nearrow', 'arrow.tr'], ['Nearrow', 'arrow.tr.double'], ['neg', 'not'], ['nequiv', 'equiv.not'], // or eq.triple.not ['neswarrow', 'arrow.tr.bl'], ['nexists', 'exists.not'], ['ngeq', 'gt.eq.not'], ['ngtr', 'gt.not'], ['ngtrless', 'gt.lt.not'], ['ngtrsim', 'gt.tilde.not'], ['nhpar', 'parallel.struck'], ['nhVvert', 'interleave.struck'], ['ni', 'in.rev'], ['nLeftarrow', 'arrow.l.double.not'], ['nleftarrow', 'arrow.l.not'], ['nLeftrightarrow', 'arrow.l.r.double.not'], ['nleftrightarrow', 'arrow.l.r.not'], ['nleq', 'lt.eq.not'], ['nless', 'lt.not'], ['nlessgtr', 'lt.gt.not'], ['nlesssim', 'lt.tilde.not'], ['nmid', 'divides.not'], ['nni', 'in.rev.not'], ['notin', 'in.not'], ['nparallel', 'parallel.not'], ['nprec', 'prec.not'], ['npreccurlyeq', 'prec.curly.eq.not'], ['nRightarrow', 'arrow.r.double.not'], ['nrightarrow', 'arrow.r.not'], ['nsim', 'tilde.not'], ['nsimeq', 'tilde.eq.not'], ['nsqsubseteq', 'subset.eq.sq.not'], ['nsqsupseteq', 'supset.eq.sq.not'], ['nsubset', 'subset.not'], ['nsubseteq', 'subset.eq.not'], ['nsucc', 'succ.not'], ['nsucccurlyeq', 'succ.curly.eq.not'], ['nsupset', 'supset.not'], ['nsupseteq', 'supset.eq.not'], ['ntrianglelefteq', 'lt.tri.eq.not'], ['ntrianglerighteq', 'gt.tri.eq.not'], ['nvartriangleleft', 'lt.tri.not'], ['nvartriangleright', 'gt.tri.not'], ['nVdash', 'forces.not'], ['nvdash', 'tack.r.not'], ['nvDash', 'tack.r.double.not'], ['nvinfty', 'infinity.bar'], ['nwarrow', 'arrow.tl'], ['Nwarrow', 'arrow.tl.double'], ['nwsearrow', 'arrow.tl.br'], ['obrbrak', 'shell.t'], ['obslash', 'backslash.circle'], ['odiv', 'div.circle'], ['odot', 'dot.circle'], ['ogreaterthan', 'gt.circle'], ['oiiint', 'integral.vol'], ['oiint', 'integral.surf'], ['oint', 'integral.cont'], ['ointctrclockwise', 'integral.cont.ccw'], ['olessthan', 'lt.circle'], ['ominus', 'minus.circle'], ['operp', 'perp.circle'], ['oplus', 'plus.circle'], ['origof', 'original'], ['otimes', 'times.circle'], // ['overbrace', 'brace.t'], ['overbracket', 'bracket.t'], ['overparen', 'paren.t'], ['parallel', 'parallel'], ['parallelogram', 'parallelogram.stroked'], ['parallelogramblack', 'parallelogram.filled'], ['parsim', 'parallel.tilde'], ['partial', 'diff'], ['pentagon', 'penta.stroked'], ['pentagonblack', 'penta.filled'], ['perp', 'perp'], ['Planckconst', 'planck'], ['pm', 'plus.minus'], ['prec', 'prec'], ['Prec', 'prec.double'], ['precapprox', 'prec.approx'], ['preccurlyeq', 'prec.curly.eq'], ['preceq', 'prec.eq'], ['preceqq', 'prec.equiv'], ['precnapprox', 'prec.napprox'], ['precneq', 'prec.neq'], ['precneqq', 'prec.nequiv'], ['precnsim', 'prec.ntilde'], ['precsim', 'prec.tilde'], ['prime', 'prime'], ['prod', 'product'], ['propto', 'prop'], ['QED', 'qed'], ['qprime', 'prime.quad'], ['quarternote', 'note.quarter.alt'], ['questeq', 'eq.quest'], ['Question', 'quest.double'], ['rangle', 'angle.r'], ['rAngle', 'angle.r.double'], ['rangledot', 'angle.r.dot'], ['rbrace', 'brace.r'], ['rBrace', 'brace.r.double'], ['rbrack', 'bracket.r'], ['rBrack', 'bracket.r.double'], ['rbrbrak', 'shell.r'], ['Rbrbrak', 'shell.r.double'], ['rceil', 'ceil.r'], ['rcurvyangle', 'angle.r.curly'], ['Re', 'Re'], ['revangle', 'angle.rev'], ['revemptyset', 'emptyset.rev'], ['revnmid', 'divides.not.rev'], ['rfloor', 'floor.r'], ['rightangle', 'angle.right'], ['rightanglemdot', 'angle.right.dot'], ['rightanglesqr', 'angle.right.sq'], ['rightarrow', 'arrow.r'], ['Rightarrow', 'arrow.r.double'], ['rightarrowbar', 'arrow.r.stop'], ['rightarrowonoplus', 'plus.circle.arrow'], ['rightarrowtail', 'arrow.r.tail'], ['rightdasharrow', 'arrow.r.dashed'], ['rightdotarrow', 'arrow.r.dotted'], ['rightdowncurvedarrow', 'arrow.r.curve'], ['rightharpoondown', 'harpoon.rb'], ['rightharpoondownbar', 'harpoon.rb.stop'], ['rightharpoonsupdown', 'harpoons.rtrb'], ['rightharpoonup', 'harpoon.rt'], ['rightharpoonupbar', 'harpoon.rt.stop'], ['rightleftarrows', 'arrows.rl'], ['rightleftharpoons', 'harpoons.rtlb'], ['rightleftharpoonsdown', 'harpoons.rblb'], ['rightleftharpoonsup', 'harpoons.rtlt'], ['rightouterjoin', 'join.r'], ['rightrightarrows', 'arrows.rr'], ['rightsquigarrow', 'arrow.r.squiggly'], ['rightthreearrows', 'arrows.rrr'], ['rightthreetimes', 'times.three.r'], ['rightwavearrow', 'arrow.r.wave'], ['rightwhitearrow', 'arrow.r.stroked'], ['risingdotseq', 'eq.dots.up'], ['rparen', 'paren.r'], ['rParen', 'paren.r.double'], ['RRightarrow', 'arrow.r.quad'], ['Rrightarrow', 'arrow.r.triple'], ['rsolbar', 'backslash.not'], ['rtimes', 'times.r'], ['rvzigzag', 'fence.r'], ['Rvzigzag', 'fence.r.double'], ['searrow', 'arrow.br'], ['Searrow', 'arrow.br.double'], ['setminus', 'without'], ['sharp', 'sharp'], ['shortdowntack', 'tack.b.short'], ['shortlefttack', 'tack.l.short'], ['shortuptack', 'tack.t.short'], ['sim', 'tilde.op'], ['sime', 'tilde.eq'], ['similarleftarrow', 'arrow.l.tilde'], ['similarrightarrow', 'arrow.r.tilde'], ['simneqq', 'tilde.nequiv'], ['smallblacktriangleleft', 'triangle.filled.small.l'], ['smallblacktriangleright', 'triangle.filled.small.r'], ['smallin', 'in.small'], ['smallni', 'in.rev.small'], ['smalltriangleleft', 'triangle.stroked.small.l'], ['smalltriangleright', 'triangle.stroked.small.r'], ['smashtimes', 'smash'], ['smblkcircle', 'bullet'], ['smblkdiamond', 'diamond.filled.small'], ['smblklozenge', 'lozenge.filled.small'], ['smblksquare', 'square.filled.tiny'], ['smeparsl', 'parallel.slanted.eq.tilde'], ['smt', 'smt'], ['smte', 'smt.eq'], ['smwhtdiamond', 'diamond.stroked.small'], ['smwhtlozenge', 'lozenge.stroked.small'], ['smwhtsquare', 'square.stroked.tiny'], ['spadesuit', 'suit.spade.filled'], ['sphericalangle', 'angle.spheric'], ['sphericalangleup', 'angle.spheric.top'], ['sqcap', 'inter.sq'], ['Sqcap', 'inter.sq.double'], ['sqcup', 'union.sq'], ['Sqcup', 'union.sq.double'], ['sqint', 'integral.square'], ['sqsubset', 'subset.sq'], ['sqsubseteq', 'subset.eq.sq'], ['sqsubsetneq', 'subset.sq.neq'], ['sqsupset', 'supset.sq'], ['sqsupseteq', 'supset.eq.sq'], ['sqsupsetneq', 'supset.sq.neq'], ['squoval', 'square.stroked.rounded'], ['sslash', 'slash.double'], ['star', 'star.op'], ['stareq', 'eq.star'], ['subset', 'subset'], ['Subset', 'subset.double'], ['subsetdot', 'subset.dot'], ['subseteq', 'subset.eq'], ['subsetneq', 'subset.neq'], ['succ', 'succ'], ['Succ', 'succ.double'], ['succapprox', 'succ.approx'], ['succcurlyeq', 'succ.curly.eq'], ['succeq', 'succ.eq'], ['succeqq', 'succ.equiv'], ['succnapprox', 'succ.napprox'], ['succneq', 'succ.neq'], ['succneqq', 'succ.nequiv'], ['succnsim', 'succ.ntilde'], ['succsim', 'succ.tilde'], ['sum', 'sum'], ['sumint', 'sum.integral'], ['supset', 'supset'], ['Supset', 'supset.double'], ['supsetdot', 'supset.dot'], ['supseteq', 'supset.eq'], ['supsetneq', 'supset.neq'], ['swarrow', 'arrow.bl'], ['Swarrow', 'arrow.bl.double'], ['therefore', 'therefore'], ['threedangle', 'angle.spatial'], ['threedotcolon', 'colon.tri.op'], ['tieinfty', 'infinity.tie'], ['times', 'times'], ['tminus', 'miny'], ['top', 'tack.b'], ['tplus', 'tiny'], ['trianglecdot', 'triangle.stroked.dot'], ['triangledown', 'triangle.stroked.small.b'], ['triangleleft', 'triangle.stroked.l'], ['trianglelefteq', 'lt.tri.eq'], ['triangleminus', 'minus.triangle'], ['triangleplus', 'plus.triangle'], ['triangleq', 'eq.delta'], ['triangleright', 'triangle.stroked.r'], ['trianglerighteq', 'gt.tri.eq'], ['triangletimes', 'times.triangle'], ['tripleplus', 'plus.triple'], ['trprime', 'prime.triple'], ['trslash', 'slash.triple'], ['twoheaddownarrow', 'arrow.b.twohead'], ['twoheadleftarrow', 'arrow.l.twohead'], ['twoheadmapsfrom', 'arrow.l.twohead.bar'], ['twoheadmapsto', 'arrow.r.twohead.bar'], ['twoheadrightarrow', 'arrow.r.twohead'], ['twoheaduparrow', 'arrow.t.twohead'], ['twonotes', 'note.eighth.beamed'], ['ubrbrak', 'shell.b'], ['ulblacktriangle', 'triangle.filled.tl'], ['ultriangle', 'triangle.stroked.tl'], ['uminus', 'union.minus'], ['underbrace', 'brace.b'], ['underbracket', 'bracket.b'], ['underparen', 'paren.b'], ['unicodecdots', 'dots.h.c'], ['unicodeellipsis', 'dots.h'], ['upand', 'amp.inv'], ['uparrow', 'arrow.t'], ['Uparrow', 'arrow.t.double'], ['updasharrow', 'arrow.t.dashed'], ['updownarrow', 'arrow.t.b'], ['Updownarrow', 'arrow.t.b.double'], ['updownarrows', 'arrows.tb'], ['updownharpoonleftleft', 'harpoon.tl.bl'], ['updownharpoonleftright', 'harpoon.tl.br'], ['updownharpoonrightleft', 'harpoon.tr.bl'], ['updownharpoonrightright', 'harpoon.tr.br'], ['updownharpoonsleftright', 'harpoons.tlbr'], ['upharpoonleft', 'harpoon.tl'], ['upharpoonleftbar', 'harpoon.tl.bar'], ['upharpoonright', 'harpoon.tr'], ['upharpoonrightbar', 'harpoon.tr.bar'], ['upharpoonsleftright', 'harpoons.tltr'], ['uplus', 'union.plus'], ['uprightcurvearrow', 'arrow.t.curve'], ['upuparrows', 'arrows.tt'], ['upwhitearrow', 'arrow.t.stroked'], ['urblacktriangle', 'triangle.filled.tr'], ['urtriangle', 'triangle.stroked.tr'], ['UUparrow', 'arrow.t.quad'], ['Uuparrow', 'arrow.t.triple'], ['varclubsuit', 'suit.club.stroked'], ['vardiamondsuit', 'suit.diamond.filled'], ['varheartsuit', 'suit.heart.filled'], ['varhexagon', 'hexa.stroked'], ['varhexagonblack', 'hexa.filled'], ['varnothing', 'emptyset'], ['varointclockwise', 'integral.cont.cw'], ['varspadesuit', 'suit.spade.stroked'], ['vartriangle', 'triangle.stroked.small.t'], ['vartriangleleft', 'lt.tri'], ['vartriangleright', 'gt.tri'], ['Vbar', 'tack.t.double'], ['Vdash', 'forces'], ['vdash', 'tack.r'], ['vDash', 'tack.r.double'], ['vdots', 'dots.v'], ['vee', 'or'], ['Vee', 'or.double'], ['veedot', 'or.dot'], ['veeeq', 'eq.equi'], ['vert', 'bar.v'], ['Vert', 'bar.v.double'], ['vlongdash', 'tack.r.long'], ['vrectangle', 'rect.stroked.v'], ['vrectangleblack', 'rect.filled.v'], ['Vvert', 'bar.v.triple'], ['vysmblkcircle', 'circle.filled.small'], ['vysmwhtcircle', 'circle.stroked.tiny'], // or compose ['wedge', 'and'], ['Wedge', 'and.double'], ['wedgedot', 'and.dot'], ['wedgeq', 'eq.est'], ['whiteinwhitetriangle', 'triangle.stroked.nested'], ['whthorzoval', 'ellipse.stroked.h'], ['whtvertoval', 'ellipse.stroked.v'], ['wideangledown', 'angle.oblique'], ['wr', 'wreath'], ['xsol', 'slash.big'], ]); const texAliasMap = new Map<string, string>([ ['gets', 'leftarrow'], ['iff', 'Longleftrightarrow'], ['implies', 'Longrightarrow'], ]); const typstAliasMap = new Map<string, string>([ // ['arrow', 'arrow.r'], // ['dot', 'dot.op'], ['arrow.double', 'arrow.r.double'], ['arrow.squiggly', 'arrow.r.squiggly'], ]); for(const [key, value] of map_from_official_docs) { if(!symbolMap.has(key)) { symbolMap.set(key, value); } } const reverseSymbolMap = new Map<string, string>(); for(const [key, value] of Array.from(symbolMap.entries()).reverse()) { reverseSymbolMap.set(value, key); } reverseSymbolMap.set('dif', 'mathrm{d}'); reverseSymbolMap.set('oo', 'infty'); // force override some one-to-multiple mappings const typst_to_tex_map = new Map<string, string>([ ['top', 'top'], ['frac', 'frac'], ['tilde', 'tilde'], ['hat', 'hat'], ['upright', 'mathrm'], ['bold', 'boldsymbol'], ['infinity', 'infty'], ['hyph.minus', '\\text{-}'], ]); for(const [key, value] of typst_to_tex_map) { reverseSymbolMap.set(key, value); } for(const [key, value] of texAliasMap) { if(!symbolMap.has(key)) { symbolMap.set(key, symbolMap.get(value)!); } } export {symbolMap, reverseSymbolMap, texAliasMap, typstAliasMap};