# [OS X TeX] How to interrupt a list?

Matthew Leingang leingang at math.harvard.edu
Tue Mar 11 14:08:12 EDT 2008

On Mar 11, 2008, at 1:08 PM, Josep M. Font wrote:

> El 11/03/2008, a las 03:56, Louis Talman escribió:
>
>> I'd like to "interrupt" an enumerated list to typeset a paragraph
>> with the same margins as the text surrounding the list, then drop
>> back into the list.  I'd rather not have to redefine the counters
>> every time I do this.
>
> In my preamble I define the following, which allows me to do this
> automatically:
>
> \newcounter{last}
> \newcommand{\interrupt}{\setcounter{last}{\value{enumi}}\end
> {enumerate}}
> \newcommand{\continue}{\begin{enumerate}\setcounter{enumi}{\value
> {last}}}
>
> Usage is clear: interrupt the list with \interrupt, and continue it
> with \continue. In the middle you can put almost anything you like,
> you can change section and even include another independent
> "enumerate" environment! The drawback is that this does work only
> for "first level" lists (as it uses the "enumi" counter).
>
> I find this mechanism especially useful when used together with the
> "enumerate" package; you have to modify \continue in the following
> way:
>
> \newcommand{\continue}[1][1.]{\begin{enumerate}[#1]\setcounter
> {enumi}{\value{last}}}
>
> In this way, a specially formatted list, such as e.g. a list of
> special conditions labelled as (C1) , (C2) , etc., can be
> "continued" throughout the whole paper or book, just by starting
> with \begin{enumerate}[(C1)], interrupting with \interrupt, and
> continuing with \continue[(C1)] ... and finally ending it with \end
> {enumerate}.
>
> This suits my needs. Hope it may suit yours,
>
> JMaF

The enumitem package does this with the resume option.  It also
allows custom labeling so for Josep's example you can do:

\begin{enumerate}[label=(C\arabic*)]
\item first
\item second
\item third
\end{enumerate}

Inter-list text...

\begin{enumerate}[label=(C\arabic*),resume]
\item fourth
\item fifth
\end{enumerate}

\end{document}

I've been using enumitem much more than enumerate these days.

--Matt

--
Matthew Leingang
Preceptor in Mathematics
Harvard University

http://www.math.harvard.edu/~leingang/vCard.vcf