* orphans and widows in poems
@ 2013-06-16 7:46 Pablo Rodríguez
2013-06-16 19:03 ` Wolfgang Schuster
2013-06-17 0:36 ` Bill Meahan
0 siblings, 2 replies; 12+ messages in thread
From: Pablo Rodríguez @ 2013-06-16 7:46 UTC (permalink / raw)
To: mailing list for ConTeXt users
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=10000
\clubpenalty=10000
\brokenpenalty=10000
\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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: orphans and widows in poems
2013-06-16 7:46 orphans and widows in poems Pablo Rodríguez
@ 2013-06-16 19:03 ` Wolfgang Schuster
2013-06-17 17:18 ` Pablo Rodríguez
2013-06-17 20:28 ` Pablo Rodríguez
2013-06-17 0:36 ` Bill Meahan
1 sibling, 2 replies; 12+ messages in thread
From: Wolfgang Schuster @ 2013-06-16 19:03 UTC (permalink / raw)
To: mailing list for ConTeXt users
Am 16.06.2013 um 09:46 schrieb Pablo Rodríguez <oinos@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=10000
> \clubpenalty=10000
> \brokenpenalty=10000
> \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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: orphans and widows in poems
2013-06-16 7:46 orphans and widows in poems Pablo Rodríguez
2013-06-16 19:03 ` Wolfgang Schuster
@ 2013-06-17 0:36 ` Bill Meahan
2013-06-17 2:29 ` Aditya Mahajan
2013-06-17 5:39 ` Wolfgang Schuster
1 sibling, 2 replies; 12+ messages in thread
From: Bill Meahan @ 2013-06-17 0:36 UTC (permalink / raw)
To: ntg-context
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 "trick"is 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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: orphans and widows in poems
2013-06-17 0:36 ` Bill Meahan
@ 2013-06-17 2:29 ` Aditya Mahajan
2013-06-17 5:39 ` Wolfgang Schuster
1 sibling, 0 replies; 12+ messages in thread
From: Aditya Mahajan @ 2013-06-17 2:29 UTC (permalink / raw)
To: mailing list for ConTeXt users
[-- Attachment #1: Type: TEXT/PLAIN, Size: 1233 bytes --]
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 "trick"is 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
[-- Attachment #2: Type: text/plain, Size: 485 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 : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: orphans and widows in poems
2013-06-17 0:36 ` Bill Meahan
2013-06-17 2:29 ` Aditya Mahajan
@ 2013-06-17 5:39 ` Wolfgang Schuster
2013-06-17 13:50 ` Bill Meahan
2013-06-17 17:23 ` Pablo Rodríguez
1 sibling, 2 replies; 12+ messages in thread
From: Wolfgang Schuster @ 2013-06-17 5:39 UTC (permalink / raw)
To: mailing list for ConTeXt users
Am 17.06.2013 um 02:36 schrieb Bill Meahan <subscribed_lists@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 "trick"is 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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: orphans and widows in poems
2013-06-17 5:39 ` Wolfgang Schuster
@ 2013-06-17 13:50 ` Bill Meahan
2013-06-17 21:02 ` Wolfgang Schuster
2013-06-17 17:23 ` Pablo Rodríguez
1 sibling, 1 reply; 12+ messages in thread
From: Bill Meahan @ 2013-06-17 13:50 UTC (permalink / raw)
To: ntg-context
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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: orphans and widows in poems
2013-06-16 19:03 ` Wolfgang Schuster
@ 2013-06-17 17:18 ` Pablo Rodríguez
2013-06-17 21:05 ` Wolfgang Schuster
2013-06-17 20:28 ` Pablo Rodríguez
1 sibling, 1 reply; 12+ messages in thread
From: Pablo Rodríguez @ 2013-06-17 17:18 UTC (permalink / raw)
To: mailing list for ConTeXt users
On 16/06/13 21:03, Wolfgang Schuster wrote:
> Am 16.06.2013 um 09:46 schrieb Pablo Rodríguez <oinos@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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: orphans and widows in poems
2013-06-17 5:39 ` Wolfgang Schuster
2013-06-17 13:50 ` Bill Meahan
@ 2013-06-17 17:23 ` Pablo Rodríguez
1 sibling, 0 replies; 12+ messages in thread
From: Pablo Rodríguez @ 2013-06-17 17:23 UTC (permalink / raw)
To: mailing list for ConTeXt users
On 17/06/13 07:39, Wolfgang Schuster wrote:
> Am 17.06.2013 um 02:36 schrieb Bill Meahan <subscribed_lists@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 "trick"is 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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: orphans and widows in poems
2013-06-16 19:03 ` Wolfgang Schuster
2013-06-17 17:18 ` Pablo Rodríguez
@ 2013-06-17 20:28 ` Pablo Rodríguez
1 sibling, 0 replies; 12+ messages in thread
From: Pablo Rodríguez @ 2013-06-17 20:28 UTC (permalink / raw)
To: mailing list for ConTeXt users
On 16/06/13 21:03, Wolfgang Schuster wrote:
> Am 16.06.2013 um 09:46 schrieb Pablo Rodríguez <oinos@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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: orphans and widows in poems
2013-06-17 13:50 ` Bill Meahan
@ 2013-06-17 21:02 ` Wolfgang Schuster
0 siblings, 0 replies; 12+ messages in thread
From: Wolfgang Schuster @ 2013-06-17 21:02 UTC (permalink / raw)
To: mailing list for ConTeXt users
Am 17.06.2013 um 15:50 schrieb Bill Meahan <subscribed_lists@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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: orphans and widows in poems
2013-06-17 17:18 ` Pablo Rodríguez
@ 2013-06-17 21:05 ` Wolfgang Schuster
2013-06-17 21:21 ` Hans Hagen
0 siblings, 1 reply; 12+ messages in thread
From: Wolfgang Schuster @ 2013-06-17 21:05 UTC (permalink / raw)
To: mailing list for ConTeXt users
Am 17.06.2013 um 19:18 schrieb Pablo Rodríguez <oinos@web.de>:
> On 16/06/13 21:03, Wolfgang Schuster wrote:
>> Am 16.06.2013 um 09:46 schrieb Pablo Rodríguez <oinos@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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: orphans and widows in poems
2013-06-17 21:05 ` Wolfgang Schuster
@ 2013-06-17 21:21 ` Hans Hagen
0 siblings, 0 replies; 12+ messages in thread
From: Hans Hagen @ 2013-06-17 21:21 UTC (permalink / raw)
To: ntg-context
On 6/17/2013 11:05 PM, Wolfgang Schuster wrote:
>
> Am 17.06.2013 um 19:18 schrieb Pablo Rodríguez <oinos@web.de>:
>
>> On 16/06/13 21:03, Wolfgang Schuster wrote:
>>> Am 16.06.2013 um 09:46 schrieb Pablo Rodríguez <oinos@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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2013-06-17 21:21 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-16 7:46 orphans and widows in poems Pablo Rodríguez
2013-06-16 19:03 ` Wolfgang Schuster
2013-06-17 17:18 ` Pablo Rodríguez
2013-06-17 21:05 ` Wolfgang Schuster
2013-06-17 21:21 ` Hans Hagen
2013-06-17 20:28 ` Pablo Rodríguez
2013-06-17 0:36 ` Bill Meahan
2013-06-17 2:29 ` Aditya Mahajan
2013-06-17 5:39 ` Wolfgang Schuster
2013-06-17 13:50 ` Bill Meahan
2013-06-17 21:02 ` Wolfgang Schuster
2013-06-17 17:23 ` Pablo Rodríguez
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).