fancyvrb's \Verb keeps the code it is given - #224
Merged
Conversation
\Verb was undefined, so a hundred fragments of code went out with it: one paper
writes \newcommand{\jl}[1]{\small\Verb{#1}} and uses \jl a hundred times, and every
one was skipped along with its text.
The braced form has to be read from TOKENS rather than from the character buffer:
by the time \Verb runs inside that macro its argument is a parameter and the file is
long past. The delimited form still reads the buffer, as \verb does.
Peeking for the optional [options] with a TOKEN read moves the buffer cursor past
the delimiter and leaves the token on the list, so \Verb|autre_code()| came out as
"utre_code()||" — the character after the bar had become the delimiter. While the
argument is still in the file, everything is peeked raw.
Measured over the 157 arXiv papers: page error 517 → 516, within 2 pages 102 → 103,
and +580 drawn glyphs — the restored fragments. The gain is content, not pagination.
Co-Authored-By: Claude Opus 5 <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.
\Verbwas undefined, so a hundred fragments of code went out with it: one paperwrites
\newcommand{\jl}[1]{\small\Verb{#1}}and uses\jla hundred times, andevery one of them was skipped along with its text.
The braced form is the one that has to be read from tokens rather than from the
character buffer — by the time
\Verbruns inside that macro, its argument is aparameter and the file is long past. The delimited form still reads the buffer, as
\verbdoes.A trap worth naming: peeking for the optional
[options]with a token readmoves the buffer cursor past the delimiter and leaves the token on the list, so
\Verb|autre_code()|came out asutre_code()||— the character after the bar hadbecome the delimiter. While the argument is still in the file, everything is peeked
raw.
Measured
Page error over the 157 arXiv papers: 517 → 516, within 2 pages 102 → 103, and
+580 drawn glyphs — the restored code fragments. The gain is content, not
pagination, which is why the glyph census is the evidence.
Four cases are tested (braced, delimited, through a macro, with options) plus the
first-character regression.
🤖 Generated with Claude Code