I have a list that I need to behave as if it is always resumed. With the enumitem package, I know I can use series=<name> on the first list, and use resume*=<name> on subsequent lists.
However, my issue is that I have these lists defined in macros and the macros don't know which one will be first (so that it can specify the series=<name> option) and which will be the subsequent ones (which need a resume*=<name>). Furthermore, any item (including the first one) may be repeated, so if any one item is assumed to be the first one, then the count gets reset.
How can I define al its that always continues numbering independent of the order?
Notes:
- A hack solution would be to pass in the
series=andresume*option when the macros are invoked, but I'd prefer not to have to do that.
Code:
\documentclass{article}
\usepackage{enumitem}
\newlist{MyList}{enumerate}{2}
\setlist[MyList]{label={\arabic*)}}
\newcommand*{\ListA}{%
\begin{MyList}[series=ResumedList]
\item Item A
\end{MyList}
}
\newcommand{\ListB}{%
\begin{MyList}[resume=ResumedList]
\item Item B
\end{MyList}
}
\begin{document}
\ListA
\ListB
\ListB
\ListA
Number of list items = \arabic{MyListi}
\ifnum\arabic{MyListi}=4\relax
\textbf{PASS}: Correct count
\else
\textbf{FAIL}: Incorrect count. Count should be 4.
\fi
\end{document}
