Continuous list enumeration throughout the document with LaTeX

Karolina asked me today to create a macro for having a continuous list enumeration throughout the whole document, i.e.

This is the first list:

1. Item;
2. Another item;

And here goes the second list:

3. Third item;
4. And yet another item.

You can obtain an effect like that by using LaTeX counters and a custom definition of your own enumerate environment. First, we need to usepackage{enumerate}, and then define the following counter and an environment in the preamble:

newcounter{enumi_saved}
newenvironment{myenumerate}
{ begin{enumerate}setcounter{enumi}{value{enumi_saved}}}
{setcounter{enumi_saved}{value{enumi}}end{enumerate}}

After that, you can use myenumerate and you’ll have a continuous enumeration in the whole document.

Oh and some credits: I wouldn’t come up with a solution if I haven’t read this post, and this website. Huge thanks to the authors for their tips!

update: There’s a much simpler solution, thanks Jakub.

4 thoughts on “Continuous list enumeration throughout the document with LaTeX

Comments are closed.