* paragraph question (the return :O)
@ 2009-03-10 15:06 Alan Stone
2009-03-10 15:35 ` Wolfgang Schuster
0 siblings, 1 reply; 9+ messages in thread
From: Alan Stone @ 2009-03-10 15:06 UTC (permalink / raw)
To: mailing list for ConTeXt users
[-- Attachment #1.1: Type: text/plain, Size: 153 bytes --]
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 ?
--
Alan
[-- Attachment #1.2: Type: text/html, Size: 245 bytes --]
[-- Attachment #2: countlines.tex --]
[-- Type: application/x-tex, Size: 1677 bytes --]
[-- Attachment #3: countlines.pdf --]
[-- Type: application/pdf, Size: 7764 bytes --]
[-- Attachment #4: Type: text/plain, Size: 487 bytes --]
___________________________________________________________________________________
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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: paragraph question (the return :O)
2009-03-10 15:06 paragraph question (the return :O) Alan Stone
@ 2009-03-10 15:35 ` Wolfgang Schuster
2009-03-10 16:35 ` Alan Stone
0 siblings, 1 reply; 9+ messages in thread
From: Wolfgang Schuster @ 2009-03-10 15:35 UTC (permalink / raw)
To: mailing list for ConTeXt users
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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: paragraph question (the return :O)
2009-03-10 15:35 ` Wolfgang Schuster
@ 2009-03-10 16:35 ` Alan Stone
2009-03-10 16:46 ` Wolfgang Schuster
0 siblings, 1 reply; 9+ messages in thread
From: Alan Stone @ 2009-03-10 16:35 UTC (permalink / raw)
To: mailing list for ConTeXt users
[-- Attachment #1.1: Type: text/plain, Size: 1805 bytes --]
On Tue, Mar 10, 2009 at 4:35 PM, Wolfgang Schuster <
schuster.wolfgang@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
>
[-- Attachment #1.2: Type: text/html, Size: 2637 bytes --]
[-- Attachment #2: countlines2.tex --]
[-- Type: application/x-tex, Size: 1830 bytes --]
[-- Attachment #3: countlines2.pdf --]
[-- Type: application/pdf, Size: 8805 bytes --]
[-- Attachment #4: Type: text/plain, Size: 487 bytes --]
___________________________________________________________________________________
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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: paragraph question (the return :O)
2009-03-10 16:35 ` Alan Stone
@ 2009-03-10 16:46 ` Wolfgang Schuster
2009-03-10 17:14 ` Alan Stone
0 siblings, 1 reply; 9+ messages in thread
From: Wolfgang Schuster @ 2009-03-10 16:46 UTC (permalink / raw)
To: mailing list for ConTeXt users
Am 10.03.2009 um 17:35 schrieb Alan Stone:
> On Tue, Mar 10, 2009 at 4:35 PM, Wolfgang Schuster <schuster.wolfgang@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 ?
Your \EveryPar hackery.
> I apologize for my ignorance, I'm still confused with this one (see
> attachments)...
Why?
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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: paragraph question (the return :O)
2009-03-10 16:46 ` Wolfgang Schuster
@ 2009-03-10 17:14 ` Alan Stone
2009-03-10 17:32 ` Wolfgang Schuster
0 siblings, 1 reply; 9+ messages in thread
From: Alan Stone @ 2009-03-10 17:14 UTC (permalink / raw)
To: mailing list for ConTeXt users
[-- Attachment #1.1: Type: text/plain, Size: 876 bytes --]
On Tue, Mar 10, 2009 at 5:46 PM, Wolfgang Schuster <
schuster.wolfgang@googlemail.com> wrote:
>
> Am 10.03.2009 um 17:35 schrieb Alan Stone:
>
> On Tue, Mar 10, 2009 at 4:35 PM, Wolfgang Schuster <
>> schuster.wolfgang@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 ?
>>
>
> Your \EveryPar hackery.
What is it about it that it's a bad idea ?
> I apologize for my ignorance, I'm still confused with this one (see
>> attachments)...
>>
>
> Why?
--------------------------------
code:
\ifnum \parlines = 1
(step 3: P\space \the\parnumber, \the\parlines\space L)%
\fi
--------------------------------
output:
2 Chapter 2
(step 3: P 1, 3 L)Thus, I came to the...
--------------------------------
(step 3: ...) is typeset one first paragraph too far.
Alan
[-- Attachment #1.2: Type: text/html, Size: 1922 bytes --]
[-- Attachment #2: Type: text/plain, Size: 487 bytes --]
___________________________________________________________________________________
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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: paragraph question (the return :O)
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
0 siblings, 2 replies; 9+ messages in thread
From: Wolfgang Schuster @ 2009-03-10 17:32 UTC (permalink / raw)
To: mailing list for ConTeXt users
Am 10.03.2009 um 18:14 schrieb Alan Stone:
>>> 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 ?
>>
>> Your \EveryPar hackery.
>
> What is it about it that it's a bad idea ?
Who knows, it could work or fail in a few cases.
>> I apologize for my ignorance, I'm still confused with this one (see
>> attachments)...
>>
>> Why?
>
> (step 3: ...) is typeset one first paragraph too far.
\def\doCountLines#1\par{%
\begingroup
\setbox\scratchbox\vbox{#1\par}%
\getnoflines{\htdp\scratchbox}%
\global\parlines=\noflines\relax
% (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}
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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: paragraph question (the return :O)
2009-03-10 17:32 ` Wolfgang Schuster
@ 2009-03-11 8:06 ` Alan Stone
2009-03-13 14:22 ` Alan Stone
1 sibling, 0 replies; 9+ messages in thread
From: Alan Stone @ 2009-03-11 8:06 UTC (permalink / raw)
To: mailing list for ConTeXt users
[-- Attachment #1.1: Type: text/plain, Size: 1097 bytes --]
Thanks Wolfgang.
Digging into some TeX books to understand how and why these fixes work...
Alan
On Tue, Mar 10, 2009 at 6:32 PM, Wolfgang Schuster <
schuster.wolfgang@googlemail.com> wrote:
>
> Am 10.03.2009 um 18:14 schrieb Alan Stone:
>
> 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
>>>> ?
>>>>
>>>
>>> Your \EveryPar hackery.
>>>
>>
>> What is it about it that it's a bad idea ?
>>
>
> Who knows, it could work or fail in a few cases.
>
> I apologize for my ignorance, I'm still confused with this one (see
>>> attachments)...
>>>
>>> Why?
>>>
>>
>> (step 3: ...) is typeset one first paragraph too far.
>>
>
> \def\doCountLines#1\par{%
> \begingroup
> \setbox\scratchbox\vbox{#1\par}%
> \getnoflines{\htdp\scratchbox}%
> \global\parlines=\noflines\relax
> % (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}
>
>
> Wolfgang
>
[-- Attachment #1.2: Type: text/html, Size: 2358 bytes --]
[-- Attachment #2: Type: text/plain, Size: 487 bytes --]
___________________________________________________________________________________
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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: paragraph question (the return :O)
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
1 sibling, 1 reply; 9+ messages in thread
From: Alan Stone @ 2009-03-13 14:22 UTC (permalink / raw)
To: mailing list for ConTeXt users
[-- Attachment #1.1: Type: text/plain, Size: 1250 bytes --]
Why this error (source: see attachment) ?
chapter : 1 Chapter 1
! Extra \fi.
<argument> \fi
One line.
\doCountLines ...arlines \space L)\fi \endgroup #1
\par
l.35
Thanks,
Alan
On Tue, Mar 10, 2009 at 6:32 PM, Wolfgang Schuster <
schuster.wolfgang@googlemail.com> wrote:
>
> Am 10.03.2009 um 18:14 schrieb Alan Stone:
>
> 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
>>>> ?
>>>>
>>>
>>> Your \EveryPar hackery.
>>>
>>
>> What is it about it that it's a bad idea ?
>>
>
> Who knows, it could work or fail in a few cases.
>
> I apologize for my ignorance, I'm still confused with this one (see
>>> attachments)...
>>>
>>> Why?
>>>
>>
>> (step 3: ...) is typeset one first paragraph too far.
>>
>
> \def\doCountLines#1\par{%
> \begingroup
> \setbox\scratchbox\vbox{#1\par}%
> \getnoflines{\htdp\scratchbox}%
> \global\parlines=\noflines\relax
> % (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}
>
>
> Wolfgang
>
[-- Attachment #1.2: Type: text/html, Size: 2445 bytes --]
[-- Attachment #2: countlines3.tex --]
[-- Type: application/x-tex, Size: 1792 bytes --]
[-- Attachment #3: Type: text/plain, Size: 487 bytes --]
___________________________________________________________________________________
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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: paragraph question (the return :O)
2009-03-13 14:22 ` Alan Stone
@ 2009-03-13 14:33 ` Wolfgang Schuster
0 siblings, 0 replies; 9+ messages in thread
From: Wolfgang Schuster @ 2009-03-13 14:33 UTC (permalink / raw)
To: mailing list for ConTeXt users
Am 13.03.2009 um 15:22 schrieb Alan Stone:
> Why this error (source: see attachment) ?
\ifnum\parnumber=1
\expandafter\expandafter\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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2009-03-13 14:33 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-03-10 15:06 paragraph question (the return :O) Alan Stone
2009-03-10 15:35 ` Wolfgang Schuster
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
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).