1

Consider the following:

  1. Example set 1

    (a) Example 1

    (b) Example 2

    (c) Example 3

    (d) Example 4

  2. Example set 2

    (a) Example 1

    (b) Example 2

    (c) Example 3

    (d) Example 4

Sometimes one gets

  1. Example set 2

written in a page and the following second level items written in the next page. How can one prevent that? That is, how can one avoid splitting the first level items from the respective second order items?

Thanks in advance,

Paul

  • 1
    Please provide more information about your formatting needs. How many lines does each level-2 item tend to take up? Must all level-2 items be placed on the same page as their associated level-1 item? Or would it be ok to allow, say, a page break after the first 2 out of 4 total level-2 items? – Mico May 9 at 4:42
  • @Mico Yes, all level-2 items be placed on the same page as their associated level-1 item. The number of lines associated to level-2 items is variable (and level-2 items may contain tables). – Paul Smith May 9 at 8:26
1

Either use/define a suitable sectioning command, this will prevent a page break after it. As an example here \minisec for the KOMA-bundle:

\documentclass{scrartcl}
\usepackage{enumitem}

\begin{document}

\vspace*{33\baselineskip}

\minisec{Example set 1}
\begin{enumerate}[label=(\alph{*})]
\item  Example 1
\item  Example 2
\item  Example 3
\item  Example 4
\end{enumerate}


\minisec{Example set 2}
%Example set 2

\begin{enumerate}[label=(\alph{*})]
\item  Example 1
\item  Example 2
\item  Example 3
\item  Example 4
\end{enumerate}
\end{document}

If you want to nest enumerates, you can (with the enumitem package) set beginpenalty to the maximum. This will prevent a page break before a list:

\documentclass{scrartcl}
\usepackage{enumitem}

\begin{document}

\vspace*{34\baselineskip}

\begin{enumerate}
\item Example set 1
\begin{enumerate}[label=(\alph{*})]
\item  Example 1
\item  Example 2
\item  Example 3
\item  Example 4
\end{enumerate}

\item Example set 2

\begin{enumerate}[label=(\alph{*}),
                  beginpenalty=10000 %<---
                 ]
\item  Example 1
\item  Example 2
\item  Example 3
\item  Example 4
\end{enumerate}
\end{enumerate}
\end{document}
  • Thanks. My enumerate is nested, and I have tried beginpenalty=10000, but with no success. However, I am not using the original enumerate of enumitem, but prenumerate from tex.stackexchange.com/questions/488397/… – Paul Smith May 10 at 10:14
  • That's a new question, so ask a new question. I will not adapt my answer to some requirement that you didn't mention in your question directly. And better add this time a real example to the question. – Ulrike Fischer May 10 at 10:18
0

Because each item is a separate paragraph, your case is one where widow/orphan penalties will have no effect. The solution might be to use samepage, as in:


\begin{samepage}
    Example set 2

    (a) Example 1

    (b) Example 2

    (c) Example 3

    (d) Example 4

\end{samepage}

You might also try \nopagebreak between each line that you wish to keep together.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.