如何继续枚举?

如何继续枚举?

可能重复:
恢复列表

扩展枚举的最佳方法是什么,使得下一个枚举环境不是从一开始,而是从前一个枚举的最后一项后面的数字开始?(让我们忽略嵌套enumerate环境的问题。)

\documentclass{article}

\begin{document}
    \begin{enumerate}
    \item One
    \item Two    
    \end{enumerate}

    Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod. 

    \begin{enumerate}
    \item Three
    \item Four     
    \end{enumerate}
\end{document}

此内容重复

恢复列表

答案1

该解决方案不使用任何包:

\documentclass{article}
\begin{document}
  It is possible to save the contents of \texttt{enumi} at the end of an enumeration:
  \begin{enumerate}
    \item This is an item.
    \item This is another item. We will now stop the enumeration.
    \newcounter{enumTemp}
    \setcounter{enumTemp}{\theenumi}
  \end{enumerate}
  \texttt{enumTemp} is now \theenumTemp. We can continue the enumeration like so:
  \begin{enumerate}
    \setcounter{enumi}{\theenumTemp}
    \item The list goes on
    \item and on.
  \end{enumerate}
  You can also put everything into your own macros for convenience. Note that this is a bit hackish, but it works.
\end{document}

答案2

尝试取消注释第二部分。

\documentclass{article}
\usepackage{enumitem}
\begin{document}
  \section{Hahaha}
    \begin{enumerate}
      \item First 
      \item Second 
    \end{enumerate}
  %\section{Hihihi}
    \begin{enumerate}[resume] % to resume
      \item Third 
      \item Fourth 
    \end{enumerate}
\end{document}

相关内容