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}
Marco Daniel
  • 95,681
  • 2
    You should consider the enumitem package, instead, and its resume feature. – egreg Jun 25 '13 at 16:39
  • @egreg Sounds promising. How do I get this package? How do I use this package? Do you know of a link to user-friendly instructions? – Fly by Night Jun 25 '13 at 16:41
  • 1
    enumitem is included in both MikTeX and TeX Live, so you may have it already. If not, which TeX distribution do you have? – Torbjørn T. Jun 25 '13 at 16:45
  • @TorbjørnT. I'm using TeXnicCenter. I added usepackage{enumitem} and it opened a Package Installation window. I've downloaded the style file, but I'm not sure how to install it. (I have folders called MikTeX, so I assume I have MikTeX) – Fly by Night Jun 25 '13 at 16:54
  • 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. – David Carlisle Jun 25 '13 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. – Torbjørn T. Jun 25 '13 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? – Torbjørn T. Jun 25 '13 at 17:06
  • @TorbjørnT. I played about with it for a bit and found an option to let me download missing packages from the internet. Then I chose a mirror from a British University. I clicked that, restarted LaTeX, and it compiled. (With 14 errors!) I've fixed all the errors now, and am fully converted to enumitem. Thanks a lot for your help!! – Fly by Night Jun 25 '13 at 17:15
  • @DavidCarlisle Thanks David. I've taken your advice and got myself using enumitem. I first learned to use LaTeX in 2002, and have stuck to what I was taught ever since. I'm quite fluent at type setting, but a total novice when it comes to anything else. – Fly by Night Jun 25 '13 at 17:16
  • there is a dedicated exam document class that facilitates exams beautifully- highly recommend it – cmhughes Jun 25 '13 at 17:22
  • @cmhughes This looks very interesting. I don't know how to install a .cls file. I changed the document class of a working file to {exam} and tried to compile. I got a package install window pop-up. I asked it to install via the web like I had when I got enumitem.sty but that didn't work. I've downloaded exam.cls but don't know how it install it. – Fly by Night Jun 25 '13 at 19:00
  • @FlybyNight; that depends on the editor you use. Most times though you can simply search on the computer in which map the other .cls files are, and place it there. After that you have to update the file name database. How that is done depends on the editor, but you should be able to easily find it online. – Mythio Jun 25 '13 at 19:06
  • @Mythio I'm using TeXnicCenter. I have no idea what a map is, or a file name database. Sorry. – Fly by Night Jun 25 '13 at 19:16
  • Texnicenter uses miktex so you can use the instructions in the answer provided here: http://tex.stackexchange.com/questions/2063/how-can-i-manually-install-a-package-on-miktex-windows – Mythio Jun 25 '13 at 19:23
  • @Mythio Thanks for trying to help, but I have no idea what a local tree structure is. I don't even know where the folders are. I have three folders containing MikTeX stuff, and they all expand to contain 30 folders each. I was hoping there might be a way to do it via the in-editor menus. – Fly by Night Jun 25 '13 at 19:30
  • @Mythio p.s. to make it worse, Windows 8 doesn't even have a start button, so I can't update the database in the way the link suggests :'( – Fly by Night Jun 25 '13 at 19:35
  • 1
    Hmm sorry man, I don't know texniccenter well enough to know if it can be done from the editor. I suggest posting a new question asking for steps to install a .cls file on windows 8 with texniccenter. That will probably get you the help you need :-) – Mythio Jun 25 '13 at 19:52

1 Answers1

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

egreg
  • 1,121,712