Repository navigation
render-pipeline: compile a float body's tikzpicture from the unmasked source (#884) - #890
Merged
Merged
Conversation
… source (#884) A `tikzpicture` inside a `figure`/`table` rendered nothing: the float environments are blanked to spaces before the compiler parses the document (`floats::mask`), and `typeset::picture_block` compiled the picture from those masked `texts`, so TikZ saw only spaces -- no nodes, no paths, zero height -- and the caption moved up by the picture's height. `typeset::Context` now carries the documents as read (`sources`, set by `render_windowed` through `Context::set_sources` and handed to the three sub-contexts); `picture_block` compiles from them. `texts` is unchanged for everything else. Measured against pdflatex (pdfTeX 1.40.29, TeX Live 2026; bp from page top) on the issue's repro without its trailing inline picture: NODEA 258.939/157.103 vs 258.939/157.047, caption 274.961/204.135 vs 274.961/204.107 -- within 0.06 bp. With the inline `INLINEC` picture the whole page below the first line is 3.85 bp high, which is that picture's paragraph-mode line height (#866), untouched here. New test `tests/float_tikzpicture.rs` (fails on main: no NODEA glyph run, caption at 168.64); `cargo test` in crates/render-pipeline: 636 passed. 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
Member
Author
|
Release evidence: |
jay3332
added a commit
that referenced
this pull request
Sep 18, 2026
…#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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #884.
Cause
Float environments are blanked to spaces before the compiler parses the document (
floats::mask), and the typesetContextonly ever held those maskedtexts. A float body'stikzpicturereachestypeset::picture_blockas aBlock::Picturewith the right span (the float-body re-parse infloats::body_blocksfinds it in the isolated run), butpicture_blockcompiled the picture fromself.texts[document]— i.e. from the spaces — so TikZ produced an empty picture: no nodes, no paths, zero height. The caption then moved up by the picture's height.\includegraphicsin a float never re-reads bytes (its box comes fromfloats::prepare), which is why #868's float case was byte-identical.Fix
typeset::Contextgets asourcesslice (the documents as read, before the float and multicol masks), set byrender_windowedthroughContext::set_sourcesand propagated to the three sub-contexts (top_material_box,floatpage::build_wide_box,multicol::paginate).picture_blockcompiles fromsources. Nothing else readssources;textsis unchanged for everything else (fence recovery,\left/\right, package detection).Measured (bp from page top,
tools/visual-oracle/pdftext.py; oracle/Library/TeX/texbin/pdflatex, pdfTeX 1.40.29 / TeX Live 2026, measurement only)Issue repro (float + a second
tikzpicturein the following paragraph):NODEANODEBFigure 1: CapINLINECBefore.The remaining 3.85 bp on every line from
Before.down is theINLINECrow (#866, not this PR): pdflatex keeps that picture in the first paragraph's line, which raises the line by the node's height above\topskip, shifting the float and everything after it by the same amount. FlashTeX still starts a new line for it; that behaviour is untouched here.Same document without the trailing
INLINECpicture, so the float is measured on its own:Before.NODEANODEBFigure 1: CapNode text and the caption are within 0.06 bp of pdflatex (tolerance 0.5 bp). The
\centeringis honoured (x exact). Thetikz_display_list_onlywarning is unchanged (paths are display-list-v2 items only).Tests
crates/render-pipeline/tests/float_tikzpicture.rs: the node glyph runs are present at the oracle's x/baseline (±0.5 bp), the caption sits below them by more than a line, the\drawand node border are path items, and the same picture outside a float still renders. The first test fails on main (no glyph run "NODEA", caption at 168.64).cd crates/render-pipeline && cargo test: green (see report).🤖 Generated with Claude Code
https://claude.ai/code/session_01Y1nAv4pEnmMYXgteBoadHn