# [texhax] Reverse page numbering(begin with the last page number and end with 0)

Ulrike Fischer news3 at nililand.de
Mon Jan 4 09:33:53 CET 2010

Am Thu, 31 Dec 2009 12:53:27 +0000 schrieb Othmane Benkirane:

> Hello,
>

> The subject explains everything: I want to start the page
> numbering from the last page number and decrement it until it's 0
> (for the last page). A mathematical operation for this would be:
> \thepage - \pageref{LastPage}, but how to include it in fancyhdr
> (for a book class) ?

Well as long as \thepage give a simple number you can use refcount:

\documentclass{article}
\usepackage{refcount}
\usepackage{lastpage}
\newcounter{mypage}

\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{}

\begin{document}
\setcounterpageref{mypage}{LastPage}
abc\newpage cd\newpage ef\newpage gh
\end{document}

--
Ulrike Fischer