Beamer:使用 \newtcbtheorem 的覆盖感知环境

Beamer:使用 \newtcbtheorem 的覆盖感知环境

我最近尝试过\newtcb定理定义新环境,但是,这些环境不具备覆盖感知能力。知道为什么会发生这种情况吗?

以下是 MWE:

\documentclass{beamer}

\usepackage[theorems]{tcolorbox}

\newtcbtheorem[number within=section]{theo_beamer}{Theorem}{colframe=blue}{thm}
\newtcbtheorem[number within=section,use counter from=theo_beamer]{prop_beamer}{Proposition}{colframe=red}{prop}

\resetcounteronoverlays{tcb@cnt@theo_beamer}

\begin{document}
\begin{frame}

\begin{theo_beamer}{Title}{label1}
main result
\end{theo_beamer}

\onslide<2->{
\begin{prop_beamer}{Title}{label2}
Let's call Theorem \ref{label1}
\end{prop_beamer}
}
\end{frame}
\end{document}

答案1

您可以让您的自定义定理覆盖像这样:

\documentclass{beamer}

\usepackage[theorems]{tcolorbox}

\newtcbtheorem[number within=section]{theo_beamer}{Theorem}{colframe=blue}{thm}
\newtcbtheorem[number within=section,use counter from=theo_beamer]{prop_beamer}{Proposition}{colframe=red}{prop}

\resetcounteronoverlays{tcb@cnt@theo_beamer}

\renewenvironment<>{prop_beamer}[2]{
  \begin{actionenv}#3
    \begin{originalprop_beamer}{#1}{#2}
}{
    \end{originalprop_beamer}
  \end{actionenv}
}

\begin{document}
\begin{frame}

\begin{theo_beamer}{Title}{label1}
main result
\end{theo_beamer}

\begin{prop_beamer}<2->{Title}{label2}
Let's call Theorem \ref{thm:label1}
\end{prop_beamer}

\end{frame}
\end{document}

相关内容