[OS X TeX] How to interrupt a list?
Josep M. Font
jmfont at orangecorreo.es
Tue Mar 11 18:08:57 CET 2008
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
More information about the macostex-archives
mailing list