Skip to content

Figures are set inline, so true figure geometry costs pages: two measured experiments #146

Description

@tannevaled

Two changes that make a figure's size more correct both make the page count worse, and for the same reason: this engine sets a figure where it stands. \figure is

\long\def\figure{\par\bigskip\begingroup\centering\def\@captype{figure}\@discardopt}

so a tall graphic pushes the text down and leaves the rest of the page empty, where LaTeX would float it to the top of a page or onto a float page and let the text continue. The measurements below are the evidence, kept here so neither experiment has to be run twice.

Experiment 1 — wiring the PDF rasteriser into the CLI

RasterizePDF is a seam the engine exposes and its comment says "the CLI and loom inject one"; the CLI does not. go-tex/pdfrender v0.1.0 plugs straight in (3 lines). A vector .pdf is the commonest figure on arXiv: 673 of the 1694 graphics the 200-paper corpus includes, ahead of PNG (567), JPEG (235) and EPS (146).

Measured on the 71 papers that include a .pdf figure (300 s timeout, 63 of them have a tectonic reference):

pages page error exact 0-page
placeholder (today) 1435 270 11 0
rasterised 1518 370 7 4

Four documents produce nothing at all: the renderer needs ~17 s on a figure-heavy paper and they run out of clock. The rasteriser itself is not at fault — asked for 200 dpi on a 720×864 bp MediaBox it returns exactly 2000×2400 px.

Experiment 2 — reading the size the figure file declares

A figure this engine cannot draw still states how big it is: an EPS in its %%BoundingBox, a PDF in its /MediaBox. Reading it is ~90 lines of parsing and no rendering, and it makes the reserved box the right SHAPE — today the placeholder is the requested width by a fixed 90 pt, whatever the figure.

pages page error bias
90 pt default 1435 270 −158
declared box 1570 320 −66

Note the two columns disagree: the absolute error rises while the systematic bias more than halves. That is the signature of a compensating error — a placeholder that is too short has been hiding the space a floated figure would not have taken.

What would have to be true first

Real float placement: figure/table deferred to the top or bottom of a page, several to a page, and a float page when they cannot fit — \topfraction, \textfraction, \@dbltopnumber and the rest. With that in place both experiments should be re-run; without it, neither change can be judged by page counts.

Branches kept for reference: wire-pdf-figures, figure-boundingbox.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions