[ Back to the WING home page
]
This page is the home page for my texWordCount perl script, a script used to count words in LaTeX documents. It is open source code which you are free to use or redistribute in any manner.
The below links may show up in your browser as plain text. If so,
just save the resulting page in a suitable plain text file, such as
texWordCount.pl.
Previous versions are incorporated into the 090326 but not explicitly available from version control (I was -- and still am -- lazy).
Try out the demo to see whether it fits your needs.
The script is a simple perl script. You need to have perl installed on your computer. For most UNIX servers, Linux based computers and Macs running OSX or later, this should be trivial, since perl comes installed with most modern operating systems.
For Windows XP/Vista, you need to install perl yourself. A perl version for windows that is free is ActiveState's ActivePerl.
usage: texWordCount.pl -h [invokes help]
texWordCount.pl -v [invokes version]
texWordCount.pl [-cduiq] filename(s)...
Options:
-c Count words in captions
-d Debug Mode
-i Inclusive. Don't search for {document} tags. Good for \includes
-q Quiet Mode (don't echo license)
-u Update word counts in file
Will accept input on STDIN as a single file.
A thing that I originally liked to do is have the word count embedded within the LaTeX file itself. You can then have the script run during TeX compilation (e.g., ant or make). Do this by including:
% texWordCount - begin % texWordCount - end
in your .tex file. The leading '%' makes it a TeX comment, invisible to LaTeX for all intents and purposes.
TeXcount: Possibly a better LaTeX word counting script? From Norway. At least it seems to have frequent updates, unlike this one. :-P