How many pages are there in my document?
Simple documents (those that start at page 1, and don't have any
breaks in their page numbering until their last page) present no
problem to the seeker after this truth. The number of pages is
reported by the lastpage package in its
For more complicated documents (most obviously, books with frontmatter in a different series of page numbers) this simple approach will not do.
The count1to package defines a label
TotalPages; this is
the value of its copy of
\count1 (a reserved TeX count
register) at the end of the document.
Package totpages defines a label
TotPages, but it also
makes the register it uses available as a LaTeX counter,
TotPages, which you can also reference via
course, the counter
TotPages is asynchronous in the same way that
page numbers are, but snapshots may safely be taken in the output
The memoir class defines two counters
lastsheet, which are set (after the first run of a document)
to the equivalent of the
LastPage label and the