Skip to content

parse: @ is a letter inside a control word - #8

Merged
tannevaled merged 1 commit into
mainfrom
at-in-control-words
Aug 31, 2026
Merged

parse: @ is a letter inside a control word#8
tannevaled merged 1 commit into
mainfrom
at-in-control-words

Conversation

@tannevaled

Copy link
Copy Markdown
Contributor

TeX reads a control word as a run of category-11 letters, and LaTeX makes @ a letter in package and class code (\makeatletter). So \the@inst and \@ifundefined are one control sequence each.

This tokeniser read control words as ASCII letters only, so \the@inst came apart into \the and @inst — and the error said unknown command \the, which no caller's macro table has. \the@inst, which the document itself defines, is one it would have found.

That matters because the error string is the caller's only handle: go-tex/engine takes the name out of it and looks it up on its retry path. 68 formulas over 6 of the 200 papers in its arXiv corpus are lost this way, all of them a class's own \the@inst.

A caller writes every control sequence with a trailing space — that is what this package's own source strings do — so a name never bleeds into what follows: \@ x stays \@ then x. \@ alone, and every control symbol, is unchanged.

It also makes \z@ one word, which readArgText had been reassembling by hand for \genfrac's thickness (#7); that special case goes.

Test

atletter_test.go: \the@inst, \@ifundefined, \@@affmark must each tokenise as one control sequence, \@ x must not swallow the x, \alpha and \{ must be untouched — and the renderer must report an unknown command by its whole name, since that string is what the caller resolves.

TeX reads a control word as a run of category-11 letters, and LaTeX makes @ a letter
in package and class code (\makeatletter). So \the@inst and \@ifundefined are ONE
control sequence each. This tokeniser read control words as ASCII letters only, so
\the@inst came apart into \the and @inst — and the error said "unknown command
\the", which no caller's macro table has. \the@inst, which the document defines, is
one it would have found.

That matters because the error string is the caller's only handle: go-tex/engine
takes the name out of it and looks it up. 68 formulas over 6 of the 200 papers in
its arXiv corpus are lost this way, all of them a class's own \the@inst.

A caller writes every control sequence with a trailing space — that is what this
package's own source strings do — so a name never bleeds into what follows: "\@ x"
stays \@ then x. \@ alone, and every control SYMBOL, is unchanged.

It also makes \z@ one word, which readArgText had been reassembling by hand for
\genfrac's thickness; that special case goes.
@tannevaled
tannevaled merged commit 9b5f5d1 into main Aug 31, 2026
11 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.

1 participant