Word count of multi-file Latex project

Today I learned a nice trick to get the total word count of a latex project with multiple files:

detex *.tex | wc -w

screenshot of a bash shell. A directory with a few tex files is shown, as well as the result of the command "detex *.tex | wc -w"

detex does a pretty decent job of extracting commands from a latex file, and wc, of course, gets a word count. What surprised me was that detex did the sensible thing when presented with multiple files and merged all the output together. Gotta love the “small tools” unix philosophy.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.