diff --git a/src/writer.ts b/src/writer.ts index 967a241..3c1dc01 100644 --- a/src/writer.ts +++ b/src/writer.ts @@ -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); diff --git a/test/symbol.yml b/test/symbol.yml index ed73cc5..b76214f 100644 --- a/test/symbol.yml +++ b/test/symbol.yml @@ -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)