我想通过可选参数为定理添加一些注释,但仅限于讲义模式。该命令\only<handout>
破坏了子标题。这是 MWE。
\documentclass[handout]{beamer}
\usepackage{amsmath}
\begin{document}
\frame{
%The theorem with a handout optional argument.
\begin{theorem}\only<handout>{[Second Fundamental Theorem of Calculus]}
\(\int_a^b f'(x)\mathrm{d}x=f(b)-f(a).\)
\end{theorem}\bigskip
%The theorem without a handout command.
\begin{theorem}[Second Fundamental Theorem of Calculus]
\(\int_a^b f'(x)\mathrm{d}x=f(b)-f(a).\)
\end{theorem}
}
\end{document}
问题是命令 \only{} 中的子标题 [second...] 无法正确识别。代码将显示 {\bf Theorem 1} [second..]。我需要的是 {\bf Theorem1}(second ..)。如何在 beamer 模式下隐藏子标题,而在讲义模式下正确显示它?
答案1
这能达到你想要的效果吗?
\documentclass[handout]{beamer}
\usepackage{amsmath}
\newenvironment{mytheorem}[1][]%
{%
\only<handout>{\begin{theorem}[#1]}
\only<beamer>{\begin{theorem}}
}%
{\end{theorem}}
\begin{document}
\begin{mytheorem}[Second fundamental theorem of calculus]
\(\int_a^b f'(x) \mathrm{d} x=f(b)-f(a)\).
\end{mytheorem}
\end{document}
显然,除了 '[' 之外的任何东西都会让 LaTeX 认为定理环境没有可选参数……