Skip to content

Commit

Permalink
fix translation for escape characters
Browse files Browse the repository at this point in the history
  • Loading branch information
qwinsi committed Aug 16, 2024
1 parent 954aa79 commit 2717954
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/writer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ function convertToken(token: string): string {
return token;
} else if (token === '\\\\') {
return '\\\n';
} else if (token === '\\$') {
} else if (['\\$', '\\#', '\\&', '\\_'].includes(token)) {
return token;
} else if (token.startsWith('\\')) {
const symbol = token.slice(1);
Expand Down
3 changes: 3 additions & 0 deletions test/symbol.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ cases:
- title: monetary symbols
tex: \$ \pounds \yen
typst: \$ pound yen
- title: escape characters
tex: \{ \} \_ \& \# \% \$
typst: "{} \\_\\& \\# % \\$" # Ideally there should be a space between \ and {, but not implemented yet
- title: combinatorial number
tex: \binom{n}{k}
typst: binom(n, k)
Expand Down

0 comments on commit 2717954

Please sign in to comment.