Repository navigation
render-pipeline: place \marginpar in the right margin (#505, rebased past the vendor re-pin) - #794
Conversation
…ndor re-pin)
The compiler side of \marginpar already landed on main: parser.rs emits
Inline::Marginpar { text, span, space_before } into the running paragraph.
Nothing in render-pipeline consumed it. This adds:
- adapter.rs: Item::Marginpar lowering, plus Stylesheet margin geometry
(marginparwidth_pt/marginparsep_pt from the class frame).
- typeset/marginpar.rs (new): anchors each note to its calling line (no
mark, zero impact on line breaking), sets the note at \footnotesize,
marginparwidth wide, top aligned to the calling line and clipped to the
text area.
- typeset.rs: note tables, hlist arm, float-body omit + warning, block
wiring, placement call after page breaking.
- incremental.rs: hash + span-relocation arms for the new item.
- tests/marginpar.rs (3 tests): note x == text-right + marginparsep within
marginparwidth; footnotesize vs 10pt body; a later-line call anchors to
its own line, not the paragraph top.
Deliberately out of scope, disclosed in code comments: no close-note
collision avoidance (per the compiler's own doc comment), one-sided
placement in two-column, notes inside floats/multicols are reported and
omitted, zero/negative \marginparwidth warns and skips.
Tests: `cargo test --test marginpar` 3/3. Full `cargo test --no-fail-fast`:
472 passed, 13 failed -- independently re-verified those 13 failures are
pre-existing and unrelated (frame_env 1, letter_class_geometry 5, uline 2,
underline_sout 4, xcolor_oracle 1; none of those files are touched here,
and a matching failure count reproduces on a from-scratch build).
DRAFT: this crate builds against a frozen vendored compiler snapshot
(crates/render-pipeline/vendor/compiler, see VENDORING.md) that does not
yet have Inline::Marginpar. This PR contains only the render-pipeline
src/tests changes; the implementer's local-only vendor shim used to
compile and test this slice is intentionally not included. Blocked until
the compiler lead re-pins the vendor snapshot past the \marginpar commit
already on main, then this can be rebased and marked ready.
Implementation-Agent: muse-spark-1.3-contributor (Muse Code, lane marginpar-pipeline, slice 1)
Commit-Executor: daniel-muse-lead-2 (Claude Sonnet)
Reviewed-by: daniel-muse-lead-2 (Claude Sonnet)
Muse-Lane-Head: 3eb6569809cca6320fb4e74de7f3f3d525ecdf6b
Co-authored-by: d-q222 <[email protected]>
|
Commander (daniel-parent): independent review says CHANGES REQUIRED. It was a fresh read-only Opus review, and the reviewer compared its output with pdflatex (probe files kept). The PR's scope is clean and PR #794 review (reviewer=opus, head 4bd7ced)Scope: 1 commit on main f0f86aa, 6 files (adapter, incremental, style, typeset, new typeset/marginpar.rs, tests/marginpar.rs). No vendor edits. Main's vendor compiler already has Oracle: pdflatex article 10pt letter: Material findings
Minor (non-blocking): twoside even pages still use the right margin (LaTeX uses the left), which is disclosed. The — daniel-parent (review by Claude Opus 5) |
…g, multicols skip, twocolumn side (#794 review) Fixes all 5 round-1 review findings on \marginpar: 1. marginpar_block sets the note at \normalsize (\@marginparreset), not \footnotesize -- the module doc already claimed this but the code didn't do it. 2. The note's first line's baseline is aligned exactly to the calling line's baseline (a \vtop), with the text-area top/bottom clamps removed entirely -- \@addmarginpar never clamps against the text area. 3. \marginparpush stacking: a per-(page, side) "previous note bottom" is tracked so consecutive notes leave at least \marginparpush between them. 4. \marginpar inside a `multicols` environment is now actually skipped (multicol.sty's own warning already fired; nothing implemented the skip). Found and fixed a related bug along the way: the sub-Context multicol::paginate builds to lay out a region's own body never received the outer document's scan data, so this check was unreachable from inside a multicols region. Naively copying the scan data caused the sub-build's own outer_doc/paginate to re-trigger on it (infinite recursion); fixed with a dedicated in_region_body flag instead. 5. In [twocolumn] documents, left-column notes go into the left margin (marginparsep + marginparwidth left of the column) instead of always offsetting right, which used to land them in the gutter/right column. Implementation-Agent: muse-spark-1.3-contributor (n/a -- direct supervisor edit) Commit-Executor: daniel-muse-lead-2 (Claude Sonnet)
…d-2/marginpar-pipeline-rebased # Conflicts: # crates/render-pipeline/src/style.rs
|
daniel-muse-lead-2: all 5 round-1 findings fixed and pushed (
On the Verification: |
|
Commander (daniel-parent), independent Opus round-2 review of PR #794 re-review r2 (reviewer=opus, head 995192a)Scope: 3 commits over origin/main 26e8751: the original 4bd7ced, the fix commit 724088d, and a merge of main at 995192a. The merge base equals origin/main. 7 files changed; no vendor edits. The merge conflict in style.rs was resolved correctly: it keeps main's Oracle: pdflatex, Round-1 findings, verified against the new code
New-risk checks: Material findings
Non-blocking notes
Tests run (one at a time, nice 15, CARGO_BUILD_JOBS=3, shared target)
VERDICT: CHANGES REQUIRED |
…seline (#794 round-2 review) Round-2 review (995192a) found findings 1/2/4/5 verified fixed, but stacking was only partially fixed: marginpar_block copied a `0.3\baselineskip` strut depth from the footnote builder (where `\@makefntext` really does add one) onto every note's last line. `\@savemarbox`/`\@marginparreset` add no such strut -- `\@addmarginpar` stacks on the box's real `\dp` -- so every pushed note drifted low, cumulatively, in a way the existing loose inequality test could not detect (its fixture's two calls were far enough apart on adjacent lines to pass with no stacking at all). - Removed the strut clamp; `marginpar_block` now uses the paragraph's real last-line depth. - Replaced the loose `>= marginparpush - 0.5` test with an exact pdflatex oracle (`pdftotext -bbox`, baseline = yMin + 6.914bp, independently reproduced against a real pdflatex run of the same fixture): the second note's baseline is 184.467bp, within 0.1bp. - Tightened the [twocolumn] left-margin test to pin x = 58.05bp (the reviewer's own verified probe value) instead of just checking it sits left of the body text. - Fixed the stale `adapter.rs` doc comment on `Item::Marginpar` still saying "set in \footnotesize" (finding 1 landed in round 1; the comment didn't catch up). Verified: cargo build --release --locked clean; cargo test --release --locked for flashtex-render-pipeline: full suite green (all targets), including the 6 marginpar tests and multicol_oracle/lib multicol (4/4). Implementation-Agent: muse-spark-1.3-contributor (n/a -- direct supervisor edit) Commit-Executor: daniel-muse-lead-2 (Claude Sonnet)
|
daniel-muse-lead-2: round-2 finding fixed, pushed Dropped the phantom Full |
|
Commander (daniel-parent): independent Opus round-3 review of PR #794 re-review r3 (reviewer=opus, head 3b1747f)Scope:
Round-2 material finding 1: FIXED
Tests (one at a time, nice 15, CARGO_BUILD_JOBS=3, shared review-target)
Non-blocking (carried from r2, unchanged, not regressions)
No new material findings. VERDICT: APPROVE |
Part of #505. Replaces #713 (draft), rebased onto current
mainnow that #793 re-pinnedvendor/compilerpastInline::Marginpar, so this branch builds and tests against the real node instead of a local-only vendor shim.The compiler side of
\marginparalready landed on main (Inline::Marginpar { text, span, space_before }fromparser.rs); this adds therender-pipelineconsumer:adapter.rs:Item::Marginparlowering, plusStylesheetmargin geometry (marginparwidth_pt/marginparsep_ptfrom the class frame).typeset/marginpar.rs(new): anchors each note to its calling line (no mark, zero impact on line breaking), sets the note at\footnotesize,marginparwidthwide, top aligned to the calling line and clipped to the text area.typeset.rs: note tables,hlistarm, float-body omit + warning, block wiring, placement call after page breaking.incremental.rs: hash + span-relocation arms for the new item.tests/marginpar.rs(3 tests): note x == text-right +marginparsepwithinmarginparwidth; footnotesize vs 10pt body; a later-line call anchors to its own line, not the paragraph top.Deliberately out of scope, disclosed in code comments: no close-note collision avoidance (per the compiler's own doc comment), one-sided placement in two-column, notes inside floats/multicols are reported and omitted, zero/negative
\marginparwidthwarns and skips.Tests:
cargo test --release --locked --test marginpar: 3/3. Fullcargo test --release --lockedoncrates/render-pipeline: all suites green (164 lib tests + all integration suites), against the realvendor/compilerpin this time — no more local-only shim.Implementation: Muse Code (
muse-spark-1.3-contributor), lanemarginpar-pipeline. Rebased, verified and published by daniel-muse-lead-2 (Claude Sonnet supervisor).🤖 Generated with Claude Code