在 \tcolorbox 环境中恢复编号

在 \tcolorbox 环境中恢复编号

我已经使用过这个网站很多次了,但这次,我的问题没有得到解答。我正在为我的海洋学课程创建实验手册。我正在使用 \tcolorbox 包来突出显示我的多项选择题。从一个框到另一个框,我希望计数器恢复(例如,Q1、Q2、Q3...)。我试过 \enumitem 包,但没有用。

\documentclass{article}

\usepackage{tcolorbox} 
\usepackage[american]{babel}
\usepackage{enumitem}
\newcounter{saveenumi}

\begin{document}
\begin{tcolorbox}[fonttitle=\sffamily\bfseries\large,colback=white,colframe=blue!50!white,title=Checking In]
    \begin{enumerate}
    \item By absorbing carbon dioxide, the world ocean \underline{\hspace{2cm}} the rate at which global warming would otherwise be occurring. 

        \begin{tabular}{p{15cm}}
        (a) slows \tabularnewline
        (b) increases \tabularnewline
        (c) does not impact \tabularnewline
        \end{tabular}
\end{enumerate}
\end{tcolorbox}

But this absorption is changing the chemical state of the ocean in other ways likely to produce dire consequences, including the acidification (lowering the pH) of seawater that is already impacting marine ecosystems.

\medskip
\begin{tcolorbox}[fonttitle=\sffamily\bfseries\large,colback=white,colframe=blue!50!white,title=Checking In]
\begin{enumerate}[resume]
    \item Which reservoir stores the most carbon? 

        \begin{tabular}{p{15cm}}
        (a) surface ocean \tabularnewline
        (b) deep ocean \tabularnewline
        (c) reactive sediments \tabularnewline
        \end{tabular}
\end{enumerate}
\end{tcolorbox}
\end{document}

我需要的是第二个框以“2. 哪些水库储存了最多的碳?”开头,而不是当前 PDF 上显示的“1. 哪些水库储存了更多的碳?”

非常感谢你的帮助。

答案1

裸枚举resume仅在相同的局部范围内起作用。要全局起作用,您需要声明一系列枚举:

\documentclass{article}

\usepackage{tcolorbox} 
\usepackage[american]{babel}
\usepackage{enumitem}
\newcounter{saveenumi}

\begin{document}
\begin{tcolorbox}[fonttitle=\sffamily\bfseries\large,colback=white,colframe=blue!50!white,title=Checking In]
    \begin{enumerate}[series=stuff]
    \item By absorbing carbon dioxide, the world ocean \underline{\hspace{2cm}} the rate at which global warming would otherwise be occurring. 

        \begin{tabular}{p{15cm}}
        (a) slows \tabularnewline
        (b) increases \tabularnewline
        (c) does not impact \tabularnewline
        \end{tabular}
\end{enumerate}
\end{tcolorbox}

But this absorption is changing the chemical state of the ocean in other ways likely to produce dire consequences, including the acidification (lowering the pH) of seawater that is already impacting marine ecosystems.

\medskip
\begin{tcolorbox}[fonttitle=\sffamily\bfseries\large,colback=white,colframe=blue!50!white,title=Checking In]
\begin{enumerate}[resume=stuff]
    \item Which reservoir stores the most carbon? 

        \begin{tabular}{p{15cm}}
        (a) surface ocean \tabularnewline
        (b) deep ocean \tabularnewline
        (c) reactive sediments \tabularnewline
        \end{tabular}
\end{enumerate}
\end{tcolorbox}

\end{document}

相关内容