### 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 `LastPage` label.

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 `\count` `1` (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 `\theTotPages`. Of course, the counter `TotPages` is asynchronous in the same way that apge numbers are, but snapshots may safely be taken in the output routine.

Both count1to and totpages need the support of the everyshi package.

`count1to.sty \latexhtml{{\rmfamily and}}{and} everyshi.sty`
  Distributed in macros/latex/contrib/supported/ms.tar.gz
`lastpage.sty`
  macros/latex/contrib/other/lastpage.tar.gz
`totpages.sty`
  macros/latex/contrib/supported/totpages.tar.gz