How can I make the resume
key work when my enumerate
d lists are contained within separate multicol
environments?
Here's the code that's not working:
\documentclass{article}
\usepackage{multicol}
\usepackage{enumitem}
\newlist{problem}{enumerate}{1}
\setlist[problem,1]{label={\bfseries\arabic{problemi}.},leftmargin=*,resume}
\def\remembered[#1]{\typeout{Call #1:\arabic{problemi}}}
\pagestyle{empty}
\begin{document}
Random content
\begin{multicols}{2}
\begin{problem}
\item something
\end{problem}
\end{multicols}
\remembered[First]
more content
\begin{multicols}{3}
\remembered[Inside 2nd]
\begin{problem}
\item something
\item something
\item something
\item something
\item something
\item something
\item something
\item something
\item something
\end{problem}
\end{multicols}
\remembered[Outside second]
more content
\begin{multicols}{3}
\remembered[Inside 3rd]
\begin{problem}
\item something
\item something
\item something
\item something
\item something
\end{problem}
\end{multicols}
\remembered[Outside 4th]
\end{document}
The \remember
command seems to indicate that the value of the counters isn't being localized by the multicols
environment. So, why can't resume
find the correct value to resume from?
Without the multicols
environment everything works as desired:
\documentclass{article}
\usepackage{multicol}
\usepackage{enumitem}
\newlist{problem}{enumerate}{1}
\setlist[problem,1]{label={\bfseries\arabic{problemi}.},leftmargin=*,resume}
\def\remembered{\typeout{\arabic{problemi}}\par I remember: \arabic{problemi}}
\pagestyle{empty}
\begin{document}
Random content
\begin{problem}
\item something
\end{problem}
\remembered[First]
more content
\remembered[Inside 2nd]
\begin{problem}
\item something
\item something
\item something
\item something
\item something
\item something
\item something
\item something
\item something
\end{problem}
\remembered[Outside second]
more content
\remembered[Inside 3rd]
\begin{problem}
\item something
\item something
\item something
\item something
\item something
\end{problem}
\remembered[Outside 4th]
\end{document}