[texhax] How to prevent page break in description environment item

Reinhard Kotucha reinhard.kotucha at web.de
Sun Nov 1 00:48:22 CET 2015


On 2015-11-01 at 07:48:08 +1300, Alan Litchfield wrote:

 > On 1/11/15 2:26 am, Moritz Sichert wrote:
 >> Hi,
 >>
 >> I have this code:
 >>
 >> \begin{description}
 >>    \item[first item] \hfill \\
 >>      Description of first item
 >>    \item[second item] \hfill \\
 >>      Description of second item
 >> \end{description}
 >>
 >>
 >> And it generates something like this:
 >>
 >> First Item
 >>    Description of first Item
 >> Second Item
 >> -------- PAGE BREAK ----------
 >>    Description of second item
 >>
 >>
 >> How can I prevent the page break between the title of an item and its
 >> description?
 >>
 >> I tried adding \nopagebreak after \descriptionlabel like this:
 >>
 >> \let\orig at descriptionlabel\descriptionlabel
 >> \renewcommand*{\descriptionlabel}[1]{\orig at descriptionlabel{#1}\nopagebreak}
 >>
 >> But that didn't change anything. Adding \nopagebreak around the second
 >> item in the code also didn't prevent the break.
 
 > Put \newpage{} at the end of the prior description item.
 > 
 > \begin{description}
 >    \item[first item] \hfill \\
 >      Description of first item \newpage{}
 >    \item[second item] \hfill \\
 >      Description of second item
 > \end{description}

But what happens if stuff is added in front of the description
environment?  The first item will appear on the next page, immediately
followed by a \newpage.

I don't think that your suggestion is a solution.  What Moritz
attempts is to re-define LaTeX macros in order to prevent page breaks
at certain places in his document without manual intervention.

Regards,
  Reinhard

-- 
------------------------------------------------------------------
Reinhard Kotucha                            Phone: +49-511-3373112
Marschnerstr. 25
D-30167 Hannover                    mailto:reinhard.kotucha at web.de
------------------------------------------------------------------


More information about the texhax mailing list