ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Joshua Ellis <josh@apostate.com>
Subject: Preventing page breaks (needspace)
Date: Sat, 24 Jun 2006 22:48:54 -0400	[thread overview]
Message-ID: <C0C371D6.A75C%josh@apostate.com> (raw)

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?

             reply	other threads:[~2006-06-25  2:48 UTC|newest]

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

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=C0C371D6.A75C%josh@apostate.com \
    --to=josh@apostate.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).