0

I'd like to make enumerate list that adds certain amount of blank lines after every \item, but without allowing page breaks that separate \item text from that blank space. My list is a problem set with blank space given for work on each problem and I don't want problems to be separated from this blank space.

I'm currently using the following code to create those empty lines:

\let\olditem\item
\renewcommand{\item}{\olditem \vspace*{10em}}

This works great when it comes to adding 10em vertical space but literally every page has one \item at the very bottom and then \vspace*{10em} continues on the next page.

How can I prevent that?

7
  • 2
    don't redefine item or use vspace, simply increase \itemsep or one of the other list parameters, possibly via the enumitem package. Oct 25, 2023 at 21:22
  • 1
    Or, load the needspace package and define \renewcommand{\item}{\Needspace*{10em}\olditem \vspace*{10em}}.
    – Mico
    Oct 25, 2023 at 21:24
  • @DavidCarlisle I tried that before, but it wasn't creating blank lines when \item was at the bottom of the page. I presume since it would continue on the next page enumerate just doesn't bother adding itemsep. Which does make sense in most cases, just not here.
    – Aca
    Oct 25, 2023 at 21:38
  • @Mico I've been having some success with \Needspace (without *) and \vspace. It works in almost all cases but sometimes leaves too little space. What's exactly the difference between \Needspace with and without *?
    – Aca
    Oct 25, 2023 at 21:59
  • According to the user guide of the needspace package, \needspace{<length>} reserves an approximate amount of space, whereas \Needspace{<length>} is "less efficient but reserves the requested space exactly". The difference between \Needspace and \Needspace* comes into play if \raggedbottom or \flushbottom is in effect -- a subject about which I can't say anything as you've failed to provide any information about the document class you employ. Do feel free to peruse the package's user guide yourself; I suggest you run texdoc needspace at a command prompt.
    – Mico
    Oct 25, 2023 at 22:09

2 Answers 2

1

With no example shown it's hard to be sure but I guess something like this will do what you want (replace the 1pt by 0pt for real code, the visible rule is just for debugging)

enter image description here

\documentclass{article}

\usepackage{enumitem}

\begin{document}
\newcommand\myitem{\item\mbox{}\par}
\begin{enumerate}[label={\arabic*)\rule[-10\baselineskip]{1pt}{10\baselineskip}}]
\myitem aaa
\myitem aaa
\myitem aaa
\myitem aaa
\myitem aaa
\myitem aaa
\myitem aaa
\myitem aaa
\myitem aaa
\myitem aaa
\end{enumerate}
\end{document}


3
  • Interesting. Is there a way to get items to go before blank lines? This looks like what I need, but aaa should come first, and empty lines after that.
    – Aca
    Oct 25, 2023 at 22:44
  • oh use \item instead of \myitem and the aaa will come before... @Aca Oct 25, 2023 at 22:46
  • That works great! Thanks!
    – Aca
    Oct 25, 2023 at 22:57
0

Based on your description, I don't think enumerate is the right tool.

You seem to want to compose a problem set that has

  • problem statements
  • reserved space for work

that you expect to "stick together". The easiest way for this to be ensured is if you stick the whole artifice within a minipage. Below is a proof-of-concept. (For the variable height version, same as David's answer, replace the 1pt in the rule by 0pt for production. The 1pt just helps you visualize the space reserved.)

\documentclass[twocolumn]{article}

\newcounter{problemnum}
\newenvironment{problem}{\refstepcounter{problemnum}%
        \par\noindent\begin{minipage}[t]{\linewidth} \noindent \theproblemnum)~}{\rule[-8.5em]{1pt}{8.5em} % This is the amount of vertical space to reserve
\end{minipage}}
\newenvironment{problemfh}{\refstepcounter{problemnum}%
        \par\noindent\begin{minipage}[t][8.5em]{\linewidth}\noindent \theproblemnum)~}{\end{minipage}}

\begin{document}

Variable height version: keeping the same amount of ``work space''. 

\begin{problem}
        This is a math problem
\end{problem}

\begin{problem}
        This is another math problem
\end{problem}

\begin{problem}
        This is a multiline math problem. It is something about chickens and rabbits on a farm, and the counts of how many feet they have altogether and how many mouths they have between them. It has something to do with algebra. 
\end{problem}

\begin{problem}
        This is another short problem
\end{problem}

\begin{problem}
        This problem should straddle the column break and be moved to the second column
\end{problem}

\hrule
The next version has a fixed total height, so the work space shrinks for the longer problem.

\begin{problemfh}
        This is a math problem
\end{problemfh}

\begin{problemfh}
        This is a multiline math problem. It is something about chickens and rabbits on a farm, and the counts of how many feet they have altogether and how many mouths they have between them. It has something to do with algebra. 
\end{problemfh}

\begin{problemfh}
        This is another short problem
\end{problemfh}
\hrule

\end{document}

enter image description here

Note that in the left column additional glue (space) has been inserted between the problems by LaTeX to spread them out more evenly. You can see that there would be more than enough space left for the text in Problem 5, but the use of minipage forces the reserved space to be placed at the same "page" (column, in this case) as the text.

You must log in to answer this question.

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