我想做完全相同的事情(在 Beamer 中,删除定理中定理可选标题周围的括号),但针对的是 ams 样式定理。我确实在使用 ams 样式定理,而不是编号定理,即我使用\setbeamertemplate{theorems}[ams style]
,而不是\setbeamertemplate{theorems}[numbered]
像其他帖子。我应该怎样调整那里的代码?
对 进行简单的更改会\defbeamertemplate{theorem begin}{numbered}
导致\defbeamertemplate{theorem begin}{ams style}
错误:LaTeX 错误:命令 \beamer@@tmpop@theorem begin@ams 样式已定义。
以下是适用于 [numbered] 的代码,我想将其改编为 [ams style]:
\documentclass{beamer}
\makeatletter
\expandafter\let\csname beamer@@tmpop@theorem begin@numbered\endcsname\relax
\defbeamertemplate{theorem begin}{numbered}
{%
\begin{\inserttheoremblockenv}
{%
\inserttheoremname
\inserttheoremnumber
\ifx\inserttheoremaddition\@empty\else\ \inserttheoremaddition\fi% (\inserttheoremaddition)
}%
}
\makeatother
\setbeamertemplate{theorems}[numbered]
\newtheorem{MyHypo}{Hypothesis}
\begin{document}
\begin{frame}
\begin{MyHypo}[insert text]
This is my hypothesis
\end{MyHypo}
\end{frame}
\end{document}
答案1
\defbeamertemplate{theorem begin}{ams style}
在 ll. 771 中定义。beamerbaseauxtemplates.sty
要删除括号:
\documentclass{beamer}
\setbeamertemplate{theorems}[ams style]
\newtheorem{MyHypo}{Hypothesis}
\makeatletter
\setbeamertemplate{theorem begin}
{%
\begin{\inserttheoremblockenv}
{%
\inserttheoremheadfont
\inserttheoremname
\inserttheoremnumber
\ifx\inserttheoremaddition\@empty\else\ \inserttheoremaddition\fi%
\inserttheorempunctuation
}%
}
\makeatother
\begin{document}
\begin{frame}
\begin{MyHypo}[insert text]
This is my hypothesis
\end{MyHypo}
\end{frame}
\end{document}