New package totcount: final counter values
If you need for instance to display page numbers in a way like “page X of Y”, there are packages like totpages and lastpage helping to achieve that. The today released package totcount allows to use the last (usually maximal) value of an arbitrary counter like the total number of chapters, sections, footnotes, citations, figures and tables etc.
A simple example of its usage:
\documentclass[a4paper,10pt]{article} \usepackage{totcount} \regtotcounter{section} \regtotcounter{page} \begin{document} \section{First} This is section \thesection\ of \total{section}. \clearpage \section{Second} This document has \total{page}\ pages. \end{document} |
The result will display “This is section 1 of 2. … This document has 2 pages.”.
For detailed information about usage, installation and implementation have a look at its documentation.
When I was looking at the package today I’ve got the idea that it could improve the usability if one could register counters just by a package option instead of needing to call \regtotcounter after loading the package.