TexWordCount: a script to count words in LaTeX

[ Back to the WING home page ]

This is the home page of TexWordCount.pl, a perl script to count words in TeX and LaTeX documents. It is free to be distributed and used (personal, commercial or otherwise) by anyone, licensed under the Lesser GNU Public License (LGPL).


 Download

Download texWordCount.pl. Or fork or download from the distribution on GitHub. Requires perl.

 Demonstration

Option 1: Cut and paste your TeX file to have the words counted.

Option 2: Or enter a file containing a single LaTeX file to count words. E.g., similar to this test.tex.

 Thanks to...

TexWordCount owes much of its added functionality and code to contributors which are incorporated in the current release. Sam Tygier at http://www.tygier.co.uk/ added functionality for \input and recursive \include and more recently, for counting words with non-breaking spaces (LaTeX "~"). Gregor Heinrich at http://www.arbylon.net/ added handling of document classes with a chapter level (book, report). Martin Magnusson modified it for running headers. Edward Vigmond added proper counting words in captions. Michael Dayan corrected bug in subsubsection counting.

 Troubleshooting

If you use the script and find problems with its execution, please report them to me. If you have any fixes that would be even better.

Known bugs: Daniel Thomas reports that: "While using texWordCount.pl I noticed that using the -u option results in the file being word counted being modified in a rather dangerous manner likely to result in data loss if the user does not have a backup. (among other things the \inputs were permanently input and the end of the file was cut off completely.)"

> Currently to address this problem, we have disabled the -u flag when \inputs or \includes are detected and processed.

 Competitors

A more comprehensive version of word counting that has a UI is also available from: http://app.uio.no/ifi/texcount/index.html. You might want to try their tool out. Our tool is for fairly simple usage and for those environments that already have the prerequisites installed.

 Group Members


Min-Yen Kan <kanmy@comp.nus.edu.sg>
Created on: Mon May 22 12:57:43 2006 | Version: 1.0 | Last modified: Wed Jun 14 17:36:27 2006