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

Othmane Benkirane eo at rhyhann.net
Mon Jan 4 14:15:53 CET 2010


Thank you very much for your help
Your solution did not work (it showed the opposite of the page), but with some tests, I ended up with something working:

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

\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{}
\cfoot{\setcounterpageref{mypage}{LastPage}\addtocounter{mypage}{-\thepage}\themypage}

\begin{document}
abc\newpage cd\newpage ef\newpage gh
\end{document}

Thank you very much,
Othmane Benkirane.

Le 4 janv. 2010 à 08:33, Ulrike Fischer a écrit :

> 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{}
> \cfoot{\addtocounter{mypage}{-1}\themypage}
> 
> \begin{document}
> \setcounterpageref{mypage}{LastPage}
> abc\newpage cd\newpage ef\newpage gh
> \end{document}
> 
> 
> 
> -- 
> Ulrike Fischer 
> 
> _______________________________________________
> TeX FAQ: http://www.tex.ac.uk/faq
> Mailing list archives: http://tug.org/pipermail/texhax/
> More links: http://tug.org/begin.html
> 
> Automated subscription management: http://tug.org/mailman/listinfo/texhax
> Human mailing list managers: postmaster at tug.org



More information about the texhax mailing list