Skip to content

A class's \@biblabel and \@cite are executed into the eqtb, then ignored by the Go citation code (19 and 12 of 154) #681

Closed

Description

@tannevaled

\cite is a Go primitive, so a document's \@citex is ignored

Found while reading the parity roadmap (#677), and it is the same shape as the
\footnoterule defect closed in #679: the engine agrees with the kernel's default by
construction, and with nobody who changes it.

The reference

latex.ltx:13283-13295 builds a citation out of five replaceable pieces:

\DeclareRobustCommand\cite{%
  \@ifnextchar [{\@tempswatrue\@citex}{\@tempswafalse\@citex[]}}
\def\@citex[#1]#2{\leavevmode
  \let\@citea\@empty
  \@cite{\@for\@citeb:=#2\do
    {\@citea\def\@citea{,\penalty\@m\ }%
     …
       {\@cite@ofmt{\csname b@\@citeb\endcsname}}}}{#1}}
\def\@cite#1#2{[{#1\if@tempswa , #2\fi}]}
\def\@biblabel#1{[#1]}

\@citea is the separator, redefined inside its own loop so it is empty before the
first key and ,\penalty\@m\ between the rest. \@citeb is the loop variable.
\@cite wraps the list, \@biblabel formats the entry in the bibliography.

Here

\cite is primitives.go:2013 → crossref.go:161's doCite, in Go. So a document that
writes

\renewcommand\@cite[2]{(#1#2)}          % parenthesised citations
\def\@biblabel#1{#1.}                   % "1." instead of "[1]"

gets brackets anyway. crossref.go:165-166 quotes the reference's definition in a
comment, which is how the shape of the defect was already known without being measured.

Measured

Papers whose own sources redefine the kernel's citation internals
(\def/\renewcommand/\let of \@citex, \@citea, \@citeb, \@cite), counted on
the corpus with measure population:

motif      \\(def|renewcommand|let)\\@cite(x|a|b)?([^A-Za-z@]|$)
fichiers   3060 appariés sur 76291 lus (.tex,.cls,.sty)
papiers    2941 sous /Users/Shared/axc/work
liste      154/154 papiers lus — recouvre 22

2941 papers, 22 of the 154 measured ones. The measurement can see the change, which
is the precondition for working on it (#675: a change no corpus document exercises is a
change whose effect cannot be read).

Why this did not appear on the roadmap as itself

\@citea and \@citeb rank 18/154 in #677's inventory as absent names, and the
roadmap's new "cited" column does not mark them: the engine writes neither name
anywhere, because the macro that uses them is replaced wholesale. So they read as the
first genuine work on the list, and that reading is wrong in an instructive way —

⛔ defining \@citea and \@citeb would accomplish nothing. They are loop variables
of a \@citex this engine never executes. The work is making the citation path run the
kernel's macros, the way \footnoterule and \@makefntext now do; the two names then
come for free, and so do \@cite, \@cite@ofmt and \@biblabel (35/154, already
"cited").

That is a fifth species of false positive for the parity inventory, after the four in
#677: a name internal to a macro the engine replaces in Go. Neither the definition
needle nor the citation column can see it; only reading the caller can.

Not planned here

doCite also carries natbib's \citep/\citet/\citeauthor/\citenum, which the
kernel does not define at all. Any move toward executing \@citex has to keep those
working, so this is a report with a measurement attached, not a plan.

🤖 Generated with Claude Code

Activity

  1. tannevaled commented on Nov 3, 2026

    @tannevaled
    ContributorAuthor

    Correction: the number in the issue counted the library, not the paper

    The issue says "2941 papers, 22 of the 154 measured ones … redefine the kernel's
    citation internals"
    . That phrasing is wrong, and the measurement behind it did not
    separate a paper's own source from the files it ships. Split by file kind:

    où la redéfinition se trouve papiers /154
    le .tex du papier lui-même 56 0
    un .cls que le papier embarque 3093 22

    Not one of the 154 papers redefines \@cite, \@citex or \@biblabel in its own
    source.
    Every one of the 22 gets it from a class.

    That is the same failure this campaign has already paid for twice — a count that does not
    say on what it was computed. Published before it was split.

    What the corrected measurement says, and why it is a stronger case

    Only 50 of the 154 papers ship a class at all. So:

    hook papiers /154 sur les 50 qui embarquent une classe
    \@biblabel 2961 19 38 %
    \@cite 1450 12 24 %
    l'un ou l'autre 3093 22 44 %

    And it is not about natbib: exactly one of the 154 ships natbib.sty
    (2311.07618). This is journal classes redefining the kernel's formatting hooks —
    and this engine executes real .cls files, so those \def\@biblabel{…} land in the
    eqtb and are then ignored by the Go citation code.

    So the defect is better founded than the original wording, not worse: the redefinitions
    are already executed, and dropped at the point of use.

    Scope that follows from the split

    \@biblabel (19) and \@cite (12) are one-argument formatting macros called at a
    known point — exactly the \footnoterule (#679) and \@makefntext (#680) shape, and
    they are what the measurement supports.

    \@citex is the whole iteration, and natbib works by \letting it
    (natbib.sty:658,666: \let\@citex\NAT@citexnum, \let\@cite\NAT@cite). Executing it
    would mean running real natbib instead of the Go emulation (latex.go:385 says in so
    many words that natbib "is emulated here rather" than executed) — a far larger change
    that no number here calls for: one paper in 154.

    ⇒ This issue is re-scoped to the two formatting hooks. \@citex is left where it is,
    with the measurement that says why.

    🤖 Generated with Claude Code

  2. changed the title [-]\cite is a Go primitive, so a document's \@citex, \@cite and \@biblabel are ignored (22 of 154)[/-] [+]A class's \@biblabel and \@cite are executed into the eqtb, then ignored by the Go citation code (19 and 12 of 154)[/+] on Nov 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions