ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Wolfgang Schuster <schuster.wolfgang@googlemail.com>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: paragraph question (the return :O)
Date: Tue, 10 Mar 2009 16:35:34 +0100	[thread overview]
Message-ID: <AE91ED5A-6CE2-49C0-9207-DF0D8BBCFF2D@gmail.com> (raw)
In-Reply-To: <326847810903100806w49882d04p30bb179a5bc3b9b7@mail.gmail.com>


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

___________________________________________________________________________________
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
___________________________________________________________________________________


  reply	other threads:[~2009-03-10 15:35 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-10 15:06 Alan Stone
2009-03-10 15:35 ` Wolfgang Schuster [this message]
2009-03-10 16:35   ` Alan Stone
2009-03-10 16:46     ` Wolfgang Schuster
2009-03-10 17:14       ` Alan Stone
2009-03-10 17:32         ` Wolfgang Schuster
2009-03-11  8:06           ` Alan Stone
2009-03-13 14:22           ` Alan Stone
2009-03-13 14:33             ` Wolfgang Schuster

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=AE91ED5A-6CE2-49C0-9207-DF0D8BBCFF2D@gmail.com \
    --to=schuster.wolfgang@googlemail.com \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).