As with most strange requests on TeX.SE, I too am writing a thesis (with the book class). Our department has a hard limit on the amount of pages it can stretch for (70).

For short documents in the past, I used to include a TeX snippet in my preamble that would just drop all pages after a specified amount. However, knowing myself, this could be too "silent" to be reminded of it. One solution I had thought of was invoking \color{red} at the start of page 71, so that it jumps out when scrolling through the text. But how do you invoke a command at a specified page number?

Another possibility is using the xwatermark package somehow, because I'm already using it to watermark my drafts.

For extra credit: I don't think appendices count towards the total, so a way to automatically determine either 1. the end of the Arabic page numbering or 2. the start of the appendices could be nice too. (You could just put \color{black} before \begin{appendices}, but having that done automatically in the preamble seems cleaner to me.)

2 Answers 2


Maybe making the whole background of the page red will catch your attention when scrolling. For that you can use the shipout hook and make the pagecolor red

\chapter{Who are you?}

The result looks something like this

enter image description here

  • Is there a way this can tolerate the offset caused by \frontmatter? Currently the 4th page is red, but I would like page 4 to be red, which is not the same thing.
    – Mew
    Feb 25, 2023 at 18:18

You can't easily (or at all) change the formatting on a specific page, the text that lands on page 71 may have been typeset when only 10 pages have been made (if it had a long paragraph, or if lots of floats were inserted or...) You can not re-set (or even access) that text in classic tex. (luatex changes the rules a bit).

However the current page number can be reliably accessed in the page head, so using fancyhdr or directly you could have a page head containing

\ifnum\value{page}>70 \textcolor{red}{BAD PAGE}\fi

Or you may prefer an error

\ifnum\value{page}>70 \PackageError{mythesis}{BAD PAGE}{write less stuff}\fi

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .