ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* paragraph question
@ 2009-03-03 11:49 Alan Stone
  2009-03-04 16:02 ` Alan Stone
  0 siblings, 1 reply; 23+ messages in thread
From: Alan Stone @ 2009-03-03 11:49 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hi,

How do you access the first paragraph of each chapter ?

I guess with...

\setuphead[chapter][after=\PlayWithFirstParagraph]

\def\PlayWithFirstParagraph...

How to fill in the dots ?

Alan
___________________________________________________________________________________
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] 23+ messages in thread

* Re: paragraph question
  2009-03-03 11:49 paragraph question Alan Stone
@ 2009-03-04 16:02 ` Alan Stone
  2009-03-04 16:32   ` Hans Hagen
                     ` (2 more replies)
  0 siblings, 3 replies; 23+ messages in thread
From: Alan Stone @ 2009-03-04 16:02 UTC (permalink / raw)
  To: mailing list for ConTeXt users

> How do you access the first paragraph of each chapter ?

... to calculate its number of lines ?

If not possible with ConTeXt commands, is this possible with LuaTeX commands?

Alan


On Tue, Mar 3, 2009 at 12:49 PM, Alan Stone
<software.list.1es9s@gmail.com> wrote:
> Hi,
>
> How do you access the first paragraph of each chapter ?
>
> I guess with...
>
> \setuphead[chapter][after=\PlayWithFirstParagraph]
>
> \def\PlayWithFirstParagraph...
>
> How to fill in the dots ?
>
> Alan
___________________________________________________________________________________
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] 23+ messages in thread

* Re: paragraph question
  2009-03-04 16:02 ` Alan Stone
@ 2009-03-04 16:32   ` Hans Hagen
  2009-03-04 16:33   ` Hans Hagen
  2009-03-04 22:38   ` Marcin Borkowski
  2 siblings, 0 replies; 23+ messages in thread
From: Hans Hagen @ 2009-03-04 16:32 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Alan Stone wrote:
>> How do you access the first paragraph of each chapter ?
> 
> .... to calculate its number of lines ?
> 
> If not possible with ConTeXt commands, is this possible with LuaTeX commands?

\the\prevgraf

but surely doable in luatex

Hans

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
      tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
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] 23+ messages in thread

* Re: paragraph question
  2009-03-04 16:02 ` Alan Stone
  2009-03-04 16:32   ` Hans Hagen
@ 2009-03-04 16:33   ` Hans Hagen
  2009-03-04 17:40     ` Alan Stone
  2009-03-04 22:38   ` Marcin Borkowski
  2 siblings, 1 reply; 23+ messages in thread
From: Hans Hagen @ 2009-03-04 16:33 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Alan Stone wrote:
>> How do you access the first paragraph of each chapter ?
> 
> .... to calculate its number of lines ?
> 
> If not possible with ConTeXt commands, is this possible with LuaTeX commands?

there is support for positional info ... depending on the problem that 
might help (set two positions and calculate the difference); no time now 
to explain details

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
      tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
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] 23+ messages in thread

* Re: paragraph question
  2009-03-04 16:33   ` Hans Hagen
@ 2009-03-04 17:40     ` Alan Stone
  0 siblings, 0 replies; 23+ messages in thread
From: Alan Stone @ 2009-03-04 17:40 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Wed, Mar 4, 2009 at 5:33 PM, Hans Hagen <pragma@wxs.nl> wrote:
> Alan Stone wrote:
>>>
>>> How do you access the first paragraph of each chapter ?
>>
>> .... to calculate its number of lines ?
>>
>> If not possible with ConTeXt commands, is this possible with LuaTeX
>> commands?
>
> there is support for positional info ... depending on the problem

To set \setuplettrine[Lines=1] if "chapter's first paragraph number of
lines = 1".

>that might
> help (set two positions and calculate the difference); no time now to
> explain details
___________________________________________________________________________________
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] 23+ messages in thread

* Re: paragraph question
  2009-03-04 16:02 ` Alan Stone
  2009-03-04 16:32   ` Hans Hagen
  2009-03-04 16:33   ` Hans Hagen
