Am 10.03.2009 um 16:06 schrieb Alan Stone:
Hi,
Re: files in attachment
Why is step 3 typeset in chapter 2's first paragraph instead of chapter 1's first paragraph and how to correct ?
I still say it's not a very good idea to do this 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}} Wolfgang