Repository navigation
render-pipeline: indent paragraph-initial tikzpictures (#857) - #866
Conversation
A tikzpicture that opens a paragraph sat 15pt left of pdflatex's placement: UnitKind::Picture/Block::Picture carried no indent or list-geometry context and picture_block hardcoded x = 0. Carry the paragraph path's own signals (initial/noindent/after_env/ theorem_item/list/caption/styled) into the picture units and blocks, and offset x by parindent_pt (or the list hanging indent, with the paragraph path's itemindent/description adjustments) in picture_block. Centered pictures are untouched. Implementation-Agent: muse-spark-1.3-contributor Commit-Executor: muse-spark-1.3-contributor
tikzpicture_becomes_paths_and_glyph_runs asserted left-margin placement with a one-sided bound that passed with the picture glued to the margin even when an indent was due. Lock the measured value with a comment saying so, and add pdflatex-oracle regression tests (article+tikz, 10pt; node-text xMin in bp): paragraph-initial 152.033, noindent 137.089, two consecutive 152.033/152.033, parindent=0pt 137.089, itemize hang 161.996, center 301.473 unchanged, plus text controls at 148.712/133.768 that must not move. Implementation-Agent: muse-spark-1.3-contributor Commit-Executor: muse-spark-1.3-contributor
The `engine performance` gate failed with "output changed in 6 place(s)". That is the intended effect of this PR: paragraph-initial tikzpictures now carry \parindent, so every tikz-heavy fixture renders 15pt to the right. Per crates/perf-bench/README.md, the timing checks only fire when meta.host_fingerprint matches the pinned reference host, which no public CI runner does -- so a failing engine-performance check means rendered output changed, not that anything got slower. The +281% timing lines in that log are cross-host noise and were never the failure. Re-recorded with merge_digests.py --case tikz-heavy, which is a diff tool rather than an accept-all: it compared 26 cases, touched the 1 named, and printed each old -> new. The six it changed are exactly the six CI listed: tikz-heavy.cold.reply 6eb062ab -> fa8304c2 tikz-heavy.export.pdf 2cbc0787 -> 842a6395 tikz-heavy.warm.delete-restore-line.v1 fbd44f14 -> 9b33fda1 tikz-heavy.warm.delete-restore-line.v2 26589d92 -> f034980b tikz-heavy.warm.type-paragraph.v1 1736053d -> 209aeb04 tikz-heavy.warm.type-paragraph.v2 e1b38ff9 -> 00d014dd Recorded from a --release build (debug and release can render differently, #667). No other case moved; `git diff --stat` shows the baseline as the only changed file. Commit-Executor: daniel-parent Co-authored-by: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz
jay3332
left a comment
There was a problem hiding this comment.
mac-claude-a verification: Read the full diff. crates/render-pipeline tikz_pipeline.rs: 7/7 passed, including the 6 new pdflatex-oracle tests. Reproduced issue #857's exact repro via CLI build of this branch vs oracle /Library/TeX/texbin/pdflatex (TeX Live 2026): AAA (paragraph-initial) x=152.033 bp, BBB (\noindent) x=137.089 bp — both match the oracle and the issue's table exactly (152.0 / 137.1).
Two things worth the Commander's attention, neither a blocker:
- This PR tightens a pre-existing test's assertion in
tikz_pipeline.rs(tikzpicture_becomes_paths_and_glyph_runs): the old bound was a loosemin_x >= 72bp("at the left margin"), now an exact(min_x_bp - 87.094).abs() <= 0.5. The PR's own comment explains the old bound "encoded the bug" (passed even when indented placement was wrong) — legitimate, but it is a changed expectation on a test that predates this PR. - The PR also updates
crates/perf-bench/baselines/linux-x86_64-ryzen7-7800x3d.json(re-recorded digests) since node-text geometry shifted. Not a vendor snapshot, so out of scope for that flag, but worth a sanity check that the new digests were regenerated from an actual run rather than hand-edited (diff shows only digest values changed, no accompanying regeneration log in the PR body).
No unwrap/expect added on data paths; picture_block's new indent math reuses existing list_geometry/text_params helpers rather than introducing new constants. No blockers found.
|
mac-claude-a verification (comment only): the PR's oracle table reproduces exactly on this Mac — AAA 152.033, BBB 137.089, Normal 148.712 bp, branch vs pdflatex TL2026 — measured with One gap, not covered by the six new tests: Mid-paragraph pictures are correctly excluded ( |
…#890 The previous re-record took tikz-heavy's digest from a run of the pre-rebase commit; #866 (paragraph-initial tikz indent) and #890 (tikz inside floats) changed that case's output. 685eaf426bbefc9b is what three local runs and CI's own run of e667cae produce. Implementation-Agent: Claude Code (mac-claude-a) Commit-Executor: git via Claude Code Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01Y1nAv4pEnmMYXgteBoadHn
Fixes #857. A
tikzpicturethat starts a paragraph missed\parindent, so every TikZ figure written the normal way — after a blank line — sat 15pt left of where pdflatex puts it.Why it needed this crate
A previous slice investigated and correctly stopped: the fix is not in
crates/compiler.UnitKind::Picturecarried only{document, picture, centered}with no indent or list geometry,Block::Picturelikewise, andpicture_blockhardcodedx = 0unless centered. It ruled out three compiler-only routes with reasons (a leading indent inline splits into a spurious empty paragraph; emitting no inlines deletes the picture; shifting spans breaks picture recognition) and handed over exact file:line targets.The fix
UnitKind::Picture/Block::Picturenow carry the paragraph path's own signals —initial(the picture opens its paragraph; whitespace-only runs before it don't count),after_env,theorem_item,list,caption,styled. The blocks stage computesindentfrom them, andpicture_blockoffsets x byparindent_ptwhen indented, else by the list hanging indent (with the paragraph path'sitemindent/descriptionadjustments). Thecenteredbranch is untouched; both call sites (main and float) pass the fields through.Oracle ground truth matched
\documentclass{article}+\usepackage{tikz}, 10pt, node-text xMin viapdftotext -bbox; tikz confirmed loaded:\noindentThe
\noindentand ordinary-text rows are the controls that pinned the diagnosis: with the indent explicitly suppressed both engines already agreed exactly, so nothing else about picture placement was wrong.It also un-encodes the bug in
crates/render-pipeline/tests/tikz_pipeline.rs, which had asserted left-margin placement — i.e. the old test was pinning the defect.Known divergence, pre-existing and out of scope
Two pictures with no blank line between them render at 152.033/152.033 (each on its own line) versus pdflatex's 152.033/170.297 (the second continues inline). Recorded, not fixed here.
crates/render-pipeline: 131 suites ok, 0 failed.This lands in
render-pipeline, which is live — no re-pin needed, it reaches users on merge.Implemented by a sandboxed Muse lane; reviewed and published by the Commander.
🤖 Generated with Claude Code