I am trying to get my page numbering as Page X of XX and I am using the standard syntax like,

\rhead{Page \thepage\ of \pageref{LastPage}}

enter image description here

It should work fine, expect that my last page has definitions like

\renewcommand{\CoverName}{Back Cover}
\huge{[This page is intentionally left blank.]

So I can get this

enter image description here

How can I keep the Back Cover and to enable the LastPage? I am thinking something like resetting the page number but I am not sure how to do it.


  • 2
    That's not standard syntax. \rhead and LastPage are not part of LaTeX. (At least two packages define LastPage and various classes/packages define \rhead. These definitions are not equivalent.) Why don't you provide an MWE? – cfr May 30 '18 at 4:01

You are redefining the builtin \thepage-command, which is not good! If any other package use it (as you demonstrate e.g. LastPage) it will be affected by this. Also It has no purpose for the header on the last page when you have \thispagestyle{empty}.

I assume you do not want the back cover to count as the last page.

LastPage puts the current page number into a macro called \lastpage@lastpage. To achieve the (presumably) desired effect you could combine this with \number\numexpr. So you'd do \rhead{\thepage~of~\the\numexpr\lastpage@lastpage-1\relax}.

Furthermore, it seems that you might want to have the text "Back Cover" on the top right part of the back cover. In this case, you could just redefine \rhead instead of \thepage.

All in all:

% ^so we can use \macros containing @ in their macronames

% Just remove the -1 below if you did not want to subtract 1
Page 1\clearpage Page 2\clearpage
% Switch out the line below with \rhead{Back Cover} if you want "Back Cover" in your header
\huge{[This page is intentionally left blank.]
  • hmmm, in my full tex file (along with lots of other packages), it did not work and gives me ! Undefined control sequence. \f@nch@orh ...of~\the \numexpr \lastpage@lastpage -1\relax \strut warning. I think I might have to find a different work around, as I also change the \rhead{ in the body of my tex. – Chen Stats Yu May 30 '18 at 13:41
  • 1
    Did you remember to insert the \makeatletter? – Andreas Storvik Strauman May 30 '18 at 13:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.