Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.

share|improve this question
1  
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
add comment

3 Answers

up vote 46 down vote accepted

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:

alt text

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

share|improve this answer
    
That's perfect, thanks! –  Mark Meckes Aug 13 '10 at 17:16
7  
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
3  
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
add comment

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

\documentclass{article}

\newcounter{tmpc}

\begin{document}

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

Foo

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

\end{document}
share|improve this answer
2  
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
2  
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
2  
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
2  
@Seamus: Apparently enumitem also allows one to do that, through what it calls series. –  Mark Meckes Apr 20 '12 at 16:54
add comment

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}
share|improve this answer
    
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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.