# How to control column/page breaks in multicols environment with nested lists?

I've a nested list within a multicolumn like this:

\begin{multicols}[2]
\begin{list}
\item main item1
\begin{list}
\item this is a very long item
\item this is a short item
\end{list}
\item main item2
\begin{list}
\item short item here
\end{list}
\item main item3
\begin{list}
\item this is a long item
\item this is a short item
\end{list}
\item ....
\end{list}
\end{multicols}


However, it happens that the multicol package or LaTeX breaks the column or the page immediately after the first level \item and before the \begin{list}. This really looks bad. It also happens, that the \item is on the last line of a page and the nested list starts on the next page.

Does anyone know how that could be changed, so that there is no longer a column/page break at that not so nice position (without having to manually insert \columnbreak every time), cause the document is really long and auto-generated from a database.

Shortest possible example (but just a special case):

\documentclass{article}
\usepackage{multicol}

\begin{document}
\begin{multicols}{2}
\begin{list}{}{}
\item{Item 1}
\begin{list}{}{}
\item{Sub Item 1}
\end{list}
\end{list}
\end{multicols}
\end{document}

-
Have you tried a simple \nobreak inserted before \begin{list}? – Joseph Wright Apr 19 '11 at 15:49
@Joseph Yes I tried that, but it did not help. It looks like \nobreak is ignored or there is a break inserted with each \item. So I also tried to add a \nobreak before the sublists items, but that also did not help. – BernS Apr 20 '11 at 7:47
I currently have a look at ltlist.dtx so that I understand what and especially why those things happen. Maybe I need to create a completely new list environment to achieve what I want to have? – BernS Apr 20 '11 at 11:43
As it looks like now it's a low-level LaTeX issue in regard to \item. \nobreak can't help as the penalty is permanent reset. The shortest possible example is shown with edit 1 in the question. – BernS Apr 20 '11 at 15:33

You can inhibit that break by setting \@beginparpenalty in the inner list to 10000, as this penalty is inserted by each \item command (which start the LR mode); the second argument to \begin{list} contains commands to be executed at list start. Here's an example; without \nobreaklist the break happens in the way you describe.

\documentclass[a4paper]{article}
\usepackage{multicol,lipsum}

\textheight=.5\textheight
\advance\textheight\baselineskip % just to show the example

\makeatletter
\newcommand*\nobreaklist{\@beginparpenalty=\@M}
\makeatother

\begin{document}
\begin{multicols}{2}
\lipsum[1]
\begin{list}{}{}
\item{Item 1}
\begin{list}{}{\nobreaklist}
\item{Sub Item 1}
\end{list}
\end{list}
\lipsum
\end{multicols}
\end{document}


In this example the first item of the outer list goes in the new column together with the inner list. However, if the inner list is more than a column long, this trick will fail miserably and something else must be tried.

I don't think it's possible to distinguish between "end-of-column" and "end-of-page".

-
Yes, that did it. Thank you very much, I'd have never found \@beginparpenalty... – BernS Apr 21 '11 at 7:36