3

I have the following MWE:

\documentclass{article}
\usepackage{enumitem}
\begin{document}
    
\begin{enumerate}[label=\textbf{\arabic*}\hspace{4mm}]
    
\item BLAH BLAH BLAH \begin{enumerate}[label=(\Alph*),leftmargin=0.85cm,itemsep=2ex] \item BLAH BLAH BLAH  \item BLAH BLAH BLAH \item BLAH BLAH BLAH \item BLAH BLAH BLAH \end{enumerate}\vskip 9mm

\item BLAH BLAH BLAH \begin{enumerate}[label=(\Alph*),leftmargin=0.85cm,itemsep=2ex] \item BLAH BLAH BLAH  \item BLAH BLAH BLAH \item BLAH BLAH BLAH \item BLAH BLAH BLAH \end{enumerate}\vskip 9mm

\item BLAH BLAH BLAH \begin{enumerate}[label=(\Alph*),leftmargin=0.85cm,itemsep=2ex] \item BLAH BLAH BLAH  \item BLAH BLAH BLAH \item BLAH BLAH BLAH \item BLAH BLAH BLAH \end{enumerate}\vskip 9mm
\item BLAH BLAH BLAH \begin{enumerate}[label=(\Alph*),leftmargin=0.85cm,itemsep=2ex] \item BLAH BLAH BLAH  \item BLAH BLAH BLAH \item BLAH BLAH BLAH \item BLAH BLAH BLAH \end{enumerate}\vskip 9mm

\item BLAH BLAH BLAH \begin{enumerate}[label=(\Alph*),leftmargin=0.85cm,itemsep=2ex] \item BLAH BLAH BLAH  \item BLAH BLAH BLAH \item BLAH BLAH BLAH \item BLAH BLAH BLAH \end{enumerate}\vskip 9mm

\item BLAH BLAH BLAH \begin{enumerate}[label=(\Alph*),leftmargin=0.85cm,itemsep=2ex] \item BLAH BLAH BLAH  \item BLAH BLAH BLAH \item BLAH BLAH BLAH \item BLAH BLAH BLAH \end{enumerate}\vskip 9mm

\item BLAH BLAH BLAH \begin{enumerate}[label=(\Alph*),leftmargin=0.85cm,itemsep=2ex] \item BLAH BLAH BLAH  \item BLAH BLAH BLAH \item BLAH BLAH BLAH \item BLAH BLAH BLAH \end{enumerate}\vskip 9mm

\item BLAH BLAH BLAH \begin{enumerate}[label=(\Alph*),leftmargin=0.85cm,itemsep=2ex] \item BLAH BLAH BLAH  \item BLAH BLAH BLAH \item BLAH BLAH BLAH \item BLAH BLAH BLAH \end{enumerate}\vskip 9mm

\item BLAH BLAH BLAH \begin{enumerate}[label=(\Alph*),leftmargin=0.85cm,itemsep=2ex] \item BLAH BLAH BLAH  \item BLAH BLAH BLAH \item BLAH BLAH BLAH \item BLAH BLAH BLAH \end{enumerate}\vskip 9mm

\end{enumerate}
\end{document}

If you notice part 5 needs to start on a new page.

Part 5

Also part 9 need to start on a new page.

Part 9

How do I go about modifying the \item environment from the preamble so that it forces any item going over two pages to start a new page automatically without affecting the other items.

I know how to do it for sections using the needspace package. But I couldn't get it to modify the item.

\usepackage{needspace}
\usepackage{xpatch}
\xpretocmd{\section}{\needspace{6\baselineskip}}{}{}

2 Answers 2

2

You can change the definition of penalties to tell LaTeX when page breaks are required. Add beginpenalty=10000,midpenalty=10000 to the enumerate options.

This is not a change in the preamble, but it is enough to define this once for any list, and all the child lists will be defined as well.

MWE:

\documentclass{article}
\usepackage{enumitem}

\begin{document}
    
