[OS X TeX] Word count function?

Maarten Sneep maarten.sneep at xs4all.nl
Tue Jan 18 05:40:29 EST 2005

On 18 jan 2005, at 2:12, Themis Matsoukas wrote:

> On Jan 17, 2005, at 7:10 PM, Ettore Aldrovandi wrote:
>> On Tue, Jan 18, 2005 at 12:56:42AM +0100, Maarten Sneep wrote:
>>> On 18 jan 2005, at 0:50, Ettore Aldrovandi wrote:
>>>> 	detex file.tex|wc -w
>>> And be sure to read
>>>     http://www.tex.ac.uk/cgi-bin/texfaq2html?label=wordcount
>>> to understand why the result might be way off.
>> Didn't claim it is precise. [...] If it is mostly text, maybe the
>> inaccuracy wouldn't be so serious.
> Excalibur will count fairly accurately w/o including latex commands. 
> You can invoke it through texshop via an applescript. I use the 
> following (copied directly from the Macros menu):

Any means of automated counting is bound to be inacurate: please count 
the number of words in $E = mc^2$. Besides: if you use a bibliography, 
the number of words will be seriously underestimated, unless detex 
includes the .bbl files for you (the command \bibliography{} will 
introduce many pages). More commands that introduce significant lengths 
of text are known to exist.

There is a trick that might work to some extend (leaving the maths as 
an unresolved issue): count the number of words in the output of 
dvi2tty instead of detex. Since this counts the words in the output of 
TeX, it is likely to generate a more accurate result, although it still 
leaves the problem of page numbers. To get around that issue: use 
tex4ht and count the words in the html output.


--------------------- Info ---------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
           & FAQ: http://latex.yauh.de/faq/
TeX FAQ: http://www.tex.ac.uk/faq
List Post: <mailto:MacOSX-TeX at email.esm.psu.edu>

More information about the MacOSX-TeX mailing list