Counting words in LateX

I often need to know approximately how many words my paper contains (for example when asking a quote from a proofreading service). As opposed to MS Word, getting an estimate word count in LateX is not that easy. Today, I stumbled upon a command line utility bundle with the standard TeX distribuition: detex.

The utility just strips TeX commands from a .tex file. So a simply way to get a word count for the paper is:

detex file.tex | wc -w

Next step, include the command in the vim-latex plugin (yes, I do use VIm, at least most of the time) to have the word count shown in the status line.


Originally published at dfucci.co on August 10, 2015.