@ 2009-03-04 22:38   ` Marcin Borkowski
  2009-03-04 23:15     ` Wolfgang Schuster
  2009-03-05  8:05     ` Hans Hagen
  2 siblings, 2 replies; 23+ messages in thread
From: Marcin Borkowski @ 2009-03-04 22:38 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Dnia Wed, Mar 04, 2009 at 05:02:40PM +0100, Alan Stone napisa&#322;(a):
> > How do you access the first paragraph of each chapter ?
> 
> ... to calculate its number of lines ?
> 
> If not possible with ConTeXt commands, is this possible with LuaTeX commands?

Maybe redefine \par to do something like

\def\nooflines{\prevgraf}\let\par=\oldpar

where previously you hd \let\oldpar=\par

Regards

-- 
Marcin Borkowski (http://mbork.pl)

Jezus żyje NAPRAWDĘ.
A Ty?
___________________________________________________________________________________
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] 23+ messages in thread

* Re: paragraph question
  2009-03-04 22:38   ` Marcin Borkowski
@ 2009-03-04 23:15     ` Wolfgang Schuster
  2009-03-05  8:05     ` Hans Hagen
  1 sibling, 0 replies; 23+ messages in thread
From: Wolfgang Schuster @ 2009-03-04 23:15 UTC (permalink / raw)
  To: mailing list for ConTeXt users


Am 04.03.2009 um 23:38 schrieb Marcin Borkowski:

> Dnia Wed, Mar 04, 2009 at 05:02:40PM +0100, Alan Stone napisa&#322; 
> (a):
>>> How do you access the first paragraph of each chapter ?
>>
>> ... to calculate its number of lines ?
>>
>> If not possible with ConTeXt commands, is this possible with LuaTeX  
>> commands?
>
> Maybe redefine \par to do something like
>
> \def\nooflines{\prevgraf}\let\par=\oldpar
>
> where previously you hd \let\oldpar=\par

I don't think this will work without problems for a complete document.

Enclosing each paragraph with \bpar ... \epar allows you to count the  
paragraph
number since the last chapter and you can save \prevgraf at the end  
with twopass
data for the next run.

But wouldn't a direct \lettrine at the begin of the first paragraph be  
easier.

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] 23+ messages in thread

* Re: paragraph question
  2009-03-04 22:38   ` Marcin Borkowski
  2009-03-04 23:15     ` Wolfgang Schuster
@ 2009-03-05  8:05     ` Hans Hagen
  2009-03-05 12:45       ` Alan Stone
  1 sibling, 1 reply; 23+ messages in thread
From: Hans Hagen @ 2009-03-05  8:05 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Marcin Borkowski wrote:
> Dnia Wed, Mar 04, 2009 at 05:02:40PM +0100, Alan Stone napisa&#322;(a):
>>> How do you access the first paragraph of each chapter ?
>> ... to calculate its number of lines ?
>>
>> If not possible with ConTeXt commands, is this possible with LuaTeX commands?
> 
> Maybe redefine \par to do something like
> 
> \def\nooflines{\prevgraf}\let\par=\oldpar
> 
> where previously you hd \let\oldpar=\par

messing around with \par is dangerous and asking for trouble


-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
      tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
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] 23+ messages in thread

* Re: paragraph question
  2009-03-05  8:05     ` Hans Hagen
@ 2009-03-05 12:45       ` Alan Stone
  2009-03-05 12:55         ` Hans Hagen
  0 siblings, 1 reply; 23+ messages in thread
From: Alan Stone @ 2009-03-05 12:45 UTC (permalink / raw)
  To: mailing list for ConTeXt users

How do you invoke a command at the end of a paragraph ?

Alan
___________________________________________________________________________________
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] 23+ messages in thread

* Re: paragraph question
  2009-03-05 12:45       ` Alan Stone
@ 2009-03-05 12:55         ` Hans Hagen
  2009-03-05 13:25           ` Alan Stone
  0 siblings, 1 reply; 23+ messages in thread
From: Hans Hagen @ 2009-03-05 12:55 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Alan Stone wrote:
> How do you invoke a command at the end of a paragraph ?

there is no hook for that (apart from adding a \endofpar command or 
whatever to every paragraph

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
      tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
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] 23+ messages in thread

