[texhax] counting words

Tom Sgouros tomfool at as220.org
Sat Sep 16 05:09:39 CEST 2006


Hi All:

I have a document that has to be prepared both for printing and for the
web.  It's responses to a survey, and for the printed version, we want
to cut the answer off after a fixed number of words (100, say).  There
are a great number of responses.  Can anyone suggest a path to making a
macro that will print the first 100 words of an argument, and not choke
if there are only 75?  Does this sound like the kind of thing that is
worth attempting in a macro?

I'm imagining something like this:

  \answer{Now is the time for all good men to come to the aid of their
  country.  And all good women, too.  And so on and so forth.}

And for the web version I can do this: \newcommand{\answer}[1]{#1}, but
for the print version run, I can define a different macro that enforces
a limit.

Thanks for any suggestions,

 -tom

-- 
 ------------------------
 tomfool at as220 dot org
 http://sgouros.com  
 http://whatcheer.net


More information about the texhax mailing list