Skip to content

A stack can repeat its header at the top of each page it goes on to - #207

Merged
czj merged 3 commits into
mainfrom
add-stack-repeated-header
Dec 3, 2026
Merged

czj merged 3 commits into
mainfrom
add-stack-repeated-header

Conversation

@czj

@czj czj commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

A list that runs over several pages loses its title after the first one: a stack kept together moves whole to the next page and leaves blank space, and one that breaks leaves its continuation untitled. Only tables repeat their header row.

stack(header: true) draws the stack's first box again at the top of each page the stack goes on to, with the stack's gap below it. Its other children flow within bounds that paint the header on each new page, so a break anywhere below, in a nested stack, a text or a table, brings it back.

  • Kept with what follows: the header goes to the next page with the start of the box after it, never alone at the bottom of a page.
  • Read once: in a tagged document the copies are /Pagination /Header artifacts, and its headings are bookmarked once.
  • Fails early: a header leaving no room under it raises CannotFit before anything is drawn.
  • Stacks only: a grid refuses header:, since it breaks pages between its lines.
  • Shared bounds: FlowingBounds gathers what these bounds share with DecoratedBounds.
Proof
  • native_breaks_test.rb: repeats on every page, breaks deep in nested stacks and tables, never stranded, drawn once when the stack fits or moves whole, decorated stacks, nested headers, too-high header, option check.
  • tagging_test.rb: header element once in the structure tree, artifacts on later pages, balanced marked content, veraPDF PDF/UA-1 valid.
  • native_roles_test.rb: the header's heading is in the outline once.
  • Layout fuzzer now gives stacks header: true: 1,000 cases green on seeds 42 and 7 (it found the recursion that the early CannotFit now prevents).
  • Full suite: 1,856 runs, 0 failures.
  • Real use: a showroom price poster went from 3 pages to 2, with each category's title repeated when it runs over.

czj added 3 commits December 3, 2026 14:52
…oes on to

Its children after the header flow within bounds that paint the header, as a tagged artifact, at the top of each new page and go on below it, so breaks deep in nested stacks, texts and tables bring it back too. The header is kept with the start of the box after it. FlowingBounds gathers what these bounds share with DecoratedBounds.

Assisted-by: Claude Opus 5.5 [Claude Code]
Assisted-by: Claude Opus 5.5 [Claude Code]
…aises

Its headings are painted again with the outline paused, and a header as high as the page with its gap raises CannotFit before anything is drawn instead of recursing. The layout fuzzer gives stacks header: true, and does not count a repeated header as a split stack.

Assisted-by: Claude Opus 5.5 [Claude Code]
@czj
czj enabled auto-merge (squash) December 3, 2026 14:04
@czj
czj merged commit 720cb1f into main Dec 3, 2026
14 of 18 checks passed
@czj
czj deleted the add-stack-repeated-header branch December 3, 2026 14:20
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