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
___________________________________________________________________________________

Reply via email to