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

Othmane Benkirane eo at rhyhann.net
Sun Jan 3 21:13:15 CET 2010


Sorry, in fact I want the result of \pageref{LastPage} - \thepage to be written in the headers (it should begin with \pageref{LastPage} - 1 and should finish with 0). My mistake.

Regards,
Othmane Benkirane.
Le 2 janv. 2010 à 01:38, Reinhard Kotucha a écrit :

> 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.
> ----------------------------------------------------------------------------
> _______________________________________________
> 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