Take the 2-minute tour ×
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.

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.

share|improve this question
1  
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
2  
You could just wrap it into a \begin{minipage}{\linewidth}...\end{minipage} environment. –  Peter Grill Feb 17 '12 at 22:06
add comment

marked as duplicate by Brent.Longborough, cmhughes, Werner, egreg, Peter Grill Feb 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.

1 Answer

up vote 2 down vote accepted

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}
share|improve this answer
1  
The interline spacing after the minipage won't be uniform. –  egreg Feb 17 '12 at 22:12
1  
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
1  
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
1  
@jamaicanworm: This seems like a new question. –  Peter Grill Feb 18 '12 at 16:30
show 1 more comment

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