## LaTeX forum ⇒ Text Formatting ⇒ Nested list first item on another page Topic is solved

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
kulima
Posts: 23
Joined: Mon Aug 03, 2015 5:42 pm

### Nested list first item on another page

Hi

I have a itemize list nested in my description list. My Problem is that the page ends right when the itemize list begins, so at the bottom of the page i got my last description(Item 23) and the first itemized item("First nested Item" is on the top of the page.
Now i want to keep "Item 23" on the same page as the nested list. It#s a bit hard to explain, here is a code example of how it looks like. Please ignore the "Random Text" and \bigskips, they are just there to push the items down and illustrate the problem.
\documentclass[12pt,a4paper,headsepline]{scrreprt}\usepackage[utf8]{inputenc}\usepackage[naustrian]{babel}\usepackage[T1]{fontenc}\usepackage{graphicx}\usepackage{lmodern}\usepackage[automark]{scrlayer-scrpage}\usepackage{blindtext}%\usepackage{scrletter}\begin{document}\blindtext\blindtext[2]Random Text \bigskipRandom Text \bigskipRandom Text \bigskipRandom Text \bigskipRandom Text   \begin{description}	\item[Item 1] \hfill \\     	Some text     \item[Item 2] \hfill \\     	Some more text     \item[Item 23] \hfill     \begin{itemize}     	\item First nested Item         \item Second nested Item     \end{itemize}     \item[Item 24] \hfill \\     	Last Item text\end{description}\end{document}

Now i could quickfix it with \newpage or \bigskip or whatever, but that presents a whole lot of new problmes once i change the document. Is there an (easy) solution to keep nested lists with its parent item, or at least one of the nested items, or push "Item 23" to the next page, so "Item 23" does not look so lonely on the bottom of the page?

Tags:

Stefan Kottwitz
Posts: 8460
Joined: Mon Mar 10, 2008 9:44 pm
Location: Hamburg, Germany
Contact:
You could load the needspace package:

\usepackage{needspace}

Then, wherever needed, you can require space. If there's not enough space left on the page, the following text would go to the next page:

\needspace{2\baselineskip}\item[Item 23]

It can be automatized for each \item, but I would not do this as \item is implicitly used at many places.

Stefan

kulima
Posts: 23
Joined: Mon Aug 03, 2015 5:42 pm
Works like a charm.
Thanks

Stefan Kottwitz
Posts: 8460
Joined: Mon Mar 10, 2008 9:44 pm
Location: Hamburg, Germany
Contact:
Nice to read your confirmation! I also tested it with your code. You provided a very good minimal code example, so it was easy.

I see you are using naustrian. If you like to post in Austrian or German language, feel free to visit our partner forum TeXwelt.de too.

A matching topic is already there: "Wie kann ich in enumerate und itemize für jedes item extra-Code ausführen lassen?"

We love good questions, here and there.

Stefan