resume
当我的enumerate
d 列表包含在单独的环境中时,如何使密钥起作用multicol
?
这是不起作用的代码:
\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}
该\remember
命令似乎表明计数器的值未被环境本地化multicols
。那么,为什么找不到resume
正确的值来恢复呢?
没有multicols
环境一切都按预期进行:
\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}
答案1
resume
它在局部起作用,因此它无法在类似群组multicols
或任何其他环境中存活。您需要使用series
来保持全局效果:
\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}