LaTeX tweak: Continuous enumeration over multiple sections

Soo…I move this from a former page to a post.

At some point last year, I needed a solution for a problem in LaTeX, where I wanted to continue an enumeration over several paragraphs.

Read on and find out how I did it.


OK, I came across a problem, when trying to use something like the following:

Q1 - foo0
Q2 - bar0

Q3 - foo1
Q4 - bar1

Q5 - foo2
Q6 - bar2

So I tried. Hard. But could not get this to work. Finally, I used several counters to do the job. Not very nice but it works:

% init new counters Rcount and Tcount

%Tell the list to use counter Rcount, and use a custom label (RQ-arabicnumberOfCounter)
\begin{list}{Q-\arabic{Rcount}}{\usecounter{Rcount} \setlength{\rightmargin}{\leftmargin}}
%since the list environment sets the used counter to zero, we need to use the second counter and load it into Rcount.
  \item fooX
  \item barX

%when the list is finished, write the value or Rcount back to the backup counter.

That’s it. Hopefully it helps somebody. For any questions, just contact me.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>