# [texhax] Am I on the lastpage?

Ulrike Fischer news3 at nililand.de
Mon May 20 18:11:59 CEST 2013

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 your code is 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.

--
Ulrike Fischer
http://www.troubleshooting-tex.de/