5

I am using a list that has only even numbered items for the exercises that my students are working on. I have run into a few issues:

  1. Commonly, questions begin with instructions for a small set of them, but if I start the list with some text instead of an "item" I get an error.

  2. If I break the list to put text in between two sets of questions, I can't automatically resume by using the [resume] option. Besides the instructions text ends up indented despite using \noindent

  3. The last item of my list is off alignment, and I have no clue why.

    \documentclass[a4paper,11pt]{report}
    
    \usepackage{enumitem}
    
    \newlist{evenenumerate}{enumerate}{1}
    \setlist[evenenumerate]{label=Question \theevenenumeratei.}
    \makeatletter
    
    \renewcommand\theevenenumeratei{\@arabic{\numexpr2*%
    \value{evenenumeratei}}}
    %I broke this line to make it fit in this text area
    \makeatother
    
    \newcommand{\evenquestions}{\evenenumerate}
    \newcommand{\question}{\item}
    
    \begin{document}
    
    \noindent 
    
    In Exercises 1–6, bla bla.
    
    \begin{evenquestions}
        \question foo 2
        \\
        \question foo 4
        \\
        \question foo 6
    \end{evenquestions}
    
    \noindent In Exercises 8-16, bla bla bla
    
    \begin{evenquestions}[resume]
        \question foo 8
        \\
        \question foo 10
        \\ 
        \question foo 12
        \\ 
        \question foo 14
        \\
        \question foo 16
    \end{evenquestions}
    \end{document}
    

I suppose I could put the instructions for the subsequent sections between two items, but it gives me really weird alignment, plus it doesn't match that of the first section.

6

The instructions to the questions needs to be before the list.

The other issues are resolved if you remove the

%\newcommand{\evenquestions}{\evenenumerate}

and instead use the evenenumerate environment directly and including align=left in the \setlist resolves the alignment issue.

enter image description here

Notes:

  • The showframe package was used to show the margins. It is not needed in your final document.

Code:

\documentclass[a4paper,11pt]{report}

\usepackage{enumitem}
\usepackage{showframe}

\newlist{evenenumerate}{enumerate}{1}
\setlist[evenenumerate]{label={Question \theevenenumeratei.}, align=left}
\makeatletter

\renewcommand\theevenenumeratei{\@arabic{\numexpr2*\value{evenenumeratei}}}
\makeatother

%\newcommand{\evenquestions}{\evenenumerate}
\newcommand{\question}{\item}

\begin{document}

\noindent 
In Exercises 1--6, bla bla.

\begin{evenenumerate}
    \question foo 2
    
    \question foo 4
    
    \question foo 6
\end{evenenumerate}

\noindent In Exercises 8--16, bla bla bla

\begin{evenenumerate}[resume]
    \question foo 8
    \question foo 10
    \question foo 12
    \question foo 14
    \question foo 16
\end{evenenumerate}
\end{document}
| improve this answer | |
  • 1
    +1. Nice touch to add the align=left option. – Mico Oct 19 '18 at 9:49
3

You can insert instructions in the evenquestions environment, with a proper command.

\documentclass[a4paper,11pt]{report}
\usepackage{enumitem}

\usepackage{showframe} % just for debugging, remove for production

\makeatletter
\newcommand{\doublearabic}[1]{\expandafter\@doublearabic\csname c@#1\endcsname}
\newcommand{\@doublearabic}[1]{\the\numexpr2*#1\relax}
\AddEnumerateCounter{\doublearabic}{\@doublearabic}{99}
\makeatother

\newlist{evenquestions}{enumerate}{1}
\setlist[evenquestions]{label=Question \doublearabic*,align=left}
\newcommand{\question}{\item}
\newcommand{\instr}{\item[]\hspace*{-\leftmargin}}

\begin{document}

\begin{evenquestions}
\instr In Exercises 1–6, bla bla.

    \question foo 2

    \question foo 4

    \question foo 6

\instr In Exercises 8-16, bla bla bla

    \question foo 8

    \question foo 10

    \question foo 12

    \question foo 14

    \question foo 16
\end{evenquestions}

We can also resume lists
\begin{evenquestions}[resume]
\question foo 18
\question foo 20
\question foo 22
\end{evenquestions}

\end{document}

enter image description here

| improve this answer | |
  • That's a neat solution, to make it into a blank item, especially with the negative space – Mahoma Oct 22 '18 at 0:10

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.