[TxMt] Word Count ?

Paul McCann paul.mccann at adelaide.edu.au
Thu Nov 30 01:12:26 UTC 2006


Haris wrote...

> \newcommand{\this}{Hi there! }
> and then the document contains:
> \this\this\this

> I would guess detex will not count those 6 words, will it?

No: but the alternative (typesetting and counting using something  
like ps2ascii) is unworkably slow on large documents, so it's going  
to depend on what sort of accuracy you're seeking (and what each  
method considers to be a "word"). It'd be nice to find something fast- 
ish and not-too-inaccurate, but I'm not holding my breath!

Re: speed. I just tried on my brother's thesis, a 250 page long lump  
of French that I typeset in LaTeX. Going the ps2ascii route (ie,  
using the Word Count command Mark posted) took about 60 seconds on my  
slow-but-serviceable eMac, with ye olde spinning wheel in the  
meantime. Not nice. The detex route was pretty much instant. Word  
counts differ by about 1-2%, so "choose your poison". In particular,  
test what comes out the other end and see if it matches your  
definition of "word". That is, try a few simple documents and use the  
commands without the pipe to "wc -w" on the end.

Cheers,
Paul




More information about the textmate mailing list