Repository navigation
render-pipeline: \twocolumn[\@maketitle] is \@topnewpage, and figure* is \@dbflt - #382
Merged
Merged
Conversation
On main a spanning title with floats on the page drew the full-width title
and then set the column material *inside* it: `let shift = if
floats.is_empty() { height } else { 0.0 }`, plus a warning saying the float
path did not shorten the columns. Removing the condition alone is not the
fix -- the shift and the shortening are one number and both have to reach
the float placer.
\@topnewpage (latex.ltx 20466-20505) boxes the optional argument at
\hsize\textwidth with a trailing \vskip -\dbltextfloatsep, so \ht\@currbox
is the material's natural height less \dbltextfloatsep; it then subtracts
\ht\@currbox + \dbltextfloatsep -- the natural height exactly -- from
\@ColhT, \vsize and \@colroom, and ends with \@floatplacement, which
recomputes \@toproom, \@botRooM and \@fpmin from that reduced \@ColhT.
\@combinedblfloats (21019) stacks the box, \vskip\dbltextfloatsep and the
two-column box in one \vbox to\textheight, so the columns start the same
natural height down that \@ColhT lost. Both columns of the page are
shortened, because \@outputdblcol reaches \@outputpage (\global\@ColhT
\textheight) only after the second one. Read off pdflatex's own \showoutput:
\vbox(686.56499) = \vbox(108.18784) + 12 - 12 + 20 + \hbox(558.37715).
So floatpage::paginate takes short_cols/short, Placer::set_colht drops
\@ColhT for those columns and restores \textheight afterwards, and a float's
graphics -- display-list items the placer had already put in page
coordinates, unlike its caption lines -- take the same shift as the column
they belong to. \@topnewpage's cap (\ht\@currbox > \textheight) and its
"Optional argument of \twocolumn too tall" case are reported, not guessed at.
\@makecol does not have two shapes, so floatpage no longer has two either:
every column is packed \vbox to\@ColhT through pagebuild::make_column, not
only a column carrying footnotes. That is what makes a \flushbottom column
(\if@twocolumn \sloppy\flushbottom\fi) stretch its glue instead of standing
at natural size; under \raggedbottom the \@textbottom fil keeps the natural
positions, so single-column documents are unchanged. make_column in turn
contributes \skip\footins, the \footnoterule and the notes only
\ifvoid\footins\else: without notes the \vskip-\@outputbox@depth lands right
after the body, so the body's last depth is outside \@ColhT. Those two were
worth 3.726bp and 0.485bp of drift per paragraph on the new fixtures.
fixtures/twocolumn-title (TeX Live 2025 on this Linux host, like
fixtures/float-notes): the title alone 852/852 words, with a [t] float on
page 1 957/957, with a float too large for the shortened column 1075/1075 --
all within 0.007bp, page counts exact. 04-title-figure-star is REPORTED, not
gated, until the next commit: figure*/table* still reach the placer as
single-column floats.
flashtex-render vs each fixture's committed reference.pdf, page-1 median dy
of matched words (control built in the same target directory, from
cc3232b): article-twocolumn +37.057bp -> +4.257bp, page 2 -241.570 ->
+0.010; conf-paper -118.696bp -> -0.000 (0 of 79 lines over 0.1pt), page 2
-246.718 -> -0.001. conf-paper's 2.25pt overfull_vbox on page 1 is gone, and
so are plain-article's and thesis-chapter's; article-twocolumn's
unsupported_block warning is gone. No other corpus fixture changes status,
page count or diagnostics.
Gates: amsmath 59/59, tabular 106/106, float-notes 10/10, footnotes 35/39
(unchanged), HW1 and HW2 3 pages each via flashtex-render with no error and
no overfull, render-pipeline suite green.
Implementation-Agent: engine-engineer (Claude Opus 5), linux-primary
Commit-Executor: engine-engineer (Claude Opus 5), direct git under the
observed-Cursor-limit fallback
Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu
conf-paper was a page short of pdflatex and the named cause was its figure*: floats.rs mapped `figure*` to a plain FloatKind::Figure, so \linewidth inside it resolved to \columnwidth (243.911pt) where pdflatex uses \textwidth (505.89pt), and the float was then placed in a column. Widening the box alone would have put a 505pt box in a 243pt column; the width and the placement are the same mechanism, and it is the one \@topnewpage already uses -- the page's spanning top area. \@float is \@dbflt \if@twocolumn (latex.ltx 17419). \@xdblfloat (17555) sets \hsize\textwidth \linewidth\textwidth, defaults the placement to [tp] rather than [tbp], and leaves the box depth at 1sp. That depth is the whole dispatch: \@testwrongwidth (21187) compares \dp\@currbox with \f@depth, which is \z@ everywhere except inside \@dblfloatplacement, so a full-width float is refused by \@addtocurcol, \@addtonextcol and \@startcolumn's \@tryfcolumn, and only \@addtodblcol (21280) takes it. That routine runs from \@startdblcolumn, after \@outputpage restored \global\@ColhT\textheight -- so it is once per page, never the page the float was written on, and its \@dbltoproom is \dbltopfraction of the full text height with \@textmin the rest. Each accepted box costs \@ColhT its height plus \dbltextfloatsep (the first) or \dblfloatsep, which is exactly the stack \@combinedblfloats (21019) builds above the columns, so the existing short_cols/short shift generalises to it unchanged. \dblfigrule is \relax in the kernel (21579). \@startdblcolumn tries \@tryfcolumn first, with \@fpmin \dblfloatpagefraction\textheight, and \@doclearpage's \if@twocolumn\if@firstcolumn branch flushes what is left the same way: a full-width float page takes every column slot of its page, and a half-finished page is closed with \@emptycol first. The box itself is built in a second Context over a \textwidth stylesheet and adopted, the route multicol already takes for a column's own \hsize -- Context::style is a shared reference and every block builder measures from it. LengthEnv grows a line_width beside text_width so \textwidth keeps meaning the whole block while \linewidth/\columnwidth/\hsize follow where the key is read; in a two-column document style.text_width_pt is \columnwidth, so the two were conflated before. conf-paper now sets 4 pages like pdflatex, with the figure* on a full-width float page of its own: page 1 median dy -0.000bp (0 of 79 lines over 0.1pt), page 3 -0.000, page 4 24/25 words matched at -0.069bp. Corpus page-count match against the references 19/22 -> 20/22 (the two remaining misses, thesis-chapter and twelvept-plain, are untouched by this). 04-title-figure-star is now gated: 1072/1072 words and its image rectangle within 0.007bp. Not modelled: nothing here changes a one-column document, where the star does nothing at all. Gates: amsmath 59/59, tabular 106/106, float-notes 10/10, floats 10/10, float-body 11/11, footnotes 35/39 (unchanged), page-frame 11/11, twocolumn-title 4/4, HW1 and HW2 3 pages each via flashtex-render with no error and no overfull, render-pipeline suite green. No corpus fixture regresses; plain-article and thesis-chapter each lose an overfull_vbox. Implementation-Agent: engine-engineer (Claude Opus 5), linux-primary Commit-Executor: engine-engineer (Claude Opus 5), direct git under the observed-Cursor-limit fallback Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu
… model The previous commit's "not modelled" note was stale the moment it was written: `\@startdblcolumn`'s `\@tryfcolumn` *is* implemented, so a `[p]` full-width float does get a double float page. The case that really is not modelled is narrower -- a page that takes a `\@dbltoplist` box and whose first column `\@startcolumn` then fills with a single-column float page. LaTeX still combines the spanning boxes when that page ships; here the spanning area is attached to the next ordinary column. It needs a deferred `[p]` float and a deferred `figure*` at the same page boundary, which no fixture reaches, and guessing at it would be worse than saying so. Comment only; no behaviour change. Implementation-Agent: engine-engineer (Claude Opus 5), linux-primary Commit-Executor: engine-engineer (Claude Opus 5), direct git under the observed-Cursor-limit fallback Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu
This was referenced Sep 15, 2026
This was referenced Sep 16, 2026
ItsAkilesh
pushed a commit
to ItsAkilesh/flashtex
that referenced
this pull request
Sep 18, 2026
…sh-tex#746 follow-up) What changed: - columns::ColumnMode::top_material finds the optional argument of a \twocolumn that IS the document's first material (the only place \@topnewpage can run: it opens with \@nodocument), matching the ] the way TeX matches a delimited parameter -- at brace level zero. - adapter::split_top_material cuts that material out of the block stream, character by character so the [ and ] glued to the words go with them, and carries it on Doc::top_material. It refuses, leaving flash-tex#746's behaviour and its report in place, when the material cannot be cut exactly (page-level material, another document, a non-paragraph block across a bracket). - typeset::top_material_box sets it in \@topnewpage's box: a sub-Context at \textwidth (Context::box_blocks is already \@parboxrestore), then natural_box for the \vbox height TeX gives a list that ends in glue -- the last line's depth counts, which is the \vskip -\dbltextfloatsep. It feeds the existing top_title plumbing, so the page-1 shortening, the shift and the float interaction are flash-tex#382's, unchanged. - style: \raggedbottom/\flushbottom and \sloppy follow the class OPTION, not \if@twocolumn. article.cls 631-640 runs them once, as the last thing \documentclass does; the \twocolumn command runs long afterwards. What was run: cargo test --lib test result: ok. 176 passed; 0 failed; 1 ignored; 0 measured cargo test --test twocolumn_banner test result: ok. 11 passed; 0 failed; 0 ignored; 0 measured cargo test --test twocolumn_command --test twocolumn_title_oracle \ --test maketitle_empty_author --test page_frame test result: ok. 7 passed; 0 failed test result: ok. 1 passed; 0 failed test result: ok. 1 passed; 0 failed test result: ok. 1 passed; 0 failed Oracle (/Library/TeX/texbin/pdflatex, pdfTeX 3.141592653-2.6-1.40.29, glyph origins via PyMuPDF), 33 probes at 10/11/12 pt: every glyph of every page within 0.194 bp of pdflatex (worst case a \Large banner at 12 pt; all others within 0.086 bp). Next step: PR, then the remaining \@topnewpage gaps (a sectioning command in the argument, \@dbltopnum's deferral of later full-width floats). Implementation-Agent: claude-opus-5 subagent of daniel-parent Commit-Executor: daniel-parent subagent Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz
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.
Issue #2's dominant error in both two-column documents:
\twocolumn[\@maketitle]with floats on the page drew the full-width title and then set the abstract inside it. The cause waslet shift = if floats.is_empty() { height } else { 0.0 }— with floats present the spanning title contributed no vertical shift at all.Fixing it by deleting the condition is not enough, because the shift and the page shortening are one number and only one of them reached the float placer. The second commit then does what the coordinator's
figure*finding requires: a full-width float is placed by the same machinery, and both are now implemented against whatlatex.ltxactually does.What
\@topnewpagedoes that we did not\@topnewpage(latex.ltx 20466-20505):\vskip -\dbltextfloatsepis inside the box, so\ht\@currboxis the material's natural height less\dbltextfloatsep, with zero depth (the last list item is glue).\@colhtthen loses\ht\@currbox + \dbltextfloatsep— the natural height exactly. One number, and it is also the distance the columns move down, because\@combinedblfloats(21019) stacks the box,\vskip\dbltextfloatsepand the two-column box in a single\vbox to\textheight. pdflatex's own\showoutputonarticle-twocolumn:\vbox(686.56499) = \vbox(108.18784) + 12 − 12 + 20 + \hbox(558.37715).\@outputdblcolreaches\@outputpage— whose last act is\global\@colht\textheight— only after the second column, and\@opcolends with\@floatplacement, which recomputes\@toproom,\@botroomand\@fpminfrom whichever\@colhtis in force. So the float placement in column 2 of page 1 also sees the reduced height.\ht\@currboxis capped at\textheight, and\@colht < 2.5\baselineskipis a named LaTeX warning with\@emptycol. Both are now reported rather than guessed at.\global\@dbltopnum\m@nebars any full-width float from the page a spanning title opened.Two more things
\@makecoldoes that floatpage did not:\vbox to\@colhtonly for a column carrying footnotes and placed every other column at natural size — so a\flushbottomcolumn (\if@twocolumn \sloppy\flushbottom\fi) never stretched its glue. Under\raggedbottomthe\@textbottomfil keeps the natural positions, so single-column documents are unchanged.\skip\footins, the\footnoteruleand the notes only\ifvoid\footins\else. Without notes the\vskip-\@outputbox@depthlands right after the body, so the body's last depth is outside\@colht.Those two were worth 3.726bp and 0.485bp of drift per paragraph.
figure*(second commit)\@floatis\@dbflt\if@twocolumn(17419), and\@xdblfloatsets\hsize\textwidth \linewidth\textwidth, defaults to[tp], and leaves the box depth at1sp. That depth is the whole dispatch:\@testwrongwidth(21187) compares it with\f@depth, which is\z@everywhere except inside\@dblfloatplacement— so a full-width float is refused by\@addtocurcol,\@addtonextcoland\@startcolumn's\@tryfcolumn, and only\@addtodblcol(21280) takes it, into the next page's\@dbltoplist. Each accepted box costs\@colhtits height plus\dbltextfloatsep(the first) or\dblfloatsep— the same spanning-area arithmetic as the title, so the shift generalises unchanged.\@startdblcolumntries\@tryfcolumnfirst (\@fpmin \dblfloatpagefraction\textheight) and\@doclearpage's two-column branch flushes the rest the same way.LengthEnvgrows aline_widthbesidetext_width, because in a two-column documentstyle.text_width_ptis\columnwidthand the two were conflated:\textwidthis the whole block,\linewidth/\columnwidth/\hsizefollow where the key is read.Per-document,
flashtex-rendervs each fixture's committedreference.pdfPage-1 median dy of matched words (words aligned by an LCS over their text, so a page whose material moved still aligns). Control built from
cc3232b4in the same cargo target directory as the branch build.cc3232b4Corpus page-count match against the references: 19/22 → 20/22.
Overfull verdict
conf-paper's 2.25ptoverfull_vboxon page 1 — the extra head line the abstract fix added — is gone. It was a column set at natural size where pdflatex shrinks its glue (\vbox(449.79996), glue set −0.59065); packing every column through\@makecolremoves it.plain-articleandthesis-chaptereach lose anoverfull_vboxtoo, from the same change.article-twocolumnbriefly gained a 12.03pt one from an intermediate state; it is not present here.Fixtures
fixtures/twocolumn-title/, generated bytools/twocolumn-title-oracle/generate.pywith TeX Live 2025 on this Linux host (pdfTeX 3.141592653-2.6-1.40.27), likefixtures/float-notes/and unlike the MacTeX 2026 data underfixtures/footnotes/andfixtures/floats/. No TeX runs in cargo.01-title-no-floats02-title-top-float([t]float on page 1)03-title-float-too-large(too tall for the shortened column)04-title-figure-star(full-width float beside the title)All within 0.007bp in x and baseline; every image rectangle matched.
Gates
amsmath 59/59 · tabular 106/106 · float-notes 10/10 · floats 10/10 · float-body 11/11 · footnotes 35/39 (unchanged) · page-frame 11/11 · toc 11/11 · twocolumn-title 4/4 · HW1 and HW2 3 pages each via
flashtex-render, 0 errors, 0 overfull · fullrender-pipelinesuite green. Zero font-failure diagnostics withFLASHTEX_FONT_DIRS/FLASHTEX_TFM_DIRSset. Nothing else in the corpus changes status, page count or diagnostics.article-twocolumn's bytes changed deliberately in #376; the further change here is the one #376's reasoning predicted.What remains
article-twocolumnpage 1, +4.257bp, is now line breaking and\cite, not page layout: we set[1,2]where pdflatex sets[1, 2](citeis recognised but not implemented), and column 1 breaks…in force at its / first character…where pdflatex breaks…in force at its first / character…. Column 2 matches pdflatex exactly to the last line of the page.conf-paperpage 2 carries a uniform 0.06bp offset in column 2 — below a tenth of a point, above the harness's 0.1pt reporting threshold on 30 of 93 lines.[p]-only full-width floats reach\@doclearpage's flush rather than\@startdblcolumn's mid-document\@tryfcolumnin every case; the code path exists but no fixture exercises the mid-document one.🤖 Generated with Claude Code
https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu