21

I'm defining a command that should behave differently in handouts vs presentation. Is there a simple way to check that?

Ideally, it should be something like this:

\newcommand{\mycom}{
\ifthenelse{[check if handout mode]}{[Behave accordingly]}{[Behave otherwise]}
}

How can I do this?

2 Answers 2

27

Without additional packages, you can use \mode to accordingly define the command:

\documentclass[handout]{beamer}

\mode<beamer|second|trans|article>{\newcommand\mycmd{No H mode}}
\mode<handout>{\newcommand\mycmd{H mode}}

\begin{document}

\begin{frame}
\mycmd
\end{frame}

\end{document}
5

Related to Detect value of option given to documentclass:

\documentclass[handout]{beamer}
\usepackage{xstring}
\makeatletter
\IfSubStr{\@classoptionslist}{handout}
  {\newcommand{\printmode}{Handout mode.}}
  {\newcommand{\printmode}{Not-handout mode.}}
\makeatother
\begin{document}

\begin{frame}
\printmode
\end{frame}

\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .