Repository navigation
\@biblabel and \@cite are macros the citation path calls, not brackets built in Go - #682
Merged
Merged
Conversation
…s built in Go
The marker's brackets were written into \@bibitemopt/\@bibitemnoopt and into doCite,
so no class could change either. The reference makes both a macro:
\def\@biblabel#1{[#1]} (latex.ltx:13324)
\def\@cite#1#2{[{#1\if@tempswa , #2\fi}]} (latex.ltx:13322)
and article.cls:568 builds the bibliography list's label by calling \@biblabel.
This engine EXECUTES real .cls files, so those redefinitions were already reaching the
eqtb and were dropped at the one point that mattered. Measured on the corpus, split by
where the redefinition lives — because the first count did not separate a paper's own
source from the files it ships:
dans le .tex du papier 56 papiers, 0 des 154
dans un .cls embarque 3093 papiers, 22 des 154
dont \@biblabel 2961 papiers, 19 des 154
dont \@cite 1450 papiers, 12 des 154
Only 50 of the 154 ship a class at all, so 22 of 50 — 44% — of the papers that bring
their own class bring one that redefines these hooks. Exactly one of the 154 ships
natbib.sty, so this is about classes, not about natbib.
Measured before and after on a four-line document: \def\@biblabel#1{<<#1>>} and
\def\@cite#1#2{(((#1#2)))} rendered BYTE-IDENTICALLY to a document without them, and
now produce <<1>> and (((1))).
\if@tempswa is SET here rather than inherited. The reference's \cite makes it true when
it read a bracket and false when it did not (latex.ltx:13283-13284), and a redefined
\@cite reads it to decide whether to print the note; leaving it alone would make the
note's fate depend on whatever last touched the switch — a defect visible only on a
document that cites twice, with and without a note, in that order.
NOT DONE HERE: \@citex, the iteration itself. natbib works by \letting it
(natbib.sty:658,666), so executing it would mean running real natbib instead of the Go
emulation — and no number here calls for that: one paper in 154 ships natbib.sty.
Co-Authored-By: Claude Opus 5 <[email protected]>
…print Co-Authored-By: Claude Opus 5 <[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.
Closes #681 for the two formatting hooks the measurement supports. Same shape as
\footnoterule(#679) and\@makefntext(#680): a macro the reference defines isexecuted, not imitated.
The defect, in four lines
Texte[1].References[1]Unereference.Texte[1].References[1]Unereference.Texte[1].References**<<1>>**Unereference.The two "avant" rows are byte-identical: the redefinition did nothing at all. Same
for
\def\@cite#1#2{(((#1#2)))}, now(((1))).The brackets were written into
\@bibitemopt/\@bibitemnoopt(latex.go) and intodoCite(crossref.go). The reference makes both a macro —\def\@biblabel#1{[#1]}(
latex.ltx:13324),\def\@cite#1#2{[{#1\if@tempswa , #2\fi}]}(:13322) — andarticle.cls:568builds the bibliography list's label by calling\@biblabel.This engine executes real
.clsfiles, so those redefinitions were already in theeqtb and were dropped at the one point that mattered.
The measurement, corrected
The first count in #681 said "2941 papers, 22 of the 154, redefine the kernel's
citation internals". It did not separate a paper's own source from the files it ships:
.texdu papier lui-même.clsembarqué\@biblabel\@citeNot one of the 154 redefines these in its own source; every one of the 22 gets it from a
class. Only 50 of the 154 ship a class at all, so this is 22 of 50 — 44 % of
the papers that bring their own class. Exactly one ships
natbib.sty, so it is aboutclasses, not natbib.
Corpus A/B
Control
4a19ba6(main), treatment77f0dd5:18 of 154, against a bound of 19 papers whose class redefines
\@biblabel. The toolprinted its own warning on this one, which is the warning working:
Controls
the default would have moved everything;
TestCitationDefaultsAreUnchangedasserts it,and the page count is flat at 0.
\@citecall disabled,TestCiteWrapperObeysTheDocumentandTestCiteSetsTheSwitchItsOwnMacroReadsfail and the default control still passes.\if@tempswais set, not inherited. The reference's\citemakes it true when itread a bracket and false when it did not (
latex.ltx:13283-13284), and a redefined\@citereads it to decide whether to print the note. Leaving it alone would make thenote's fate depend on whatever last touched the switch — a defect visible only on a
document that cites twice, with and without a note, in that order. That is the test.
NOT DONE HERE
\@citex, the iteration itself. natbib works by\letting it (natbib.sty:658,666:\let\@citex\NAT@citexnum,\let\@cite\NAT@cite), so executing it would mean runningreal natbib instead of the Go emulation that
latex.go:385describes. No number herecalls for that — one paper in 154 ships natbib.sty — and #681 keeps it open with the
measurement that says why.
🤖 Generated with Claude Code