8

I'm trying to write an exam paper using LaTeX. I use the enumerate package, e.g.

\begin{enumerate}
  \item This question is about balloons.
    \begin{enumerate}
      \item What shape are balloons?
      \item What colour are balloons?
    \end{enumerate}
\end{enumerate}

The problem comes from when I want to put commentary into the question. At the moment, the first level of enumerate gives me a number, and the second a letter. But in between the letters, I might like to say something about the next part of the question, and I would like that outdented, i.e. not on the same level as the lettered parts of the question. I have a work around:

\begin{enumerate}
  \item This question is about balloons.
    \begin{enumerate}[(a)]
      \item What shape are balloons?
    \end{enumerate}
  Assume that all balloons are the same shape.
    \begin{enumerate}[(b)]
      \item What colour are balloons?
    \end{enumerate}
\end{enumerate}

This is a real pain in the you-know-what. Doing it this way, everything in the last enumerate environment gets labelled as (b). So I have to \begin{enumerate} and \end{enumerate} and label every subsequent part:

\begin{enumerate}
  \item This question is about balloons.
    \begin{enumerate}[(a)]
      \item What shape are balloons?
    \end{enumerate}
  Assume that all balloons are the same shape.
    \begin{enumerate}[(b)]
      \item What colour are balloons?
    \end{enumerate}
    \begin{enumerate}[(c)]
      \item Why do I have to keep doing this?
    \end{enumerate}
    \begin{enumerate}[(d)]
      \item Why do I have to keep doing this?
    \end{enumerate}
\end{enumerate}
17
  • 2
    You should consider the enumitem package, instead, and its resume feature.
    – egreg
    Commented Jun 25, 2013 at 16:39
  • 1
    enumitem is included in both MikTeX and TeX Live, so you may have it already. If not, which TeX distribution do you have? Commented Jun 25, 2013 at 16:45
  • 2
    enumerate is quite old and you should probably use enumitem but you can use enumerate but you are misusing it \begin{enumerate}[(b)] should be \begin{enumerate}[(a)]\setcounter{enumii}{2} Only a is a special value to set the counter format you can not use b to set the start value. Commented Jun 25, 2013 at 16:58
  • 1
    TeXnicCenter is just the editor, and doesn't really have anything to do with installing packages -- the distribution (in this case MikTeX) takes care of that. Anyways, MikTeX has a package manager, you can find a shortcut in the start menu. In that, you can search for, and install, packages. Or, if you have activated on-the-fly installation of missing packages, all you have to do is compile a document with \usepackage{enumitem}, and the installation happens automatically. Commented Jun 25, 2013 at 17:04
  • 1
    (Heh, I didn't read your comment to the end, silly me.) If you dis as asked in the installation window, then the package should be installed. Does the document compile? Commented Jun 25, 2013 at 17:06

1 Answer 1

10

This is quite easy with enumitem:

\documentclass{article}
\usepackage{enumitem}
\newlist{subquestion}{enumerate}{1}
\setlist[subquestion,1]{label=(\alph*)}

\begin{document}
\begin{enumerate}
\item This question is about balloons.
   \begin{subquestion}
   \item What shape are balloons?
   \end{subquestion}
Assume that all balloons are the same shape.
  \begin{subquestion}[resume]
  \item What colour are balloons?
  \item Why do I have to keep doing this?
  \end{subquestion}
Something else.
  \begin{subquestion}[resume]
  \item Why do I have to keep doing this?
  \end{subquestion}
\end{enumerate}
\end{document}

enter image description here

You must log in to answer this question.

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