Skip to content

fix(report): show "Seite N von N" footer on back-matter/bibliography pages#20

Merged
frederikbeimgraben merged 1 commit into
mainfrom
fix/report-lastpage-footer
Jun 4, 2026
Merged

fix(report): show "Seite N von N" footer on back-matter/bibliography pages#20
frederikbeimgraben merged 1 commit into
mainfrom
fix/report-lastpage-footer

Conversation

@frederikbeimgraben
Copy link
Copy Markdown
Owner

Problem

In the report variant the centre footer "Seite X von Y" was missing on every back-matter page. The most visible case: the bibliography, which is the document's last page — its centre footer was blank while every other page had it.

Root cause (src/pytex_hsrtreport/tex/pagesetup.tex)

Two coupled causes, both in the \cfoot definition:

  1. \cfoot content was wrapped in \ifHSRTBackMatter\else … \fi. BACKMATTER_HEADER (document.py) sets \HSRTBackMattertrue before \printbibliography, so the footer collapsed to empty in back matter. \ifHSRTBackMatter is meant only to suppress chapter-name headers, not the page footer.
  2. The von \pageref{LastPage} suffix was gated on \if@mainmatter, but \backmatter sets \@mainmatterfalse — so the "von N" suffix would disappear in back matter even without cause 1.

Not a plain-pagestyle issue: the bibliography is a \chapter* and \chapterpagestyle is already scrheadings.

Fix

  • Add \newif\ifHSRTNumberedBody, set \HSRTNumberedBodytrue in the redefined \mainmatter and never reset it (survives \backmatter).
  • Gate the von \pageref{LastPage} suffix on \ifHSRTNumberedBody instead of \if@mainmatter.
  • Decouple the footer content from \ifHSRTBackMatter.

Front matter (roman pages) keeps bare Seite ii with no total — unchanged.

Verification

Built a report with a real bibliography (pytex … --build --variant report) and inspected the last page with pdftotext -layout:

Page Before After
Title page (no footer) (no footer)
Front-matter ToC Seite ii Seite ii
Main matter Seite 2 von 10 Seite 2 von 10
Bibliography (last page) Frederik Beimgraben only — no centre footer Frederik Beimgraben … Seite 10 von 10

Tests

Added two regression tests in tests/pytex_hsrtreport/test_document.py asserting the footer config: footer not gated by \ifHSRTBackMatter, and the LastPage suffix gated on \ifHSRTNumberedBody (not \if@mainmatter), with \mainmatter setting the flag.

CI-equivalent local status: ruff format --check src tests ✅ · ruff check src tests ✅ · basedpyright src ✅ (0 errors) · pytest -q ✅ 757 passed.

🤖 Generated with Claude Code

The centre footer "Seite X von Y" was missing on every back-matter page —
most visibly the bibliography, which is the document's last page.

Two coupled causes in tex/pagesetup.tex:

1. The \cfoot content was wrapped in \ifHSRTBackMatter\else ... \fi, so it
   collapsed to empty once \backmatter set \HSRTBackMattertrue (done by
   BACKMATTER_HEADER before \printbibliography). \ifHSRTBackMatter is only
   meant to suppress chapter-name headers, not the page footer.
2. The "von \pageref{LastPage}" suffix was gated on \if@mainmatter, but
   \backmatter sets \@mainmatterfalse, so the suffix would vanish in back
   matter even without cause 1.

Fix: introduce \ifHSRTNumberedBody, set true in the redefined \mainmatter and
never reset (so it survives \backmatter), and gate the suffix on it instead of
\if@mainmatter. Decouple the footer content from \ifHSRTBackMatter. Front
matter (roman pages) keeps the bare "Seite ii" with no total, unchanged.

Verified on a report with a bibliography: the last page now shows
"Seite 10 von 10" centred; main-matter and front-matter footers unchanged.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@frederikbeimgraben frederikbeimgraben merged commit c6ea77a into main Jun 4, 2026
1 check passed
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