\begin{enumerate}[label=\textbf{\arabic*}\hspace{4mm},beginpenalty=10000,midpenalty=10000]
    
\item BLAH BLAH BLAH \begin{enumerate}[label=(\Alph*),leftmargin=0.85cm,itemsep=2ex] \item BLAH BLAH BLAH  \item BLAH BLAH BLAH \item BLAH BLAH BLAH \item BLAH BLAH BLAH \end{enumerate}\vskip 9mm

\item BLAH BLAH BLAH \begin{enumerate}[label=(\Alph*),leftmargin=0.85cm,itemsep=2ex] \item BLAH BLAH BLAH  \item BLAH BLAH BLAH \item BLAH BLAH BLAH \item BLAH BLAH BLAH \end{enumerate}\vskip 9mm

\item BLAH BLAH BLAH \begin{enumerate}[label=(\Alph*),leftmargin=0.85cm,itemsep=2ex] \item BLAH BLAH BLAH  \item BLAH BLAH BLAH \item BLAH BLAH BLAH \item BLAH BLAH BLAH \end{enumerate}\vskip 9mm
\item BLAH BLAH BLAH \begin{enumerate}[label=(\Alph*),leftmargin=0.85cm,itemsep=2ex] \item BLAH BLAH BLAH  \item BLAH BLAH BLAH \item BLAH BLAH BLAH \item BLAH BLAH BLAH \end{enumerate}\vskip 9mm

\item BLAH BLAH BLAH \begin{enumerate}[label=(\Alph*),leftmargin=0.85cm,itemsep=2ex] \item BLAH BLAH BLAH  \item BLAH BLAH BLAH \item BLAH BLAH BLAH \item BLAH BLAH BLAH \end{enumerate}\vskip 9mm

\item BLAH BLAH BLAH \begin{enumerate}[label=(\Alph*),leftmargin=0.85cm,itemsep=2ex] \item BLAH BLAH BLAH  \item BLAH BLAH BLAH \item BLAH BLAH BLAH \item BLAH BLAH BLAH \end{enumerate}\vskip 9mm

\item BLAH BLAH BLAH \begin{enumerate}[label=(\Alph*),leftmargin=0.85cm,itemsep=2ex] \item BLAH BLAH BLAH  \item BLAH BLAH BLAH \item BLAH BLAH BLAH \item BLAH BLAH BLAH \end{enumerate}\vskip 9mm

\item BLAH BLAH BLAH \begin{enumerate}[label=(\Alph*),leftmargin=0.85cm,itemsep=2ex] \item BLAH BLAH BLAH  \item BLAH BLAH BLAH \item BLAH BLAH BLAH \item BLAH BLAH BLAH \end{enumerate}\vskip 9mm

\item BLAH BLAH BLAH \begin{enumerate}[label=(\Alph*),leftmargin=0.85cm,itemsep=2ex] \item BLAH BLAH BLAH  \item BLAH BLAH BLAH \item BLAH BLAH BLAH \item BLAH BLAH BLAH \end{enumerate}\vskip 9mm

\end{enumerate}
\end{document}

LaTex puts your text in blocks. The spaces between the boxes are called glue. Penalties are used to tell LaTeX when you can break on a glue. 10000 means do not break.

If you tell LaTeX not to break in the middle of the list, the whole list will be a single unbreakable box. When a page break arrives LaTeX will push all the items in the list to a new page. However, since this is a nested list, if you only define mid penalty then LaTeX may break before the list starts, meaning you'd get

  1. BLAH BLAH BLAH

--page break--

(A) BLAH BLAH BLAH

(B) BLAH...

When you tell LaTeX not to break at the start and not to break in the middle, the whole list with its father is considered as a single box and will not be broken.

notice that an end penalty is not defined as do not break. If you define an end penalty you'll get the list in one single page, with no breaks, when some of the lists get overflown outside margins like an image that's too big.

