[Tex/LaTex] Force a block of text to be impervious to page breaks

page-breaking

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.

Best 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.

Note:

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}
Related Question