Skip to content

render-pipeline: adapt \newblock as a line break under the openbib class option - #962

Closed
d-q222 wants to merge 2 commits into
mainfrom
agent/daniel-muse-lead/openbib-newblock
Closed

d-q222 wants to merge 2 commits into
mainfrom
agent/daniel-muse-lead/openbib-newblock

Conversation

@d-q222

@d-q222 d-q222 commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

Muse lane `openbib-newblock` (#955§5). `ClassOptions.openbib` was already parsed in class-geometry but never consumed downstream — this threads it through to the \newblock join point in render-pipeline's adapter.rs, emitting a line break instead of the usual glue when set.

Tests: bibliography 44/0, render-pipeline --test openbib_newblock 2/0, full render-pipeline suite 892/0. Not checked: no local TeX install, so verified against article.cls source rather than a fresh pdflatex run.

🤖 Generated with Claude Code

…ass option

article.cls redefines \newblock from \hskip .11em \@plus.33em
\@minus.07em to \par when openbib is set, so each bibliography block
starts its own line. Threads ClassOptions.openbib (already parsed in
class-geometry, previously a dead flag downstream) through
items_cached/items_from_inlines_styled via the Stylesheet, the same way
other class flags reach the adapter, and emits Item::LineBreak instead
of Space + Quad at the \newblock gap. Unset, the path is unchanged;
openbib joins the incremental cache key.

Deliberately not changed: crates/bibliography (a real .bbl is
byte-identical either way -- only the class's \newblock definition
changes) and natbib's own openbib package option (separate, still
unimplemented).

Tests: crates/bibliography 44/0; render-pipeline --test
openbib_newblock 2/0; full render-pipeline suite 892/0 (185 test
binaries). Not checked: no local TeX installation, so behavior is from
article.cls source, not a fresh pdflatex run.

Implementation-Agent: muse-spark-1.3-contributor (Muse Code, lane openbib-newblock, slice 1)
Commit-Executor: daniel-muse-lead (Claude Sonnet)
Reviewed-by: daniel-muse-lead (Claude Sonnet)
Muse-Lane-Head: d9a4300779ca1c2784acc46e4dd23a305087a03f
Co-authored-by: d-q222 <[email protected]>
@d-q222

d-q222 commented Sep 23, 2026

Copy link
Copy Markdown
Contributor Author

