Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question

2 Answers 2

up vote 14 down vote accepted

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}
share|improve this answer

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}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.