ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Aditya Mahajan <adityam@umich.edu>
Subject: Re: Preventing page breaks (needspace)
Date: Sun, 25 Jun 2006 00:34:01 -0400 (EDT)	[thread overview]
Message-ID: <Pine.WNT.4.63.0606250032030.2212@nqvgln> (raw)
In-Reply-To: <C0C371D6.A75C%josh@apostate.com>

On Sat, 24 Jun 2006, Joshua Ellis wrote:

> While using \obeylines for some poetry there would sometimes be page breaks
> in the middle of stanzas, even if there was very stretchy space on either
> side.  So I borrowed some code from needspace.sty, basically to tell TeX I'd
> be much happier w/ a ragged bottom than a break between lines:
>
>  \def\needspace#1{%
>  \begingroup
>  \vskip#1\lineheight\penalty -100\vskip-#1\lineheight
>  \vskip#1\lineheight\penalty 9999\vskip-#1\lineheight
>  \endgroup}
>
> So if there is a stanza of four lines that *really* shouldn't be split
> across pages, it looks like this:
>
> \needspace{4}
> Line 1
> Line 2
> Line 3
> Line 4
>
> However, I suspect I'm not the first person to run into this.  So my
> question is if there is a more ConTeXt-y way to do this?  Or does ConTeXt
> already have something to do this?

\testpage[4] will check if there is space for 4 lines, and would 
otherwise cause a pagebreak. I do not know how testpage compares with 
needspace defined above.

Aditya

      reply	other threads:[~2006-06-25  4:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-06-25  2:48 Joshua Ellis
2006-06-25  4:34 ` Aditya Mahajan [this message]

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=Pine.WNT.4.63.0606250032030.2212@nqvgln \
    --to=adityam@umich.edu \
    --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).