问题
I want to do something like the following in TeX:
\begin{nobreak}
Text here will not split over pages, it will remain
as one continuous chunk. If there isn't enough room
for it on the current page a pagebreak will happen
before it and the whole chunk will start on the next
page.
\end{nobreak}
Is this possible?
回答1:
You could try
\begin{samepage}
This is the first paragraph. This is the first paragraph.
This is the first paragraph. This is the first paragraph.
\nopagebreak
This the second. This the second. This the second.
This the second. This the second. This the second.
This the second. This the second.
\end{samepage}
samepage prevents LaTeX from pagebreaking within one paragraph, i.e. within the samepage envirnment, pagebreaks are only between paragraphs. Thus, you need nopagebreak as well, to prevent LaTeX from pagebreaking between two paragraphs.
回答2:
A quick test reveals thatminipage has this behavior, too.
\begin{minipage}{3in}
One contiguous chunk.
\end{minipage}
\begin{minipage}{3in}
Another contiguous chunk.
\end{minipage}
来源:https://stackoverflow.com/questions/4003473/make-an-unbreakable-block-in-tex