Skip to content

TeX reader: keep a trailing control space - #311

Merged
jgm merged 1 commit into
jgm:masterfrom
Lotion-3:tex-reader-trailing-control-space
Nov 27, 2026
Merged

jgm merged 1 commit into
jgm:masterfrom
Lotion-3:tex-reader-trailing-control-space

Conversation

@Lotion-3

Copy link
Copy Markdown
Contributor

Since the trailing whitespace is stripped before parsing (a957687), a formula ending in a control space loses the space and is left with a lone backslash: a\ fails with "unexpected eof". The TeX writer writes a 2/9 em space as \ , so this also affects reading texmath's own output (e.g. of a~).

This keeps the whitespace character after a final unescaped backslash, and adds a regression test.

Stripping trailing whitespace before parsing (a957687) also removed the
space of a final "\ ", leaving a lone backslash, so "a\ " was a parse
error ("unexpected eof"). The TeX writer writes ESpace (2 % 9), e.g.
from "~", as "\ ", so this also broke reading its own output.
@jgm
jgm merged commit fc48c1f into jgm:master Nov 27, 2026
6 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