fix(report): show "Seite N von N" footer on back-matter/bibliography pages#20
Merged
Merged
Conversation
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>
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.
Problem
In the
reportvariant 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
\cfootdefinition:\cfootcontent was wrapped in\ifHSRTBackMatter\else … \fi.BACKMATTER_HEADER(document.py) sets\HSRTBackMattertruebefore\printbibliography, so the footer collapsed to empty in back matter.\ifHSRTBackMatteris meant only to suppress chapter-name headers, not the page footer.von \pageref{LastPage}suffix was gated on\if@mainmatter, but\backmattersets\@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\chapterpagestyleis alreadyscrheadings.Fix
\newif\ifHSRTNumberedBody, set\HSRTNumberedBodytruein the redefined\mainmatterand never reset it (survives\backmatter).von \pageref{LastPage}suffix on\ifHSRTNumberedBodyinstead of\if@mainmatter.\ifHSRTBackMatter.Front matter (roman pages) keeps bare
Seite iiwith no total — unchanged.Verification
Built a
reportwith a real bibliography (pytex … --build --variant report) and inspected the last page withpdftotext -layout:Seite iiSeite iiSeite 2 von 10Seite 2 von 10Frederik Beimgrabenonly — no centre footerFrederik Beimgraben … Seite 10 von 10✅Tests
Added two regression tests in
tests/pytex_hsrtreport/test_document.pyasserting the footer config: footer not gated by\ifHSRTBackMatter, and theLastPagesuffix gated on\ifHSRTNumberedBody(not\if@mainmatter), with\mainmattersetting 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