# How to set an optional argument of theorem in handout mode?

I want to add some remarks to the theorem via an optional argument, but only in handout mode. The command \only<handout> destroyed the subheader. Here is a 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}


The problem is the subheader [second...] in the command \only{} can not be identify correctly. The code will show me {\bf Theorem 1} [second..]. What I need is {\bf Theorem1}(second ..). How can I hide the subheader in beamer mode while show it correctly in handout mode?

Would this do what you want?

\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}


Apparently, anything other than a '[' makes LaTeX think there's no optional argument to the theorem environment...

• The problem is the subheader [second...] in the command \only<handout>{} can not be identify correctly. The code will show me {\bf Theorem 1} [second..]. What I need is {\bf Theorem1}(second ..). – MiGang Mar 20 '18 at 7:17
• I changed my answer taking into account your clarifications – remco Mar 20 '18 at 7:58