* Re: paragraph question
  2009-03-05 12:55         ` Hans Hagen
@ 2009-03-05 13:25           ` Alan Stone
  2009-03-05 13:44             ` Wolfgang Schuster
  0 siblings, 1 reply; 23+ messages in thread
From: Alan Stone @ 2009-03-05 13:25 UTC (permalink / raw)
  To: mailing list for ConTeXt users

>> How do you invoke a command at the end of a paragraph ?
>
> there is no hook for that (apart from adding a \endofpar command or whatever
> to every paragraph

>From "TeX for the Impatient"...

-----------------------------------------------
\prevgraf [ <number> parameter ]
In horizontal mode, this parameter specifies the number of lines in the
paragraph so far; in vertical mode, it specifies the number of lines in
the previous paragraph.
-----------------------------------------------

After giving it some further thought and with reference to "specifies
the number of lines in the
paragraph so far", I don't need to know the paragraph's number of
lines but whether its "number of lines" = 1 or not.

Alan
___________________________________________________________________________________
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] 23+ messages in thread

* Re: paragraph question
  2009-03-05 13:25           ` Alan Stone
@ 2009-03-05 13:44             ` Wolfgang Schuster
  2009-03-05 14:05               ` Marcin Borkowski
  2009-03-05 14:08               ` Alan Stone
  0 siblings, 2 replies; 23+ messages in thread
From: Wolfgang Schuster @ 2009-03-05 13:44 UTC (permalink / raw)
  To: mailing list for ConTeXt users


Am 05.03.2009 um 14:25 schrieb Alan Stone:

> After giving it some further thought and with reference to "specifies
> the number of lines in the
> paragraph so far", I don't need to know the paragraph's number of
> lines but whether its "number of lines" = 1 or not.


You can test whether the last paragraph had 1 or more lines and make
your decision dependent on the result but this can be done only after
the paragraph ist finished.

\def\paragraphlines
   {\blank % Finish the last paragraph
    \ifnum\prevgraf=1 What I want.\else Too many lines.\fi
    \blank}

\starttext

\dorecurse{30}{text }\paragraphlines

\dorecurse{10}{text }\paragraphlines

\dorecurse{50}{text }\paragraphlines

\stoptext

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] 23+ messages in thread

* Re: paragraph question
  2009-03-05 13:44             ` Wolfgang Schuster
@ 2009-03-05 14:05               ` Marcin Borkowski
  2009-03-05 14:14                 ` Wolfgang Schuster
  2009-03-05 14:08               ` Alan Stone
  1 sibling, 1 reply; 23+ messages in thread
From: Marcin Borkowski @ 2009-03-05 14:05 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Dnia Thu, Mar 05, 2009 at 02:44:53PM +0100, Wolfgang Schuster napisa&#322;(a):
> 
> Am 05.03.2009 um 14:25 schrieb Alan Stone:
> 
> >After giving it some further thought and with reference to "specifies
> >the number of lines in the
> >paragraph so far", I don't need to know the paragraph's number of
> >lines but whether its "number of lines" = 1 or not.
> 
> 
> You can test whether the last paragraph had 1 or more lines and make
> your decision dependent on the result but this can be done only after
> the paragraph ist finished.

Well, Wolfgang, you'll be surprised: it can be done (even in pure
vanilla TeX), at the expense of (possibly) nonuniform spacing.  Google
for a file "meashor.tex":).  (In Poland, we have a saying: "nasi górą!"
-- roughly "our people win!" -- I can't resist citing it here, since it
was Bogusław Jackowski who wrote that macros:)).

Regards

-- 
Marcin Borkowski (http://mbork.pl)

Remember that direct plagiarism, including the editing of other
people's work, is distinctly uncool.

                                    (Mark's Pixel Art Tutorial)
___________________________________________________________________________________
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] 23+ messages in thread

* Re: paragraph question
  2009-03-05 13:44             ` Wolfgang Schuster
  2009-03-05 14:05               ` Marcin Borkowski
@ 2009-03-05 14:08               ` Alan Stone
  2009-03-05 14:17                 ` Wolfgang Schuster
  2009-03-05 16:09                 ` Hans Hagen
  1 sibling, 2 replies; 23+ messages in thread
From: Alan Stone @ 2009-03-05 14:08 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Thanks Wolfgang, however I'm looking for a solution without adding
additional commands to the text source.

Requires to switch to the LuaTeX list ?

Alan

On Thu, Mar 5, 2009 at 2:44 PM, Wolfgang Schuster
<schuster.wolfgang@googlemail.com> wrote:
>
> Am 05.03.2009 um 14:25 schrieb Alan Stone:
>
>> After giving it some further thought and with reference to "specifies
>> the number of lines in the
>> paragraph so far", I don't need to know the paragraph's number of
>> lines but whether its "number of lines" = 1 or not.
>
>
> You can test whether the last paragraph had 1 or more lines and make
> your decision dependent on the result but this can be done only after
> the paragraph ist finished.
>
> \def\paragraphlines
>  {\blank % Finish the last paragraph
>   \ifnum\prevgraf=1 What I want.\else Too many lines.\fi
>   \blank}
>
> \starttext
>
> \dorecurse{30}{text }\paragraphlines
>
> \dorecurse{10}{text }\paragraphlines
>
> \dorecurse{50}{text }\paragraphlines
>
> \stoptext
>
> 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
> ___________________________________________________________________________________
>



-- 
Alan
___________________________________________________________________________________
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] 23+ messages in thread

* Re: paragraph question
  2009-03-05 14:05               ` Marcin Borkowski
@ 2009-03-05 14:14                 ` Wolfgang Schuster
  2009-03-05 15:22                   ` Marcin Borkowski
  0 siblings, 1 reply; 23+ messages in thread
From: Wolfgang Schuster @ 2009-03-05 14:14 UTC (permalink / raw)
  To: mailing list for ConTeXt users


Am 05.03.2009 um 15:05 schrieb Marcin Borkowski:

>> You can test whether the last paragraph had 1 or more lines and make
>> your decision dependent on the result but this can be done only after
>> the paragraph ist finished.
>
> Well, Wolfgang, you'll be surprised: it can be done (even in pure
> vanilla TeX), at the expense of (possibly) nonuniform spacing.  Google
> for a file "meashor.tex":).  (In Poland, we have a saying: "nasi  
> górą!"
> -- roughly "our people win!" -- I can't resist citing it here, since  
> it
> was Bogusław Jackowski who wrote that macros:)).

I found the information about display math in my TeX book (although my
TeX skills are not good enough to to write the code) but Alan want to
know the number of lines before the text is typeset to insert a lettrine
at the begin of the paragraph, can you also deliver code for this?

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] 23+ messages in thread

* Re: paragraph question
  2009-03-05 14:08               ` Alan Stone
@ 2009-03-05 14:17                 ` Wolfgang Schuster
  2009-03-05 16:09                 ` Hans Hagen
  1 sibling, 0 replies; 23+ messages in thread
From: Wolfgang Schuster @ 2009-03-05 14:17 UTC (permalink / raw)
  To: mailing list for ConTeXt users


Am 05.03.2009 um 15:08 schrieb Alan Stone:

> Thanks Wolfgang, however I'm looking for a solution without adding
> additional commands to the text source.
>
> Requires to switch to the LuaTeX list ?

You can give it a try but I think Hans or Taco had given you then
a solution if this is possible but I could be wrong regarding LuaTeX.

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] 23+ messages in thread

* Re: paragraph question
  2009-03-05 14:14                 ` Wolfgang Schuster
@ 2009-03-05 15:22                   ` Marcin Borkowski
  0 siblings, 0 replies; 23+ messages in thread
From: Marcin Borkowski @ 2009-03-05 15:22 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Dnia Thu, Mar 05, 2009 at 03:14:23PM +0100, Wolfgang Schuster napisa&#322;(a):
> 
> Am 05.03.2009 um 15:05 schrieb Marcin Borkowski:
> 
> >>You can test whether the last paragraph had 1 or more lines and make
> >>your decision dependent on the result but this can be done only after
> >>the paragraph ist finished.
> >
> >Well, Wolfgang, you'll be surprised: it can be done (even in pure
> >vanilla TeX), at the expense of (possibly) nonuniform spacing.  Google
> >for a file "meashor.tex":).  (In Poland, we have a saying: "nasi  
> >górą!"
> >-- roughly "our people win!" -- I can't resist citing it here, since  
> >it
> >was Bogusław Jackowski who wrote that macros:)).
> 
> I found the information about display math in my TeX book (although my
> TeX skills are not good enough to to write the code) but Alan want to
> know the number of lines before the text is typeset to insert a lettrine
> at the begin of the paragraph, can you also deliver code for this?

Well, obviously not:).  But I only wanted to show that it _is_ possible
to know in which line we are before we have the whole paragraph typeset
(although with limitations).  Sorry, it was a bit off-topic, but I
couldn't resist the temptation to point out that Wolfgang The Great TeX
Haxxor doesn't know something:P.
> 
> Wolfgang

regards

-- 
Marcin Borkowski (http://mbork.pl)

Szema Izrael: Adonai Elohenu, Adonai Ehad!
___________________________________________________________________________________
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] 23+ messages in thread

* Re: paragraph question
  2009-03-05 14:08               ` Alan Stone
  2009-03-05 14:17                 ` Wolfgang Schuster
@ 2009-03-05 16:09                 ` Hans Hagen
  2009-03-05 16:21                   ` Alan Stone
  1 sibling, 1 reply; 23+ messages in thread
From: Hans Hagen @ 2009-03-05 16:09 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Alan Stone wrote:
> Thanks Wolfgang, however I'm looking for a solution without adding
> additional commands to the text source.
> 
> Requires to switch to the LuaTeX list ?

that does not help you as taco and i are on both lists

i can imagine that mkiv at some point privides something but it needs 
way more thinking (we have this end of par problem since ages) if only 
because what you see as end of par might actually be just before the 
final skips that ends a par

something everyendpar is on our todo list but later in the luatex project

Hans

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
      tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
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] 23+ messages in thread

* Re: paragraph question
  2009-03-05 16:09                 ` Hans Hagen
@ 2009-03-05 16:21                   ` Alan Stone
  2009-03-05 18:35                     ` Hans Hagen
  0 siblings, 1 reply; 23+ messages in thread
From: Alan Stone @ 2009-03-05 16:21 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Thu, Mar 5, 2009 at 5:09 PM, Hans Hagen <pragma@wxs.nl> wrote:
> Alan Stone wrote:
>>
>> Thanks Wolfgang, however I'm looking for a solution without adding
>> additional commands to the text source.
>>
>> Requires to switch to the LuaTeX list ?
>
> that does not help you as taco and i are on both lists
>
> i can imagine that mkiv at some point privides something but it needs way
> more thinking (we have this end of par problem since ages) if only because
> what you see as end of par might actually be just before the final skips
> that ends a par
>
> something everyendpar is on our todo list but later in the luatex project
>
> Hans

Ok.

In the meantime, an idea - for what it's worth...

Would it be possible to somehow, in the typesetting process, dummy
typeset the first paragraph of each chapter (in memory or in a dummy
output file) to determine whether its number of lines = 1 or > 1, or
determine its total number of lines, and work from there ?

Alan
___________________________________________________________________________________
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] 23+ messages in thread

* Re: paragraph question
  2009-03-05 16:21                   ` Alan Stone
@ 2009-03-05 18:35                     ` Hans Hagen
  2009-03-06  9:42                       ` Alan Stone
  0 siblings, 1 reply; 23+ messages in thread
From: Hans Hagen @ 2009-03-05 18:35 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Alan Stone wrote:
> On Thu, Mar 5, 2009 at 5:09 PM, Hans Hagen <pragma@wxs.nl> wrote:
>> Alan Stone wrote:
>>> Thanks Wolfgang, however I'm looking for a solution without adding
>>> additional commands to the text source.
>>>
>>> Requires to switch to the LuaTeX list ?
>> that does not help you as taco and i are on both lists
>>
>> i can imagine that mkiv at some point privides something but it needs way
>> more thinking (we have this end of par problem since ages) if only because
>> what you see as end of par might actually be just before the final skips
>> that ends a par
>>
>> something everyendpar is on our todo list but later in the luatex project
>>
>> Hans
> 
> Ok.
> 
> In the meantime, an idea - for what it's worth...
> 
> Would it be possible to somehow, in the typesetting process, dummy
> typeset the first paragraph of each chapter (in memory or in a dummy
> output file) to determine whether its number of lines = 1 or > 1, or
> determine its total number of lines, and work from there ?

a luatex/mkiv solution is actually rather simple but i'm in the middle 
of math stuff so it has to wait some time

Hans


-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
      tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
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] 23+ messages in thread

* Re: paragraph question
  2009-03-05 18:35                     ` Hans Hagen
@ 2009-03-06  9:42                       ` Alan Stone
  2009-03-06 14:05                         ` Hans Hagen
  0 siblings, 1 reply; 23+ messages in thread
From: Alan Stone @ 2009-03-06  9:42 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Another idea...

How do you make this line counter work ?

\newcount\parnumber
\newcount\linenumber
\def\myCounters{%
   \EveryPar{%
      \advance\parnumber by 1
      (P\the\parnumber)
      \EveryLine{%
%         (L\the\prevgraf)}}
      \advance\linenumber by 1
      (L\the\linenumber)}
      \linenumber=0\relax}
   \parnumber=0\relax}

\setuphead[chapter][page=,after={\myCounters}]

\starttext

\chapter{Chapter 0}

Only one line.

\dorecurse{2}{\chapter{Chapter #1}\input knuth}

\stoptext


Alan
___________________________________________________________________________________
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] 23+ messages in thread

* Re: paragraph question
  2009-03-06  9:42                       ` Alan Stone
@ 2009-03-06 14:05                         ` Hans Hagen
  2009-03-06 14:25                           ` Alan Stone
  0 siblings, 1 reply; 23+ messages in thread
From: Hans Hagen @ 2009-03-06 14:05 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Alan Stone wrote:
> Another idea...
> 
> How do you make this line counter work ?
> 
> \newcount\parnumber
> \newcount\linenumber
> \def\myCounters{%
>    \EveryPar{%
>       \advance\parnumber by 1
>       (P\the\parnumber)
>       \EveryLine{%
> %         (L\the\prevgraf)}}
>       \advance\linenumber by 1
>       (L\the\linenumber)}
>       \linenumber=0\relax}
>    \parnumber=0\relax}
> 
> \setuphead[chapter][page=,after={\myCounters}]
> 
> \starttext
> 
> \chapter{Chapter 0}
> 
> Only one line.
> 
> \dorecurse{2}{\chapter{Chapter #1}\input knuth}
> 
> \stoptext


\startlinenumbering

\input tufte

\stoplinenumbering

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
      tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
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] 23+ messages in thread

* Re: paragraph question
  2009-03-06 14:05                         ` Hans Hagen
@ 2009-03-06 14:25                           ` Alan Stone
  0 siblings, 0 replies; 23+ messages in thread
From: Alan Stone @ 2009-03-06 14:25 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Fri, Mar 6, 2009 at 3:05 PM, Hans Hagen <pragma@wxs.nl> wrote:
[...]
> \startlinenumbering
>
> \input tufte
>
> \stoplinenumbering

Ok, my question was a bit ambiguous...

I was not looking to number lines, but to count lines using EveryLine
within EveryPar, aka the paragraph counter \parnumber in the provided
code.

Alan
___________________________________________________________________________________
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] 23+ messages in thread

end of thread, other threads:[~2009-03-06 14:25 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-03-03 11:49 paragraph question Alan Stone
2009-03-04 16:02 ` Alan Stone
2009-03-04 16:32   ` Hans Hagen
2009-03-04 16:33   ` Hans Hagen
2009-03-04 17:40     ` Alan Stone
2009-03-04 22:38   ` Marcin Borkowski
2009-03-04 23:15     ` Wolfgang Schuster
2009-03-05  8:05     ` Hans Hagen
2009-03-05 12:45       ` Alan Stone
2009-03-05 12:55         ` Hans Hagen
2009-03-05 13:25           ` Alan Stone
2009-03-05 13:44             ` Wolfgang Schuster
2009-03-05 14:05               ` Marcin Borkowski
2009-03-05 14:14                 ` Wolfgang Schuster
2009-03-05 15:22                   ` Marcin Borkowski
2009-03-05 14:08               ` Alan Stone
2009-03-05 14:17                 ` Wolfgang Schuster
2009-03-05 16:09                 ` Hans Hagen
2009-03-05 16:21                   ` Alan Stone
2009-03-05 18:35                     ` Hans Hagen
2009-03-06  9:42                       ` Alan Stone
2009-03-06 14:05                         ` Hans Hagen
2009-03-06 14:25                           ` Alan Stone

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).