From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/30092 Path: news.gmane.org!not-for-mail From: "Mojca Miklavec" Newsgroups: gmane.comp.tex.context Subject: Re: counting the words in a TeX document Date: Mon, 7 Aug 2006 23:31:19 +0200 Message-ID: <6faad9f00608071431v3a097f38u86534b806896a996@mail.gmail.com> References: <6faad9f00608050945g5f829eaeka4afdee9858c7df8@mail.gmail.com> <44D4FA91.3080808@wxs.nl> <6faad9f00608051731t1dc00da2v73ad192dedd4835c@mail.gmail.com> <6faad9f00608070124h2162d8ddj163fd308ca30348a@mail.gmail.com> <44D7065E.2010808@wxs.nl> <6faad9f00608071154v561ff28aq32c5446415e98657@mail.gmail.com> <44D7A8A6.1050708@wxs.nl> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1154986402 27392 80.91.229.2 (7 Aug 2006 21:33:22 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 7 Aug 2006 21:33:22 +0000 (UTC) Original-X-From: ntg-context-bounces@ntg.nl Mon Aug 07 23:33:20 2006 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from ronja.vet.uu.nl ([131.211.172.88] helo=ronja.ntg.nl) by ciao.gmane.org with esmtp (Exim 4.43) id 1GACis-0005jd-3F for gctc-ntg-context-518@m.gmane.org; Mon, 07 Aug 2006 23:33:18 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 9F0FC1FD81; Mon, 7 Aug 2006 23:33:17 +0200 (CEST) Original-Received: from ronja.ntg.nl ([127.0.0.1]) by localhost (smtp.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 06911-04; Mon, 7 Aug 2006 23:33:17 +0200 (CEST) Original-Received: from ronja.vet.uu.nl (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id EA6DA1FD8C; Mon, 7 Aug 2006 23:31:25 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 0086A1FD8C for ; Mon, 7 Aug 2006 23:31:24 +0200 (CEST) Original-Received: from ronja.ntg.nl ([127.0.0.1]) by localhost (smtp.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 06911-01-4 for ; Mon, 7 Aug 2006 23:31:23 +0200 (CEST) Original-Received: from wx-out-0506.google.com (wx-out-0506.google.com [66.249.82.232]) by ronja.ntg.nl (Postfix) with SMTP id DC9691FD81 for ; Mon, 7 Aug 2006 23:31:20 +0200 (CEST) Original-Received: by wx-out-0506.google.com with SMTP id s12so387286wxc for ; Mon, 07 Aug 2006 14:31:19 -0700 (PDT) Original-Received: by 10.78.128.11 with SMTP id a11mr1901767hud; Mon, 07 Aug 2006 14:31:19 -0700 (PDT) Original-Received: by 10.78.175.15 with HTTP; Mon, 7 Aug 2006 14:31:19 -0700 (PDT) Original-To: "mailing list for ConTeXt users" In-Reply-To: <44D7A8A6.1050708@wxs.nl> Content-Disposition: inline X-Virus-Scanned: amavisd-new at ntg.nl X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.7 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: ntg-context-bounces@ntg.nl Errors-To: ntg-context-bounces@ntg.nl X-Virus-Scanned: amavisd-new at ntg.nl Xref: news.gmane.org gmane.comp.tex.context:30092 Archived-At: On 8/7/06, Hans Hagen wrote: > > > (I'll spare you the fun with sections for some other time,) but since > > you reminded me that I might have some questions left, here you have > > another one: how do I replace hyphens, en-dashes and em-dashes with > > "spaces/line breaks"? > > \catcode`~=13\let~=\space > > does what I want, but none of the following works: > > \def\-{\space} > > \def-{\space} > > \let\-=\space > > > \catcode`-=\active \def-{ } I tried that one already, but it didn't work. Now I figured out that it was because of nesting the definitions (perhaps even some interference with negative numbers?), not because of wrong definition on itself. I'm sorry. Mojca (But my fear is that the whole problem is too complex anyway (tables, ...) to be solved elegantly.) \long\def\startstatistics#1\stopstatistics {\setbox0\vbox\bgroup % \tracingall -) \forgetall \nohyphens \hsize1mm % treat non-breakable space as a normal one \catcode`~=13\let~=\space % treat en-dash as a normal one \catcode`-=\active \def-{ } % ERROR \bgroup#1\egroup\egroup \newcounter\NOfLines \beginshapebox \unvcopy0 \endshapebox \reshapebox{\doglobal\increment\NOfLines} #1\crlf\unvbox0\crlf words: \NOfLines\crlf} \starttext \startstatistics abc~def ghi-jkl -- mno --- prs \stopstatistics % works OK %abc-def -- ghi --- jkl % \catcode`-=\active \def-{ } %abc-def -- ghi --- jkl \stoptext