# Welcome to the UK List of TeX Frequently Asked Questions on the Web

## Interrupting enumerated lists

It’s often convenient to have commentary text, ‘outside’ the list, between successive entries of a list. In the case of itemize lists this is no problem, since there’s never anything to distinguish successive items, while in the case of description lists, the item labels are under the user’s control so there’s no automatic issue of continuity.

For enumerate lists, the labels are generated automatically, and are context-sensitive, so the context (in this case, the state of the enumeration counter) needs to be preserved.

The belt-and-braces approach is to remember the state of the enumeration in your own counter variable, and then restore it when restarting enumerate:

\newcounter{saveenum}
...
\begin{enumerate}
...
\setcounter{saveenum}{\value{enumi}}
\end{enumerate}
<Commentary text>
\begin{enumerate}
\setcounter{enumi}{\value{saveenum}}
...
\end{enumerate}


This is reasonable, in small doses… Problems (apart from sheer verbosity) are getting the level right (“should I use counter enumi, enumii, …”) and remembering not to nest the interruptions (i.e., not to have a separate list, that is itself interrupted) in the “commentary text”).

The mdwlist package defines commands \suspend and \resume that simplify the process:

\begin{enumerate}
...
\suspend{enumerate}
<Commentary text>
\resume{enumerate}
...
\end{enumerate}


The package allows an optional name (as in \suspend[id]{enumerate}) to allow you to identify a particular suspension, and hence provide a handle for manipulating nested suspensions.

If you’re suspending a fancy-enumeration list, you need to re-supply the optional “item label layout” parameters required by the enumerate package when resuming the list, whether by the belt-and-braces approach, or by the mdwlist \resume{enumerate} technique. The task is a little tedious in the mdwlist case, since the optional argument has to be encapsulated, whole, inside an optional argument to \resume, which requires use of extra braces:

\begin{enumerate}[\textbf{Item} i]
...
\suspend{enumerate}
<comment>
\resume{enumerate}[{[\textbf{Item} i]}]
...
\end{enumerate}


The enumitem package, in its most recent release, will also allow you to resume lists:

\begin{enumerate}
...
\end{enumerate}
<comment>
\begin{enumerate}[resume]
...
\end{enumerate}


which feels just as “natural” as the mdwtools facility, and has the advantage of playing well with the other excellent facilities of enumitem.

Expdlist has a neat way of providing for comments, with its \listpart command. The command’s argument becomes a comment between items of the list:

\begin{enumerate}
\item item 1
\item item 2
\listpart{interpolated comment}
\item item 3
\end{enumerate}


This, you will realise, means it doesn’t even have to think about suspending or resuming the list, and of course it works equally well in any of the list environments (thought it’s not actually necessary for any but enumerate).

Enumitem also allows multi-level suspension and resumption of lists:

\begin{enumerate}
\item outer item 1
\end{enumerate}
<comment>
\begin{enumerate}[resume]
\item outer item 2
% nested enumerate
\begin{enumerate}
\item inner item 1
\end{enumerate}
<nested comment>
% resume nested enumerate
\begin{enumerate}[resume]
\item inner item 2
\end{enumerate}
\item outer item 3
% end outer enumerate
\end{enumerate}


However, the ‘nested comment’ interpolated in the nested enumeration appears as if it were a second paragraph to “outer item 2”, which is hardly satisfactory.

enumerate.sty
Distributed as part of macros/latex/required/tools (or browse the directory); catalogue entry
enumitem.sty
macros/latex/contrib/enumitem (or browse the directory); catalogue entry
expdlist.sty
macros/latex/contrib/expdlist (or browse the directory)
mdwlist.sty
Distributed as part of macros/latex/contrib/mdwtools (or browse the directory); catalogue entry

Go to previous question, or next question

Go to FAQ home.

URL for this question: http://www.tex.ac.uk/cgi-bin/texfaq2html?label=interruptlist

Comments, suggestions, or error reports? - see “how to improve the FAQ”.

This is FAQ version 3.28, released on 2014-06-10.