ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Wolfgang Schuster <schuster.wolfgang@gmail.com>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: orphans and widows in poems
Date: Mon, 17 Jun 2013 23:05:59 +0200	[thread overview]
Message-ID: <D1F980C5-2AB2-42B9-AC83-458DD3BA51AB@gmail.com> (raw)
In-Reply-To: <51BF4503.5020801@web.de>


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
___________________________________________________________________________________


  reply	other threads:[~2013-06-17 21:05 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-16  7:46 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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=D1F980C5-2AB2-42B9-AC83-458DD3BA51AB@gmail.com \
    --to=schuster.wolfgang@gmail.com \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).