My idea is to use TeXcount to scan my document and output the number of words, figures, tables, equations and citations.

I've been looking at the documentation for TeXcount and it seems that words and equations are handled by default, but I don't see how to give different environments their own counters (and citations are a different matter). Can anyone help me?


1 Answer 1


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
echo `texcount -quiet -merge -1 -char cub-ant-sys-lit-sur.tex`|sed -e 's/\([0-9]*\).*/\1/'
% word count: the value is printed in the ancillary file word-count.tex
echo `texcount -quiet -merge -1 insert-name-of-file-here.tex`|sed -e 's/\([0-9]*\).*/\1/'
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.

  • I'd prefer to have these statistics in a separate text file instead of my LaTeX document. Is there a way to output these counters to a text file, perhaps using your \bash command?
    – David Hall
    Dec 5, 2013 at 10:27
  • Of course! Here's an example: \bash[ignoreStderr=true,stdoutFile=word-count.tex] echo texcount -quiet -merge -1 cub-ant-sys-the-pro.tex|sed -e 's/([0-9]*).*/\1/' \END` this editor does not escape very well the reverse ' Dec 11, 2013 at 10:28
  • Right, this is like in your initial example. But how do I output counters like the figure counter (LaTeX counters rather than TeXcount counters)?
    – David Hall
    Dec 12, 2013 at 11:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .