6

How can I make the resume key work when my enumerated 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}
6

resume acts locally, so it won't survive a group like multicols or any other environment, for that matter. You need to use a series to keep the effect global:

\documentclass{article}
\usepackage{multicol}
\usepackage{enumitem}
\newlist{problem}{enumerate}{1}
\setlist[problem,1]{label={\bfseries\arabic{problemi}.},leftmargin=*,resume=problem}
\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}

enter image description here

  • 1
    So the problem wasn't one of remembering the counter, but one of remember which counter it is to restore? – A.Ellett Apr 10 '14 at 12:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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