Skip to content

Commit

Permalink
additionally support \mathscr, \LaTeX, \TeX
Browse files Browse the repository at this point in the history
  • Loading branch information
qwinsi committed Aug 17, 2024
1 parent 2717954 commit af27ec5
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
5 changes: 5 additions & 0 deletions src/map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -292,4 +292,9 @@ export const symbolMap = new Map<string, string>([
['xi', 'xi'],
['yen', 'yen'],
['zeta', 'zeta'],

// extended
['mathscr', 'scr'],
['LaTeX', '#LaTeX'],
['TeX', '#TeX'],
]);
2 changes: 2 additions & 0 deletions src/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,8 @@ export function parseTex(tex: string, customTexMacros: {[key: string]: string}):
'\\vdots': '\\operatorname{SyMb01-vdots}',
'\\notin': '\\operatorname{SyMb01-notin}',
'\\slash': '\\operatorname{SyMb01-slash}',
'\\LaTeX': '\\operatorname{SyMb01-LaTeX}',
'\\TeX': '\\operatorname{SyMb01-TeX}',
...customTexMacros
};
const options = {
Expand Down
9 changes: 4 additions & 5 deletions test/symbol.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,6 @@ cases:
- title: mathcal
tex: \mathcal{A} \mathcal{B} \mathcal{C} \mathcal{D} \mathcal{E} \mathcal{F} \mathcal{G} \mathcal{H} \mathcal{I} \mathcal{J} \mathcal{K} \mathcal{L} \mathcal{M} \mathcal{N} \mathcal{O} \mathcal{P} \mathcal{Q} \mathcal{R} \mathcal{S} \mathcal{T} \mathcal{U} \mathcal{V} \mathcal{W} \mathcal{X} \mathcal{Y} \mathcal{Z}
typst: cal(A) cal(B) cal(C) cal(D) cal(E) cal(F) cal(G) cal(H) cal(I) cal(J) cal(K) cal(L) cal(M) cal(N) cal(O) cal(P) cal(Q) cal(R) cal(S) cal(T) cal(U) cal(V) cal(W) cal(X) cal(Y) cal(Z)
- title: mathscr
tex: \mathscr{A} \mathscr{B} \mathscr{C} \mathscr{D} \mathscr{E} \mathscr{F} \mathscr{G} \mathscr{H} \mathscr{I} \mathscr{J} \mathscr{K} \mathscr{L} \mathscr{M} \mathscr{N} \mathscr{O} \mathscr{P} \mathscr{Q} \mathscr{R} \mathscr{S} \mathscr{T} \mathscr{U} \mathscr{V} \mathscr{W} \mathscr{X} \mathscr{Y} \mathscr{Z}
# This result it not proper. Try to make it better
typst: cal(A) cal(B) cal(C) cal(D) cal(E) cal(F) cal(G) cal(H) cal(I) cal(J) cal(K) cal(L) cal(M) cal(N) cal(O) cal(P) cal(Q) cal(R) cal(S) cal(T) cal(U) cal(V) cal(W) cal(X) cal(Y) cal(Z)
- title: mathrm
tex: \mathrm{a} \rm{a}
typst: upright(a) upright(a)
Expand Down Expand Up @@ -110,4 +106,7 @@ cases:
- title: non-strict mode
tex: \myop
typst: myop
nonStrict: true
nonStrict: true
- title: extended
tex: \mathscr{A} \LaTeX \TeX
typst: "scr(A) #LaTeX #TeX"

0 comments on commit af27ec5

Please sign in to comment.