I don't know if you have any other object you want to count, but for those that you mentioned, here's how I worked it out:
- words: use texcount (see example below)
- figures: use the default LaTeX counter
figure
- tables: use the default LaTeX counter
table
- equations: use the default LaTeX counter
equation
- citations: use the lastbib package
You can display the current value of any counter using \arabic{NameOfTheCounter}
. To display the maximum value assigned to a counter anywhere in the document, the totcount package should be helpful.
The following is the colophon I recently started to use. Comments provided for your convenience
% characters count: the value is printed in the ancillary file char-count.tex
\bash[ignoreStderr=true,stdoutFile=char-count.tex]
echo `texcount -quiet -merge -1 -char cub-ant-sys-lit-sur.tex`|sed -e 's/\([0-9]*\).*/\1/'
\END
% word count: the value is printed in the ancillary file word-count.tex
\bash[ignoreStderr=true,stdoutFile=word-count.tex]
echo `texcount -quiet -merge -1 insert-name-of-file-here.tex`|sed -e 's/\([0-9]*\).*/\1/'
\END
\section{Colophon}
Document data: \thepage{} pages; % display number of pages
\input{word-count} words; % display number of words
\input{char-count}characters; % display number of characters
\arabic{figure} figures; % display number of figures
\LastBib{} references; % display number of references in the bibliography (not the number of citations)
\arabic{footnote} numbered notes; % display number of footnotes
\arabic{glossaryentry} glossary entries. % display number of glossary entries (using package glossaries)
In the example I didn't need the package totcount
, because the colophon is the last text appearing in the document.