# Force a block of text to be impervious to page breaks [duplicate]

Possible Duplicate:
Unbreakable block

I have a block of text (possibly comprising many paragraphs) near the end of a page. The page break is being inserted in the middle of this block--how do I prevent that? (How do I tell LaTeX that this block of text needs to always stay together on the same page?)

This question should apply to all formats, but in my case I am using the memoir class, and am willing to include any necessary packages.

-

## marked as duplicate by Brent.Longborough, cmhughes, Werner, egreg, Peter GrillFeb 18 '12 at 0:21

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

Of course you're willing to accept a badly filled page. –  egreg Feb 17 '12 at 22:04
Yes, that's definitely an unavoidable side-effect. –  jamaicanworm Feb 17 '12 at 22:05
You could just wrap it into a \begin{minipage}{\linewidth}...\end{minipage} environment. –  Peter Grill Feb 17 '12 at 22:06

## 1 Answer

If you wrap the contents within a minipage then TeX will put that block on the next page if it does not fit on the current page.

In the example below, the text in red is on Page 2. But if you remove the minipage environment by commentig out the \begin{minipage}{\linewidth} and \end{minipage}, then the text will be on Pages 1 and 2.

## Code:

\documentclass{article}
\usepackage{lipsum}% for dummy text
\usepackage{xcolor}
\begin{document}
\lipsum[1-4]% dummy text to get towards bottom of page
\noindent
\begin{minipage}{\linewidth}% Following stays together
\color{red}
\lipsum[1-2]
\end{minipage}
\end{document}

-
The interline spacing after the minipage won't be uniform. –  egreg Feb 17 '12 at 22:12
and the minipage will set the glue (vertical stretch if any) so that it doesn't participate with other glue on the page. –  Frank Mittelbach Feb 17 '12 at 22:58
Thanks! What is the difference between \begin{minipage}{\lindwidth} (what you wrote) and \begin{minipage}{\textwidth}? –  jamaicanworm Feb 18 '12 at 2:33
Basically \textwidth is the full width on the page between the margins, where \linwidth adjusts for multiple columns, lists, etc. See difference between textwidth linewidth and hsize for a more detailed discussion. –  Peter Grill Feb 18 '12 at 3:14
@jamaicanworm: This seems like a new question. –  Peter Grill Feb 18 '12 at 16:30