Skip to content

compiler: kernel and natbib citations, bibliography labels and .bbl input - #166

Closed
GoKubar wants to merge 4 commits into
mainfrom
agent/kabir-claude/citations-bibliography
Closed

GoKubar wants to merge 4 commits into
mainfrom
agent/kabir-claude/citations-bibliography

Conversation

@GoKubar

@GoKubar GoKubar commented Sep 13, 2026

Copy link
Copy Markdown
Contributor

Citations and bibliography labels in the compiler (outside the macro-expansion pass; crates/bibliography and the BibTeX .bst engine untouched).

Kernel (latex.ltx \@citex/\@cite): \cite[note]{k1,k2} → [1, 2, note]; undefined keys → bold ? with Citation key' undefined; \nocitewarns for undefined keys;\bibitem[label]{key}; keys lose only leading spaces, like @firstofone`.

natbib 8.31b: \cite, \citet, \citep[pre][post], \citealt, \citealp, \citeauthor, \citeyear, \citeyearpar, \citenum, capitalised and starred forms. Also:

  • options applied in \ProcessOptions order: numbers, super, authoryear, round/square/angle/curly, comma/semicolon, sort, compress, sort&compress, longnamesfirst;
  • \bibpunct, \setcitestyle (braced values), \citestyle, and the \bibliographystyle \bibstyle@<name> applied at \begin{document};
  • \bibitem[Name(Year)Long] labels, \natexlab, extra year labels, and forced numbers for a bibliography without year data;
  • compress ranges [1–3].

.bbl input: \bibliography{..} reads the project's <jobname>.bbl in its place. It is expanded as its own document and spliced into the parser stream. \penalty<n> sets no text.

Structured output: Parsed.citations (keys, cite.<key> targets, typed text), cite_style, cite_numbers. bib::resolve stays pub(crate) for #131. List labels follow the mode: [label], natbib [n], or empty for author-year. report/book headings are Bibliography.

Supported inventory regenerated (drift gate). cargo test --release in crates/compiler: all green, including new bib/parser tests.

Oracle (render-pipeline PR, 22 pdflatex fixtures): with this compiler in a scratch vendor copy, citation text matches pdflatex for every fixture except super (set on the baseline, diagnosed).

Re-pin: the render-pipeline companion PR's natbib/.bbl oracle tests are ignored until the vendored compiler carries this branch.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu

GoKubar and others added 4 commits September 13, 2026 09:30
…nput

\cite follows latex.ltx \@citex/\@cite ([1, 2, note], bold ? for an
undefined key with LaTeX's "Citation `key' undefined" warning, \nocite
warnings). With natbib loaded, \cite, \citet, \citep, \citealt, \citealp,
\citeauthor, \citeyear, \citeyearpar, \citenum and the capitalised and
starred forms follow natbib.sty's \NAT@citexnum (numbers, super, sort,
compress ranges, textual Name [n]) and \NAT@citex (author-year, grouped
years, extra labels, pre/post notes), with options in \ProcessOptions
order, \bibpunct, \setcitestyle, \citestyle and the BibTeX style's
\bibstyle@<name> applied at \begin{document}. \bibitem[Name(Year)Long]
labels feed natbib; an entry without year data settles the document on
numbers like \NAT@force@numbers. Bibliography list labels follow the
mode (kernel [label], natbib [n], none for author-year) and report/book
headings are Bibliography.

\bibliography{..} reads the project's <jobname>.bbl in its place
(expanded as its own document and spliced into the parser stream).
Parsed gains citations (keys, cite.<key> targets, text), cite_style and
cite_numbers. Supported inventory regenerated.

Implementation-Agent: Claude Opus 5 (subagent kabir-claude citations, mac-m5pro-kabir)
Commit-Executor: Claude Code direct Git
Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu
\@for splits the list at top-level commas and a braced value keeps its
spaces; the parser now passes the argument with its braces.

Implementation-Agent: Claude Opus 5 (subagent kabir-claude citations, mac-m5pro-kabir)
Commit-Executor: Claude Code direct Git
Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu
…ling spaces

\bibpunct, \setcitestyle and \citestyle ran into the preamble catch-all
and were diagnosed as unsupported there; they now dispatch before it.
Citation keys drop only their leading spaces, as \@Firstofone does in
\@citex and natbib, so \cite{a ,b} asks for `a ' like LaTeX.

Implementation-Agent: Claude Opus 5 (subagent kabir-claude citations, mac-m5pro-kabir)
Commit-Executor: Claude Code direct Git
Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu
…o text

natbib.sty's {\reset@font\bfseries?} ends its line, so pdflatex prints
[1? , 2] and ? ] for undefined numerical citations. BibTeX .bbl files
write \penalty0 in page ranges; the number was typeset as text.

Implementation-Agent: Claude Opus 5 (subagent kabir-claude citations, mac-m5pro-kabir)
Commit-Executor: Claude Code direct Git
Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu
GoKubar added a commit that referenced this pull request Sep 13, 2026
…ession handoff)

Stage 1 partly done: #131, #137, #153 (incl. #142), #144, #147, #149, #150,
#155, #159, #163, #164 merged with conflicts and post-expansion fixes recorded
in docs/evidence/integration-2026-09-13b/merge-log.md. Remaining: #166, #169,
#148, #161, then the inventory regeneration and stages 2-4. The helper scripts
under tools/ hard-code the original worktree path.

Implementation-Agent: Claude Opus 5 (subagent kabir-claude integration, mac-m5pro-kabir)
Commit-Executor: Claude Code direct Git
Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu
GoKubar added a commit that referenced this pull request Sep 13, 2026
Conflicts: bib.rs BibItem accessor; parser.rs Parsed fields/initialisers,
preamble dispatch and \usepackage (two braces git had shared were restored),
\bibliographystyle vs main's now-dead inline \cite body, and the \bibitem
label. Re-added #131's hyperref cite.<key> links inside citation() and #147's
pending_item template for bibliography markers.

Implementation-Agent: Claude Opus 5 (subagent kabir-claude integration, nixos-pc-kabir)
Commit-Executor: Claude Code direct Git
Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu
GoKubar added a commit that referenced this pull request Sep 13, 2026
…merges

Every stage 1 merge took main's side of the generated inventory and deferred
the regeneration to the end of the stage. Running
crates/compiler/scripts/render_supported_latex.sh picks up #131, #137, #144,
#147, #149, #150, #153, #155, #159, #163, #164, #166 and #169, so
supported_latex::generated_artifacts_are_current passes again.

The TeX Live-derived canonical denominator is deliberately untouched: this
machine has TeX Live 2025, not the MacTeX the committed file was pinned from.

Implementation-Agent: Claude Opus 5 (subagent kabir-claude integration, nixos-pc-kabir)
Commit-Executor: Claude Code direct Git
Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu
@d-q222

d-q222 commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

Superseded — landed via #380 (dd4a9809).

Verified on origin/main: natbib.rs, bib.rs and biblatex.rs are comprehensive (Entry, Options, NAT@citex, the "Citation \{}` undefined"diagnostic); tests atcrates/compiler/tests/natbib.rsandbiblatex.rs`.

One deliberate architectural difference: .bbl-as-external-input splicing is not on main — main uses its own bibtex-bst engine instead. Different approach, equivalent capability. Reopen if the splicing route is still wanted.


Closed by the Commander after a stale-draft screening pass that required evidence in both directions — a landing SHA to close, an empty grep to keep open. If this verdict is wrong, say so on issue #2 and I will reopen: an asymmetric bar has produced wrong calls here in both directions before.

@d-q222 d-q222 closed this Sep 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants