3

I'm using a special list type to automatically number items across the whole document using the enumitem package with the 'resume' option.

This works fine for custom list environments all over the document, it does, however, not increase the list counter as expected, when I put my custom list items inside a table.

This is my MWE:

\documentclass{article}

\RequirePackage{enumitem}
\newlist{mylist}{enumerate}{1}
\setlist[mylist]{label=\textbf{L\arabic*:}, resume}

\begin{document}

\section{Test}

\subsection{A list}

\begin{mylist}
    \item test1
    \item test2
\end{mylist}

\subsection {Another list} \label{sec:another}

Next "mylist" env (also in different subsection), will continue numbering as it should:

\begin{mylist}
    \item test3
    \item test4
\end{mylist}

\subsection{A third list inside a table}

Now inside table, the numbering continues, but only in the first table:

\begin{tabular}{ |l|p{3in}| } 
    \hline
    cell1 & 
        \begin{mylist}
            \item test5
            \item test6
        \end{mylist} \\
    \hline
\end{tabular}

\subsection{Another list inside a table}

The next table env, however, restarts the numbering at the count that section \ref{sec:another} finished at:

\begin{tabular}{ |l|p{3in}| } 
    \hline
    cell1 & 
        \begin{mylist}
            \item test7
            \item test8
        \end{mylist} \\
    \hline
\end{tabular}

\end{document}

Output using xelatex on MacOS:

PDF Output of MWE using XeLaTex

The only way I've found to make sure the numbering continues inside the tables is to repeat "[resume*]" at each \begin{mylist} line like so:

\begin{mylist}[resume*]
  \item test7
  \item test8
\end{mylist}

I'd like to avoid this repetition. How do I globally declare the list counter to be increased by the list items inside table cells, as well?

1 Answer 1

1

Use a series, as explained in section 3.4 of the enumitem documentation.

\setlist[mylist]{label=\textbf{L\arabic*:}, resume=mischa_obrecht}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .