有没有办法“暂停” enumitem 包的计数器?

有没有办法“暂停” enumitem 包的计数器?

我正在尝试设置一个特定的枚举列表,其中我需要在\begin{enumerate}环境之间保留计数器。类似以下内容:

\begin{enumerate}[leftmargin=0.85cm, label=A\arabic*.]
\item First item
\item Second item
\end{enumerate}

write some other text here

% write another enumerated list here of the same type, but continuing with the numbering of the previous one.
\begin{enumerate}[leftmargin=0.85cm, label=A\arabic*.]
\item First item
\item Second item
\end{enumerate}

显然这不起作用,因为第二个枚举列表从头开始。我尝试在包中使用suspend和命令,但没有起作用。resumemdwlist

答案1

如果您使用 ,则无需直接处理底层计数器enumitem。您可以只使用resumeresume*/或series,带或不带自定义列表,具体取决于您的需求有多复杂。

\documentclass{article}
\usepackage{enumitem}   

\begin{document}

  \begin{enumerate}[leftmargin=0.85cm, label=A\arabic*.]
    \item First item
    \item Second item
  \end{enumerate}
  If you don't mind having to re-specify everything:
  \begin{enumerate}[leftmargin=0.85cm, label=A\arabic*., resume]
    \item Third item
    \item Fourth item
  \end{enumerate}
  If you would prefer not to re-specify:
  \begin{enumerate}[resume*]
    \item Fifth item
    \item Sixth item
  \end{enumerate}
  What if you want to use first one enumeration:
  \begin{enumerate}[leftmargin=0.85cm, label=D\arabic*., series=denum]
    \item First item
    \item Second item
  \end{enumerate}
  And then another:
  \begin{enumerate}[leftmargin=0.85cm, label=(\alph*)., series=alphenum]
    \item First item
    \item Second item
  \end{enumerate}
  And then you want to continue the first?
  \begin{enumerate}[resume*=denum]
    \item Third item
    \item Fourth item
  \end{enumerate}
  Perhaps you even want to continue the second:
  \begin{enumerate}[resume*=alphenum]
    \item Third item
    \item Fourth item
  \end{enumerate}
  Too much work?
  \newlist{blist}{enumerate}{1}
  \setlist[blist]{leftmargin=0.85cm, label=B\arabic*.}
  \begin{blist}
    \item First item
    \item Second item
  \end{blist}
  And then you can have something entirely different:
  \begin{enumerate}[leftmargin=.3\textwidth, label=\Roman*)]
    \item First Roman
    \item Second Roman
  \end{enumerate}
  Before continuing:
  \begin{blist}[resume]
    \item Third item
    \item Fourth item
  \end{blist}

\end{document}

许多清单

相关内容