1

I'm trying to create a notes packet for my class, which is basically a long list of questions, 2 or 3 to a page, with space after each question where the students can work out solutions. I'm using the enumitem package, and I have worked out an almost perfect solution, using a custom list enviroment and defining itemsep and after to do the vertical spacing work:

\documentclass{article}
\usepackage[shortlabels]{enumitem}
\newlist{questions}{enumerate}{1} 
\setlist[questions]{label=\itshape{{Question }\arabic*.},
                    ref={Question }\arabic*,
                    leftmargin=*,
                    itemindent=*,
                    itemsep=\fill, 
                    after={\vfill},
                    resume}

\begin{document}
    \begin{questions}
        \item First Question
        \item Another Question
        \item Another Question
        \item Another Question
    \end{questions}
\end{document}

This works fine, until I decide I want to spread these questions out over two pages, by manually inserting a \newpage:

\begin{document}
    \begin{questions}
        \item First Question
        \item Another Question
           \newpage
        \item Another Question
        \item Another Question
    \end{questions}
\end{document}

In this version, Question 2 ends up at the bottom of page 1, with no space after it. I can sorta fix it by ending the questions list before the newpage, and restarting it afterwards, like so:

\begin{document}
    \begin{questions}
        \item First Question
        \item Another Question
    \end{questions}
           \newpage
    \begin{questions}
        \item Another Question
        \item Another Question
    \end{questions}
\end{document}

...but ending and restarting the list every time I want to insert a new page is a pain.

Is there a more "elegant" (read: easier) way to get the behavior I want using the enumitem package? I'm pretty sold on enumitem and I'd rather not switch to a different package unless there is a really good reason to.

3
  • 1
    \vfill\newpage will put question 2 somewhere in the middle. Commented Jan 10 at 21:21
  • Ah, yes, that works! I was trying to avoid any manual use of \vfill, but I guess that is probably just as easy as typing \newpage.
    – CarneSeca
    Commented Jan 10 at 21:28
  • @CarneSeca \def\vfnp{\vfill\newpage}?
    – Tom
    Commented Jan 10 at 22:08

2 Answers 2

1

There is an automatic \vfil with \newpage. It was getting crushed by \fill.

\documentclass{article}
\usepackage[shortlabels]{enumitem}
\newlist{questions}{enumerate}{1} 
\setlist[questions]{label=\itshape{{Question }\arabic*.},
                    ref={Question }\arabic*,
                    leftmargin=*,
                    itemindent=*,
                    itemsep=0pt plus 1fil, 
                    resume}

\begin{document}
    \begin{questions}
        \item First Question
        \item Another Question
    \newpage
        \item Another Question
        \item Another Question
    \end{questions}
\end{document}
0

The problem is that the \itemsep glue is inserted by the command \item, so it is at the top of the second page and gets discarded by rule.

I see no way to “backtrack”, because when TeX has completed a page it removes it from memory. Thus you need to manually add \vfill in front of \newpage.

Adding some semantics, you can do

\newcommand{\questionbreak}{\vfill\pagebreak}

Example:

\documentclass{article}
\usepackage{enumitem}

\newlist{questions}{enumerate}{1}
\setlist[questions]{
  label=\textit{Question} \arabic*.,
  ref=Question \arabic*,
  leftmargin=*,
  itemindent=*,
  itemsep=\fill,
  after=\vfill,
  resume,
}

\newcommand{\questionbreak}{\vfill\pagebreak}

\begin{document}

\begin{questions}
\item First Question

\item Another Question

\questionbreak

\item Another Question

\item Another Question

\end{questions}

\end{document}

enter image description here

Check the small changes: \itshape doesn't take an argument. If you want that also the number is in italics, do

label=\textit{Question \arabic*.}
1
  • Ah, using \textit rather than \itshape does seem much nicer.
    – CarneSeca
    Commented Jan 11 at 17:07

You must log in to answer this question.

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