tex2typst 0.4.1 → 0.5.1

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
@@ -626,7 +626,8 @@ var rules_map = /* @__PURE__ */ new Map([
626
626
  ],
627
627
  [String.raw`%[^\n]*`, (s) => new TexToken(4 /* COMMENT */, s.text().substring(1))],
628
628
  [String.raw`[{}_^&]`, (s) => new TexToken(7 /* CONTROL */, s.text())],
629
- [String.raw`\\[\\,:;! ]`, (s) => new TexToken(7 /* CONTROL */, s.text())],
629
+ [String.raw`\\[\\,:;!> ]`, (s) => new TexToken(7 /* CONTROL */, s.text())],
630
+ [String.raw`~`, (s) => new TexToken(7 /* CONTROL */, s.text())],
630
631
  [String.raw`\r?\n`, (_s) => new TexToken(6 /* NEWLINE */, "\n")],
631
632
  [String.raw`\s+`, (s) => new TexToken(5 /* SPACE */, s.text())],
632
633
  [String.raw`\\[{}%$&#_|]`, (s) => new TexToken(1 /* ELEMENT */, s.text())],
@@ -763,19 +764,7 @@ var LatexParser = class {
763
764
  this.newline_sensitive = newline_sensitive;
764
765
  }
765
766
  parse(tokens) {
766
- const token_displaystyle = new TexToken(2 /* COMMAND */, "\\displaystyle");
767
- const idx = array_find(tokens, token_displaystyle);
768
- if (idx === -1) {
769
- return this.parseGroup(tokens.slice(0));
770
- } else if (idx === 0) {
771
- const tree = this.parseGroup(tokens.slice(1));
772
- return new TexFuncCall(token_displaystyle, [tree]);
773
- } else {
774
- const tree1 = this.parseGroup(tokens.slice(0, idx));
775
- const tree2 = this.parseGroup(tokens.slice(idx + 1, tokens.length));
776
- const display = new TexFuncCall(token_displaystyle, [tree2]);
777
- return new TexGroup([tree1, display]);
778
- }
767
+ return this.parseGroup(tokens.slice(0));
779
768
  }
780
769
  parseGroup(tokens) {
781
770
  const [tree, _] = this.parseClosure(tokens, 0, null);
@@ -805,11 +794,12 @@ var LatexParser = class {
805
794
  if (pos >= tokens.length && closingToken !== null) {
806
795
  return [EMPTY_NODE, -1];
807
796
  }
797
+ const styledResults = this.applyStyleCommands(results);
808
798
  let node;
809
- if (results.length === 1) {
810
- node = results[0];
799
+ if (styledResults.length === 1) {
800
+ node = styledResults[0];
811
801
  } else {
812
- node = new TexGroup(results);
802
+ node = new TexGroup(styledResults);
813
803
  }
814
804
  return [node, pos + 1];
815
805
  }
@@ -824,8 +814,9 @@ var LatexParser = class {
824
814
  const next_token = tokens[pos];
825
815
  if (next_token.eq(SUB_SYMBOL)) {
826
816
  [sub, pos] = this.parseNextExprWithoutSupSub(tokens, pos + 1);
827
- num_prime += eat_primes(tokens, pos);
828
- pos += num_prime;
817
+ const new_primes = eat_primes(tokens, pos);
818
+ num_prime += new_primes;
819
+ pos += new_primes;
829
820
  if (pos < tokens.length && tokens[pos].eq(SUP_SYMBOL)) {
830
821
  [sup, pos] = this.parseNextExprWithoutSupSub(tokens, pos + 1);
831
822
  if (eat_primes(tokens, pos) > 0) {
@@ -911,8 +902,10 @@ var LatexParser = class {
911
902
  case "\\,":
912
903
  case "\\:":
913
904
  case "\\;":
905
+ case "\\>":
914
906
  return [firstToken.toNode(), start + 1];
915
907
  case "\\ ":
908
+ case "~":
916
909
  return [firstToken.toNode(), start + 1];
917
910
  case "_":
918
911
  case "^":
@@ -1087,6 +1080,34 @@ var LatexParser = class {
1087
1080
  this.alignmentDepth--;
1088
1081
  return [allRows, pos];
1089
1082
  }
1083
+ applyStyleCommands(nodes) {
1084
+ for (let i = 0; i < nodes.length; i++) {
1085
+ const styleToken = this.getStyleToken(nodes[i]);
1086
+ if (styleToken) {
1087
+ const before = this.applyStyleCommands(nodes.slice(0, i));
1088
+ const after = this.applyStyleCommands(nodes.slice(i + 1));
1089
+ let body;
1090
+ if (after.length === 0) {
1091
+ body = EMPTY_NODE;
1092
+ } else if (after.length === 1) {
1093
+ body = after[0];
1094
+ } else {
1095
+ body = new TexGroup(after);
1096
+ }
1097
+ const funcCall = new TexFuncCall(styleToken, [body]);
1098
+ return before.concat(funcCall);
1099
+ }
1100
+ }
1101
+ return nodes;
1102
+ }
1103
+ getStyleToken(node) {
1104
+ if (node.type === "terminal") {
1105
+ if (node.head.eq(TexToken.COMMAND_DISPLAYSTYLE) || node.head.eq(TexToken.COMMAND_TEXTSTYLE)) {
1106
+ return node.head;
1107
+ }
1108
+ }
1109
+ return null;
1110
+ }
1090
1111
  };
1091
1112
  function passIgnoreWhitespaceBeforeScriptMark(tokens) {
1092
1113
  const is_script_mark = (token) => token.eq(SUB_SYMBOL) || token.eq(SUP_SYMBOL);
@@ -1124,6 +1145,7 @@ function parseTex(tex, customTexMacros = {}) {
1124
1145
 
1125
1146
  // src/typst-shorthands.ts
1126
1147
  var shorthandMap = /* @__PURE__ */ new Map([
1148
+ // The following snippet is generated with tools/make-short-hand-map.py
1127
1149
  ["arrow.l.r.double.long", "<==>"],
1128
1150
  ["arrow.l.r.long", "<-->"],
1129
1151
  ["arrow.r.bar", "|->"],
@@ -1138,7 +1160,6 @@ var shorthandMap = /* @__PURE__ */ new Map([
1138
1160
  ["arrow.l.long.squiggly", "<~~"],
1139
1161
  ["arrow.l.tail", "<-<"],
1140
1162
  ["arrow.l.twohead", "<<-"],
1141
- ["arrow.l.r", "<->"],
1142
1163
  ["arrow.l.r.double", "<=>"],
1143
1164
  ["colon.double.eq", "::="],
1144
1165
  ["dots.h", "..."],
@@ -1150,8 +1171,8 @@ var shorthandMap = /* @__PURE__ */ new Map([
1150
1171
  ["arrow.l", "<-"],
1151
1172
  ["arrow.l.squiggly", "<~"],
1152
1173
  ["bar.v.double", "||"],
1153
- ["bracket.l.double", "[|"],
1154
- ["bracket.r.double", "|]"],
1174
+ ["bracket.l.stroked", "[|"],
1175
+ ["bracket.r.stroked", "|]"],
1155
1176
  ["colon.eq", ":="],
1156
1177
  ["eq.colon", "=:"],
1157
1178
  ["eq.not", "!="],
@@ -1161,7 +1182,9 @@ var shorthandMap = /* @__PURE__ */ new Map([
1161
1182
  ["lt.eq", "<="],
1162
1183
  ["ast.op", "*"],
1163
1184
  ["minus", "-"],
1164
- ["tilde.op", "~"]
1185
+ ["tilde.op", "~"],
1186
+ // Typst's documentation doesn't include this. Wondering why
1187
+ ["arrow.l.r", "<->"]
1165
1188
  ]);
1166
1189
  var reverseShorthandMap = /* @__PURE__ */ new Map();
1167
1190
  for (const [key, value] of shorthandMap.entries()) {
@@ -1206,7 +1229,7 @@ var TypstToken = class _TypstToken {
1206
1229
  new _TypstToken(2 /* ELEMENT */, "["),
1207
1230
  new _TypstToken(2 /* ELEMENT */, "{"),
1208
1231
  new _TypstToken(2 /* ELEMENT */, "|"),
1209
- new _TypstToken(1 /* SYMBOL */, "angle.l"),
1232
+ new _TypstToken(1 /* SYMBOL */, "chevron.l"),
1210
1233
  new _TypstToken(1 /* SYMBOL */, "paren.l"),
1211
1234
  new _TypstToken(1 /* SYMBOL */, "brace.l")
1212
1235
  ];
@@ -1215,7 +1238,7 @@ var TypstToken = class _TypstToken {
1215
1238
  new _TypstToken(2 /* ELEMENT */, "]"),
1216
1239
  new _TypstToken(2 /* ELEMENT */, "}"),
1217
1240
  new _TypstToken(2 /* ELEMENT */, "|"),
1218
- new _TypstToken(1 /* SYMBOL */, "angle.r"),
1241
+ new _TypstToken(1 /* SYMBOL */, "chevron.r"),
1219
1242
  new _TypstToken(1 /* SYMBOL */, "paren.r"),
1220
1243
  new _TypstToken(1 /* SYMBOL */, "brace.r")
1221
1244
  ];
@@ -1643,6 +1666,22 @@ var symbolMap = /* @__PURE__ */ new Map([
1643
1666
  [":", "med"],
1644
1667
  [" ", "med"],
1645
1668
  [";", "thick"],
1669
+ [">", "med"],
1670
+ ["~", "space.nobreak"],
1671
+ ["blacktriangleleft", "triangle.filled.l"],
1672
+ ["blacktriangleright", "triangle.filled.r"],
1673
+ ["clubsuit", "suit.club.filled"],
1674
+ ["hookleftarrow", "arrow.l.hook"],
1675
+ ["hookrightarrow", "arrow.r.hook"],
1676
+ ["leftrightarrow", "arrow.l.r"],
1677
+ ["lgblksquare", "square.filled.big"],
1678
+ ["lgwhtsquare", "square.stroked.big"],
1679
+ ["nearrow", "arrow.tr"],
1680
+ ["nwarrow", "arrow.tl"],
1681
+ ["searrow", "arrow.br"],
1682
+ ["swarrow", "arrow.bl"],
1683
+ ["spadesuit", "suit.spade.filled"],
1684
+ ["updownarrow", "arrow.t.b"],
1646
1685
  /* textual operators */
1647
1686
  ["ln", "ln"],
1648
1687
  ["log", "log"],
@@ -1677,13 +1716,9 @@ var symbolMap = /* @__PURE__ */ new Map([
1677
1716
  ["quad", "quad"],
1678
1717
  ["qquad", "wide"],
1679
1718
  ["overbrace", "overbrace"],
1680
- // same
1681
1719
  ["underbrace", "underbrace"],
1682
- // same
1683
1720
  ["overline", "overline"],
1684
- // same
1685
1721
  ["underline", "underline"],
1686
- // same
1687
1722
  ["bar", "macron"],
1688
1723
  ["dbinom", "binom"],
1689
1724
  ["tbinom", "binom"],
@@ -1759,7 +1794,7 @@ var symbolMap = /* @__PURE__ */ new Map([
1759
1794
  ["geq", "gt.eq"],
1760
1795
  ["geqslant", "gt.eq.slant"],
1761
1796
  ["gg", "gt.double"],
1762
- ["hbar", "planck.reduce"],
1797
+ ["hbar", "planck"],
1763
1798
  ["imath", "dotless.i"],
1764
1799
  ["iiiint", "integral.quad"],
1765
1800
  ["iiint", "integral.triple"],
@@ -1774,7 +1809,7 @@ var symbolMap = /* @__PURE__ */ new Map([
1774
1809
  ["kappa", "kappa"],
1775
1810
  ["lambda", "lambda"],
1776
1811
  ["land", "and"],
1777
- ["langle", "angle.l"],
1812
+ ["langle", "chevron.l"],
1778
1813
  ["lbrace", "brace.l"],
1779
1814
  ["lbrack", "bracket.l"],
1780
1815
  ["ldots", "dots.h"],
@@ -1836,7 +1871,7 @@ var symbolMap = /* @__PURE__ */ new Map([
1836
1871
  ["prod", "product"],
1837
1872
  ["propto", "prop"],
1838
1873
  ["psi", "psi"],
1839
- ["rangle", "angle.r"],
1874
+ ["rangle", "chevron.r"],
1840
1875
  ["rbrace", "brace.r"],
1841
1876
  ["rbrack", "bracket.r"],
1842
1877
  ["rhd", "triangle"],
@@ -1909,6 +1944,7 @@ var map_from_official_docs = /* @__PURE__ */ new Map([
1909
1944
  ["approxident", "tilde.triple"],
1910
1945
  ["assert", "tack.r.short"],
1911
1946
  ["ast", "ast.op"],
1947
+ ["astrosun", "sun"],
1912
1948
  ["asymp", "asymp"],
1913
1949
  ["awint", "integral.ccw"],
1914
1950
  ["backcong", "tilde.rev.equiv"],
@@ -1964,10 +2000,9 @@ var map_from_official_docs = /* @__PURE__ */ new Map([
1964
2000
  ["bigcup", "union.big"],
1965
2001
  ["bigcupdot", "union.dot.big"],
1966
2002
  ["biginterleave", "interleave.big"],
1967
- ["bigodot", "dot.circle.big"],
1968
- ["bigoplus", "plus.circle.big"],
1969
- // or 'xor.big'
1970
- ["bigotimes", "times.circle.big"],
2003
+ ["bigodot", "dot.o.big"],
2004
+ ["bigoplus", "plus.o.big"],
2005
+ ["bigotimes", "times.o.big"],
1971
2006
  ["bigsqcap", "inter.sq.big"],
1972
2007
  ["bigsqcup", "union.sq.big"],
1973
2008
  ["bigstar", "star.filled"],
@@ -1984,8 +2019,6 @@ var map_from_official_docs = /* @__PURE__ */ new Map([
1984
2019
  ["blackhourglass", "hourglass.filled"],
1985
2020
  ["blacktriangle", "triangle.filled.small.t"],
1986
2021
  ["blacktriangledown", "triangle.filled.small.b"],
1987
- ["blacktriangleleft", "triangle.filled.l"],
1988
- ["blacktriangleright", "triangle.filled.r"],
1989
2022
  ["blkhorzoval", "ellipse.filled.h"],
1990
2023
  ["blkvertoval", "ellipse.filled.v"],
1991
2024
  ["bot", "bot"],
@@ -2002,13 +2035,14 @@ var map_from_official_docs = /* @__PURE__ */ new Map([
2002
2035
  ["cdot", "dot.op"],
2003
2036
  ["cdotp", "dot.c"],
2004
2037
  ["checkmark", "checkmark"],
2005
- ["circledast", "ast.circle"],
2006
- ["circledcirc", "circle.nested"],
2007
- ["circleddash", "dash.circle"],
2008
- ["circledequal", "eq.circle"],
2009
- ["circledparallel", "parallel.circle"],
2010
- ["circledvert", "bar.v.circle"],
2011
- ["clubsuit", "suit.club.filled"],
2038
+ ["circledast", "ast.op.o"],
2039
+ ["circledbullet", "bullet.o"],
2040
+ ["circledcirc", "compose.o"],
2041
+ ["circleddash", "dash.o"],
2042
+ ["circledequal", "cc.nd"],
2043
+ ["circledparallel", "parallel.o"],
2044
+ ["circledvert", "bar.v.o"],
2045
+ ["circledwhitebullet", "bullet.stroked.o"],
2012
2046
  ["Colon", "colon.double"],
2013
2047
  ["coloneq", "colon.eq"],
2014
2048
  ["Coloneq", "colon.double.eq"],
@@ -2059,6 +2093,7 @@ var map_from_official_docs = /* @__PURE__ */ new Map([
2059
2093
  ["downarrow", "arrow.b"],
2060
2094
  ["Downarrow", "arrow.b.double"],
2061
2095
  ["downarrowbar", "arrow.b.stop"],
2096
+ ["downarrowbarred", "arrow.b.struck"],
2062
2097
  ["downdasharrow", "arrow.b.dashed"],
2063
2098
  ["downdownarrows", "arrows.bb"],
2064
2099
  ["downharpoonleft", "harpoon.bl"],
@@ -2066,7 +2101,6 @@ var map_from_official_docs = /* @__PURE__ */ new Map([
2066
2101
  ["downharpoonright", "harpoon.br"],
2067
2102
  ["downharpoonrightbar", "harpoon.br.stop"],
2068
2103
  ["downharpoonsleftright", "harpoons.blbr"],
2069
- ["downrightcurvedarrow", "arrow.b.curve"],
2070
2104
  ["downuparrows", "arrows.bt"],
2071
2105
  ["downupharpoonsleftright", "harpoons.bltr"],
2072
2106
  ["downwhitearrow", "arrow.b.stroked"],
@@ -2099,13 +2133,13 @@ var map_from_official_docs = /* @__PURE__ */ new Map([
2099
2133
  ["errbardiamond", "errorbar.diamond.stroked"],
2100
2134
  ["errbarsquare", "errorbar.square.stroked"],
2101
2135
  ["euro", "euro"],
2102
- ["Exclam", "excl.double"],
2103
2136
  ["exists", "exists"],
2104
2137
  ["fallingdotseq", "eq.dots.down"],
2105
2138
  ["fint", "integral.slash"],
2106
2139
  ["flat", "flat"],
2107
2140
  ["forall", "forall"],
2108
2141
  ["fourvdots", "fence.dotted"],
2142
+ ["frown", "frown"],
2109
2143
  ["fullouterjoin", "join.l.r"],
2110
2144
  ["geq", "gt.eq"],
2111
2145
  ["geqq", "gt.equiv"],
@@ -2129,14 +2163,11 @@ var map_from_official_docs = /* @__PURE__ */ new Map([
2129
2163
  ["hknwarrow", "arrow.tl.hook"],
2130
2164
  ["hksearrow", "arrow.br.hook"],
2131
2165
  ["hkswarrow", "arrow.bl.hook"],
2132
- ["hookleftarrow", "arrow.l.hook"],
2133
- ["hookrightarrow", "arrow.r.hook"],
2134
2166
  ["horizbar", "bar.h"],
2135
2167
  ["hourglass", "hourglass.stroked"],
2136
2168
  ["hrectangle", "rect.stroked.h"],
2137
2169
  ["hrectangleblack", "rect.filled.h"],
2138
- ["hslash", "planck.reduce"],
2139
- ["hzigzag", "dash.wave.double"],
2170
+ ["hyphenbullet", "bullet.hyph"],
2140
2171
  ["iiiint", "integral.quad"],
2141
2172
  ["iiint", "integral.triple"],
2142
2173
  ["iinfin", "infinity.incomplete"],
@@ -2155,23 +2186,29 @@ var map_from_official_docs = /* @__PURE__ */ new Map([
2155
2186
  ["interleave", "interleave"],
2156
2187
  ["intlarhk", "integral.arrow.hook"],
2157
2188
  ["intx", "integral.times"],
2189
+ ["inversebullet", "bullet.hole"],
2158
2190
  ["Join", "join"],
2159
- ["langle", "angle.l"],
2160
- ["lAngle", "angle.l.double"],
2161
- ["langledot", "angle.l.dot"],
2191
+ ["langle", "chevron.l"],
2192
+ ["lAngle", "chevron.l.double"],
2193
+ ["langledot", "chevron.l.dot"],
2162
2194
  ["lat", "lat"],
2163
2195
  ["late", "lat.eq"],
2196
+ ["lbag", "bag.l"],
2197
+ ["lblkbrbrak", "shell.l.filled"],
2164
2198
  ["lbrace", "brace.l"],
2165
- ["lBrace", "brace.l.double"],
2199
+ ["lBrace", "brace.l.stroked"],
2166
2200
  ["lbrack", "bracket.l"],
2167
- ["lBrack", "bracket.l.double"],
2201
+ ["lBrack", "bracket.l.stroked"],
2202
+ ["lbracklltick", "bracket.l.tick.b"],
2203
+ ["lbrackultick", "bracket.l.tick.t"],
2168
2204
  ["lbrbrak", "shell.l"],
2169
- ["Lbrbrak", "shell.l.double"],
2205
+ ["Lbrbrak", "shell.l.stroked"],
2170
2206
  ["lceil", "ceil.l"],
2171
- ["lcurvyangle", "angle.l.curly"],
2207
+ ["lcurvyangle", "chevron.l.curly"],
2172
2208
  ["leftarrow", "arrow.l"],
2173
2209
  ["Leftarrow", "arrow.l.double"],
2174
2210
  ["leftarrowtail", "arrow.l.tail"],
2211
+ ["leftarrowtriangle", "arrow.l.open"],
2175
2212
  ["leftdasharrow", "arrow.l.dashed"],
2176
2213
  ["leftdotarrow", "arrow.l.dotted"],
2177
2214
  ["leftdowncurvedarrow", "arrow.l.curve"],
@@ -2182,9 +2219,9 @@ var map_from_official_docs = /* @__PURE__ */ new Map([
2182
2219
  ["leftharpoonupbar", "harpoon.lt.bar"],
2183
2220
  ["leftleftarrows", "arrows.ll"],
2184
2221
  ["leftouterjoin", "join.l"],
2185
- ["leftrightarrow", "arrow.l.r"],
2186
2222
  ["Leftrightarrow", "arrow.l.r.double"],
2187
2223
  ["leftrightarrows", "arrows.lr"],
2224
+ ["leftrightarrowtriangle", "arrow.l.r.open"],
2188
2225
  ["leftrightharpoondowndown", "harpoon.lb.rb"],
2189
2226
  ["leftrightharpoondownup", "harpoon.lb.rt"],
2190
2227
  ["leftrightharpoons", "harpoons.ltrb"],
@@ -2209,16 +2246,19 @@ var map_from_official_docs = /* @__PURE__ */ new Map([
2209
2246
  ["lesssim", "lt.tilde"],
2210
2247
  ["lfloor", "floor.l"],
2211
2248
  ["lgblkcircle", "circle.filled.big"],
2212
- ["lgblksquare", "square.filled.big"],
2249
+ ["lgroup", "paren.l.flat"],
2213
2250
  ["lgwhtcircle", "circle.stroked.big"],
2214
- ["lgwhtsquare", "square.stroked.big"],
2215
2251
  ["ll", "lt.double"],
2252
+ ["llangle", "chevron.l.closed"],
2216
2253
  ["llblacktriangle", "triangle.filled.bl"],
2254
+ ["llcorner", "corner.l.b"],
2217
2255
  ["LLeftarrow", "arrow.l.quad"],
2218
2256
  ["Lleftarrow", "arrow.l.triple"],
2219
2257
  ["lll", "lt.triple"],
2220
2258
  ["lllnest", "lt.triple.nested"],
2259
+ ["llparenthesis", "paren.l.closed"],
2221
2260
  ["lltriangle", "triangle.stroked.bl"],
2261
+ ["lmoustache", "mustache.l"],
2222
2262
  ["lnapprox", "lt.napprox"],
2223
2263
  ["lneq", "lt.neq"],
2224
2264
  ["lneqq", "lt.nequiv"],
@@ -2239,8 +2279,9 @@ var map_from_official_docs = /* @__PURE__ */ new Map([
2239
2279
  ["looparrowleft", "arrow.l.loop"],
2240
2280
  ["looparrowright", "arrow.r.loop"],
2241
2281
  ["lparen", "paren.l"],
2242
- ["lParen", "paren.l.double"],
2282
+ ["lParen", "paren.l.stroked"],
2243
2283
  ["lrblacktriangle", "triangle.filled.br"],
2284
+ ["lrcorner", "corner.r.b"],
2244
2285
  ["lrtriangle", "triangle.stroked.br"],
2245
2286
  ["ltimes", "times.l"],
2246
2287
  ["lvzigzag", "fence.l"],
@@ -2258,8 +2299,8 @@ var map_from_official_docs = /* @__PURE__ */ new Map([
2258
2299
  ["mathcomma", "comma"],
2259
2300
  ["mathdollar", "dollar"],
2260
2301
  ["mathexclam", "excl"],
2261
- // ['mathhyphen', 'hyph'], // \mathhyphen is not defined in standard amsmath package
2262
- ["mathoctothorpe", "hash"],
2302
+ ["mathhyphen", "hyph"],
2303
+ // \mathhyphen is not defined in standard amsmath package
2263
2304
  ["mathparagraph", "pilcrow"],
2264
2305
  ["mathpercent", "percent"],
2265
2306
  ["mathperiod", "dot.basic"],
@@ -2273,7 +2314,6 @@ var map_from_official_docs = /* @__PURE__ */ new Map([
2273
2314
  ["mathyen", "yen"],
2274
2315
  ["mdblkdiamond", "diamond.filled.medium"],
2275
2316
  ["mdblklozenge", "lozenge.filled.medium"],
2276
- ["mdblksquare", "square.filled.medium"],
2277
2317
  ["mdlgblkcircle", "circle.filled"],
2278
2318
  ["mdlgblkdiamond", "diamond.filled"],
2279
2319
  ["mdlgblklozenge", "lozenge.filled"],
@@ -2283,12 +2323,9 @@ var map_from_official_docs = /* @__PURE__ */ new Map([
2283
2323
  ["mdlgwhtlozenge", "lozenge.stroked"],
2284
2324
  ["mdlgwhtsquare", "square.stroked"],
2285
2325
  ["mdsmblkcircle", "circle.filled.tiny"],
2286
- ["mdsmblksquare", "square.filled.small"],
2287
2326
  ["mdsmwhtcircle", "circle.stroked.small"],
2288
- ["mdsmwhtsquare", "square.stroked.small"],
2289
2327
  ["mdwhtdiamond", "diamond.stroked.medium"],
2290
2328
  ["mdwhtlozenge", "lozenge.stroked.medium"],
2291
- ["mdwhtsquare", "square.stroked.medium"],
2292
2329
  ["measeq", "eq.m"],
2293
2330
  ["measuredangle", "angle.arc"],
2294
2331
  ["measuredangleleft", "angle.arc.rev"],
@@ -2349,6 +2386,7 @@ var map_from_official_docs = /* @__PURE__ */ new Map([
2349
2386
  ['mupvarpi', 'pi.alt'],
2350
2387
  ['mupvarrho', 'rho.alt'],
2351
2388
  ['mupvarsigma', 'sigma.alt'],
2389
+ ['mupvarTheta', 'Theta.alt'],
2352
2390
  ['mupvartheta', 'theta.alt'],
2353
2391
  ['mupXi', 'Xi'],
2354
2392
  ['mupxi', 'xi'],
@@ -2360,7 +2398,6 @@ var map_from_official_docs = /* @__PURE__ */ new Map([
2360
2398
  ["natural", "natural"],
2361
2399
  ["ncong", "tilde.equiv.not"],
2362
2400
  ["ne", "eq.not"],
2363
- ["nearrow", "arrow.tr"],
2364
2401
  ["Nearrow", "arrow.tr.double"],
2365
2402
  ["neg", "not"],
2366
2403
  ["nequiv", "equiv.not"],
@@ -2371,7 +2408,9 @@ var map_from_official_docs = /* @__PURE__ */ new Map([
2371
2408
  ["ngtr", "gt.not"],
2372
2409
  ["ngtrless", "gt.lt.not"],
2373
2410
  ["ngtrsim", "gt.tilde.not"],
2411
+ ["nHdownarrow", "arrow.b.dstruck"],
2374
2412
  ["nhpar", "parallel.struck"],
2413
+ ["nHuparrow", "arrow.t.dstruck"],
2375
2414
  ["nhVvert", "interleave.struck"],
2376
2415
  ["ni", "in.rev"],
2377
2416
  ["nLeftarrow", "arrow.l.double.not"],
@@ -2408,36 +2447,62 @@ var map_from_official_docs = /* @__PURE__ */ new Map([
2408
2447
  ["nvdash", "tack.r.not"],
2409
2448
  ["nvDash", "tack.r.double.not"],
2410
2449
  ["nvinfty", "infinity.bar"],
2411
- ["nwarrow", "arrow.tl"],
2450
+ ["nvLeftarrow", "arrow.l.double.struck"],
2451
+ ["nvleftarrow", "arrow.l.struck"],
2452
+ ["nVleftarrow", "arrow.l.dstruck"],
2453
+ ["nvleftarrowtail", "arrow.l.tail.struck"],
2454
+ ["nVleftarrowtail", "arrow.l.tail.dstruck"],
2455
+ ["nvLeftrightarrow", "arrow.l.r.double.struck"],
2456
+ ["nvleftrightarrow", "arrow.l.r.struck"],
2457
+ ["nVleftrightarrow", "arrow.l.r.dstruck"],
2458
+ ["nvRightarrow", "arrow.r.double.struck"],
2459
+ ["nvrightarrow", "arrow.r.struck"],
2460
+ ["nVrightarrow", "arrow.r.dstruck"],
2461
+ ["nvrightarrowtail", "arrow.r.tail.struck"],
2462
+ ["nVrightarrowtail", "arrow.r.tail.dstruck"],
2463
+ ["nvtwoheadleftarrow", "arrow.l.twohead.struck"],
2464
+ ["nVtwoheadleftarrow", "arrow.l.twohead.dstruck"],
2465
+ ["nvtwoheadleftarrowtail", "arrow.l.twohead.tail.struck"],
2466
+ ["nVtwoheadleftarrowtail", "arrow.l.twohead.tail.dstruck"],
2467
+ ["nvtwoheadrightarrow", "arrow.r.twohead.struck"],
2468
+ ["nVtwoheadrightarrow", "arrow.r.twohead.dstruck"],
2469
+ ["nvtwoheadrightarrowtail", "arrow.r.twohead.tail.struck"],
2470
+ ["nVtwoheadrightarrowtail", "arrow.r.twohead.tail.dstruck"],
2412
2471
  ["Nwarrow", "arrow.tl.double"],
2413
2472
  ["nwsearrow", "arrow.tl.br"],
2414
2473
  ["obrbrak", "shell.t"],
2415
- ["obslash", "backslash.circle"],
2416
- ["odiv", "div.circle"],
2417
- ["odot", "dot.circle"],
2418
- ["ogreaterthan", "gt.circle"],
2474
+ ["obslash", "backslash.o"],
2475
+ ["odiv", "div.o"],
2476
+ ["odot", "dot.o"],
2477
+ ["odotslashdot", "div.slanted.o"],
2478
+ ["ogreaterthan", "gt.o"],
2419
2479
  ["oiiint", "integral.vol"],
2420
2480
  ["oiint", "integral.surf"],
2421
2481
  ["oint", "integral.cont"],
2422
2482
  ["ointctrclockwise", "integral.cont.ccw"],
2423
- ["olessthan", "lt.circle"],
2424
- ["ominus", "minus.circle"],
2425
- ["operp", "perp.circle"],
2426
- ["oplus", "plus.circle"],
2483
+ ["olessthan", "lt.o"],
2484
+ ["ominus", "minus.o"],
2485
+ ["operp", "perp.o"],
2486
+ ["oplus", "plus.o"],
2487
+ ["opluslhrim", "plus.o.l"],
2488
+ ["oplusrhrim", "plus.o.r"],
2427
2489
  ["origof", "original"],
2428
- ["otimes", "times.circle"],
2490
+ ["oslash", "slash.o"],
2491
+ ["otimes", "times.o"],
2492
+ ["otimeshat", "times.o.hat"],
2493
+ ["otimeslhrim", "times.o.l"],
2494
+ ["otimesrhrim", "times.o.r"],
2429
2495
  // ['overbrace', 'brace.t'],
2430
- ["overbracket", "bracket.t"],
2431
- ["overparen", "paren.t"],
2496
+ // ['overbracket', 'bracket.t'],
2497
+ // ['overparen', 'paren.t'],
2432
2498
  ["parallel", "parallel"],
2433
2499
  ["parallelogram", "parallelogram.stroked"],
2434
2500
  ["parallelogramblack", "parallelogram.filled"],
2435
2501
  ["parsim", "parallel.tilde"],
2436
- ["partial", "diff"],
2502
+ ["partial", "partial"],
2437
2503
  ["pentagon", "penta.stroked"],
2438
2504
  ["pentagonblack", "penta.filled"],
2439
2505
  ["perp", "perp"],
2440
- ["Planckconst", "planck"],
2441
2506
  ["pm", "plus.minus"],
2442
2507
  ["prec", "prec"],
2443
2508
  ["Prec", "prec.double"],
@@ -2458,30 +2523,37 @@ var map_from_official_docs = /* @__PURE__ */ new Map([
2458
2523
  ["quarternote", "note.quarter.alt"],
2459
2524
  ["questeq", "eq.quest"],
2460
2525
  ["Question", "quest.double"],
2461
- ["rangle", "angle.r"],
2462
- ["rAngle", "angle.r.double"],
2463
- ["rangledot", "angle.r.dot"],
2526
+ ["rangle", "chevron.r"],
2527
+ ["rAngle", "chevron.r.double"],
2528
+ ["rangledot", "chevron.r.dot"],
2529
+ ["rangledownzigzagarrow", "angle.azimuth"],
2530
+ ["rbag", "bag.r"],
2531
+ ["rblkbrbrak", "shell.r.filled"],
2464
2532
  ["rbrace", "brace.r"],
2465
- ["rBrace", "brace.r.double"],
2533
+ ["rBrace", "brace.r.stroked"],
2466
2534
  ["rbrack", "bracket.r"],
2467
- ["rBrack", "bracket.r.double"],
2535
+ ["rBrack", "bracket.r.stroked"],
2536
+ ["rbracklrtick", "bracket.r.tick.b"],
2537
+ ["rbrackurtick", "bracket.r.tick.t"],
2468
2538
  ["rbrbrak", "shell.r"],
2469
- ["Rbrbrak", "shell.r.double"],
2539
+ ["Rbrbrak", "shell.r.stroked"],
2470
2540
  ["rceil", "ceil.r"],
2471
- ["rcurvyangle", "angle.r.curly"],
2541
+ ["rcurvyangle", "chevron.r.curly"],
2472
2542
  ["Re", "Re"],
2473
2543
  ["revangle", "angle.rev"],
2474
2544
  ["revemptyset", "emptyset.rev"],
2475
2545
  ["revnmid", "divides.not.rev"],
2476
2546
  ["rfloor", "floor.r"],
2547
+ ["rgroup", "paren.r.flat"],
2477
2548
  ["rightangle", "angle.right"],
2478
2549
  ["rightanglemdot", "angle.right.dot"],
2479
- ["rightanglesqr", "angle.right.sq"],
2550
+ ["rightanglesqr", "angle.right.square"],
2480
2551
  ["rightarrow", "arrow.r"],
2481
2552
  ["Rightarrow", "arrow.r.double"],
2482
2553
  ["rightarrowbar", "arrow.r.stop"],
2483
- ["rightarrowonoplus", "plus.circle.arrow"],
2554
+ ["rightarrowonoplus", "plus.o.arrow"],
2484
2555
  ["rightarrowtail", "arrow.r.tail"],
2556
+ ["rightarrowtriangle", "arrow.r.open"],
2485
2557
  ["rightdasharrow", "arrow.r.dashed"],
2486
2558
  ["rightdotarrow", "arrow.r.dotted"],
2487
2559
  ["rightdowncurvedarrow", "arrow.r.curve"],
@@ -2502,15 +2574,17 @@ var map_from_official_docs = /* @__PURE__ */ new Map([
2502
2574
  ["rightwavearrow", "arrow.r.wave"],
2503
2575
  ["rightwhitearrow", "arrow.r.stroked"],
2504
2576
  ["risingdotseq", "eq.dots.up"],
2577
+ ["rmoustache", "mustache.r"],
2505
2578
  ["rparen", "paren.r"],
2506
- ["rParen", "paren.r.double"],
2579
+ ["rParen", "paren.r.stroked"],
2580
+ ["rrangle", "chevron.r.closed"],
2507
2581
  ["RRightarrow", "arrow.r.quad"],
2508
2582
  ["Rrightarrow", "arrow.r.triple"],
2583
+ ["rrparenthesis", "paren.r.closed"],
2509
2584
  ["rsolbar", "backslash.not"],
2510
2585
  ["rtimes", "times.r"],
2511
2586
  ["rvzigzag", "fence.r"],
2512
2587
  ["Rvzigzag", "fence.r.double"],
2513
- ["searrow", "arrow.br"],
2514
2588
  ["Searrow", "arrow.br.double"],
2515
2589
  ["setminus", "without"],
2516
2590
  ["sharp", "sharp"],
@@ -2532,16 +2606,15 @@ var map_from_official_docs = /* @__PURE__ */ new Map([
2532
2606
  ["smblkcircle", "bullet"],
2533
2607
  ["smblkdiamond", "diamond.filled.small"],
2534
2608
  ["smblklozenge", "lozenge.filled.small"],
2535
- ["smblksquare", "square.filled.tiny"],
2536
2609
  ["smeparsl", "parallel.slanted.eq.tilde"],
2610
+ ["smile", "smile"],
2537
2611
  ["smt", "smt"],
2538
2612
  ["smte", "smt.eq"],
2613
+ ["smwhtcircle", "bullet.stroked"],
2539
2614
  ["smwhtdiamond", "diamond.stroked.small"],
2540
2615
  ["smwhtlozenge", "lozenge.stroked.small"],
2541
- ["smwhtsquare", "square.stroked.tiny"],
2542
- ["spadesuit", "suit.spade.filled"],
2543
2616
  ["sphericalangle", "angle.spheric"],
2544
- ["sphericalangleup", "angle.spheric.top"],
2617
+ ["sphericalangleup", "angle.spheric.t"],
2545
2618
  ["sqcap", "inter.sq"],
2546
2619
  ["Sqcap", "inter.sq.double"],
2547
2620
  ["sqcup", "union.sq"],
@@ -2580,7 +2653,6 @@ var map_from_official_docs = /* @__PURE__ */ new Map([
2580
2653
  ["supsetdot", "supset.dot"],
2581
2654
  ["supseteq", "supset.eq"],
2582
2655
  ["supsetneq", "supset.neq"],
2583
- ["swarrow", "arrow.bl"],
2584
2656
  ["Swarrow", "arrow.bl.double"],
2585
2657
  ["therefore", "therefore"],
2586
2658
  ["threedangle", "angle.spatial"],
@@ -2603,15 +2675,19 @@ var map_from_official_docs = /* @__PURE__ */ new Map([
2603
2675
  ["tripleplus", "plus.triple"],
2604
2676
  ["trprime", "prime.triple"],
2605
2677
  ["trslash", "slash.triple"],
2678
+ ["turnediota", "iota.inv"],
2606
2679
  ["twoheaddownarrow", "arrow.b.twohead"],
2607
2680
  ["twoheadleftarrow", "arrow.l.twohead"],
2681
+ ["twoheadleftarrowtail", "arrow.l.twohead.tail"],
2608
2682
  ["twoheadmapsfrom", "arrow.l.twohead.bar"],
2609
2683
  ["twoheadmapsto", "arrow.r.twohead.bar"],
2610
2684
  ["twoheadrightarrow", "arrow.r.twohead"],
2685
+ ["twoheadrightarrowtail", "arrow.r.twohead.tail"],
2611
2686
  ["twoheaduparrow", "arrow.t.twohead"],
2612
2687
  ["twonotes", "note.eighth.beamed"],
2613
2688
  ["ubrbrak", "shell.b"],
2614
2689
  ["ulblacktriangle", "triangle.filled.tl"],
2690
+ ["ulcorner", "corner.l.t"],
2615
2691
  ["ultriangle", "triangle.stroked.tl"],
2616
2692
  ["uminus", "union.minus"],
2617
2693
  ["underbrace", "brace.b"],
@@ -2622,8 +2698,11 @@ var map_from_official_docs = /* @__PURE__ */ new Map([
2622
2698
  ["upand", "amp.inv"],
2623
2699
  ["uparrow", "arrow.t"],
2624
2700
  ["Uparrow", "arrow.t.double"],
2701
+ ["uparrowbarred", "arrow.t.struck"],
2702
+ ["upbackepsilon", "epsilon.alt.rev"],
2625
2703
  ["updasharrow", "arrow.t.dashed"],
2626
- ["updownarrow", "arrow.t.b"],
2704
+ ["upDigamma", "Digamma"],
2705
+ ["updigamma", "digamma"],
2627
2706
  ["Updownarrow", "arrow.t.b.double"],
2628
2707
  ["updownarrows", "arrows.tb"],
2629
2708
  ["updownharpoonleftleft", "harpoon.tl.bl"],
@@ -2637,16 +2716,14 @@ var map_from_official_docs = /* @__PURE__ */ new Map([
2637
2716
  ["upharpoonrightbar", "harpoon.tr.bar"],
2638
2717
  ["upharpoonsleftright", "harpoons.tltr"],
2639
2718
  ["uplus", "union.plus"],
2640
- ["uprightcurvearrow", "arrow.t.curve"],
2641
2719
  ["upuparrows", "arrows.tt"],
2642
2720
  ["upwhitearrow", "arrow.t.stroked"],
2643
2721
  ["urblacktriangle", "triangle.filled.tr"],
2722
+ ["urcorner", "corner.r.t"],
2644
2723
  ["urtriangle", "triangle.stroked.tr"],
2645
2724
  ["UUparrow", "arrow.t.quad"],
2646
2725
  ["Uuparrow", "arrow.t.triple"],
2647
2726
  ["varclubsuit", "suit.club.stroked"],
2648
- ["vardiamondsuit", "suit.diamond.filled"],
2649
- ["varheartsuit", "suit.heart.filled"],
2650
2727
  ["varhexagon", "hexa.stroked"],
2651
2728
  ["varhexagonblack", "hexa.filled"],
2652
2729
  ["varnothing", "emptyset"],
@@ -2671,6 +2748,7 @@ var map_from_official_docs = /* @__PURE__ */ new Map([
2671
2748
  ["vrectangleblack", "rect.filled.v"],
2672
2749
  ["Vvert", "bar.v.triple"],
2673
2750
  ["vysmblkcircle", "circle.filled.small"],
2751
+ // or bullet.op
2674
2752
  ["vysmwhtcircle", "circle.stroked.tiny"],
2675
2753
  // or compose
2676
2754
  ["wedge", "and"],
@@ -2680,7 +2758,7 @@ var map_from_official_docs = /* @__PURE__ */ new Map([
2680
2758
  ["whiteinwhitetriangle", "triangle.stroked.nested"],
2681
2759
  ["whthorzoval", "ellipse.stroked.h"],
2682
2760
  ["whtvertoval", "ellipse.stroked.v"],
2683
- ["wideangledown", "angle.oblique"],
2761
+ ["wideangledown", "angle.obtuse"],
2684
2762
  ["wr", "wreath"],
2685
2763
  ["xsol", "slash.big"]
2686
2764
  ]);
@@ -2784,6 +2862,9 @@ function tex_token_to_typst(token, options) {
2784
2862
  return new TypstToken(7 /* CONTROL */, "\\");
2785
2863
  } else if (token.value === "\\!") {
2786
2864
  return new TypstToken(1 /* SYMBOL */, "#h(-math.thin.amount)");
2865
+ } else if (token.value === "~") {
2866
+ const typst_symbol = symbolMap.get("~");
2867
+ return new TypstToken(1 /* SYMBOL */, typst_symbol);
2787
2868
  } else if (symbolMap.has(token.value.substring(1))) {
2788
2869
  const typst_symbol = symbolMap.get(token.value.substring(1));
2789
2870
  return new TypstToken(1 /* SYMBOL */, typst_symbol);
@@ -2864,23 +2945,8 @@ function convert_tex_array_align_literal(alignLiteral) {
2864
2945
  }
2865
2946
  var TYPST_LEFT_PARENTHESIS3 = new TypstToken(2 /* ELEMENT */, "(");
2866
2947
  var TYPST_RIGHT_PARENTHESIS3 = new TypstToken(2 /* ELEMENT */, ")");
2867
- function is_delimiter(c) {
2868
- return c.head.type === 2 /* ELEMENT */ && ["(", ")", "[", "]", "{", "}", "|", "\u230A", "\u230B", "\u2308", "\u2309"].includes(c.head.value);
2869
- }
2870
2948
  function appendWithBracketsIfNeeded(node) {
2871
2949
  let need_to_wrap = ["group", "supsub", "matrixLike", "fraction", "empty"].includes(node.type);
2872
- if (node.type === "group") {
2873
- const group = node;
2874
- if (group.items.length === 0) {
2875
- need_to_wrap = true;
2876
- } else {
2877
- const first = group.items[0];
2878
- const last = group.items[group.items.length - 1];
2879
- if (is_delimiter(first) && is_delimiter(last)) {
2880
- need_to_wrap = false;
2881
- }
2882
- }
2883
- }
2884
2950
  if (need_to_wrap) {
2885
2951
  return new TypstLeftright(null, {
2886
2952
  left: TYPST_LEFT_PARENTHESIS3,
@@ -2925,7 +2991,6 @@ function convert_tex_node_to_typst(abstractNode, options) {
2925
2991
  sup: sup ? convert_tex_node_to_typst(sup, options) : null,
2926
2992
  sub: sub ? convert_tex_node_to_typst(sub, options) : null
2927
2993
  };
2928
- data.base = appendWithBracketsIfNeeded(data.base);
2929
2994
  if (data.sup) {
2930
2995
  data.sup = appendWithBracketsIfNeeded(data.sup);
2931
2996
  }