Repository navigation
engine: the end-of-line character, and \ifcat on a \let character - #15
Merged
Merged
Conversation
Two mouth-level pieces of TeX that beamer's own machinery stands on. Both were
found by pointing the real beamer.cls at the engine and asking what it did with
the document body: it commented ALL of it out.
* \endlinechar. TeX reads its input one LINE at a time and appends the
character \endlinechar (13 = ^^M) to each line; from then on that character
acts on its CATCODE like any other. This engine keeps the source in one
buffer with \n as the separator and produced a hardwired end-of-line token,
so \endlinechar and \catcode`\^^M were settable but inert. The mouth now
presents the line separator AS \endlinechar (mouthChar): with the defaults
that is exactly the token it produced before, and a package that changes
either one now gets what TeX gives it. beamer reads a line verbatim with
\catcode`\^^M=12 and a macro DELIMITED by ^^M; against a hardwired token
that delimiter can never match and the macro runs away with the file.
* \if and \ifcat on a control sequence \let to a CHARACTER. Such a cs behaves
exactly as that character (TeX §506) — that is the whole point of
\futurelet, which \let's a lookahead cs to the token it peeked at and then
asks \ifcat what it was. The engine treated EVERY control sequence as "not a
character", so \ifcat\next a was false for a \next \let to a letter.
beamer decides whether a \mode<…> spec is a MODE NAME or an overlay range
with exactly that test. It always answered "overlay", so every
\mode<presentation> concluded the mode did not apply and started beamer's
line-by-line comment skipper — which then ate the rest of the class AND the
document. That is why a talk came out blank.
A \chardef'd constant is NOT a character token: real TeX answers OTHER for
\ifcat\chardefd a and DIFF for \if\chardefd A, and so does this. Checked.
Also the kernel names those two fixes exposed next: \maxdimen (package code uses
it as "no limit", so its absence means the assignment does not happen), \@COns,
\@onelevel@sanitize / \strip@prefix, and xcolor's \ifglobalcolors /
\ifXC@keepwhite switches that xxcolor toggles around every colour it sets.
Where the beamer bring-up stands after this: the class loads and its modes now
resolve, the document reaches the page builder, and a two-page talk comes out
with the right page COUNT. The content is still wrong — xxcolor's pale-colour
layer leaks text ("pale") into the page — with, again, no undefined control
sequence. That is the next thread.
Proof: all tests pass under -race; the conformance ratchet gains three rows;
scripts/fidelity.sh --check is OK. Against a binary built from main BEFORE the
previous merge, the ten TikZ documents and all ten pages of the arXiv paper
(2608.14117) render PIXEL-IDENTICAL — these changes move nothing that worked.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two mouth-level pieces of TeX that beamer's own machinery stands on. Both were
found by pointing the real beamer.cls at the engine and asking what it did with
the document body: it commented ALL of it out.
\endlinechar. TeX reads its input one LINE at a time and appends the
character \endlinechar (13 = ^^M) to each line; from then on that character
acts on its CATCODE like any other. This engine keeps the source in one
buffer with \n as the separator and produced a hardwired end-of-line token,
so \endlinechar and \catcode
\^^M were settable but inert. The mouth now presents the line separator AS \endlinechar (mouthChar): with the defaults that is exactly the token it produced before, and a package that changes either one now gets what TeX gives it. beamer reads a line verbatim with \catcode^^M=12 and a macro DELIMITED by ^^M; against a hardwired tokenthat delimiter can never match and the macro runs away with the file.
\if and \ifcat on a control sequence \let to a CHARACTER. Such a cs behaves
exactly as that character (TeX §506) — that is the whole point of
\futurelet, which \let's a lookahead cs to the token it peeked at and then
asks \ifcat what it was. The engine treated EVERY control sequence as "not a
character", so \ifcat\next a was false for a \next \let to a letter.
beamer decides whether a \mode<…> spec is a MODE NAME or an overlay range
with exactly that test. It always answered "overlay", so every
\mode concluded the mode did not apply and started beamer's
line-by-line comment skipper — which then ate the rest of the class AND the
document. That is why a talk came out blank.
A \chardef'd constant is NOT a character token: real TeX answers OTHER for
\ifcat\chardefd a and DIFF for \if\chardefd A, and so does this. Checked.
Also the kernel names those two fixes exposed next: \maxdimen (package code uses
it as "no limit", so its absence means the assignment does not happen), @COns,
@onelevel@sanitize / \strip@prefix, and xcolor's \ifglobalcolors /
\ifXC@keepwhite switches that xxcolor toggles around every colour it sets.
Where the beamer bring-up stands after this: the class loads and its modes now
resolve, the document reaches the page builder, and a two-page talk comes out
with the right page COUNT. The content is still wrong — xxcolor's pale-colour
layer leaks text ("pale") into the page — with, again, no undefined control
sequence. That is the next thread.
Proof: all tests pass under -race; the conformance ratchet gains three rows;
scripts/fidelity.sh --check is OK. Against a binary built from main BEFORE the
previous merge, the ten TikZ documents and all ten pages of the arXiv paper
(2608.14117) render PIXEL-IDENTICAL — these changes move nothing that worked.
🤖 Generated with Claude Code