[Tex/LaTex] ny way to do a correct word count of a LaTeX document

compilingpackagesscriptsword count

Often assignments (or even papers) have a word count limit. That is not a big deal when using Word, but I don't know how to do that using LaTeX. My solution has been so far to compile the document and then do a rough word count of my pdf file, sometimes even copying the contents of the pdf file and pasting in Word to get a mostly correct Word count.

Is there any tool (maybe even an online tool), package, script or software to do that directly from my .tex document and still get the right word count (i.e., ignore commands, equations, etc)?

Best Answer

This is in the UK TeX FAQ. The solutions suggested are:

  • detex filename (which tries to strip LaTeX commands), then use any word count tool. (e.g. wc)

  • latexcount.pl, a Perl script for word count

  • texcount, another script even has an online interface

  • wordcount, which has a script that runs LaTeX with some settings, then counts word indications in the log file.