[texhax] Reverse page numbering (begin with the last page number and end with 0)
Reinhard Kotucha
reinhard.kotucha at web.de
Sat Jan 2 02:38:36 CET 2010
On 31 December 2009 Othmane Benkirane wrote:
> 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) ?
\thepage - \pageref{LastPage} gives negative page numbers. If this is
ok for you, try, for instance, \setcounter{page}{-123} in the
preamble.
Don't rely on \pageref{LastPage}. Its value depends on the initial
setting of the page counter and you'll get different results after
each run.
If you want to determine the number of pages of your document
automatically, then you should create a dedicated counter yourself.
You probably can can increase it using \everyshipout from the everyshi
package and finally write the number to a file. I didn't test it.
If you are familiar with a programming language, you could simply
evaluate the log file and search for the line
"Output written on foo.pdf (123 pages, 123456 bytes)"
and create a file which contains the string "\setcounter{page}{-123}".
You then have to \input the file in the preamble.
But in most cases it should be sufficient to initialize the page counter
manually.
Regards,
Reinhard
--
----------------------------------------------------------------------------
Reinhard Kotucha Phone: +49-511-3373112
Marschnerstr. 25
D-30167 Hannover mailto:reinhard.kotucha at web.de
----------------------------------------------------------------------------
Microsoft isn't the answer. Microsoft is the question, and the answer is NO.
----------------------------------------------------------------------------
More information about the texhax
mailing list