Repository navigation
feat(pdf-engine): a citation lands on its entry by the paper's own key; an entry's environment read inside it - #702
Conversation
…y, the geometry its check The source reader keeps each \bibitem's key with the entry's first unit where the argument is characters only (no control sequence, group, comment or active character); the instrument carries it (InstrumentUnit.key, not in the bundle). A destination whose name equals `cite.` and one unit's key byte for byte (or chapterbib's `@-<n>` after it) lands on that entry's one located member; where the edge reading names another member or the entry begins on another page it is refused (`key`); a name no one unit's key reads keeps the point's rule. The lab's record counts the landings by key, the ones the point's rule lands elsewhere, the refusals for the key and the keys against the citations' names; the gate fails a citation landed elsewhere than on its key's entry. The compile key moves (latex-front.ts); no unit, unit id, part or version. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rt of it; a key read past its comment
An entry is one unit from its \bibitem to the next: an environment written in it, of none of the kinds the walk reads apart
(a table, a picture, a float, one skipped), is a pair round its body in the entry's unit. apacite writes an entry's authors in
APACrefauthors and the rest in field commands of its own: read as a unit of its own, the entry was cut after its authors and the
rest was no unit at all (its ink an ink unit kept as the original). The key is read with its comments out as TeX takes them
(apacite writes `{%` and the key on the next line). The units of apacite's and Springer Nature's entries move: PIPELINE moves
at merge.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… today's recorded serialize is handed the unit it knew The units golden of the sample hashes the source reader's units, which now carry each entry's key (the bundle's units and every wire unchanged: their goldens hold). Today's serialize was recorded with a source unit of no key, a field no wire reads: the case hands it the unit without it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ed over the 245 and the 599 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ted lines, out of the walk; the point's rule named so The walk asks one function whether an environment is read inside the unit it stands in (a tabular of one column nested in a cell, or an environment written in a bibliography's entry), so that it stays the length it was. The comments name the point's rule as such. No behaviour moves. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…, and an entry's environment read inside it, with its reason Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@codex review |
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the
|
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. Bravo. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
| const argsEnd = envArgs(s, afterBegin, bodyEnd, env, ctx).end | ||
| const id = b.open(s.slice(i, argsEnd), i) | ||
| walk(s, argsEnd, bodyEnd, b, ctx) |
There was a problem hiding this comment.
🟡 Untranslated titles in bibliography annotations
When a bibliography entry contains a theorem-style remark, entryEnvironment leaves its optional title untranslated. It bypasses the theorem title handling that previously extracted the title as a heading.
Learn more
The usual environment walker extracts optional theorem titles into heading units and reads the body as a theorem. The bibliography shortcut takes only envArgs(...).end, so it puts the optional title into the opening source rather than extracting a unit for it. The original title stays in the PDF, but the translation pipeline no longer receives it as text.
Example: With \newtheorem{remark}{Remark}, a bibliography entry containing \begin{remark}[Limitations of the study] previously emitted a heading unit for “Limitations of the study.” On this branch the phrase appears only in the opening source of the reference unit.
Recommended fix: Keep theorem-style environments on the existing environment path. Add a bibliography fixture with an optional theorem title alongside the inline apacite fixture.
Was this helpful? React with 👍 or 👎 to provide feedback.
There was a problem hiding this comment.
Real. Fixed in 0e35873, red first: a theorem-style environment written inside a bibliography entry keeps its own reading, so its optional title is a heading unit as it is anywhere else, and the entry is still read whole around it.
| const rest = name.slice('cite.'.length) | ||
| const holders = new Set(keyed.get(rest) ?? []) | ||
| const unit = /^(.*)@-(\d+)$/.exec(rest) | ||
| if (unit) for (const i of keyed.get(unit[1]!) ?? []) holders.add(i) | ||
| if (holders.size !== 1) return null |
There was a problem hiding this comment.
🔍 Chapter suffix matching lacks package context
entryOfName interprets @-<n> as a chapter suffix even outside chapterbib. The corpus gate repeats that interpretation. Add compiled fixtures for a chapterbib citation and a literal key ending in @-<n>.
Was this helpful? React with 👍 or 👎 to provide feedback.
There was a problem hiding this comment.
Real: @-<n> was read as chapterbib's suffix with nothing saying chapterbib was in use, and it could have named another entry's key. Fixed in 0e35873, red first: a citation's name is its key's only where it is cite. and the key exactly, byte for byte; the suffixed form is not read at all (no citation of the corpus uses it, and chapterbib's bibliographies are files the reader does not read).
| describe('an environment written in an entry is part of it: the entry one unit', () => { | ||
| it("apacite's entry: its authors and the rest one unit, the environment a pair round the authors, the key its own", () => { | ||
| const units = entriesOf({ 'main.tex': doc(`${APA('doe2020', 'Doe', 'A Title of Ours')}\n${APA('roe2021', 'Roe', 'Another Title')}`) }) | ||
| expect(units.map((u) => u.key)).toEqual(['doe2020', 'roe2021']) | ||
| const [a] = units | ||
| const t = textOf(a!) | ||
| expect(t).toMatch(/^<ph:\\APACinsertmetastar[^>]*><open:\\begin\{APACrefauthors\}/) | ||
| expect(t).toContain('Doe, J') | ||
| expect(t).toContain('<close:\\end{APACrefauthors}') | ||
| expect(t).toContain('APACrefatitle') | ||
| expect(t).toContain('APACjournalVolNumPages') |
There was a problem hiding this comment.
There was a problem hiding this comment.
Adopted in 0e35873: an end-to-end TeX test in the pinned image compiles an apacite document with the marks and checks that the authors, the title and the venue of an entry are located as one entry; it is red at the base of this pull request.
…ion's name is its key's only where it is `cite.` and the key exactly The review of #702: a theorem written in a bibliography entry stays on the walk's theorem path, its title a heading unit of its own (an entry's environment of the theorem kind is read apart, as a table or a float is). A name that is a key with more after it (chapterbib's `@-<n>`, or a key of its own ending so) is no key's: the entry its whole name keys may be one no unit holds, and the landing would have named another. Over the regression corpus no citation is named with a suffix and no theorem stands in an entry: nothing moves there. An end-to-end TeX test: an apacite entry's unit owns its authors', title's and journal's glyphs on B (red on the line: the unit owned the authors alone). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Rules gate: passedModel tier of the layer gate on 32 outputs of 7 targets, The rule set changes no target. No output for zh-TW, pt, it, nl, pl, tr, id, ms, cs, sv, uk, bg: their rules are not measured here. de: 5 outputs, no measure moved
es: 4 outputs, no measure moved
fr: 4 outputs, no measure moved
ja: 4 outputs, no measure moved
ko: 4 outputs, no measure moved
ru: 4 outputs, no measure moved
zh: 7 outputs, no measure moved
The links open the lab on a machine that has the fixtures. No page and no text of a paper is shown here: the papers are under arXiv's licence. |
|
@codex review |
|
Codex Review: Didn't find any major issues. Nice work! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
…g's disagreement is counted, not a refusal The lead's ruling on the eye-read sheets: wherever the edge reading and the entry's key disagreed, the edge had named the label of the entry above (an anchor raised past it) or a label set apart from its entry, and the key named the entry cited. A citation whose key one located unit holds lands on it whatever the edge names; the edge's member is counted (Landing.byKey.edge, the lab's `keyEdge`). The refusal `key` stays for the one contradiction: the entry beginning on another page than the destination's. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@codex review |
|
Codex Review: Didn't find any major issues. Keep it up! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
…he entry's unit, each entry's key kept with it The units of the papers whose entries hold an environment move (apacite's authors, Springer Nature's entry environments). The sample's bundle: its versions alone move (its units are the line's: the bundle units' golden holds), so its `versions.pipeline` is written; the goldens recorded again (the bundle's hash, the unit cut's version line: the cut itself unchanged). LAYOUT 48, TRANSLATE 11 and FORMAT 1 stay. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@codex review |
|
Codex Review: Didn't find any major issues. Keep it up! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
What
A citation's destination is named by hyperref after the paper's own key:
cite.<key>, the key of the entry's\bibitem{key}. The source reader now keeps that key with the entry's first unit, and a citation lands on its entry by that identity; the point's geometry, which decided alone before, becomes its check (docs/PDF-READER.md §20.3).And a bibliography entry is read whole where its style writes an environment inside it: apacite writes an entry's authors in
APACrefauthorsand the rest in field commands of its own, so the entry was cut after its authors and the rest was no unit at all (§19.13).Why
A citation's preview shows the reference's own text, and the entry it shows must be the one cited. Over the regression corpus, half of the reference landings were stated on their name's kind alone, nothing confirming the member; reading the landings by key shows the point's rule had been landing a share of citations on the entry above (a raised anchor past the last line of the entry before it) or on an entry of the other column, some of them confirmed by the edge reading.
The rule
latex-front.tsbibKeyOf): the\bibitem's argument, kept on the entry's first unit where it is characters only as the source reader reads it (its comments out as TeX takes them; no control sequence, no group, no active character).InstrumentUnit.keycarries it; the bundle does not (Unitunchanged).cite.<key>exactly (hyperref's\@bibitemand\@lbibitem,cite.#1\@extra@b@citeb; natbib's\NAT@anchorthrough hyperref's\hyper@natanchorstart; multibib and bibunits leave hyperref's own). Equality byte for byte, case kept: no table of characters, no normalising. A name that is a key with more after it is no key's (chapterbib's@-<n>, bibtopic's unit number: their bibliographies are other jobs'.bblfiles, which the source reader does not read; over the corpus no citation is named so).targets.tsentryOfName,byKeyOf): a name one unit's key reads, the unit having one located member, lands on that member as a reference (its box judged whole as any reference's), whatever the edge reading names: the key decides (the maintainer's ruling, on the eye-read sheets). The edge's disagreement is counted (Landing.byKey.edge, the lab'skeyEdge), never a refusal. Refused (key, never stated) only where the entry begins on another page than the destination's point. A name no unit's key reads, or two do, or whose unit is not located: the point's rule, as before.entryEnvironment): an environment written in an entry, of none of the kinds the walk reads apart (a table, a picture, a float, a theorem, one skipped), is a pair round its body in the entry's unit. Over both corpora the environments standing in entries are apacite's (APACrefauthors,APACrefURL,APACrefDOI) and Springer Nature's (barticle,bbook,bchapter,botherref), none setting a paragraph.The gate
link-targets.mjsreads each unit's key (run.mjsfrom the located units) and counts the landings by proof: by key, proved by the edge, by the kind alone. A citation landed elsewhere than on the entry its key names fails the gate. Reported beside it, never rules: each landing by key the point's rule lands elsewhere (keyGeometry), each refusal for the key with both readings' members (keyRefused), the keys taken against the citations' names.Tests
Red first: the source reader's key (
packages/engine/tests/front/entry-keys.test.ts: 7, then 2 for a comment in the argument and the entry's environment), the landing (packages/engine/tests/targets.test.ts: 5 red; its fallback cases describe the rule before and pass on both sides), the record and the gate (tests/lab/floats-gate.test.ts: 7). A TeX test in the pinned image (tests/pdf-reader/entry-keys.test.ts): the instrument's units state their keys, and the paper's own compile namescite.<key>for keys with_,:,+,/,.,-, both cases, with hyperref alone and with natbib (red on the instrument's keys; its reading of the names was first wrong in the test itself, then read as the engine reads them, through the links). Two existing tests moved with the new field: the source units' golden of the sample (the bundle's units and every wire hold), and a case handing a source unit to a recorded answer of the reader before the cut-over (handed the unit without the key, which no wire reads).Proof
Each corpus against the line (
rebuild/v2e5ffc2d), every compile reused where the marked TeX is the line's (the 245's made again at the line first: none was kept at its marks).245 papers: 242 byte for byte the line's (every object, prepare and located dump) but the heads' reference targets; the marked TeX moved in 3 (two apacite papers, one Springer Nature paper whose targets are unchanged). The gate passes on both sides.
599 papers: 534 byte for byte but the heads' reference targets; the marked TeX moved in 7 (one apacite paper, six Springer Nature papers, their targets unchanged). The gate passes.
keyIdentity against geometry: read by eye, 100 rows over both corpora (the landings by key the point's rule put elsewhere, and the edge's disagreements): in every row the entry the key names is the one the link cites; the edge had named the label of the entry above (an anchor raised past it) or a label set apart from its entry, the point's rule the entry above or one of the other column.
Entries cut after their authors: 81 in 3 papers and 54 in 6, now 19 in 2 and 18 in 6. What is left is an entry whose last line holds only what follows its last word (a kept number, a URL): its end mark, set after that word, leaves that line to no unit (the marking's; not changed here).
The display gate: its 24 pairs' papers are all among the 245 that are byte for byte the line's but the heads' targets, which it does not draw.
The targets phase: 11 ms a paper at the median, 37 at the 95th percentile.
Review round (on 844ea27)
Codex: no major issues. A second reviewer's three points, all adopted, each with a test red first: a theorem written in an entry keeps its own reading (its title a heading unit); a name that is a key with more after it is no key's (
cite.<key>exactly; a key ending in@-<n>of its own would have been read as another's); an end-to-end TeX test of an apacite entry (its unit owns its authors', title's and journal's glyphs on B; red on the line, where it owned the authors alone). Neither code change moves the corpora: no citation over either is named with a suffix, and no theorem stands in an entry.The key decides (after the review round)
The maintainer read the refusals' sheet and ruled that the key decides: the edge reading's disagreement is counted, not a refusal; the refusal
keystays for an entry on another page. A test red first (the label of the entry above at the destination's x: the key's entry lands). The heads over both corpora again: nothing but the heads' reference targets moves (the table above).Versions
The compile key moves (
latex-front.tsis on the compile side): every paper compiles once more, in the same release as the marks' change before it. The units of the papers whose entries hold an environment move: PIPELINE 130 at merge. LAYOUT stays (the layout file holds unit ids, and no unit of the gate pack's papers moves); TRANSLATE and FORMAT stay; the bundle'sUnitand the head'sTargetare unchanged.Not here
Biblatex's entries (units made from the page's ink) carry no key: giving them one means writing the entry's key and its refsection at the compile's point before each entry (
bi<n>, biblatex's per-entry hook), a change of the marks' TeX, and readingcite.<refsection>@<key>. An entry's last line holding only its trailing placeholders. Keys whose name the PDF writes in another encoding (one over the 599) or with a byte after it (one): they keep the point's rule.🤖 Generated with Claude Code