Discussion:
resume an enumeration
(too old to reply)
Guenter Milde
2008-11-23 19:38:02 UTC
Permalink
Resuming an emumeration is possible with the mdwlist package.

Example::

\documentclass{article}

\usepackage{mdwlist}

\begin{document}

\begin{enumerate}
\item first
\item list
\suspend{enumerate}
regular text
\resume{enumerate}
\item resumed
\end{enumerate}

\end{document}

yields:

1. first
2. list

regular text

3. resumed

However, I wonder whether it is possible to define an alternative
enumeration environment to get the same result (i.e. start with the next
number from the last enumeration of the same depth), like

\begin{enumerate}
\item first
\item list
\end{enumerate}
regular text
\begin{enumerate*}
\item resumed
\end{enumerate*}

Looking at latex.ltx, it seems like the enum* counters are not reset at
the end of the enumerate environment. So, maybe an enumerate* variant
could use them without resetting first...

Günter
Heiko Oberdiek
2008-11-23 20:43:56 UTC
Permalink
Post by Guenter Milde
Resuming an emumeration is possible with the mdwlist package.
\documentclass{article}
\usepackage{mdwlist}
\begin{document}
\begin{enumerate}
\item first
\item list
\suspend{enumerate}
regular text
\resume{enumerate}
\item resumed
\end{enumerate}
\end{document}
1. first
2. list
regular text
3. resumed
However, I wonder whether it is possible to define an alternative
enumeration environment to get the same result (i.e. start with the next
number from the last enumeration of the same depth), like
\begin{enumerate}
\item first
\item list
\end{enumerate}
regular text
\begin{enumerate*}
\item resumed
\end{enumerate*}
Looking at latex.ltx, it seems like the enum* counters are not reset at
the end of the enumerate environment. So, maybe an enumerate* variant
could use them without resetting first...
The following solution uses \usecounter as hook into the code of
\enumerate:

\documentclass{article}

\makeatletter
\newenvironment{enumerate*}{%
\let\***@usecounter\usecounter
\def\usecounter##1{%
\begingroup
\edef\x{\endgroup
\noexpand\***@usecounter{##1}%
\noexpand\setcounter{##1}{\the\value{##1}}%
}%
\x
\let\usecounter\***@usecounter
}%
\enumerate
}{%
\@nameuse{enumerate}%
}
\makeatother

\begin{document}

\begin{enumerate}
\item first
\item list
\end{enumerate}
regular text
\begin{enumerate*}
\item resumed
\end{enumerate*}

\end{document}

Yours sincerely
Heiko <***@uni-freiburg.de>
Alan Munn
2008-11-23 20:52:42 UTC
Permalink
Post by Guenter Milde
Resuming an emumeration is possible with the mdwlist package.
Also with the enumitem package.
Post by Guenter Milde
However, I wonder whether it is possible to define an alternative
enumeration environment to get the same result (i.e. start with the next
number from the last enumeration of the same depth), like
\begin{enumerate}
\item first
\item list
\end{enumerate}
regular text
\begin{enumerate*}
\item resumed
\end{enumerate*}
Looking at latex.ltx, it seems like the enum* counters are not reset at
the end of the enumerate environment. So, maybe an enumerate* variant
could use them without resetting first...
GÃŒnter
Your enumerate* environment is just enumitem's \begin{enumerate}[resume]
environment, so maybe this would do the job.

\documentclass{article}
\usepackage{enumitem}
\begin{document}
\begin{enumerate}
\item first
\item list
\end{enumerate}
regular text
\begin{enumerate}[resume]
\item resumed
\end{enumerate}
\end{document}

Alan

Continue reading on narkive:
Loading...