[texhax] How to avoid page breaks between paragraphs and lists?
Ian Collier
imc at comlab.ox.ac.uk
Tue Oct 14 13:15:58 CEST 2003
Stefan.Wachter at gmx.de ("Stefan Wachter") writes in texhax:
>does anyone know how to avoid page breaks between paragraphs and lists? The
>TeX input has the following form:
>\parbox{\textwidth}{some text some text some text ...}
>
>% TeX inserts a page break here. The command \nopagebreak has no effect
>here!
>\begin{list}
>\item Item 1
>\item Item 2
>\end{list}
This is a hack, but:
{\makeatletter\gdef\reallynopagebreak{\par\nopagebreak\@nobreaktrue}}
Given that, the following document has no page break between the
paragraph and the list:
\leftline{\parbox{\textwidth}{some text some text some text ...}}
\reallynopagebreak
\begin{itemize}
\item Item 1
\item Item 2
\end{itemize}
Notes:
1. Like many of LaTeX's boxes, \parbox places your paragraph box
_inside_ the current paragraph (and it starts a new paragraph if
necessary), so it's indented and thus extends beyond the right-hand
margin. Putting it within a \leftline stops this.
2. \begin{list} isn't valid by itself in LaTeX - it's usually used
indirectly by choosing a specific type of list (such as {itemize}).
If you don't want a pagebreak anywhere inside the list then the answer
is much easier: use the \samepage command.
--
---- Ian Collier : imc at comlab.ox.ac.uk : WWW page below
------ http://users.comlab.ox.ac.uk/ian.collier/imc.shtml
More information about the texhax
mailing list