Resuming a list
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.
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}{\value{enumi}}
\end{enumerate}
Foo
\begin{enumerate}
\setcounter{enumi}{\value{nameOfYourChoice}}
\item Foo
\end{enumerate}
\end{document}
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}