I try to have enumerate resume its numbering but restart with each chapter. I have found a way to restart the counter here:

https://tex.stackexchange.com/a/348942

However, the solution does not resume the counter when certain environments are involved, like a proof.

Here is what I have so far (but it does not resume the counter after the proof):

\documentclass{book}

\usepackage{enumitem}
\usepackage{etoolbox}
\usepackage{amsthm}

% include the chapter number
\setlist[enumerate]{label=\thechapter.\arabic{*},resume}

% restart the enumerate list every chapter
\preto\chapter{%
  \restartlist{enumerate}%
}

\begin{document}

\chapter{one}

\begin{enumerate}
  \item first
  \item second
\end{enumerate}
more
\begin{proof}
  \begin{enumerate}
    \item third
    \item fourth
  \end{enumerate}
\end{proof}
more
\begin{enumerate}
  \item fifth
  \item sixth
\end{enumerate}

\chapter{two}
\begin{enumerate}
  \item first
  \item second
\end{enumerate}
more
\begin{enumerate}
  \item third
  \item fourth
\end{enumerate}

\end{document}
  • So, do you want a separate "proof" enumerate counter or do you wish to reset the enumerate counter at the beginning of a proof environment? – nox Oct 11 at 10:25
  • @nox Oh, I see now that I have formulated it incorrectly. I want the counter just to resume with 1.5 after the proof – Daniel Oct 11 at 10:44
up vote 2 down vote accepted

Looks like enumitem saves the resuming data (counter etc.) locally, and LaTeX forgets about these saved data after the current group ends. You could patch the \enit@setresumekeys command and replace \def by \gdef in it. Since there are two \def entries, I had to use the \patchcmd twice (it is defined in etoolbox like \preto. The changed code:

\documentclass{book}

\usepackage{enumitem}
\usepackage{etoolbox}
\usepackage{amsthm}

% include the chapter number
\setlist[enumerate]{label=\thechapter.\arabic{*},resume}

% restart the enumerate list every chapter
\preto\chapter{%
  \restartlist{enumerate}%
}

\makeatletter
\patchcmd{\enit@setresumekeys}{\def}{\gdef}{}{}
\patchcmd{\enit@setresumekeys}{\def}{\gdef}{}{}
\makeatother

\begin{document}
\chapter{one}

\begin{enumerate}
  \item first
  \item second
\end{enumerate}
more
\begin{proof}
  \begin{enumerate}
    \item third
    \item fourth
  \end{enumerate}
\end{proof}
more
\begin{enumerate}
  \item fifth
  \item sixth
\end{enumerate}

\chapter{two}
\begin{enumerate}
  \item first
  \item second
\end{enumerate}
more
\begin{enumerate}
  \item third
  \item fourth
\end{enumerate}
\end{document}

And the first page:

enter image description here

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.