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)
General ⇒ Best way to count words in latex-file?
NEW: TikZ book now 40% off at Amazon.com for a short time.
Re: Best way to count words in latex-file?
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?
Best way to count words in latex-file?
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
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
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
Best way to count words in latex-file?
Many thanks for this useful contribution. Now it seems not be a mystery any more to count the words of a LaTeX document.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. […]
Best regards and welcome to the board
Thorsten¹
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10