Skip to content

Fix Typst spacing after escaped expressions#292

Merged
jgm merged 3 commits into
jgm:masterfrom
filipviz:agent/fix-typst-escaped-spacing
Jul 23, 2026
Merged

Fix Typst spacing after escaped expressions#292
jgm merged 3 commits into
jgm:masterfrom
filipviz:agent/fix-typst-escaped-spacing

Conversation

@filipviz

@filipviz filipviz commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Fix for #291. Some context:

The fix for #286 removed spacing after expressions whose Typst output began with an escape. This worked as intended for standalone escaped symbols (such as "\("), but also affected compound expressions. For example:

$)^n k$
->
$\)^nk$

This output results in a Typst error: error: unknown variable: nk. The desired output here would be $\)^n k$.

This PR limits the space removal to standalone escapes and adds a regression test.

AI use disclosure: I work with LaTeX and Typst often, but only rarely with Haskell. Thus, this PR was written with assistance from Claude Fable 5. I could be missing something here.

@filipviz
filipviz marked this pull request as ready for review July 22, 2026 18:02
Comment thread src/Text/TeXMath/Writers/Typst.hs Outdated
@jgm
jgm merged commit 2b91795 into jgm:master Jul 23, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants