Re: [NTG-context] orphans and widows in poems

2013-06-17 Thread Bill Meahan

On 6/17/2013 1:39 AM, Wolfgang Schuster wrote:

  Verse page.
You don’t need any tricks to prevent page breaks in a lines environment because
\setuplines[option=packed] already does it.

Wolfgang



You still need to make each stanza an individual lines environment, 
don't you?


--
Bill Meahan
Westland Michigan

___
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  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] orphans and widows in poems

2013-06-17 Thread Pablo Rodríguez
On 16/06/13 21:03, Wolfgang Schuster wrote:
 Am 16.06.2013 um 09:46 schrieb Pablo Rodríguez oi...@web.de:
 [...]
 Is there no way to avoid orphans and widows in the lines
 environment?
 
 1. Don’t use * in your setups names because names starting with an
 asterisk are system modes.
 
 2. To load the defaults settings you have to use \setups[*reset]
 which needs the asterisks because it’s a system mode.
 
 3.The settings doesn’t help because in the lines environment each
 line is a separate paragraph which makes \widowpenalty useless here.

Thanks for your reply, Wolfgang.

So, according to 3, there is no way to prevent widow or orphan lines in
a line environment, isn't it?

Many thanks for your help again,


Pablo
-- 
http://www.ousia.tk
___
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  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] orphans and widows in poems

2013-06-17 Thread Pablo Rodríguez
On 17/06/13 07:39, Wolfgang Schuster wrote:
 Am 17.06.2013 um 02:36 schrieb Bill Meahan subscribed_li...@meahan.net:
 On 6/16/2013 3:46 AM, Pablo Rodríguez wrote:
[...]
 Is there no way to avoid orphans and widows in the lines environment?
 It's a bit ugly, but if the poem consists of individual stanzas,
 you can put each stanza in an non-bordered frame.
 [...]
 A frame will never be split across pages.

 BTW this trickis on the wiki on the Verse page.
 
 You don’t need any tricks to prevent page breaks in a lines environment 
 because
 \setuplines[option=packed] already does it.

Many thanks for your replies, Bill, Aditya and Wolfgang.

I don't want to prevent page breaks in lines environment, I only want to
prevent orphan and widow lines in this environment too (which seems to
be impossible, if I didn't get it wrong).


Pablo
-- 
http://www.ousia.tk
___
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  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] orphans and widows in poems

2013-06-17 Thread Pablo Rodríguez
On 16/06/13 21:03, Wolfgang Schuster wrote:
 Am 16.06.2013 um 09:46 schrieb Pablo Rodríguez oi...@web.de:
 [...]
 Is there no way to avoid orphans and widows in the lines environment?
 [...]
 3. The settings doesn’t help because in the lines environment each
 line is a separate paragraph which makes \widowpenalty useless here.

Wolfgang,

it just came to my mind that a workaround to avoid orphans and widows
would be not to use the lines environment and add new lines, such as in:

First verse\\
second verse\\
third verse\\
fourth verse.

It seems to work in my example. Does it have another unwanted consequences?

Many thanks for your help,


Pablo
-- 
http://www.ousia.tk
___
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  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] orphans and widows in poems

2013-06-17 Thread Wolfgang Schuster

Am 17.06.2013 um 15:50 schrieb Bill Meahan subscribed_li...@meahan.net:

 On 6/17/2013 1:39 AM, Wolfgang Schuster wrote:
  Verse page.
 You don’t need any tricks to prevent page breaks in a lines environment 
 because
 \setuplines[option=packed] already does it.
 
 Wolfgang
 
 
 You still need to make each stanza an individual lines environment, don't you?


You can change the definition of the inbetween key (default: \blank)
which is used when you add a blank line in the environment. With the
preference keyword for \blank you can allow a page break.

\setuplayout[lines=8]

\starttext \showframe

\startlines[option=packed,inbetween={\blank[preference,line]}]
Line 1
Line 2
Line 3
Line 4

Line 5
Line 6
Line 7
Line 8
\stoplines

\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  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] orphans and widows in poems

2013-06-17 Thread Wolfgang Schuster

Am 17.06.2013 um 19:18 schrieb Pablo Rodríguez oi...@web.de:

 On 16/06/13 21:03, Wolfgang Schuster wrote:
 Am 16.06.2013 um 09:46 schrieb Pablo Rodríguez oi...@web.de:
 [...]
 Is there no way to avoid orphans and widows in the lines
 environment?
 
 1. Don’t use * in your setups names because names starting with an
 asterisk are system modes.
 
 2. To load the defaults settings you have to use \setups[*reset]
 which needs the asterisks because it’s a system mode.
 
 3.The settings doesn’t help because in the lines environment each
 line is a separate paragraph which makes \widowpenalty useless here.
 
 Thanks for your reply, Wolfgang.
 
 So, according to 3, there is no way to prevent widow or orphan lines in
 a line environment, isn't it?

Not with the current implementation of the environment because it doesn’t
know how many lines are there. With a Lua based solution it would be simple
to add a mechanism to prevent a page break at a certain region because
the needed information are available.

\startluacode

userdata  = userdata  or { }
userdata.linescontent = userdata.linescontent or { }

local linescontent = userdata.linescontent

function linescontent.process()
local lines = string.splitlines(buffers.getcontent(linescontent))
context.begingroup()
for i=1,#lines do
local l = lines[i]
context(%s,l)
context.par()
end
context.endgroup()
end

\stopluacode

\def\startlinescontent
  {\grabbufferdata[linescontent][startlinescontent][stoplinescontent]}

\def\stoplinescontent
  {\ctxlua{userdata.linescontent.process()}}

\starttext

\startlinescontent
One
Two
Three
Four
Five
Six
\stoplinescontent

\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  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] orphans and widows in poems

2013-06-17 Thread Hans Hagen

On 6/17/2013 11:05 PM, Wolfgang Schuster wrote:


Am 17.06.2013 um 19:18 schrieb Pablo Rodríguez oi...@web.de:


On 16/06/13 21:03, Wolfgang Schuster wrote:

Am 16.06.2013 um 09:46 schrieb Pablo Rodríguez oi...@web.de:

[...]
Is there no way to avoid orphans and widows in the lines
environment?


1. Don’t use * in your setups names because names starting with an
asterisk are system modes.

2. To load the defaults settings you have to use \setups[*reset]
which needs the asterisks because it’s a system mode.

3.The settings doesn’t help because in the lines environment each
line is a separate paragraph which makes \widowpenalty useless here.


Thanks for your reply, Wolfgang.

So, according to 3, there is no way to prevent widow or orphan lines in
a line environment, isn't it?


Not with the current implementation of the environment because it doesn’t
know how many lines are there. With a Lua based solution it would be simple
to add a mechanism to prevent a page break at a certain region because
the needed information are available.


yes, some of that is on the agenda (not to hard but as usual it take a 
bit of thinking / experimenting to get an interface)


basically it's a variant of \setpenalties (the plural \widowpenalties etc)


\startluacode

userdata  = userdata  or { }
userdata.linescontent = userdata.linescontent or { }

local linescontent = userdata.linescontent

function linescontent.process()
local lines = string.splitlines(buffers.getcontent(linescontent))
context.begingroup()
for i=1,#lines do
local l = lines[i]
context(%s,l)
context.par()
end
context.endgroup()
end

\stopluacode

\def\startlinescontent
   {\grabbufferdata[linescontent][startlinescontent][stoplinescontent]}

\def\stoplinescontent
   {\ctxlua{userdata.linescontent.process()}}

\starttext

\startlinescontent
One
Two
Three
Four
Five
Six
\stoplinescontent

\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  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___




--

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | voip: 087 875 68 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  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


[NTG-context] orphans and widows in poems

2013-06-16 Thread Pablo Rodríguez
Dear list,

I have a document that contains a long poem and although it contains the
following code:

\setuplayout[setups=*lessstrict]
\startsetups[*lessstrict]
\setup[reset]
\widowpenalty=1
\clubpenalty=1
\brokenpenalty=1
\stopsetups

I'm afraid that I get widow lines in the lines environment.

Is there no way to avoid orphans and widows in the lines environment?

Many thanks for your help,


Pablo
-- 
http://www.ousia.tk
___
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  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] orphans and widows in poems

2013-06-16 Thread Wolfgang Schuster

Am 16.06.2013 um 09:46 schrieb Pablo Rodríguez oi...@web.de:

 Dear list,
 
 I have a document that contains a long poem and although it contains the
 following code:
 
 \setuplayout[setups=*lessstrict]
 \startsetups[*lessstrict]
\setup[reset]
\widowpenalty=1
\clubpenalty=1
\brokenpenalty=1
 \stopsetups
 
 I'm afraid that I get widow lines in the lines environment.
 
 Is there no way to avoid orphans and widows in the lines environment?

1. Don’t use * in your setups names because names starting with an asterisk are 
system modes.

2. To load the defaults settings you have to use \setups[*reset] which needs 
the asterisks because it’s a system mode.

3. The settings doesn’t help because in the lines environment each line is a 
separate paragraph which makes \widowpenalty useless here.

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  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] orphans and widows in poems

2013-06-16 Thread Bill Meahan

On 6/16/2013 3:46 AM, Pablo Rodríguez wrote:



I'm afraid that I get widow lines in the lines environment.

Is there no way to avoid orphans and widows in the lines environment?
It's a bit ugly, but if the poem consists of individual stanzas, you can 
put each stanza in an non-bordered frame.


e.g.:
% Set up the lines environment to put the contained lines in a frame so 
they are kept together

\setuplines[indenting={yes,small,even},   --  whatever options you want
   before={\startframedtext[frame=off]},
   after=\stopframedtext]

% Then wrap your stanzas in individual line environments
  \startlines
A maiden fair was seated there,
Her hair of fine-spun gold.
Azure eyes so clear and bright,
So wondrous to behold.
  \stoplines

A frame will never be split across pages.

BTW this trickis on the wiki on the Verse page.

--
Bill Meahan
Westland Michigan

___
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  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] orphans and widows in poems

2013-06-16 Thread Aditya Mahajan

On Sun, 16 Jun 2013, Bill Meahan wrote:


On 6/16/2013 3:46 AM, Pablo Rodríguez wrote:



I'm afraid that I get widow lines in the lines environment.

Is there no way to avoid orphans and widows in the lines environment?
It's a bit ugly, but if the poem consists of individual stanzas, you can put 
each stanza in an non-bordered frame.


e.g.:
% Set up the lines environment to put the contained lines in a frame so they 
are kept together

\setuplines[indenting={yes,small,even},   --  whatever options you want
  before={\startframedtext[frame=off]},
  after=\stopframedtext]

% Then wrap your stanzas in individual line environments
 \startlines
   A maiden fair was seated there,
   Her hair of fine-spun gold.
   Azure eyes so clear and bright,
   So wondrous to behold.
 \stoplines

A frame will never be split across pages.

BTW this trickis on the wiki on the Verse page.


If the poem consists of stanzas with fixed number of lines, say 4, then 
you could also try:


\setuplines[inbetween={\testpage[4]\blank}]

This will ensure that a stanza does not break across pages.

Aditya___
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  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

Re: [NTG-context] orphans and widows in poems

2013-06-16 Thread Wolfgang Schuster

Am 17.06.2013 um 02:36 schrieb Bill Meahan subscribed_li...@meahan.net:

 On 6/16/2013 3:46 AM, Pablo Rodríguez wrote:
 
 
 I'm afraid that I get widow lines in the lines environment.
 
 Is there no way to avoid orphans and widows in the lines environment?
 It's a bit ugly, but if the poem consists of individual stanzas, you can put 
 each stanza in an non-bordered frame.
 
 e.g.:
 % Set up the lines environment to put the contained lines in a frame so they 
 are kept together
 \setuplines[indenting={yes,small,even},   --  whatever options you want
   before={\startframedtext[frame=off]},
   after=\stopframedtext]
 
 % Then wrap your stanzas in individual line environments
  \startlines
A maiden fair was seated there,
Her hair of fine-spun gold.
Azure eyes so clear and bright,
So wondrous to behold.
  \stoplines
 
 A frame will never be split across pages.
 
 BTW this trickis on the wiki on the Verse page.

You don’t need any tricks to prevent page breaks in a lines environment because
\setuplines[option=packed] already does it.

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  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___