On Tue, Mar 10, 2009 at 4:35 PM, Wolfgang Schuster < schuster.wolfg...@googlemail.com> wrote:
> I still say it's not a very good idea to do this > In order to make an informed decision, what are you refering to Wolfgang ? > but here is a fixed > version of your macros. You should always take care to keep scratch > counters/dimenens/... local. > > \def\doCountLines#1\par{% > \begingroup > \setbox\scratchbox\vbox{#1\par}% > \getnoflines{\htdp\scratchbox}% > \global\parlines=\number\numexpr\noflines > (step 2: P\space\the\parnumber, \the\parlines\space L)\relax > \ifnum \parlines = 1 > (step 3: P\space \the\parnumber, \the\parlines\space L)% > \fi > \endgroup#1\par} > > \def\CountLines{% > \global\parnumber=0 > \EveryPar{% > \advance\parnumber by 1 > % (step 1: P\space\the\parnumber, \the\parlines\space L) > \ifnum \parnumber = 1 > \expandafter\doCountLines > \fi}} > I apologize for my ignorance, I'm still confused with this one (see attachments)... \def\doCountLines#1\par{% \begingroup \setbox\scratchbox\vbox{#1\par}% \getnoflines{\htdp\scratchbox}% \global\parlines=\number\numexpr\noflines % (step 2: P\space\the\parnumber, \the\parlines\space L) \ifnum \parlines = 1 (step 3: P\space \the\parnumber, \the\parlines\space L)% \fi \endgroup#1\par} \def\CountLines{% \global\parnumber=0 \EveryPar{% \advance\parnumber by 1 % (step 1: P\space\the\parnumber, \the\parlines\space L) \ifnum \parnumber = 1 \expandafter\doCountLines \fi}} > > > Wolfgang >
countlines2.tex
Description: TeX document
countlines2.pdf
Description: Adobe PDF document
___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________