Skip to content

render-pipeline: typeset float bodies (tabulars drawn in floats) - #123

Closed
GoKubar wants to merge 3 commits into
mainfrom
agent/kabir-claude/float-tables
Closed

GoKubar wants to merge 3 commits into
mainfrom
agent/kabir-claude/float-tables

Conversation

@GoKubar

@GoKubar GoKubar commented Sep 13, 2026

Copy link
Copy Markdown
Contributor

Float bodies are now typeset like the main flow instead of only \includegraphics/\caption. Tabulars inside table/figure get their cells and rules drawn via table.rs, and the float box height is the typeset \vbox, so FT-063 placement stays exact.

Carries #117 (agent/kabir-claude/realworld-pagecounts, merged in) until it lands. #116 is already in main. Nothing under crates/render-pipeline/vendor changed; no compiler edits.

What changed (floats.rs, typeset/floatpage.rs, small typeset.rs/adapter.rs hooks)

  • The float body is parsed on its own. The preamble is kept, \caption/\includegraphics become \par, \label becomes spaces, and byte offsets are preserved. Each paragraph (text, tabular, \centering/center) is placed in source order with the captions and graphics.
  • Kernel rules followed:
    • \@parboxrestore: no indent, \parskip 0, \sloppy.
    • \@floatboxreset/\@setminipage: no \addvspace before the first paragraph, and \@endparenv adds \@topsepadd after center.
    • \@caption is \normalsize, with \abovecaptionskip/\belowcaptionskip, above or below the table.
    • Top-level \small/\footnotesize set the \baselineskip.
    • \vspace is honoured.
    • figure*/table* set at \textwidth. Only the width: spanning placement is still single-column.
  • Lists, display math, headings and tikzpicture inside floats are reported (float_content_unsupported). The old tabular height placeholder is gone.

Oracle

fixtures/float-tables: 14 MacTeX 2026 pdflatex fixtures, with the generator (make_fixtures.py, oracle.py, which reuses the tabular corpus extraction) and committed refs. tests/float_tables_oracle.rs checks words to 0.5 bp and rules to 0.1 bp, same page count, no float_* diagnostics. 14/14 pass, worst word 0.058 bp, worst rule 0.058 bp:
caption above, caption below, booktabs [t], tabular in a figure, two floats on a float page, a text paragraph in a figure, a \small table, a twocolumn table float, a center env, a \footnotesize [b] table with vertical rules, \vspace, a demo graphic above a tabular, table*, and a long wrapped caption (10pt).

Gates

  • floats_oracle 10/10.
  • tabular_oracle unchanged (45 passing).
  • page_frame passes.
  • cargo test --release (render-pipeline) green.
  • Real-world corpus compared against this branch minus the commit: hw1, hw2, cv, input-bibliography, lecture-notes, letter, math-sheet and unicode-accents are byte-identical. article-twocolumn stays at 2 pages (cv at 1) and now draws its booktabs table: 3 more rules, no float warning.

Known, outside this PR

In a narrow twocolumn column, a main-flow paragraph breaks differently from pdflatex. This came up while writing fixture 08, whose text was then shortened.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu

GoKubar and others added 3 commits September 13, 2026 06:23
…, float bodies)

article-twocolumn rendered 1 page (pdflatex 2) and cv 2 pages (pdflatex 1).

cv: enumitem `\begin{itemize}[nosep,...]` keys were never read; only
`\setlist` reached `list_seps`, so every item kept article's `\itemsep`/
`\parsep`/`\topsep`. The list's own `\begin` options now apply after
`\setlist` (`nosep` zeroes all four skips, `noitemsep` `\itemsep`/`\parsep`,
explicit keys as before; a shortlabels template is not read as keys).

article-twocolumn:
- `\maketitle` in a two-column article is `\twocolumn[\@maketitle]`
  (`\@topnewpage`): the title parts are now set at `\textwidth` above both
  columns of page 1, whose `\@colht` is `\textheight` less the box
  (`\null\vskip2em` title `\vskip1.5em` authors `\vskip1em` date
  `\vskip1.5em`, `\LARGE`/`\large` baselineskips). The adapter marks the
  lowered title paragraphs (`Doc::title_parts`); the page builder and float
  placer take a per-column height (`break_pages_cols`, `paginate`'s
  `first_colht`), and page-1 lines and float items are shifted below the box.
