GeneralBest way to count words in latex-file?

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
Mixhael
Posts: 26
Joined: Sun Oct 05, 2008 12:56 pm

Best way to count words in latex-file?

Post by Mixhael »

I've found some perl-scripts to count words in latex, but what method is the best?

And is there a way to automatically include the counted words in your pdf-file? (preferably without toc, references, citations etc... included)

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

Mixhael
Posts: 26
Joined: Sun Oct 05, 2008 12:56 pm

Re: Best way to count words in latex-file?

Post by Mixhael »

I'm mainly interested in a way to automatically include the word-count in your pdf-file, but after a lot of searching found nothing. Guess this is not possible then?
Einar
Posts: 1
Joined: Sun Nov 16, 2008 6:23 am

Best way to count words in latex-file?

Post by Einar »

I've made a Perl script for counting words in LaTeX document which is available from here:
http://folk.uio.no/einarro/Comp/texwordcount.html
You can either download it and run it on your own (requires Perl), or use the online web service. The script contains rules for handling most of the common macros, and you can add your own rules through comments in the LaTeX document.

In order to include the count in your document, the best solution is to write the word count information to a file, and then include this in the document. How to do that is briefly explained in the FAQ:
http://folk.uio.no/einarro/Comp/texcoun ... cludecount
Doing this, you can include either just the total word count, or more detailed information such as subcounts.

I am hardly unbiased when it comes to comparing the different scripts available, nor have I made any major attempt at a comparison, and their accuracies are also likely to depend on your LaTeX coding style. The main point I should emphasize is that my script gives you a detailed, colour coded output of the parsed LaTeX code which enables you to assess the script's interpretation of the code.

Einar
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Best way to count words in latex-file?

Post by localghost »

Einar wrote:I've made a Perl script for counting words in LaTeX document which is available from here:
http://folk.uio.no/einarro/Comp/texwordcount.html
You can either download it and run it on your own (requires Perl), or use the online web service. The script contains rules for handling most of the common macros, and you can add your own rules through comments in the LaTeX document. […]
Many thanks for this useful contribution. Now it seems not be a mystery any more to count the words of a LaTeX document.


Best regards and welcome to the board
Thorsten¹
Post Reply