Word count in LateX

I’m under strict instructions that the article I’m currently writing should be under 11,000 words. How to keep track of that while using LaTeX (with a lot of mark-up commands that won’t be separate words in the final product and a full bibliography that doesn’t get compiled until the pdf gets produced and thus is not in reflected in the length of the source file)? Easy, run pdflatex on the source (including the bibliography compilation) and count the words in the resulting pdf. But how does that work? My installation includes a ghostscript utility called ps2ascii (I assume that came with MacTex). So, it really is trivial; in Terminal:

ps2ascii test.pdf | wc -w

Answer: 10198. Whew! Still in the game.

2 comments ↓

#1 Sarah Murray on 10.14.09 at 8:04 pm

Thanks for this tip, it is quite useful! I did find that it includes the page numbers in the count, but that is easy to correct for.

#2 Sigve on 12.19.09 at 10:17 am

There is also a nice Perl script by Einar Rødland called ‘texcount’ that can count the words from your LaTeX-file directly. It doesn’t count the markup, and separates words in header, floats, math etc. It doesn’t count the bibliography, though, but you could probably just run a second count on your .bbl file if you wanted that.

http://folk.uio.no/einarro/Comp/texwordcount.html

Leave a Comment