# Resuming a list

I'd like to be able to resume an enumerated list, continuing the old numbering, after some intervening text which should not be formatted like a list item. Is there a nice way to do this?

In particular, I don't want to start a second list with a hard-coded initial counter value, because that will break if I change the number of items in the first list.

-
related: making custom lists (if you want not to use a package but to create something like this yourself) –  Grigory M Aug 13 '10 at 17:49
BTW, this question had been asked before on SO: stackoverflow.com/questions/1348194/… –  Waldir Leoncio Aug 5 '14 at 19:43

This can easily be done using the enumitem package, for example:

\documentclass[12pt]{article}
\usepackage{enumitem}
\begin{document}
\begin{enumerate}
\item One
\item Two
\end{enumerate}
Some text
\begin{enumerate}[resume]
\item Three
\end{enumerate}
\end{document}


Output:

Alternatively, the package mdwlist provides the commands \suspend and \resume for temporarily ending a list and restarting it.

-
Before this site existed, I had the impression there were a couple dozen tex packages I should know about that I don't. Now it seems like thousands. –  Mark Meckes Aug 13 '10 at 17:17
@Mark, i feel the same way. every thread on this site introduces me to 2 or more new packages. –  masfenix Aug 13 '10 at 17:34
I was about to ask another question, but then on a whim Googled the name that I would have given a package to solve my problem (theoremref), and came up with exactly what I wanted. –  Mark Meckes Aug 13 '10 at 19:20
@MarkMeckes It never ends! :P –  Alenanno Apr 24 '12 at 11:45

Just save the counter and then restore it. There's no reason to use packages for things like this.

\documentclass{article}

\newcounter{nameOfYourChoice}

\begin{document}

\begin{enumerate}
\item Foo
\setcounter{nameOfYourChoice}{\theenumi}
\end{enumerate}

Foo

\begin{enumerate}
\setcounter{enumi}{\thenameOfYourChoice}
\item Foo
\end{enumerate}

\end{document}

-
I admire the simplicity. The advantage of one of the packages Stefan suggested is that it allows for more semantic markup. –  Mark Meckes Aug 14 '10 at 13:22
I'm happy to see this solution. I'm always a bit hesitant to clutter my document with yet another package, because you can never really be sure what else it does under the hood, in addition to fixing a small problem you have. –  Thomas Feb 8 '11 at 16:23
I think this is the better solution for a one off. But if you're going to be doing it a lot, then the enumitem solution is better (especially since you might want to use other features of enumitem if you have a lot of lists going on...) –  Seamus May 30 '11 at 12:50
Thinking about it, this solution also has the advantage that you can have one list, then have another list, and then resume the first list. (Although I'm not totally sure that would be a good idea...) –  Seamus May 30 '11 at 12:56
@Seamus: Apparently enumitem also allows one to do that, through what it calls series. –  Mark Meckes Apr 20 '12 at 16:54

The question How to have the same counter in two enumerate lists? was closed as a duplicate of this one but introduced a slight difference: one of the pieces of the enumeration was inside a theorem environment. When using enumitem this needs special handling. The solution is contained in Mark Meckes comment on Carl's answer above, but in light of the new question I thought it instructive to give an example.

First, the non-working code:

\documentclass{article}
\usepackage{enumitem}
\newtheorem{theorem}{Theorem}
\begin{document}
\begin{theorem} We are in the theorem environment,
\begin{enumerate}
\item\label{condition1}the first condition,
\item\label{condition2}the second condition,
\end{enumerate}
\end{theorem}

We have exited the theorem environment. We also have one more condition,

\begin{enumerate}[resume]
\item\label{condition3}\emph{the third condition}.
\end{enumerate}
\end{document}


When TeXed, the third condition has the incorrect number 1. Commenting out the \begin{theorem} and \end{theorem} lines gives it the correct number 3.

The correct way to correct this is to use the series key. This is explained in Section 3.5 of the enumitem manual. The feature was introduced in Version 3.0.

\documentclass{article}
\usepackage{enumitem}
\newtheorem{theorem}{Theorem}
\begin{document}
\begin{theorem} We are in the theorem environment,
\begin{enumerate}[series=theoremconditions]
\item\label{condition1}the first condition,
\item\label{condition2}the second condition,
\end{enumerate}
\end{theorem}

We have exited the theorem environment. We also have one more condition,

\begin{enumerate}[resume=theoremconditions]
\item\label{condition3}\emph{the third condition}.
\end{enumerate}
\end{document}


This produces the correct numbering. It can also handle having arbitrary stuff in between, including other lists.

Here's the same example with the labels modified (see How to have the same counter in two enumerate lists?), also showing the use of the resume* variant.

\documentclass{article}
\usepackage{enumitem}
\newtheorem{theorem}{Theorem}

\begin{document}
\begin{theorem} We are in the theorem environment,
\begin{enumerate}[label=(\roman*),series=theoremconditions]
\item \label{condition1}the first condition,
\item \label{condition2}the second condition,
\end{enumerate}
\end{theorem}

We havve exited the theorem environment. We also have one more condition,
\begin{enumerate}[resume*=theoremconditions]
\item \label{condition3}\emph{the third condition}
\end{enumerate}

\begin{theorem}
We have another theorem, based on \ref{condition3}.
\end{theorem}
\end{document}

-
Interestingly, this fix does not seem to work if your document is an amsart document. However, if this is so then Carl Mummert's \newcounter method does the trick (even with the specific conditions in your answer)! –  user1729 Jun 12 '12 at 16:23

Here is a way if you don't want to do it by hand each time:

\documentclass{article}

\newcounter{myenumi}
\setcounter{myenumi}{0}
\newenvironment{myenumerate}{\begin{enumerate} \setcounter{enumi}{\themyenumi}}{ \setcounter{myenumi}{\theenumi}\end{enumerate}}

\begin{document}

\begin{myenumerate}
\item first one
\item second one
\end{myenumerate}
Now we've ended the enumeration.

Let's start enumerating again
\begin{myenumerate}
\item third
\item fourth.
\end{myenumerate}

\end{document}

-