tex2typst 0.2.9 → 0.2.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -36,21 +36,15 @@ var symbolMap = new Map([
36
36
  ["pmb", "bold"],
37
37
  ["pm", "plus.minus"],
38
38
  ["mp", "minus.plus"],
39
- ["oplus", "xor"],
40
39
  ["boxplus", "plus.square"],
41
40
  ["otimes", "times.circle"],
42
41
  ["boxtimes", "times.square"],
43
- ["sim", "tilde"],
44
42
  ["approx", "approx"],
45
43
  ["cong", "tilde.equiv"],
46
44
  ["simeq", "tilde.eq"],
47
45
  ["asymp", "\u224D"],
48
46
  ["equiv", "equiv"],
49
47
  ["propto", "prop"],
50
- ["lfloor", "\u230A"],
51
- ["rfloor", "\u230B"],
52
- ["lceil", "\u2308"],
53
- ["rceil", "\u2309"],
54
48
  ["gets", "arrow.l"],
55
49
  ["hookleftarrow", "arrow.l.hook"],
56
50
  ["leftharpoonup", "harpoon.lt"],
@@ -62,7 +56,6 @@ var symbolMap = new Map([
62
56
  ["Longleftarrow", "arrow.l.double.long"],
63
57
  ["Longrightarrow", "arrow.r.double.long"],
64
58
  ["Longleftrightarrow", "arrow.l.r.double.long"],
65
- ["longmapsto", "arrow.r.bar"],
66
59
  ["hookrightarrow", "arrow.r.hook"],
67
60
  ["rightharpoonup", "harpoon.rt"],
68
61
  ["rightharpoondown", "harpoon.rb"],
@@ -104,17 +97,13 @@ var symbolMap = new Map([
104
97
  ["angle", "angle"],
105
98
  ["approx", "approx"],
106
99
  ["approxeq", "approx.eq"],
107
- ["ast", "ast"],
108
100
  ["beta", "beta"],
109
101
  ["bigcap", "sect.big"],
110
102
  ["bigcirc", "circle.big"],
111
103
  ["bigcup", "union.big"],
112
104
  ["bigodot", "dot.circle.big"],
113
- ["bigoplus", "xor.big"],
114
105
  ["bigotimes", "times.circle.big"],
115
106
  ["bigsqcup", "union.sq.big"],
116
- ["bigtriangledown", "triangle.b"],
117
- ["bigtriangleup", "triangle.t"],
118
107
  ["biguplus", "union.plus.big"],
119
108
  ["bigvee", "or.big"],
120
109
  ["bigwedge", "and.big"],
@@ -156,7 +145,7 @@ var symbolMap = new Map([
156
145
  ["gg", "gt.double"],
157
146
  ["hbar", "planck.reduce"],
158
147
  ["imath", "dotless.i"],
159
- ["iiiint", "intgral.quad"],
148
+ ["iiiint", "integral.quad"],
160
149
  ["iiint", "integral.triple"],
161
150
  ["iint", "integral.double"],
162
151
  ["in", "in"],
@@ -181,19 +170,15 @@ var symbolMap = new Map([
181
170
  ["leqslant", "lt.eq.slant"],
182
171
  ["lhd", "triangle.l"],
183
172
  ["ll", "lt.double"],
184
- ["longmapsto", "arrow.bar.long"],
185
- ["longrightarrow", "arrow.long"],
186
173
  ["lor", "or"],
187
174
  ["ltimes", "times.l"],
188
- ["mapsto", "arrow.bar"],
189
175
  ["measuredangle", "angle.arc"],
190
176
  ["mid", "divides"],
191
177
  ["models", "models"],
192
178
  ["mp", "minus.plus"],
193
179
  ["mu", "mu"],
194
- ["nRightarrow", "arrow.double.not"],
195
180
  ["nabla", "nabla"],
196
- ["ncong", "tilde.nequiv"],
181
+ ["ncong", "tilde.equiv.not"],
197
182
  ["ne", "eq.not"],
198
183
  ["neg", "not"],
199
184
  ["neq", "eq.not"],
@@ -205,7 +190,6 @@ var symbolMap = new Map([
205
190
  ["ngeq", "gt.eq.not"],
206
191
  ["nmid", "divides.not"],
207
192
  ["notin", "in.not"],
208
- ["nrightarrow", "arrow.not"],
209
193
  ["nsim", "tilde.not"],
210
194
  ["nsubseteq", "subset.eq.not"],
211
195
  ["nu", "nu"],
@@ -218,7 +202,6 @@ var symbolMap = new Map([
218
202
  ["oiiint", "integral.vol"],
219
203
  ["omega", "omega"],
220
204
  ["ominus", "minus.circle"],
221
- ["oplus", "xor"],
222
205
  ["otimes", "times.circle"],
223
206
  ["parallel", "parallel"],
224
207
  ["partial", "diff"],
@@ -243,7 +226,7 @@ var symbolMap = new Map([
243
226
  ["rtimes", "times.r"],
244
227
  ["setminus", "without"],
245
228
  ["sigma", "sigma"],
246
- ["sim", "tilde"],
229
+ ["sim", "tilde.op"],
247
230
  ["simeq", "tilde.eq"],
248
231
  ["slash", "slash"],
249
232
  ["smallsetminus", "without"],
@@ -252,7 +235,6 @@ var symbolMap = new Map([
252
235
  ["sqcup", "union.sq"],
253
236
  ["sqsubseteq", "subset.eq.sq"],
254
237
  ["sqsupseteq", "supset.eq.sq"],
255
- ["star", "star"],
256
238
  ["subset", "subset"],
257
239
  ["subseteq", "subset.eq"],
258
240
  ["subsetneq", "subset.neq"],
@@ -269,9 +251,6 @@ var symbolMap = new Map([
269
251
  ["to", "arrow.r"],
270
252
  ["top", "top"],
271
253
  ["triangle", "triangle.t"],
272
- ["triangledown", "triangle.b.small"],
273
- ["triangleleft", "triangle.l.small"],
274
- ["triangleright", "triangle.r.small"],
275
254
  ["twoheadrightarrow", "arrow.r.twohead"],
276
255
  ["uparrow", "arrow.t"],
277
256
  ["updownarrow", "arrow.t.b"],
@@ -297,6 +276,763 @@ var symbolMap = new Map([
297
276
  ["LaTeX", "#LaTeX"],
298
277
  ["TeX", "#TeX"]
299
278
  ]);
279
+ var map_from_official_docs = new Map([
280
+ ["lparen", "paren.l"],
281
+ ["lParen", "paren.l.double"],
282
+ ["rparen", "paren.r"],
283
+ ["rParen", "paren.r.double"],
284
+ ["overparen", "paren.t"],
285
+ ["underparen", "paren.b"],
286
+ ["lbrace", "brace.l"],
287
+ ["lBrace", "brace.l.double"],
288
+ ["rbrace", "brace.r"],
289
+ ["rBrace", "brace.r.double"],
290
+ ["underbrace", "brace.b"],
291
+ ["lbrack", "bracket.l"],
292
+ ["lBrack", "bracket.l.double"],
293
+ ["rbrack", "bracket.r"],
294
+ ["rBrack", "bracket.r.double"],
295
+ ["overbracket", "bracket.t"],
296
+ ["underbracket", "bracket.b"],
297
+ ["lbrbrak", "shell.l"],
298
+ ["Lbrbrak", "shell.l.double"],
299
+ ["rbrbrak", "shell.r"],
300
+ ["Rbrbrak", "shell.r.double"],
301
+ ["obrbrak", "shell.t"],
302
+ ["ubrbrak", "shell.b"],
303
+ ["vert", "bar.v"],
304
+ ["Vert", "bar.v.double"],
305
+ ["Vvert", "bar.v.triple"],
306
+ ["circledvert", "bar.v.circle"],
307
+ ["horizbar", "bar.h"],
308
+ ["lvzigzag", "fence.l"],
309
+ ["Lvzigzag", "fence.l.double"],
310
+ ["rvzigzag", "fence.r"],
311
+ ["Rvzigzag", "fence.r.double"],
312
+ ["fourvdots", "fence.dotted"],
313
+ ["angle", "angle"],
314
+ ["langle", "angle.l"],
315
+ ["lcurvyangle", "angle.l.curly"],
316
+ ["langledot", "angle.l.dot"],
317
+ ["rangle", "angle.r"],
318
+ ["rcurvyangle", "angle.r.curly"],
319
+ ["rangledot", "angle.r.dot"],
320
+ ["angdnr", "angle.acute"],
321
+ ["measuredangle", "angle.arc"],
322
+ ["measuredangleleft", "angle.arc.rev"],
323
+ ["wideangledown", "angle.oblique"],
324
+ ["revangle", "angle.rev"],
325
+ ["rightangle", "angle.right"],
326
+ ["measuredrightangle", "angle.right.arc"],
327
+ ["rightanglemdot", "angle.right.dot"],
328
+ ["rightanglesqr", "angle.right.sq"],
329
+ ["angles", "angle.s"],
330
+ ["threedangle", "angle.spatial"],
331
+ ["sphericalangle", "angle.spheric"],
332
+ ["gtlpar", "angle.spheric.rev"],
333
+ ["sphericalangleup", "angle.spheric.top"],
334
+ ["lceil", "ceil.l"],
335
+ ["rceil", "ceil.r"],
336
+ ["lfloor", "floor.l"],
337
+ ["rfloor", "floor.r"],
338
+ ["mathampersand", "amp"],
339
+ ["upand", "amp.inv"],
340
+ ["ast", "ast.op"],
341
+ ["circledast", "ast.circle"],
342
+ ["boxast", "ast.square"],
343
+ ["mathatsign", "at"],
344
+ ["backslash", "backslash"],
345
+ ["obslash", "backslash.circle"],
346
+ ["rsolbar", "backslash.not"],
347
+ ["mathcolon", "colon"],
348
+ ["Colon", "colon.double"],
349
+ ["coloneq", "colon.eq"],
350
+ ["Coloneq", "colon.double.eq"],
351
+ ["mathcomma", "comma"],
352
+ ["dagger", "dagger"],
353
+ ["ddagger", "dagger.double"],
354
+ ["dashcolon", "dash.colon"],
355
+ ["circleddash", "dash.circle"],
356
+ ["hzigzag", "dash.wave.double"],
357
+ ["cdot", "dot.op"],
358
+ ["mathperiod", "dot.basic"],
359
+ ["cdotp", "dot.c"],
360
+ ["odot", "dot.circle"],
361
+ ["bigodot", "dot.circle.big"],
362
+ ["boxdot", "dot.square"],
363
+ ["dddot", "dot.triple"],
364
+ ["ddddot", "dot.quad"],
365
+ ["mathexclam", "excl"],
366
+ ["Exclam", "excl.double"],
367
+ ["mathquestion", "quest"],
368
+ ["Question", "quest.double"],
369
+ ["mathoctothorpe", "hash"],
370
+ ["mathhyphen", "hyph"],
371
+ ["mathpercent", "percent"],
372
+ ["mathparagraph", "pilcrow"],
373
+ ["mathsection", "section"],
374
+ ["mathsemicolon", "semi"],
375
+ ["mathslash", "slash"],
376
+ ["sslash", "slash.double"],
377
+ ["trslash", "slash.triple"],
378
+ ["xsol", "slash.big"],
379
+ ["unicodecdots", "dots.h.c"],
380
+ ["unicodeellipsis", "dots.h"],
381
+ ["vdots", "dots.v"],
382
+ ["ddots", "dots.down"],
383
+ ["adots", "dots.up"],
384
+ ["sim", "tilde.op"],
385
+ ["dotsim", "tilde.dot"],
386
+ ["sime", "tilde.eq"],
387
+ ["nsimeq", "tilde.eq.not"],
388
+ ["backsimeq", "tilde.eq.rev"],
389
+ ["cong", "tilde.equiv"],
390
+ ["ncong", "tilde.equiv.not"],
391
+ ["simneqq", "tilde.nequiv"],
392
+ ["nsim", "tilde.not"],
393
+ ["backsim", "tilde.rev"],
394
+ ["backcong", "tilde.rev.equiv"],
395
+ ["approxident", "tilde.triple"],
396
+ ["caretinsert", "caret"],
397
+ ["prime", "prime"],
398
+ ["backprime", "prime.rev"],
399
+ ["dprime", "prime.double"],
400
+ ["backdprime", "prime.double.rev"],
401
+ ["trprime", "prime.triple"],
402
+ ["backtrprime", "prime.triple.rev"],
403
+ ["qprime", "prime.quad"],
404
+ ["mathplus", "plus"],
405
+ ["oplus", "plus.circle"],
406
+ ["rightarrowonoplus", "plus.circle.arrow"],
407
+ ["bigoplus", "plus.circle.big"],
408
+ ["dotplus", "plus.dot"],
409
+ ["doubleplus", "plus.double"],
410
+ ["pm", "plus.minus"],
411
+ ["boxplus", "plus.square"],
412
+ ["triangleplus", "plus.triangle"],
413
+ ["tripleplus", "plus.triple"],
414
+ ["minus", "minus"],
415
+ ["ominus", "minus.circle"],
416
+ ["dotminus", "minus.dot"],
417
+ ["mp", "minus.plus"],
418
+ ["boxminus", "minus.square"],
419
+ ["eqsim", "minus.tilde"],
420
+ ["triangleminus", "minus.triangle"],
421
+ ["div", "div"],
422
+ ["odiv", "div.circle"],
423
+ ["times", "times"],
424
+ ["bigtimes", "times.big"],
425
+ ["otimes", "times.circle"],
426
+ ["bigotimes", "times.circle.big"],
427
+ ["divideontimes", "times.div"],
428
+ ["leftthreetimes", "times.three.l"],
429
+ ["rightthreetimes", "times.three.r"],
430
+ ["ltimes", "times.l"],
431
+ ["rtimes", "times.r"],
432
+ ["boxtimes", "times.square"],
433
+ ["triangletimes", "times.triangle"],
434
+ ["mathratio", "ratio"],
435
+ ["equal", "eq"],
436
+ ["stareq", "eq.star"],
437
+ ["circledequal", "eq.circle"],
438
+ ["eqcolon", "eq.colon"],
439
+ ["eqdef", "eq.def"],
440
+ ["triangleq", "eq.delta"],
441
+ ["veeeq", "eq.equi"],
442
+ ["wedgeq", "eq.est"],
443
+ ["eqgtr", "eq.gt"],
444
+ ["eqless", "eq.lt"],
445
+ ["measeq", "eq.m"],
446
+ ["ne", "eq.not"],
447
+ ["curlyeqprec", "eq.prec"],
448
+ ["questeq", "eq.quest"],
449
+ ["curlyeqsucc", "eq.succ"],
450
+ ["equiv", "eq.triple"],
451
+ ["Equiv", "eq.quad"],
452
+ ["greater", "gt"],
453
+ ["ogreaterthan", "gt.circle"],
454
+ ["gtrdot", "gt.dot"],
455
+ ["gtrapprox", "gt.approx"],
456
+ ["gg", "gt.double"],
457
+ ["geq", "gt.eq"],
458
+ ["geqslant", "gt.eq.slant"],
459
+ ["gtreqless", "gt.eq.lt"],
460
+ ["ngeq", "gt.eq.not"],
461
+ ["geqq", "gt.equiv"],
462
+ ["gtrless", "gt.lt"],
463
+ ["ngtrless", "gt.lt.not"],
464
+ ["gneq", "gt.neq"],
465
+ ["gnapprox", "gt.napprox"],
466
+ ["gneqq", "gt.nequiv"],
467
+ ["ngtr", "gt.not"],
468
+ ["gnsim", "gt.ntilde"],
469
+ ["gtrsim", "gt.tilde"],
470
+ ["ngtrsim", "gt.tilde.not"],
471
+ ["vartriangleright", "gt.tri"],
472
+ ["trianglerighteq", "gt.tri.eq"],
473
+ ["ntrianglerighteq", "gt.tri.eq.not"],
474
+ ["nvartriangleright", "gt.tri.not"],
475
+ ["ggg", "gt.triple"],
476
+ ["gggnest", "gt.triple.nested"],
477
+ ["less", "lt"],
478
+ ["olessthan", "lt.circle"],
479
+ ["lessdot", "lt.dot"],
480
+ ["lessapprox", "lt.approx"],
481
+ ["ll", "lt.double"],
482
+ ["leq", "lt.eq"],
483
+ ["leqslant", "lt.eq.slant"],
484
+ ["lesseqgtr", "lt.eq.gt"],
485
+ ["nleq", "lt.eq.not"],
486
+ ["leqq", "lt.equiv"],
487
+ ["lessgtr", "lt.gt"],
488
+ ["nlessgtr", "lt.gt.not"],
489
+ ["lneq", "lt.neq"],
490
+ ["lnapprox", "lt.napprox"],
491
+ ["lneqq", "lt.nequiv"],
492
+ ["nless", "lt.not"],
493
+ ["lnsim", "lt.ntilde"],
494
+ ["lesssim", "lt.tilde"],
495
+ ["nlesssim", "lt.tilde.not"],
496
+ ["vartriangleleft", "lt.tri"],
497
+ ["trianglelefteq", "lt.tri.eq"],
498
+ ["ntrianglelefteq", "lt.tri.eq.not"],
499
+ ["nvartriangleleft", "lt.tri.not"],
500
+ ["lll", "lt.triple"],
501
+ ["lllnest", "lt.triple.nested"],
502
+ ["approx", "approx"],
503
+ ["approxeq", "approx.eq"],
504
+ ["napprox", "approx.not"],
505
+ ["prec", "prec"],
506
+ ["precapprox", "prec.approx"],
507
+ ["preccurlyeq", "prec.curly.eq"],
508
+ ["npreccurlyeq", "prec.curly.eq.not"],
509
+ ["Prec", "prec.double"],
510
+ ["preceq", "prec.eq"],
511
+ ["preceqq", "prec.equiv"],
512
+ ["precnapprox", "prec.napprox"],
513
+ ["precneq", "prec.neq"],
514
+ ["precneqq", "prec.nequiv"],
515
+ ["nprec", "prec.not"],
516
+ ["precnsim", "prec.ntilde"],
517
+ ["precsim", "prec.tilde"],
518
+ ["succ", "succ"],
519
+ ["succapprox", "succ.approx"],
520
+ ["succcurlyeq", "succ.curly.eq"],
521
+ ["nsucccurlyeq", "succ.curly.eq.not"],
522
+ ["Succ", "succ.double"],
523
+ ["succeq", "succ.eq"],
524
+ ["succeqq", "succ.equiv"],
525
+ ["succnapprox", "succ.napprox"],
526
+ ["succneq", "succ.neq"],
527
+ ["succneqq", "succ.nequiv"],
528
+ ["nsucc", "succ.not"],
529
+ ["succnsim", "succ.ntilde"],
530
+ ["succsim", "succ.tilde"],
531
+ ["nequiv", "equiv.not"],
532
+ ["propto", "prop"],
533
+ ["origof", "original"],
534
+ ["imageof", "image"],
535
+ ["varnothing", "emptyset"],
536
+ ["emptysetoarr", "emptyset.arrow.r"],
537
+ ["emptysetoarrl", "emptyset.arrow.l"],
538
+ ["emptysetobar", "emptyset.bar"],
539
+ ["emptysetocirc", "emptyset.circle"],
540
+ ["revemptyset", "emptyset.rev"],
541
+ ["setminus", "without"],
542
+ ["complement", "complement"],
543
+ ["in", "in"],
544
+ ["notin", "in.not"],
545
+ ["ni", "in.rev"],
546
+ ["nni", "in.rev.not"],
547
+ ["smallni", "in.rev.small"],
548
+ ["smallin", "in.small"],
549
+ ["subset", "subset"],
550
+ ["subsetdot", "subset.dot"],
551
+ ["Subset", "subset.double"],
552
+ ["subseteq", "subset.eq"],
553
+ ["nsubseteq", "subset.eq.not"],
554
+ ["sqsubseteq", "subset.eq.sq"],
555
+ ["nsqsubseteq", "subset.eq.sq.not"],
556
+ ["subsetneq", "subset.neq"],
557
+ ["nsubset", "subset.not"],
558
+ ["sqsubset", "subset.sq"],
559
+ ["sqsubsetneq", "subset.sq.neq"],
560
+ ["supset", "supset"],
561
+ ["supsetdot", "supset.dot"],
562
+ ["Supset", "supset.double"],
563
+ ["supseteq", "supset.eq"],
564
+ ["nsupseteq", "supset.eq.not"],
565
+ ["sqsupseteq", "supset.eq.sq"],
566
+ ["nsqsupseteq", "supset.eq.sq.not"],
567
+ ["supsetneq", "supset.neq"],
568
+ ["nsupset", "supset.not"],
569
+ ["sqsupset", "supset.sq"],
570
+ ["sqsupsetneq", "supset.sq.neq"],
571
+ ["cup", "union"],
572
+ ["cupleftarrow", "union.arrow"],
573
+ ["bigcup", "union.big"],
574
+ ["cupdot", "union.dot"],
575
+ ["bigcupdot", "union.dot.big"],
576
+ ["Cup", "union.double"],
577
+ ["uminus", "union.minus"],
578
+ ["cupvee", "union.or"],
579
+ ["uplus", "union.plus"],
580
+ ["biguplus", "union.plus.big"],
581
+ ["sqcup", "union.sq"],
582
+ ["bigsqcup", "union.sq.big"],
583
+ ["Sqcup", "union.sq.double"],
584
+ ["cap", "sect"],
585
+ ["capwedge", "sect.and"],
586
+ ["bigcap", "sect.big"],
587
+ ["capdot", "sect.dot"],
588
+ ["Cap", "sect.double"],
589
+ ["sqcap", "sect.sq"],
590
+ ["bigsqcap", "sect.sq.big"],
591
+ ["Sqcap", "sect.sq.double"],
592
+ ["infty", "infinity"],
593
+ ["nvinfty", "infinity.bar"],
594
+ ["iinfin", "infinity.incomplete"],
595
+ ["tieinfty", "infinity.tie"],
596
+ ["partial", "diff"],
597
+ ["nabla", "gradient"],
598
+ ["sum", "sum"],
599
+ ["sumint", "sum.integral"],
600
+ ["prod", "product"],
601
+ ["coprod", "product.co"],
602
+ ["int", "integral"],
603
+ ["intlarhk", "integral.arrow.hook"],
604
+ ["awint", "integral.ccw"],
605
+ ["oint", "integral.cont"],
606
+ ["ointctrclockwise", "integral.cont.ccw"],
607
+ ["varointclockwise", "integral.cont.cw"],
608
+ ["intclockwise", "integral.cw"],
609
+ ["intbar", "integral.dash"],
610
+ ["intBar", "integral.dash.double"],
611
+ ["iint", "integral.double"],
612
+ ["iiiint", "integral.quad"],
613
+ ["intcap", "integral.sect"],
614
+ ["fint", "integral.slash"],
615
+ ["sqint", "integral.square"],
616
+ ["oiint", "integral.surf"],
617
+ ["intx", "integral.times"],
618
+ ["iiint", "integral.triple"],
619
+ ["intcup", "integral.union"],
620
+ ["oiiint", "integral.vol"],
621
+ ["increment", "laplace"],
622
+ ["forall", "forall"],
623
+ ["exists", "exists"],
624
+ ["nexists", "exists.not"],
625
+ ["top", "top"],
626
+ ["bot", "bot"],
627
+ ["neg", "not"],
628
+ ["wedge", "and"],
629
+ ["bigwedge", "and.big"],
630
+ ["curlywedge", "and.curly"],
631
+ ["wedgedot", "and.dot"],
632
+ ["Wedge", "and.double"],
633
+ ["vee", "or"],
634
+ ["bigvee", "or.big"],
635
+ ["curlyvee", "or.curly"],
636
+ ["veedot", "or.dot"],
637
+ ["Vee", "or.double"],
638
+ ["models", "models"],
639
+ ["Vdash", "forces"],
640
+ ["nVdash", "forces.not"],
641
+ ["therefore", "therefore"],
642
+ ["because", "because"],
643
+ ["QED", "qed"],
644
+ ["vysmwhtcircle", "compose"],
645
+ ["multimap", "multimap"],
646
+ ["dualmap", "multimap.double"],
647
+ ["tplus", "tiny"],
648
+ ["tminus", "miny"],
649
+ ["mid", "divides"],
650
+ ["nmid", "divides.not"],
651
+ ["wr", "wreath"],
652
+ ["parallel", "parallel"],
653
+ ["nhpar", "parallel.struck"],
654
+ ["circledparallel", "parallel.circle"],
655
+ ["equalparallel", "parallel.eq"],
656
+ ["equivVert", "parallel.equiv"],
657
+ ["nparallel", "parallel.not"],
658
+ ["eparsl", "parallel.slanted.eq"],
659
+ ["smeparsl", "parallel.slanted.eq.tilde"],
660
+ ["eqvparsl", "parallel.slanted.equiv"],
661
+ ["parsim", "parallel.tilde"],
662
+ ["perp", "perp"],
663
+ ["operp", "perp.circle"],
664
+ ["diameter", "diameter"],
665
+ ["Join", "join"],
666
+ ["rightouterjoin", "join.r"],
667
+ ["leftouterjoin", "join.l"],
668
+ ["fullouterjoin", "join.l.r"],
669
+ ["smashtimes", "smash"],
670
+ ["mathdollar", "dollar"],
671
+ ["euro", "euro"],
672
+ ["mathsterling", "pound"],
673
+ ["mathyen", "yen"],
674
+ ["checkmark", "checkmark"],
675
+ ["maltese", "maltese"],
676
+ ["clubsuit", "suit.club.filled"],
677
+ ["varclubsuit", "suit.club.stroked"],
678
+ ["vardiamondsuit", "suit.diamond.filled"],
679
+ ["diamondsuit", "suit.diamond.stroked"],
680
+ ["varheartsuit", "suit.heart.filled"],
681
+ ["heartsuit", "suit.heart.stroked"],
682
+ ["spadesuit", "suit.spade.filled"],
683
+ ["varspadesuit", "suit.spade.stroked"],
684
+ ["quarternote", "note.quarter.alt"],
685
+ ["eighthnote", "note.eighth.alt"],
686
+ ["twonotes", "note.eighth.beamed"],
687
+ ["natural", "natural"],
688
+ ["flat", "flat"],
689
+ ["sharp", "sharp"],
690
+ ["smblkcircle", "bullet"],
691
+ ["mdlgwhtcircle", "circle.stroked"],
692
+ ["mdsmwhtcircle", "circle.stroked.small"],
693
+ ["lgwhtcircle", "circle.stroked.big"],
694
+ ["mdlgblkcircle", "circle.filled"],
695
+ ["mdsmblkcircle", "circle.filled.tiny"],
696
+ ["vysmblkcircle", "circle.filled.small"],
697
+ ["lgblkcircle", "circle.filled.big"],
698
+ ["dottedcircle", "circle.dotted"],
699
+ ["circledcirc", "circle.nested"],
700
+ ["whthorzoval", "ellipse.stroked.h"],
701
+ ["whtvertoval", "ellipse.stroked.v"],
702
+ ["blkhorzoval", "ellipse.filled.h"],
703
+ ["blkvertoval", "ellipse.filled.v"],
704
+ ["bigtriangleup", "triangle.stroked.t"],
705
+ ["bigtriangledown", "triangle.stroked.b"],
706
+ ["triangleright", "triangle.stroked.r"],
707
+ ["triangleleft", "triangle.stroked.l"],
708
+ ["lltriangle", "triangle.stroked.bl"],
709
+ ["lrtriangle", "triangle.stroked.br"],
710
+ ["ultriangle", "triangle.stroked.tl"],
711
+ ["urtriangle", "triangle.stroked.tr"],
712
+ ["vartriangle", "triangle.stroked.small.t"],
713
+ ["triangledown", "triangle.stroked.small.b"],
714
+ ["smalltriangleright", "triangle.stroked.small.r"],
715
+ ["smalltriangleleft", "triangle.stroked.small.l"],
716
+ ["whiteinwhitetriangle", "triangle.stroked.nested"],
717
+ ["trianglecdot", "triangle.stroked.dot"],
718
+ ["bigblacktriangleup", "triangle.filled.t"],
719
+ ["bigblacktriangledown", "triangle.filled.b"],
720
+ ["blacktriangleright", "triangle.filled.r"],
721
+ ["blacktriangleleft", "triangle.filled.l"],
722
+ ["llblacktriangle", "triangle.filled.bl"],
723
+ ["lrblacktriangle", "triangle.filled.br"],
724
+ ["ulblacktriangle", "triangle.filled.tl"],
725
+ ["urblacktriangle", "triangle.filled.tr"],
726
+ ["blacktriangle", "triangle.filled.small.t"],
727
+ ["blacktriangledown", "triangle.filled.small.b"],
728
+ ["smallblacktriangleright", "triangle.filled.small.r"],
729
+ ["smallblacktriangleleft", "triangle.filled.small.l"],
730
+ ["mdlgwhtsquare", "square.stroked"],
731
+ ["smwhtsquare", "square.stroked.tiny"],
732
+ ["mdsmwhtsquare", "square.stroked.small"],
733
+ ["mdwhtsquare", "square.stroked.medium"],
734
+ ["lgwhtsquare", "square.stroked.big"],
735
+ ["dottedsquare", "square.stroked.dotted"],
736
+ ["squoval", "square.stroked.rounded"],
737
+ ["mdlgblksquare", "square.filled"],
738
+ ["smblksquare", "square.filled.tiny"],
739
+ ["mdsmblksquare", "square.filled.small"],
740
+ ["mdblksquare", "square.filled.medium"],
741
+ ["lgblksquare", "square.filled.big"],
742
+ ["hrectangle", "rect.stroked.h"],
743
+ ["vrectangle", "rect.stroked.v"],
744
+ ["hrectangleblack", "rect.filled.h"],
745
+ ["vrectangleblack", "rect.filled.v"],
746
+ ["pentagon", "penta.stroked"],
747
+ ["pentagonblack", "penta.filled"],
748
+ ["varhexagon", "hexa.stroked"],
749
+ ["varhexagonblack", "hexa.filled"],
750
+ ["mdlgwhtdiamond", "diamond.stroked"],
751
+ ["smwhtdiamond", "diamond.stroked.small"],
752
+ ["mdwhtdiamond", "diamond.stroked.medium"],
753
+ ["diamondcdot", "diamond.stroked.dot"],
754
+ ["mdlgblkdiamond", "diamond.filled"],
755
+ ["mdblkdiamond", "diamond.filled.medium"],
756
+ ["smblkdiamond", "diamond.filled.small"],
757
+ ["mdlgwhtlozenge", "lozenge.stroked"],
758
+ ["smwhtlozenge", "lozenge.stroked.small"],
759
+ ["mdwhtlozenge", "lozenge.stroked.medium"],
760
+ ["mdlgblklozenge", "lozenge.filled"],
761
+ ["smblklozenge", "lozenge.filled.small"],
762
+ ["mdblklozenge", "lozenge.filled.medium"],
763
+ ["parallelogram", "parallelogram.stroked"],
764
+ ["parallelogramblack", "parallelogram.filled"],
765
+ ["star", "star.op"],
766
+ ["bigwhitestar", "star.stroked"],
767
+ ["bigstar", "star.filled"],
768
+ ["rightarrow", "arrow.r"],
769
+ ["longmapsto", "arrow.r.long.bar"],
770
+ ["mapsto", "arrow.r.bar"],
771
+ ["rightdowncurvedarrow", "arrow.r.curve"],
772
+ ["rightdasharrow", "arrow.r.dashed"],
773
+ ["rightdotarrow", "arrow.r.dotted"],
774
+ ["Rightarrow", "arrow.r.double"],
775
+ ["Mapsto", "arrow.r.double.bar"],
776
+ ["Longrightarrow", "arrow.r.double.long"],
777
+ ["Longmapsto", "arrow.r.double.long.bar"],
778
+ ["nRightarrow", "arrow.r.double.not"],
779
+ ["hookrightarrow", "arrow.r.hook"],
780
+ ["longrightarrow", "arrow.r.long"],
781
+ ["longrightsquigarrow", "arrow.r.long.squiggly"],
782
+ ["looparrowright", "arrow.r.loop"],
783
+ ["nrightarrow", "arrow.r.not"],
784
+ ["RRightarrow", "arrow.r.quad"],
785
+ ["rightsquigarrow", "arrow.r.squiggly"],
786
+ ["rightarrowbar", "arrow.r.stop"],
787
+ ["rightwhitearrow", "arrow.r.stroked"],
788
+ ["rightarrowtail", "arrow.r.tail"],
789
+ ["similarrightarrow", "arrow.r.tilde"],
790
+ ["Rrightarrow", "arrow.r.triple"],
791
+ ["twoheadmapsto", "arrow.r.twohead.bar"],
792
+ ["twoheadrightarrow", "arrow.r.twohead"],
793
+ ["rightwavearrow", "arrow.r.wave"],
794
+ ["leftarrow", "arrow.l"],
795
+ ["mapsfrom", "arrow.l.bar"],
796
+ ["leftdowncurvedarrow", "arrow.l.curve"],
797
+ ["leftdasharrow", "arrow.l.dashed"],
798
+ ["leftdotarrow", "arrow.l.dotted"],
799
+ ["Leftarrow", "arrow.l.double"],
800
+ ["Mapsfrom", "arrow.l.double.bar"],
801
+ ["Longleftarrow", "arrow.l.double.long"],
802
+ ["Longmapsfrom", "arrow.l.double.long.bar"],
803
+ ["nLeftarrow", "arrow.l.double.not"],
804
+ ["hookleftarrow", "arrow.l.hook"],
805
+ ["longleftarrow", "arrow.l.long"],
806
+ ["longmapsfrom", "arrow.l.long.bar"],
807
+ ["longleftsquigarrow", "arrow.l.long.squiggly"],
808
+ ["looparrowleft", "arrow.l.loop"],
809
+ ["nleftarrow", "arrow.l.not"],
810
+ ["LLeftarrow", "arrow.l.quad"],
811
+ ["leftsquigarrow", "arrow.l.squiggly"],
812
+ ["barleftarrow", "arrow.l.stop"],
813
+ ["leftwhitearrow", "arrow.l.stroked"],
814
+ ["leftarrowtail", "arrow.l.tail"],
815
+ ["similarleftarrow", "arrow.l.tilde"],
816
+ ["Lleftarrow", "arrow.l.triple"],
817
+ ["twoheadmapsfrom", "arrow.l.twohead.bar"],
818
+ ["twoheadleftarrow", "arrow.l.twohead"],
819
+ ["leftwavearrow", "arrow.l.wave"],
820
+ ["uparrow", "arrow.t"],
821
+ ["mapsup", "arrow.t.bar"],
822
+ ["uprightcurvearrow", "arrow.t.curve"],
823
+ ["updasharrow", "arrow.t.dashed"],
824
+ ["Uparrow", "arrow.t.double"],
825
+ ["UUparrow", "arrow.t.quad"],
826
+ ["baruparrow", "arrow.t.stop"],
827
+ ["upwhitearrow", "arrow.t.stroked"],
828
+ ["Uuparrow", "arrow.t.triple"],
829
+ ["twoheaduparrow", "arrow.t.twohead"],
830
+ ["downarrow", "arrow.b"],
831
+ ["mapsdown", "arrow.b.bar"],
832
+ ["downrightcurvedarrow", "arrow.b.curve"],
833
+ ["downdasharrow", "arrow.b.dashed"],
834
+ ["Downarrow", "arrow.b.double"],
835
+ ["DDownarrow", "arrow.b.quad"],
836
+ ["downarrowbar", "arrow.b.stop"],
837
+ ["downwhitearrow", "arrow.b.stroked"],
838
+ ["Ddownarrow", "arrow.b.triple"],
839
+ ["twoheaddownarrow", "arrow.b.twohead"],
840
+ ["leftrightarrow", "arrow.l.r"],
841
+ ["Leftrightarrow", "arrow.l.r.double"],
842
+ ["Longleftrightarrow", "arrow.l.r.double.long"],
843
+ ["nLeftrightarrow", "arrow.l.r.double.not"],
844
+ ["longleftrightarrow", "arrow.l.r.long"],
845
+ ["nleftrightarrow", "arrow.l.r.not"],
846
+ ["leftrightsquigarrow", "arrow.l.r.wave"],
847
+ ["updownarrow", "arrow.t.b"],
848
+ ["Updownarrow", "arrow.t.b.double"],
849
+ ["nearrow", "arrow.tr"],
850
+ ["Nearrow", "arrow.tr.double"],
851
+ ["hknearrow", "arrow.tr.hook"],
852
+ ["searrow", "arrow.br"],
853
+ ["Searrow", "arrow.br.double"],
854
+ ["hksearrow", "arrow.br.hook"],
855
+ ["nwarrow", "arrow.tl"],
856
+ ["Nwarrow", "arrow.tl.double"],
857
+ ["hknwarrow", "arrow.tl.hook"],
858
+ ["swarrow", "arrow.bl"],
859
+ ["Swarrow", "arrow.bl.double"],
860
+ ["hkswarrow", "arrow.bl.hook"],
861
+ ["nwsearrow", "arrow.tl.br"],
862
+ ["neswarrow", "arrow.tr.bl"],
863
+ ["acwopencirclearrow", "arrow.ccw"],
864
+ ["curvearrowleft", "arrow.ccw.half"],
865
+ ["cwopencirclearrow", "arrow.cw"],
866
+ ["curvearrowright", "arrow.cw.half"],
867
+ ["downzigzagarrow", "arrow.zigzag"],
868
+ ["rightrightarrows", "arrows.rr"],
869
+ ["leftleftarrows", "arrows.ll"],
870
+ ["upuparrows", "arrows.tt"],
871
+ ["downdownarrows", "arrows.bb"],
872
+ ["leftrightarrows", "arrows.lr"],
873
+ ["barleftarrowrightarrowbar", "arrows.lr.stop"],
874
+ ["rightleftarrows", "arrows.rl"],
875
+ ["updownarrows", "arrows.tb"],
876
+ ["downuparrows", "arrows.bt"],
877
+ ["rightthreearrows", "arrows.rrr"],
878
+ ["leftthreearrows", "arrows.lll"],
879
+ ["rightharpoonup", "harpoon.rt"],
880
+ ["barrightharpoonup", "harpoon.rt.bar"],
881
+ ["rightharpoonupbar", "harpoon.rt.stop"],
882
+ ["rightharpoondown", "harpoon.rb"],
883
+ ["barrightharpoondown", "harpoon.rb.bar"],
884
+ ["rightharpoondownbar", "harpoon.rb.stop"],
885
+ ["leftharpoonup", "harpoon.lt"],
886
+ ["leftharpoonupbar", "harpoon.lt.bar"],
887
+ ["barleftharpoonup", "harpoon.lt.stop"],
888
+ ["leftharpoondown", "harpoon.lb"],
889
+ ["leftharpoondownbar", "harpoon.lb.bar"],
890
+ ["barleftharpoondown", "harpoon.lb.stop"],
891
+ ["upharpoonleft", "harpoon.tl"],
892
+ ["upharpoonleftbar", "harpoon.tl.bar"],
893
+ ["barupharpoonleft", "harpoon.tl.stop"],
894
+ ["upharpoonright", "harpoon.tr"],
895
+ ["upharpoonrightbar", "harpoon.tr.bar"],
896
+ ["barupharpoonright", "harpoon.tr.stop"],
897
+ ["downharpoonleft", "harpoon.bl"],
898
+ ["bardownharpoonleft", "harpoon.bl.bar"],
899
+ ["downharpoonleftbar", "harpoon.bl.stop"],
900
+ ["downharpoonright", "harpoon.br"],
901
+ ["bardownharpoonright", "harpoon.br.bar"],
902
+ ["downharpoonrightbar", "harpoon.br.stop"],
903
+ ["leftrightharpoonupup", "harpoon.lt.rt"],
904
+ ["leftrightharpoondowndown", "harpoon.lb.rb"],
905
+ ["leftrightharpoondownup", "harpoon.lb.rt"],
906
+ ["leftrightharpoonupdown", "harpoon.lt.rb"],
907
+ ["updownharpoonleftleft", "harpoon.tl.bl"],
908
+ ["updownharpoonrightright", "harpoon.tr.br"],
909
+ ["updownharpoonleftright", "harpoon.tl.br"],
910
+ ["updownharpoonrightleft", "harpoon.tr.bl"],
911
+ ["rightharpoonsupdown", "harpoons.rtrb"],
912
+ ["downharpoonsleftright", "harpoons.blbr"],
913
+ ["downupharpoonsleftright", "harpoons.bltr"],
914
+ ["leftrightharpoonsdown", "harpoons.lbrb"],
915
+ ["leftharpoonsupdown", "harpoons.ltlb"],
916
+ ["leftrightharpoons", "harpoons.ltrb"],
917
+ ["leftrightharpoonsup", "harpoons.ltrt"],
918
+ ["rightleftharpoonsdown", "harpoons.rblb"],
919
+ ["rightleftharpoons", "harpoons.rtlb"],
920
+ ["rightleftharpoonsup", "harpoons.rtlt"],
921
+ ["updownharpoonsleftright", "harpoons.tlbr"],
922
+ ["upharpoonsleftright", "harpoons.tltr"],
923
+ ["vdash", "tack.r"],
924
+ ["nvdash", "tack.r.not"],
925
+ ["vlongdash", "tack.r.long"],
926
+ ["assert", "tack.r.short"],
927
+ ["vDash", "tack.r.double"],
928
+ ["nvDash", "tack.r.double.not"],
929
+ ["dashv", "tack.l"],
930
+ ["longdashv", "tack.l.long"],
931
+ ["shortlefttack", "tack.l.short"],
932
+ ["Dashv", "tack.l.double"],
933
+ ["bigbot", "tack.t.big"],
934
+ ["Vbar", "tack.t.double"],
935
+ ["shortuptack", "tack.t.short"],
936
+ ["bigtop", "tack.b.big"],
937
+ ["barV", "tack.b.double"],
938
+ ["shortdowntack", "tack.b.short"],
939
+ ["dashVdash", "tack.l.r"],
940
+ ["mupalpha", "alpha"],
941
+ ["mupbeta", "beta"],
942
+ ["mupchi", "chi"],
943
+ ["mupdelta", "delta"],
944
+ ["mupvarepsilon", "epsilon"],
945
+ ["mupepsilon", "epsilon.alt"],
946
+ ["mupeta", "eta"],
947
+ ["mupgamma", "gamma"],
948
+ ["mupiota", "iota"],
949
+ ["mupkappa", "kappa"],
950
+ ["mupvarkappa", "kappa.alt"],
951
+ ["muplambda", "lambda"],
952
+ ["mupmu", "mu"],
953
+ ["mupnu", "nu"],
954
+ ["mho", "ohm.inv"],
955
+ ["mupomega", "omega"],
956
+ ["mupomicron", "omicron"],
957
+ ["mupvarphi", "phi"],
958
+ ["mupphi", "phi.alt"],
959
+ ["muppi", "pi"],
960
+ ["mupvarpi", "pi.alt"],
961
+ ["muppsi", "psi"],
962
+ ["muprho", "rho"],
963
+ ["mupvarrho", "rho.alt"],
964
+ ["mupsigma", "sigma"],
965
+ ["mupvarsigma", "sigma.alt"],
966
+ ["muptau", "tau"],
967
+ ["muptheta", "theta"],
968
+ ["mupvartheta", "theta.alt"],
969
+ ["mupupsilon", "upsilon"],
970
+ ["mupxi", "xi"],
971
+ ["mupzeta", "zeta"],
972
+ ["mupAlpha", "Alpha"],
973
+ ["mupBeta", "Beta"],
974
+ ["mupChi", "Chi"],
975
+ ["mupDelta", "Delta"],
976
+ ["mupEpsilon", "Epsilon"],
977
+ ["mupEta", "Eta"],
978
+ ["mupGamma", "Gamma"],
979
+ ["mupIota", "Iota"],
980
+ ["mupKappa", "Kappa"],
981
+ ["mupLambda", "Lambda"],
982
+ ["mupMu", "Mu"],
983
+ ["mupNu", "Nu"],
984
+ ["mupOmega", "Omega"],
985
+ ["mupOmicron", "Omicron"],
986
+ ["mupPhi", "Phi"],
987
+ ["mupPi", "Pi"],
988
+ ["mupPsi", "Psi"],
989
+ ["mupRho", "Rho"],
990
+ ["mupSigma", "Sigma"],
991
+ ["mupTau", "Tau"],
992
+ ["mupTheta", "Theta"],
993
+ ["mupUpsilon", "Upsilon"],
994
+ ["mupXi", "Xi"],
995
+ ["mupZeta", "Zeta"],
996
+ ["BbbA", "AA"],
997
+ ["BbbB", "BB"],
998
+ ["BbbC", "CC"],
999
+ ["BbbD", "DD"],
1000
+ ["BbbE", "EE"],
1001
+ ["BbbF", "FF"],
1002
+ ["BbbG", "GG"],
1003
+ ["BbbH", "HH"],
1004
+ ["BbbI", "II"],
1005
+ ["BbbJ", "JJ"],
1006
+ ["BbbK", "KK"],
1007
+ ["BbbL", "LL"],
1008
+ ["BbbM", "MM"],
1009
+ ["BbbN", "NN"],
1010
+ ["BbbO", "OO"],
1011
+ ["BbbP", "PP"],
1012
+ ["BbbQ", "QQ"],
1013
+ ["BbbR", "RR"],
1014
+ ["BbbS", "SS"],
1015
+ ["BbbT", "TT"],
1016
+ ["BbbU", "UU"],
1017
+ ["BbbV", "VV"],
1018
+ ["BbbW", "WW"],
1019
+ ["BbbX", "XX"],
1020
+ ["BbbY", "YY"],
1021
+ ["BbbZ", "ZZ"],
1022
+ ["ell", "ell"],
1023
+ ["Planckconst", "planck"],
1024
+ ["hslash", "planck.reduce"],
1025
+ ["Angstrom", "angstrom"],
1026
+ ["Re", "Re"],
1027
+ ["Im", "Im"],
1028
+ ["imath", "dotless.i"],
1029
+ ["jmath", "dotless.j"]
1030
+ ]);
1031
+ for (const [key, value] of map_from_official_docs) {
1032
+ if (!symbolMap.has(key)) {
1033
+ symbolMap.set(key, value);
1034
+ }
1035
+ }
300
1036
 
301
1037
  // src/parser.ts
302
1038
  function assert(condition, message = "") {
@@ -314,16 +1050,16 @@ function get_command_param_num(command) {
314
1050
  }
315
1051
  }
316
1052
  function find_closing_curly_bracket(tokens, start) {
317
- assert(token_eq(tokens[start], LEFT_CURLY_BRACKET));
1053
+ assert(tokens[start].eq(LEFT_CURLY_BRACKET));
318
1054
  let count = 1;
319
1055
  let pos = start + 1;
320
1056
  while (count > 0) {
321
1057
  if (pos >= tokens.length) {
322
1058
  throw new LatexParserError("Unmatched curly brackets");
323
1059
  }
324
- if (token_eq(tokens[pos], LEFT_CURLY_BRACKET)) {
1060
+ if (tokens[pos].eq(LEFT_CURLY_BRACKET)) {
325
1061
  count += 1;
326
- } else if (token_eq(tokens[pos], RIGHT_CURLY_BRACKET)) {
1062
+ } else if (tokens[pos].eq(RIGHT_CURLY_BRACKET)) {
327
1063
  count -= 1;
328
1064
  }
329
1065
  pos += 1;
@@ -331,16 +1067,16 @@ function find_closing_curly_bracket(tokens, start) {
331
1067
  return pos - 1;
332
1068
  }
333
1069
  function find_closing_square_bracket(tokens, start) {
334
- assert(token_eq(tokens[start], LEFT_SQUARE_BRACKET));
1070
+ assert(tokens[start].eq(LEFT_SQUARE_BRACKET));
335
1071
  let count = 1;
336
1072
  let pos = start + 1;
337
1073
  while (count > 0) {
338
1074
  if (pos >= tokens.length) {
339
1075
  throw new LatexParserError("Unmatched square brackets");
340
1076
  }
341
- if (token_eq(tokens[pos], LEFT_SQUARE_BRACKET)) {
1077
+ if (tokens[pos].eq(LEFT_SQUARE_BRACKET)) {
342
1078
  count += 1;
343
- } else if (token_eq(tokens[pos], RIGHT_SQUARE_BRACKET)) {
1079
+ } else if (tokens[pos].eq(RIGHT_SQUARE_BRACKET)) {
344
1080
  count -= 1;
345
1081
  }
346
1082
  pos += 1;
@@ -372,7 +1108,7 @@ function eat_parenthesis(tokens, start) {
372
1108
  }
373
1109
  function eat_primes(tokens, start) {
374
1110
  let pos = start;
375
- while (pos < tokens.length && token_eq(tokens[pos], { type: 0 /* ELEMENT */, value: "'" })) {
1111
+ while (pos < tokens.length && tokens[pos].eq(new Token(0 /* ELEMENT */, "'"))) {
376
1112
  pos += 1;
377
1113
  }
378
1114
  return pos - start;
@@ -391,9 +1127,9 @@ function find_closing_right_command(tokens, start) {
391
1127
  if (pos >= tokens.length) {
392
1128
  return -1;
393
1129
  }
394
- if (token_eq(tokens[pos], LEFT_COMMAND)) {
1130
+ if (tokens[pos].eq(LEFT_COMMAND)) {
395
1131
  count += 1;
396
- } else if (token_eq(tokens[pos], RIGHT_COMMAND)) {
1132
+ } else if (tokens[pos].eq(RIGHT_COMMAND)) {
397
1133
  count -= 1;
398
1134
  }
399
1135
  pos += 1;
@@ -407,9 +1143,9 @@ function find_closing_end_command(tokens, start) {
407
1143
  if (pos >= tokens.length) {
408
1144
  return -1;
409
1145
  }
410
- if (token_eq(tokens[pos], BEGIN_COMMAND)) {
1146
+ if (tokens[pos].eq(BEGIN_COMMAND)) {
411
1147
  count += 1;
412
- } else if (token_eq(tokens[pos], END_COMMAND)) {
1148
+ } else if (tokens[pos].eq(END_COMMAND)) {
413
1149
  count -= 1;
414
1150
  }
415
1151
  pos += 1;
@@ -449,7 +1185,7 @@ function tokenize(latex) {
449
1185
  while (newPos < latex.length && latex[newPos] !== "\n") {
450
1186
  newPos += 1;
451
1187
  }
452
- token = { type: 3 /* COMMENT */, value: latex.slice(pos + 1, newPos) };
1188
+ token = new Token(3 /* COMMENT */, latex.slice(pos + 1, newPos));
453
1189
  pos = newPos;
454
1190
  break;
455
1191
  }
@@ -458,19 +1194,19 @@ function tokenize(latex) {
458
1194
  case "_":
459
1195
  case "^":
460
1196
  case "&":
461
- token = { type: 6 /* CONTROL */, value: firstChar };
1197
+ token = new Token(6 /* CONTROL */, firstChar);
462
1198
  pos++;
463
1199
  break;
464
1200
  case "\n":
465
- token = { type: 5 /* NEWLINE */, value: firstChar };
1201
+ token = new Token(5 /* NEWLINE */, firstChar);
466
1202
  pos++;
467
1203
  break;
468
1204
  case "\r": {
469
1205
  if (pos + 1 < latex.length && latex[pos + 1] === "\n") {
470
- token = { type: 5 /* NEWLINE */, value: "\n" };
1206
+ token = new Token(5 /* NEWLINE */, "\n");
471
1207
  pos += 2;
472
1208
  } else {
473
- token = { type: 5 /* NEWLINE */, value: "\n" };
1209
+ token = new Token(5 /* NEWLINE */, "\n");
474
1210
  pos++;
475
1211
  }
476
1212
  break;
@@ -480,7 +1216,7 @@ function tokenize(latex) {
480
1216
  while (newPos < latex.length && latex[newPos] === " ") {
481
1217
  newPos += 1;
482
1218
  }
483
- token = { type: 4 /* WHITESPACE */, value: latex.slice(pos, newPos) };
1219
+ token = new Token(4 /* WHITESPACE */, latex.slice(pos, newPos));
484
1220
  pos = newPos;
485
1221
  break;
486
1222
  }
@@ -490,12 +1226,12 @@ function tokenize(latex) {
490
1226
  }
491
1227
  const firstTwoChars = latex.slice(pos, pos + 2);
492
1228
  if (["\\\\", "\\,"].includes(firstTwoChars)) {
493
- token = { type: 6 /* CONTROL */, value: firstTwoChars };
1229
+ token = new Token(6 /* CONTROL */, firstTwoChars);
494
1230
  } else if (["\\{", "\\}", "\\%", "\\$", "\\&", "\\#", "\\_"].includes(firstTwoChars)) {
495
- token = { type: 0 /* ELEMENT */, value: firstTwoChars };
1231
+ token = new Token(0 /* ELEMENT */, firstTwoChars);
496
1232
  } else {
497
1233
  const command = eat_command_name(latex, pos + 1);
498
- token = { type: 1 /* COMMAND */, value: "\\" + command };
1234
+ token = new Token(1 /* COMMAND */, "\\" + command);
499
1235
  }
500
1236
  pos += token.value.length;
501
1237
  break;
@@ -506,13 +1242,13 @@ function tokenize(latex) {
506
1242
  while (newPos < latex.length && isdigit(latex[newPos])) {
507
1243
  newPos += 1;
508
1244
  }
509
- token = { type: 0 /* ELEMENT */, value: latex.slice(pos, newPos) };
1245
+ token = new Token(0 /* ELEMENT */, latex.slice(pos, newPos));
510
1246
  } else if (isalpha(firstChar)) {
511
- token = { type: 0 /* ELEMENT */, value: firstChar };
1247
+ token = new Token(0 /* ELEMENT */, firstChar);
512
1248
  } else if ("+-*/=\'<>!.,;?()[]|".includes(firstChar)) {
513
- token = { type: 0 /* ELEMENT */, value: firstChar };
1249
+ token = new Token(0 /* ELEMENT */, firstChar);
514
1250
  } else {
515
- token = { type: 7 /* UNKNOWN */, value: firstChar };
1251
+ token = new Token(7 /* UNKNOWN */, firstChar);
516
1252
  }
517
1253
  pos += token.value.length;
518
1254
  }
@@ -522,7 +1258,7 @@ function tokenize(latex) {
522
1258
  if (pos >= latex.length || latex[pos] !== "{") {
523
1259
  throw new LatexParserError(`No content for ${token.value} command`);
524
1260
  }
525
- tokens.push({ type: 6 /* CONTROL */, value: "{" });
1261
+ tokens.push(new Token(6 /* CONTROL */, "{"));
526
1262
  const posClosingBracket = find_closing_curly_bracket_char(latex, pos);
527
1263
  pos++;
528
1264
  let textInside = latex.slice(pos, posClosingBracket);
@@ -530,18 +1266,15 @@ function tokenize(latex) {
530
1266
  for (const char of chars) {
531
1267
  textInside = textInside.replaceAll("\\" + char, char);
532
1268
  }
533
- tokens.push({ type: 2 /* TEXT */, value: textInside });
534
- tokens.push({ type: 6 /* CONTROL */, value: "}" });
1269
+ tokens.push(new Token(2 /* TEXT */, textInside));
1270
+ tokens.push(new Token(6 /* CONTROL */, "}"));
535
1271
  pos = posClosingBracket + 1;
536
1272
  }
537
1273
  }
538
1274
  return tokens;
539
1275
  }
540
- function token_eq(token1, token2) {
541
- return token1.type == token2.type && token1.value == token2.value;
542
- }
543
1276
  function passIgnoreWhitespaceBeforeScriptMark(tokens) {
544
- const is_script_mark = (token) => token_eq(token, SUB_SYMBOL) || token_eq(token, SUP_SYMBOL);
1277
+ const is_script_mark = (token) => token.eq(SUB_SYMBOL) || token.eq(SUP_SYMBOL);
545
1278
  let out_tokens = [];
546
1279
  for (let i = 0;i < tokens.length; i++) {
547
1280
  if (tokens[i].type === 4 /* WHITESPACE */ && i + 1 < tokens.length && is_script_mark(tokens[i + 1])) {
@@ -611,15 +1344,27 @@ var BINARY_COMMANDS = [
611
1344
  "dfrac",
612
1345
  "tbinom"
613
1346
  ];
1347
+
1348
+ class Token {
1349
+ type;
1350
+ value;
1351
+ constructor(type, value) {
1352
+ this.type = type;
1353
+ this.value = value;
1354
+ }
1355
+ eq(token) {
1356
+ return this.type === token.type && this.value === token.value;
1357
+ }
1358
+ }
614
1359
  var EMPTY_NODE = { type: "empty", content: "" };
615
- var LEFT_CURLY_BRACKET = { type: 6 /* CONTROL */, value: "{" };
616
- var RIGHT_CURLY_BRACKET = { type: 6 /* CONTROL */, value: "}" };
617
- var LEFT_SQUARE_BRACKET = { type: 0 /* ELEMENT */, value: "[" };
618
- var RIGHT_SQUARE_BRACKET = { type: 0 /* ELEMENT */, value: "]" };
619
- var LEFT_COMMAND = { type: 1 /* COMMAND */, value: "\\left" };
620
- var RIGHT_COMMAND = { type: 1 /* COMMAND */, value: "\\right" };
621
- var BEGIN_COMMAND = { type: 1 /* COMMAND */, value: "\\begin" };
622
- var END_COMMAND = { type: 1 /* COMMAND */, value: "\\end" };
1360
+ var LEFT_CURLY_BRACKET = new Token(6 /* CONTROL */, "{");
1361
+ var RIGHT_CURLY_BRACKET = new Token(6 /* CONTROL */, "}");
1362
+ var LEFT_SQUARE_BRACKET = new Token(0 /* ELEMENT */, "[");
1363
+ var RIGHT_SQUARE_BRACKET = new Token(0 /* ELEMENT */, "]");
1364
+ var LEFT_COMMAND = new Token(1 /* COMMAND */, "\\left");
1365
+ var RIGHT_COMMAND = new Token(1 /* COMMAND */, "\\right");
1366
+ var BEGIN_COMMAND = new Token(1 /* COMMAND */, "\\begin");
1367
+ var END_COMMAND = new Token(1 /* COMMAND */, "\\end");
623
1368
 
624
1369
  class LatexParserError extends Error {
625
1370
  constructor(message) {
@@ -627,8 +1372,8 @@ class LatexParserError extends Error {
627
1372
  this.name = "LatexParserError";
628
1373
  }
629
1374
  }
630
- var SUB_SYMBOL = { type: 6 /* CONTROL */, value: "_" };
631
- var SUP_SYMBOL = { type: 6 /* CONTROL */, value: "^" };
1375
+ var SUB_SYMBOL = new Token(6 /* CONTROL */, "_");
1376
+ var SUP_SYMBOL = new Token(6 /* CONTROL */, "^");
632
1377
 
633
1378
  class LatexParser {
634
1379
  space_sensitive;
@@ -680,22 +1425,22 @@ class LatexParser {
680
1425
  let num_prime = 0;
681
1426
  num_prime += eat_primes(tokens, pos);
682
1427
  pos += num_prime;
683
- if (pos < tokens.length && token_eq(tokens[pos], SUB_SYMBOL)) {
1428
+ if (pos < tokens.length && tokens[pos].eq(SUB_SYMBOL)) {
684
1429
  [sub, pos] = this.parseNextExprWithoutSupSub(tokens, pos + 1);
685
1430
  num_prime += eat_primes(tokens, pos);
686
1431
  pos += num_prime;
687
- if (pos < tokens.length && token_eq(tokens[pos], SUP_SYMBOL)) {
1432
+ if (pos < tokens.length && tokens[pos].eq(SUP_SYMBOL)) {
688
1433
  [sup, pos] = this.parseNextExprWithoutSupSub(tokens, pos + 1);
689
1434
  if (eat_primes(tokens, pos) > 0) {
690
1435
  throw new LatexParserError("Double superscript");
691
1436
  }
692
1437
  }
693
- } else if (pos < tokens.length && token_eq(tokens[pos], SUP_SYMBOL)) {
1438
+ } else if (pos < tokens.length && tokens[pos].eq(SUP_SYMBOL)) {
694
1439
  [sup, pos] = this.parseNextExprWithoutSupSub(tokens, pos + 1);
695
1440
  if (eat_primes(tokens, pos) > 0) {
696
1441
  throw new LatexParserError("Double superscript");
697
1442
  }
698
- if (pos < tokens.length && token_eq(tokens[pos], SUB_SYMBOL)) {
1443
+ if (pos < tokens.length && tokens[pos].eq(SUB_SYMBOL)) {
699
1444
  [sub, pos] = this.parseNextExprWithoutSupSub(tokens, pos + 1);
700
1445
  if (eat_primes(tokens, pos) > 0) {
701
1446
  throw new LatexParserError("Double superscript");
@@ -741,9 +1486,9 @@ class LatexParser {
741
1486
  case 5 /* NEWLINE */:
742
1487
  return [{ type: "newline", content: firstToken.value }, start + 1];
743
1488
  case 1 /* COMMAND */:
744
- if (token_eq(firstToken, BEGIN_COMMAND)) {
1489
+ if (firstToken.eq(BEGIN_COMMAND)) {
745
1490
  return this.parseBeginEndExpr(tokens, start);
746
- } else if (token_eq(firstToken, LEFT_COMMAND)) {
1491
+ } else if (firstToken.eq(LEFT_COMMAND)) {
747
1492
  return this.parseLeftRightExpr(tokens, start);
748
1493
  } else {
749
1494
  return this.parseCommandExpr(tokens, start);
@@ -791,7 +1536,7 @@ class LatexParser {
791
1536
  }
792
1537
  return [{ type: "symbol", content: command }, pos];
793
1538
  case 1: {
794
- if (command === "\\sqrt" && pos < tokens.length && token_eq(tokens[pos], LEFT_SQUARE_BRACKET)) {
1539
+ if (command === "\\sqrt" && pos < tokens.length && tokens[pos].eq(LEFT_SQUARE_BRACKET)) {
795
1540
  const posLeftSquareBracket = pos;
796
1541
  const posRightSquareBracket = find_closing_square_bracket(tokens, pos);
797
1542
  const exprInside = tokens.slice(posLeftSquareBracket + 1, posRightSquareBracket);
@@ -802,9 +1547,9 @@ class LatexParser {
802
1547
  if (pos + 2 >= tokens.length) {
803
1548
  throw new LatexParserError("Expecting content for \\text command");
804
1549
  }
805
- assert(token_eq(tokens[pos], LEFT_CURLY_BRACKET));
1550
+ assert(tokens[pos].eq(LEFT_CURLY_BRACKET));
806
1551
  assert(tokens[pos + 1].type === 2 /* TEXT */);
807
- assert(token_eq(tokens[pos + 2], RIGHT_CURLY_BRACKET));
1552
+ assert(tokens[pos + 2].eq(RIGHT_CURLY_BRACKET));
808
1553
  const text = tokens[pos + 1].value;
809
1554
  return [{ type: "text", content: text }, pos + 3];
810
1555
  }
@@ -821,7 +1566,7 @@ class LatexParser {
821
1566
  }
822
1567
  }
823
1568
  parseLeftRightExpr(tokens, start) {
824
- assert(token_eq(tokens[start], LEFT_COMMAND));
1569
+ assert(tokens[start].eq(LEFT_COMMAND));
825
1570
  let pos = start + 1;
826
1571
  pos += eat_whitespaces(tokens, pos).length;
827
1572
  if (pos >= tokens.length) {
@@ -859,11 +1604,11 @@ class LatexParser {
859
1604
  return [res, pos];
860
1605
  }
861
1606
  parseBeginEndExpr(tokens, start) {
862
- assert(token_eq(tokens[start], BEGIN_COMMAND));
1607
+ assert(tokens[start].eq(BEGIN_COMMAND));
863
1608
  let pos = start + 1;
864
- assert(token_eq(tokens[pos], LEFT_CURLY_BRACKET));
1609
+ assert(tokens[pos].eq(LEFT_CURLY_BRACKET));
865
1610
  assert(tokens[pos + 1].type === 2 /* TEXT */);
866
- assert(token_eq(tokens[pos + 2], RIGHT_CURLY_BRACKET));
1611
+ assert(tokens[pos + 2].eq(RIGHT_CURLY_BRACKET));
867
1612
  const envName = tokens[pos + 1].value;
868
1613
  pos += 3;
869
1614
  pos += eat_whitespaces(tokens, pos).length;
@@ -874,9 +1619,9 @@ class LatexParser {
874
1619
  }
875
1620
  const exprInsideEnd = endIdx;
876
1621
  pos = endIdx + 1;
877
- assert(token_eq(tokens[pos], LEFT_CURLY_BRACKET));
1622
+ assert(tokens[pos].eq(LEFT_CURLY_BRACKET));
878
1623
  assert(tokens[pos + 1].type === 2 /* TEXT */);
879
- assert(token_eq(tokens[pos + 2], RIGHT_CURLY_BRACKET));
1624
+ assert(tokens[pos + 2].eq(RIGHT_CURLY_BRACKET));
880
1625
  if (tokens[pos + 1].value !== envName) {
881
1626
  throw new LatexParserError("Mismatched \\begin and \\end environments");
882
1627
  }
@@ -982,7 +1727,14 @@ function convertTree(node) {
982
1727
  content: "",
983
1728
  args: node.args.map(convertTree)
984
1729
  };
985
- if (["[]", "()", "\\{\\}", "\\lfloor\\rfloor", "\\lceil\\rceil"].includes(left.content + right.content)) {
1730
+ if ([
1731
+ "[]",
1732
+ "()",
1733
+ "\\{\\}",
1734
+ "\\lfloor\\rfloor",
1735
+ "\\lceil\\rceil",
1736
+ "\\lfloor\\rceil"
1737
+ ].includes(left.content + right.content)) {
986
1738
  return group;
987
1739
  }
988
1740
  return {
@@ -1324,17 +2076,24 @@ class TypstWriter {
1324
2076
  finalize() {
1325
2077
  this.flushQueue();
1326
2078
  const smartFloorPass = function(input) {
1327
- let res = input.replace(/⌊\s*(.*?)\s*⌋/g, "floor($1)");
2079
+ let res = input.replace(/floor\.l\s*(.*?)\s*floor\.r/g, "floor($1)");
1328
2080
  res = res.replace(/floor\(\)/g, 'floor("")');
1329
2081
  return res;
1330
2082
  };
1331
2083
  const smartCeilPass = function(input) {
1332
- let res = input.replace(/⌈\s*(.*?)\s*⌉/g, "ceil($1)");
2084
+ let res = input.replace(/ceil\.l\s*(.*?)\s*ceil\.r/g, "ceil($1)");
1333
2085
  res = res.replace(/ceil\(\)/g, 'ceil("")');
1334
2086
  return res;
1335
2087
  };
1336
- this.buffer = smartFloorPass(this.buffer);
1337
- this.buffer = smartCeilPass(this.buffer);
2088
+ const smartRoundPass = function(input) {
2089
+ let res = input.replace(/floor\.l\s*(.*?)\s*ceil\.r/g, "round($1)");
2090
+ res = res.replace(/round\(\)/g, 'round("")');
2091
+ return res;
2092
+ };
2093
+ const all_passes = [smartFloorPass, smartCeilPass, smartRoundPass];
2094
+ for (const pass of all_passes) {
2095
+ this.buffer = pass(this.buffer);
2096
+ }
1338
2097
  return this.buffer;
1339
2098
  }
1340
2099
  }