The technique is beguilingly simple, but it’s not terribly accurate The latexcount script does the same sort of job, in one “step”; being a perl script, it is in principle rather easily configured (see documentation inside the script). Several editors and shells offer something similar. TeXcount goes a long way with heuristics for counting, starting from a LaTeX file; the documentation is comprehensive, and you may try the script on-line via the package home page. However, even quite sophisticated stripping of (La)TeX markup can never be entirely reliable: markup itself may contribute typeset words, or even consume words that appear in the text. The wordcount package contains a Bourne shell (i.e., typically Unix) script for running a LaTeX file with a special piece of supporting TeX code, and then counting word indications in the log file. This is probably as accurate automatic counting as you can get, if it works for you.detex <filename> | wc -w
Go to previous question, or next question
Go to FAQ home.
URL for this question: http://www.tex.ac.uk/cgi-bin/texfaq2html?label=wordcount
Comments, suggestions, or error reports? - see “how to improve the FAQ”.
This is FAQ version 3.27, released on 2013-06-07.