parse: don't drop equations on font/mode switches, \smash, or AMS Hebrew - #5
Merged
Conversation
An unknown control sequence drops the WHOLE equation group, so commands that
merely reach the math layer through macro expansion silently delete content.
A 200-paper arXiv census ranked the offenders:
- Text-mode font/size/mode switches (\normalfont 127, \par 55, \bfseries,
\small, \relax, \ignorespaces, …): no glyph, no argument. Treat as
transparent, like \limits — they change nothing the layer models.
- \smash / \smashoperator (32): the height/depth trim is not modelled, but the
CONTENT must render. Skip an optional [t]/[b], keep the body.
- AMS Hebrew \beth \gimel \daleth (\daleth 26): only \aleph was present.
Deliberately NOT handled here: \penalty, \hskip, \kern (unbraced dimension/
number arguments the math layer has no scanner for). No-oping them without
consuming the argument would leave "3pt" as parasitic math text — worse than a
clean drop. They stay dropped until a dimension scanner lands.
TestAddedSymbols gains the switches, \smash, and the Hebrew letters.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The macos/windows lanes run the 100% coverage gate; the new \smash case added
two error returns (broken optional [t|b] bracket, broken {body}) that the
success-only tests did not exercise. TestSmashErrors triggers both.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
An unknown control sequence drops the whole equation group, so commands that only reach the math layer through macro expansion silently delete content. A 200-paper arXiv census (
gotex -lenient -report-skipped) ranked the offenders.Now transparent (no glyph, no argument)
\normalfont(127 dropped groups),\par(55), plus\rmfamily/\sffamily/\ttfamily/\bfseries/\mdseries/\itshape/\scshape/\upshape/\em, the size switches\small…\Huge, and\relax/\protect/\leavevmode/\noindent/\ignorespaces. Handled exactly like\limits— they change nothing this layer models.\smash/\smashoperator(32)The height/depth trim isn't modelled, but the content must render. Skip an optional
[t]/[b], keep the body.AMS Hebrew
\beth\gimel\daleth(\daleth: 26)Only
\alephwas present.Deliberately NOT handled
\penalty,\hskip,\kerntake unbraced dimension/number arguments the math layer has no scanner for. No-oping them without consuming the argument would leave3ptas parasitic math text — worse than a clean drop. They stay dropped until a dimension scanner lands.TestAddedSymbolsextended; full suite green.