[texhax] Am I on the lastpage?

Schwartz, Steven J s.schwartz at imperial.ac.uk
Mon May 20 19:22:28 CEST 2013


Ulrike Fischer wrote on 2013-05-20:
----------------
> Am Mon, 20 May 2013 15:13:08 +0000 schrieb Schwartz, Steven J:
>
>>> \thepage can be wrong in the first paragraph in the text *body* of
>>> a page but it is always correct when header and footers are added
>>> to the page (as the headers and always footers has to (and do) show
>>> the correct page number). So if you are really using fancyhdr and
>>> do the comparison in the footer it should work -- which means that
> probably faulty.
>
>
>> I wasn't doing the comparison inside the footer,
>
> If you want to do the page number comparision in the body you should use
> *two* \label's: one for lastpage and one for the current page and then
> compare the two \pageref's.

In this case at least, doing this in the body would require serious convolutions in the code.

By comparison, doing it inside the footer itself involved adding a single line of code, and removing 15 or 20 from elsewhere that were no longer necessary. That must be ample evidence that it is the right way for me to go!

Best wishes and thanks
Steve

--------------------------------------------------------------------
Professor Steven J Schwartz        Phone:  +44 (0)207 594 7660
Head, Space & Atmospheric Physics  Fax:    +44 (0)207 594 7772
The Blackett Laboratory            Email:  s.schwartz at imperial.ac.uk
Imperial College London            Office: Huxley 6M67A
London SW7 2AZ, UK                 Web:    www.sp.ph.ic.ac.uk/~sjs
--------------------------------------------------------------------