[texhax] How to avoid page breaks between paragraphs and lists?
Stefan Wachter
Stefan.Wachter at gmx.de
Fri Oct 24 15:48:56 CEST 2003
Hi Ian,
thanks for the tip. It works!
--Stefan
PS: Can you explain what the macro does?
> 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
>
> _______________________________________________
> TeX FAQ: http://faq.tug.org/
> TeX newsgroup: http://groups.google.com/groups?group=comp.text.tex
> Mailing list archives: http://tug.org/pipermail/texhax/
> More links: http://tug.org/begin.html
>
> Automated subscription management: http://tug.org/mailman/listinfo/texhax
> Human mailing list managers: postmaster at tug.org
>
More information about the texhax
mailing list