# How can I suppress a page break in enumeration

I'm writing a document with some lists and I need to suppress a page break between the \item and the following line. Following is a MWE:

\documentclass[a4paper, 11pt]{scrartcl}
\usepackage{blindtext}
\usepackage{enumitem}

\begin{document}
\blindtext[2]
line\\
line\\
line\\
\begin{enumerate}[label=\textbf{Gruppe \arabic*},align=left,leftmargin=*,itemindent=0cm,labelwidth=\itemindent]
\item~\\[-2em]
\begin{enumerate}[label=\textbf{\alph*)},align=left,leftmargin=-1cm]
\item \blindtext

\item \blindtext
\end{enumerate}

\item~\nopagebreak\\[-2em]\nopagebreak
\begin{enumerate}[label=\textbf{\alph*)},align=left,leftmargin=-1cm]
\item \blindtext
\end{enumerate}
\end{enumerate}
\end{document}


I want Gruppe 2 and a) Lorem Ipsum on the same page. A page break before the item or after the first line is ok. But the page breaks between the \item and the first line is a problem. I tried \nopagebreak but it doesn't change anything. I read about samepage environment or minipage but I think this is not possible in this situation. A manual page break is only the last solution since this is at many places in the document and I want to find some generic solution.

• Did you see the posting Unbreakable block?
– Mico
Nov 25 '17 at 21:59
• I can't create a block containing \item and only the first line of the paragraph. A page break after the first line of the paragraph is allowed. I only want to suppress a page break between these two lines. Nov 25 '17 at 22:10
• Load the needspace package and issue the directive \needspace{3\baselineskip} immediately before the \item~\\[-2em] instruction in question.
– Mico
Nov 25 '17 at 22:14
• @Mico formulate an answer and I will accept it. It is exactly what I was looking for. Nov 25 '17 at 22:20

I suggest you load the needspace package and employ its \needspace macro.

\documentclass[a4paper, 11pt]{scrartcl}
\usepackage{blindtext,enumitem}
\usepackage{needspace} % <-- new

\begin{document}
\blindtext[2]
line\\
line\\
\begin{enumerate}[label=\textbf{Gruppe \arabic*},
align=left,leftmargin=*,itemindent=0cm,
labelwidth=\itemindent]
\item~\\[-1.25\baselineskip]
\begin{enumerate}[label=\textbf{\alph*)},
align=left,leftmargin=-1cm]
\item \blindtext
\item \blindtext
\end{enumerate}

\needspace{3\baselineskip} % <-- new
\item~\\[-1.25\baselineskip]
\begin{enumerate}[label=\textbf{\alph*)},
align=left,leftmargin=-1cm]
\item \blindtext
\end{enumerate}
\end{enumerate}
\end{document}


You can still use a minipage in your case by utilizing the reume option for lists. This key is applied on second list, third list, and so on. Also notice that these \item~\\[-2em]s are not a recommended style. Use of hard \\s should be avoided, only in tabulars and sparingly in packages.

\documentclass[a4paper, 11pt]{scrartcl}
\usepackage{blindtext}
\usepackage{enumitem}

\begin{document}
\blindtext[2]
line\\
line

\noindent
\begin{minipage}{\linewidth}\noindent
\begin{enumerate}[label=\textbf{Gruppe \arabic*},align=left,leftmargin=*]
\item {}
\item[]
\begin{enumerate}[label=\textbf{\alph*)},align=left,leftmargin=-1cm]
\item \blindtext
\item \blindtext
\end{enumerate}
\end{enumerate}
\end{minipage}
\begin{minipage}{\linewidth}\noindent
\begin{enumerate}[resume,label=\textbf{Gruppe \arabic*},align=left,leftmargin=*]
\item {}
\item []
\begin{enumerate}[label=\textbf{\alph*)},align=left,leftmargin=-1cm]
\item \blindtext
\end{enumerate}
\end{enumerate}
\end{minipage}

\end{document}


• But then I suppress the page break in the whole paragraph. That is not exactly what I want. I want to allow a page break in the paragraph but not between Gruppe 2 and a) Nov 25 '17 at 22:08
• And the use of \item~\\[-2em] was the only solution I found. It was recommended in this post tex.stackexchange.com/questions/29517/…. If you know a better way, I will listen. Nov 25 '17 at 22:15