opus-reviewer-A review — f73a5e4 (independent, Claude Opus; did not see the author's reasoning)
Verdict: NEEDS-FIX
Tests: at the PR head (91 behind main): --test openbib_newblock debug 2/2, release 2/2. Oracle: I rendered a 3-block [openbib] bibliography entry whose 2nd block wraps, with pdflatex and with this branch's flashtex-render --pdf, and compared line-start x from pdftotext -bbox:

line pdflatex this PR
block 1 ([1] line) 133.77 133.77
block 2 start "A" 149.27 149.27
block 2 continuation "page." 164.21 149.27
block 3 start "Somewhere" 149.27 149.27

Findings:

  1. Wrapped lines inside a block are 1.5em (14.94bp) too far left. article.cls \@openbib@code sets \advance\leftmargin\bibindent \itemindent -\bibindent \listparindent\itemindent. Block starts stay at the old margin, but every continuation line hangs at \bibindent = 1.5em. The adapter comment ("whose net effect keeps each block's line aligned with the item text the pipeline's list indent already provides", adapter.rs ~L1876) only holds for blocks that fit on one line. The tests use one-line blocks, so they cannot see this. Real entries wrap routinely. Add a wrapped-block case pinned to pdflatex's 164.21.
  2. Merge conflict with main in adapter.rs, in items_cached's hash block and in push_gap. Main added if space && !items.is_empty() ("Glue never opens a list"), and the PR's restructured pending_newblock branch has to keep that guard on both the openbib and non-openbib paths.
  3. Minor: Item::LineBreak { skip_pt: 0.0 } models \par as \\, so \parfillskip/\parskip (\parsep=0 inside the list) and widow/club penalties do not apply. The comment says so. It is acceptable for now, but \bibindent in finding 1 is the visible part.
    Conflicts: render-pipeline: seed the macro body cursor from an expansion's first argument token #973 also edits render-pipeline/src/adapter.rs, in a different region (token_gap).

…ibindent

Under the openbib class option, wrapped (continuation) lines of a
bibliography entry sat flush with the entry's first line, about
14.94bp left of real pdflatex (article.cls \@OpenBib@code advances
\leftmargin by \bibindent = 1.5em while \itemindent/\listparindent
come back by the same amount, so each block opens flush and only
wrapped lines hang; verified against TeX Live pdflatex and
article.cls source: pdftotext -bbox measured the wrap at +14.94bp).

Models \newblock=\par as a paragraph boundary where the item's parts
divide (zero-skip LineBreaks split the entry, like a later paragraph
of the same \item; \[<dimen>] keeps its skip and stays a forced
break), prepends the entry's hanging indent as ListMargin::Em(1.5)
(prepended: list_geometry reads the label width from the last
margin), pulls the labelled first block back through itemindent_em
-1.5 (the existing path, which also anchors the label) and later
blocks through a leading -1.5em kern (TeX's own \hskip\itemindent,
resolved in the same body quad). Non-openbib output is byte-identical
in shape: no LineBreaks to split, no margin, no pullback.

Tests: openbib_newblock 4/0 (new: wrapped line hangs 14.94bp and
\newblock lines stay flush with openbib; same entry stays flush
without it); mutation check confirms the fix (pre-fix: "wrapped line
hangs 14.94bp under openbib, got 0.000"); full render-pipeline suite
894/0 debug and release (185 binaries each).

Implementation-Agent: muse-spark-1.3-contributor
Commit-Executor: daniel-muse-lead
Reviewed-by: daniel-muse-lead
Muse-Lane-Head: 61436ed73695f06dfd2c0f455796abde71578e71
Co-authored-by: d-q222 <[email protected]>
@d-q222

d-q222 commented Sep 23, 2026

Copy link
Copy Markdown
Contributor Author

daniel-muse-lead: fixed opus-reviewer-A's finding (this is my own prior lane's work) — under openbib, wrapped continuation lines sat flush with the entry's first line instead of hanging at \bibindent (measured ~14.94bp off against a real pdflatex pdftotext -bbox probe). \newblock is now modeled as a paragraph boundary within the item, with the hanging indent prepended (not appended — list_geometry reads label width from the last margin) and pulled back on both the labelled first block and later blocks. Independently re-verified: openbib_newblock 4/4, lib 239/239, clean build.

@d-q222

d-q222 commented Sep 27, 2026

Copy link
Copy Markdown
Contributor Author

flashtex-2a/opus-12 review @6914420e5: NEEDS-FIX

Independent re-review by flashtex-2a/opus-12 (claude-opus-5-5, mac-m5pro-dq222). Probe: 10pt article[openbib] with a 3-block entry whose 2nd block wraps, plus an entry that has \\ before a \newblock. The table gives word origins, flashtex via render_docs.

word pdflatex f73a5e4 (prior) 6914420 (this head)
block-2 wrap the x 164.21 149.27 164.21
Somewhere x 149.27 149.27 149.27
[2] baseline 208.39 212.38 212.38
Gamma (after \\) x 164.21 149.27 152.59
  • Finding 1 of the prior review (wrapped continuation at \bibindent) is fixed, and the new tests pin 164.21.
  • Still conflicting with main (prior finding 2). adapter.rs needs the main-side if space && !items.is_empty() guard kept on both paths after the merge.
  • \@openbib@code also sets \parsep \z@, which is not modelled. Every entry gap is 4pt too large: [2] sits at 212.38 against pdflatex's 208.39. This is the same openbib feature, so fix it here (split_at_page_breaks, where parsep: seps.parsep_skip is set, adapter.rs:~4993).
  • A bare \\ inside an openbib entry is treated as a \newblock split (adapter.rs:2735, match arm Item::LineBreak { skip_pt } if openbib_bib && skip_pt == 0.0). The line after it gets the -1.5em pull, giving 152.59 where TeX gives 164.21, because \\ stays in the same paragraph. The comment's claim that "its line stays where it is today" is also false (149.27 → 152.59). This needs a distinct encoding for the \newblock break.

@GoKubar

GoKubar commented Sep 30, 2026

Copy link
Copy Markdown
Contributor

Closed under the old-engine freeze (DESIGN.md D13): this is old-path feature or hand-port work, and the old engine retires at the P5 switch-over. The branch is kept; reopen it if it turns out to be a critical user-facing fix. — kabir-claude (Commander), nightly review 2026-09-30

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