4
  • Hi @Elad Den, what does the values mean in end/mid peanlty?
    – Alan Jones
    Commented Sep 28, 2020 at 3:10
  • 1
    I Added the reply to the answer
    – Elad Den
    Commented Sep 29, 2020 at 6:01
  • what about images? If I have images within an \item. How do I go about moving that down aswell?
    – Alan Jones
    Commented Sep 29, 2020 at 9:44
  • 1
    I think that would be with the beginmargin and the float positioning [H] or badness. But I think this calls for a new question with a new MWE...
    – Elad Den
    Commented Sep 29, 2020 at 9:54
0

An awkward solution is to encapsulate every \item in a \vbox.

\documentclass{article}
\usepackage{enumitem}


\begin{document}
    
\begin{enumerate}[label={\textbf{\arabic*}\hspace{4mm}}]
    
\vbox{\item BLAH BLAH BLAH \begin{enumerate}[label=(\Alph*),leftmargin=0.85cm,itemsep=2ex] \item BLAH BLAH BLAH  \item BLAH BLAH BLAH \item BLAH BLAH BLAH \item BLAH BLAH BLAH \end{enumerate}}\vskip 9mm

\vbox{\item BLAH BLAH BLAH \begin{enumerate}[label=(\Alph*),leftmargin=0.85cm,itemsep=2ex] \item BLAH BLAH BLAH  \item BLAH BLAH BLAH \item BLAH BLAH BLAH \item BLAH BLAH BLAH \end{enumerate}}\vskip 9mm

\vbox{\item BLAH BLAH BLAH \begin{enumerate}[label=(\Alph*),leftmargin=0.85cm,itemsep=2ex] \item BLAH BLAH BLAH  \item BLAH BLAH BLAH \item BLAH BLAH BLAH \item BLAH BLAH BLAH \end{enumerate}}\vskip 9mm
\vbox{\item BLAH BLAH BLAH \begin{enumerate}[label=(\Alph*),leftmargin=0.85cm,itemsep=2ex] \item BLAH BLAH BLAH  \item BLAH BLAH BLAH \item BLAH BLAH BLAH \item BLAH BLAH BLAH \end{enumerate}}\vskip 9mm

\vbox{\item BLAH BLAH BLAH \begin{enumerate}[label=(\Alph*),leftmargin=0.85cm,itemsep=2ex] \item BLAH BLAH BLAH  \item BLAH BLAH BLAH \item BLAH BLAH BLAH \item BLAH BLAH BLAH \end{enumerate}}\vskip 9mm

\vbox{\item BLAH BLAH BLAH \begin{enumerate}[label=(\Alph*),leftmargin=0.85cm,itemsep=2ex] \item BLAH BLAH BLAH  \item BLAH BLAH BLAH \item BLAH BLAH BLAH \item BLAH BLAH BLAH \end{enumerate}}\vskip 9mm

\vbox{\item BLAH BLAH BLAH \begin{enumerate}[label=(\Alph*),leftmargin=0.85cm,itemsep=2ex] \item BLAH BLAH BLAH  \item BLAH BLAH BLAH \item BLAH BLAH BLAH \item BLAH BLAH BLAH \end{enumerate}}\vskip 9mm

\vbox{\item BLAH BLAH BLAH \begin{enumerate}[label=(\Alph*),leftmargin=0.85cm,itemsep=2ex] \item BLAH BLAH BLAH  \item BLAH BLAH BLAH \item BLAH BLAH BLAH \item BLAH BLAH BLAH \end{enumerate}}\vskip 9mm

\vbox{\item BLAH BLAH BLAH \begin{enumerate}[label=(\Alph*),leftmargin=0.85cm,itemsep=2ex] \item BLAH BLAH BLAH  \item BLAH BLAH BLAH \item BLAH BLAH BLAH \item BLAH BLAH BLAH \end{enumerate}}\vskip 9mm

\end{enumerate}
\end{document}
1
  • I think there was a response that looked at putting each \item in a minipage, but I haven't seen this approach before.However, I need to learn how to modify it from the preamble.
    – Alan Jones
    Commented Sep 27, 2020 at 8:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .