TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I defined a poem-environment for two lined poems with the macro below. And could get both lines unbroken with samepage environment.

But how do I make them to not end on last line of a page.

share|improve this question
You can use the needspace package, and use \needspace{r\baselineskip} to reserve at least three lines so that it won't end of the last line of the page. – Peter Grill Nov 2 '12 at 7:09

Without the use of any extra package it can be done as follows:

<material without pagebreak, e.g., your two line poem>


  • the first \vspace* adds a vertical space without adding a break possibility before
  • at the \allowbreak LaTeX will check if the page can be broken here. If this makes the page overfull LaTeX will break before your poem. If it is a possible breakpoint it will be recorded as such and possibly chosen later as the best one (in which case one baselineskip of space would end up at the bottom)
  • if the break is chosen at this point then the following two vertical spaces will vanish into the page break
  • then we back up so that we are directly after the last line of text to typeset further material without this extra space.
  • the \vspace{0pt} is only added to guard against something like \addvspace that should not "see" our artificial negative space.
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.