Word count in LaTeX documents
Sometimes it can be useful to count the word of a LaTex document. One option is to use pdftotext and pipe it to the wc command.
pdftotext template.pdf - | wc -w
6910However, only the total word count is printed to the terminal. Sometimes, more details are needed, e.g. the word count in the text, the word count of the captions, or the amount of floating environments. Here, texcount provides much more details
texcount -inc -total template.tex
Total
Words in text: 5409
Words in headers: 78
Words outside text (captions, etc.): 398
Number of headers: 25
Number of floats/tables/figures: 9
Number of math inlines: 44
Number of math displayed: 1
Files: 12the option -inc includes all TeX files recursively and -total combines the statistics. To see the statics for each TeX file leave out the -total option.