1

I am creating a two-column document that includes a long enumerate environment where each numbered item is followed by a nested enumerate environment with letters (a) - (e), like so:

\begin{enumerate}
    \setlength{\itemsep}{2em}
    \item prompt
        \begin{enumerate}
            \item choice a
            \item choice b
            \item choice c
            \item choice d
            \item choice e
        \end{enumerate}
    \item prompt
        \begin{enumerate}
            \item choice a
            \item choice b
            \item choice c
            \item choice d
            \item choice e
        \end{enumerate}
\end{enumerate}

I would like to tell latex to place column and page breaks only before each of the prompts, and not break the list anywhere else. How can I do this?

0

Define a promptlist environment that sets its contents inside a minipage:

enter image description here

\documentclass{article}

\usepackage{enumitem,multicol}

\newenvironment{promptlist}
  {\par\nobreak\noindent
   \begin{minipage}{\linewidth}
     \begin{enumerate}}
  {  \end{enumerate}
   \end{minipage}}

\raggedcolumns % ...might be a good idea

\begin{document}

\begin{multicols}{2}

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum porttitor 
cursus viverra. Sed vitae libero condimentum, dapibus enim quis, aliquam mi. 
Ut cursus, mauris eu ultricies bibendum, diam enim euismod magna, ut 
sollicitudin ipsum mi at dolor. Etiam ac cursus quam. In hac habitasse platea 
dictumst. Nam pretium metus a libero pretium, vitae lacinia nunc tincidunt. 
Duis vitae posuere dolor. Mauris et nisl nisl. Sed rutrum eros sed erat 
hendrerit, nec iaculis velit ornare.

Sed posuere molestie turpis in eleifend. Aenean vestibulum at turpis eu 
pulvinar. Nam ligula quam, aliquet vitae lorem sed, venenatis tincidunt 
ligula. Integer quis sapien quis nulla interdum ultrices. Quisque et arcu 
placerat, elementum dolor at, accumsan justo. In hac habitasse platea 
dictumst. Phasellus volutpat elit lectus, vel sollicitudin nulla volutpat ut. 
Sed vel dui ornare, blandit leo eget, tempor massa. Mauris pellentesque 
lacinia arcu, ac rutrum tellus blandit vel. Pellentesque fringilla ut magna 
eu lobortis. Pellentesque dictum ipsum et orci mollis luctus.

Phasellus tristique quam ligula, non sagittis ipsum ullamcorper et. 
Maecenas a accumsan lectus, eu vestibulum arcu. Fusce vel felis ligula. 
Nullam non tempus metus. Nam sagittis feugiat leo, eu accumsan neque ornare 
eget. Mauris sem neque, tempor nec consequat non, imperdiet id est. Proin 
id pretium neque. Aliquam mollis, nisl sit amet consectetur sollicitudin, 
nisl ipsum convallis purus, molestie tincidunt arcu erat dictum erat. 
Maecenas vehicula nunc non sapien ornare cursus.

\begin{enumerate}[itemsep = 2em]
  \item prompt A
    \begin{promptlist}
      \item choice A.a
      \item choice A.b
      \item choice A.c
      \item choice A.d
      \item choice A.e
    \end{promptlist}
  \item prompt B
    \begin{promptlist}
      \item choice B.a
      \item choice B.b
      \item choice B.c
      \item choice B.d
      \item choice B.e
    \end{promptlist}
  \item prompt C
    \begin{promptlist}
      \item choice C.a
      \item choice C.b
      \item choice C.c
      \item choice C.d
      \item choice C.e
    \end{promptlist}
  \item prompt D
    \begin{promptlist}
      \item choice D.a
      \item choice D.b
      \item choice D.c
      \item choice D.d
      \item choice D.e
    \end{promptlist}
\end{enumerate}

Quisque pharetra aliquam ante, non eleifend nisi pharetra a. Pellentesque 
quis imperdiet nunc, in blandit lectus. Quisque sed egestas metus. Aenean 
diam magna, scelerisque sed urna tincidunt, semper ultrices leo. Suspendisse 
porta ut neque id maximus. In hac habitasse platea dictumst. Pellentesque 
tristique risus facilisis, condimentum risus ut, mattis ante.

\end{multicols}

\end{document}

Since you may have large chunks of text pushed to subsequent columns, issuing \raggedbottom sounds like a good idea.


Alternatively, include the prompt as part of a promptlist environment argument. This would allow you to set the entire \item and sub-\items inside a minipage, ensuring they will always stay together:

\usepackage{enumitem,multicol}

\newenvironment{promptlist}[1]
  {\begin{minipage}{\linewidth}
     \item \rule{0pt}{2em}#1
     \begin{enumerate}}
  {  \strut\end{enumerate}
   \end{minipage}}
\newlist{prompts}{enumerate}{1}
\setlist[prompts]{itemsep=2em,label=\arabic*,topsep=0pt}

% ...

\begin{prompts}
  \begin{promptlist}{prompt A}
    \item choice A.a
    \item choice A.b
    \item choice A.c
    \item choice A.d
    \item choice A.e
  \end{promptlist}
  \begin{promptlist}{prompt B}
    \item choice B.a
    % ...
| improve this answer | |
  • This still does not prevent page breaks from being inserted between the prompt and the choices or within the prompt. How can I include the prompt inside the minipage? – Nick Attkiss Mar 29 '17 at 22:48
  • @NickAttkiss: Could you provide some example code that shows it doesn't work? Perhaps on Pastebin? – Werner Mar 29 '17 at 22:51
  • I managed to solve the problem by adding the prompt as a parameter to the environment to be put in the minipage. On an unrelated note, \raggedbottom seems to have no effect. Here's some example code: pastebin.com/t6RsG4zB. Even with \raggedbottom, that ugly white space remains in the left column. – Nick Attkiss Mar 30 '17 at 0:33
  • @NickAttkiss: Well, you're forcing unwanted breaks in certain columns. TeX will stretch things out as far as it can, but that stretching will span an entire column, which probably looks worse than a gap at the bottom of a column. – Werner Mar 30 '17 at 0:52
  • And \raggedbottom can't change that? – Nick Attkiss Mar 30 '17 at 1:31

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.