From af27ec5dd3b803f137450a7372a8e6dda3fba6ed Mon Sep 17 00:00:00 2001 From: qwinsi <70425035+qwinsi@users.noreply.github.com> Date: Sat, 17 Aug 2024 08:26:54 +0800 Subject: [PATCH] additionally support \mathscr, \LaTeX, \TeX --- src/map.ts | 5 +++++ src/parser.ts | 2 ++ test/symbol.yml | 9 ++++----- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/map.ts b/src/map.ts index 0677455..e5ff222 100644 --- a/src/map.ts +++ b/src/map.ts @@ -292,4 +292,9 @@ export const symbolMap = new Map([ ['xi', 'xi'], ['yen', 'yen'], ['zeta', 'zeta'], + + // extended + ['mathscr', 'scr'], + ['LaTeX', '#LaTeX'], + ['TeX', '#TeX'], ]); diff --git a/src/parser.ts b/src/parser.ts index cdde996..1039844 100644 --- a/src/parser.ts +++ b/src/parser.ts @@ -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 = { diff --git a/test/symbol.yml b/test/symbol.yml index b76214f..3e971a9 100644 --- a/test/symbol.yml +++ b/test/symbol.yml @@ -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) @@ -110,4 +106,7 @@ cases: - title: non-strict mode tex: \myop typst: myop - nonStrict: true \ No newline at end of file + nonStrict: true + - title: extended + tex: \mathscr{A} \LaTeX \TeX + typst: "scr(A) #LaTeX #TeX" \ No newline at end of file