- two-column `abstract` is article's `\section*{\abstractname}`.
- graphicx `demo`: `\includegraphics` is a black rule of the requested width
  and height (150pt x 100pt default), no file read, no image_unavailable.
- a `tabular` inside a float keeps its box height (struts x `\arraystretch`,
  `\hline`, booktabs rules, `[c]` on the axis) from the compiler's tabular
  model; cells/rules are still not painted (reported).

Result (pdflatex MacTeX 2026 oracle): article-twocolumn 2 pages, title
baseline 95.8 vs 95.9pt, first author row 124.7 vs 124.8pt, page 2 last line
matches; cv 1 page, first/last line match. hw1, hw2, input-bibliography,
lecture-notes, letter, math-sheet, unicode-accents display lists
byte-identical to a630863. cargo test --release green (page_frame included).

Remaining article-twocolumn page-1 offset (+12.7pt, one line per column) is
the compiler's one-author-per-line `\and` (pdflatex: side-by-side tabulars)
plus unsupported `\TeX`/`\LaTeX` text changing line breaks.

Implementation-Agent: Claude Opus 5 (subagent kabir-claude realworld page counts, mac-m5pro-kabir)
Commit-Executor: Claude Code direct Git
Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu
…ecounts' into agent/kabir-claude/float-tables
…izes)

A float body is now set like the main flow instead of only
\includegraphics/\caption: the body bytes are parsed on their own (preamble
kept; \caption/\includegraphics become \par, \label spaces, offsets kept)
and every paragraph (text, tabular via table.rs with cells and rules
painted, \centering/center) is placed in the float's \vbox in source order
with the captions and graphics:

- \@parboxrestore: no \parindent, \parskip 0, \sloppy (captions too);
  \@floatboxreset \normalsize + \@setminipage: \addvspace does nothing until
  the first paragraph or caption, so a leading center adds no \topsep while
  \end{center} adds \@topsepadd.
- \@caption is \normalsize with \abovecaptionskip before and
  \belowcaptionskip after, above or below the table.
- top-level \small/\footnotesize/... set the \baselineskip of what follows;
  paragraphs use their own size's \baselineskip.
- \vspace before a paragraph; figure*/table* use \textwidth as \hsize.
- the adapter's environment skips are kept only where the float body itself
  holds \begin/\end of a paragraph-shape environment (in the isolated body
  its gap scan reached the preamble's \begin{document}).
- lists, display math, headings and tikzpicture in floats are reported
  (float_content_unsupported) instead of the old tabular height placeholder.

Oracle: fixtures/float-tables (14 pdflatex MacTeX 2026 fixtures, generator
make_fixtures.py + oracle.py reusing the tabular corpus extraction);
tests/float_tables_oracle.rs: 14/14 within 0.5 bp words, 0.1 bp rules.

Implementation-Agent: Claude Opus 5 (subagent kabir-claude float tables, mac-m5pro-kabir)
Commit-Executor: Claude Code direct Git
Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu
@GoKubar

GoKubar commented Sep 13, 2026

Copy link
Copy Markdown
Contributor Author

Superseded by #135: the float-tables and realworld-pagecounts work of this PR, rebased onto main 85ec30c keeping #122's \maketitle design (break_pages_shortened, Block::Title), with floats threaded on top and the float-bodies work folded in. Please review/merge #135 instead; this PR can be closed.

@GoKubar

GoKubar commented Sep 15, 2026

Copy link
Copy Markdown
Contributor Author

Closing as superseded — the work is already on main.

Replacement: superseded by #135, which itself landed as b6752e7 (#357) and e3fa43e (#382)

Closed by the integration lane while clearing a 219-PR backlog (112 of them drafts). If this is wrong, reopen it and tell me — I would rather be corrected than leave stale work buried.

— orchestrator-astra (Commander)

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.

1 participant