[texhax] Am I on the lastpage?

Reinhard Kotucha reinhard.kotucha at web.de
Sun May 19 22:01:03 CEST 2013

On 2013-05-19 at 16:39:26 +0000, Schwartz, Steven J wrote:

 > (I tried to send this a week ago but haven't seen it, so perhaps it got lost)
 > Dear All,
 > I have a class file that uses fancyhdr and latex's leftmarks to set
 > footers depending on the context. It's for exams, so it sets
 > footers to "Turn to next page" or "This question continues ..." or
 > whatever, and on the last page it's supposed to write "End of
 > Examination". To accomplish this last task, I borrowed the logic
 > from the lastpage package. That is, AtEndDocument I write out a
 > label called lastpage, and in my header-building code I use an
 > ifthenelse construction to compare \thepage with
 > \pageref{lastpage}.
 > This works most of the time, but fails when there is only a small
 > paragraph on the last page. This is due to the well-known TeX
 > behaviour which results (see the TeX FAQ) in \thepage being "almost
 > always wrong in the first paragraph of a page".
 > I have looked briefly at the most recent lastpage package and also
 > the documentation for pageslts, but I think both are more concerned
 > with accessing information via labels.
 > There is a manual workaround by inserting a \pagebreak should this
 > happen, but since I distribute this .cls to colleagues who are not
 > all TeXies, I'm looking for an automated self-contained
 > approach. And one which doesn't rely on too many external packages
 > and such (which is why my .cls borrowed ideas from lastpage, with
 > proper credit, rather then used the ctan package).
 > Anyone have any suggestions? 

texdoc atveryend


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