# Suppress text formatting in Beamer handout mode

During a presentation, I want to highlight certain texts by changing their color and underlining them. However, I don't want such effects on the handouts.

In the following MWE, I define a macro \bluebr to underline texts and to change their color to blue. To suppress such effects in handout mode, I added the handout:0 option to the command. But this is inefficient, as I use this command a lot throughout the document.

\documentclass[handout]{beamer}

\usepackage[normalem]{ulem} % underlines
\setlength{\ULdepth}{1pt}

\newcommand<>\bluebr[1]{\alt#2{\textcolor{blue}{\uline{#1}}}{#1}}

\begin{document}

\begin{frame}
Text \bluebr<2| handout:0>{highlighted in frame 2}
\end{frame}

\end{document}


I wonder if there is a way to defining \bluebr so that it takes a pre-set overlay specification option handout:0.

You can define your macro twice: One for the beamer mode, that make what you want, and another in handout mode to do nothing:

\documentclass[beamer]{beamer} % with underlines
%\documentclass[handout]{beamer} % without underlines
\usepackage[normalem]{ulem} % underlines
\setlength{\ULdepth}{1pt}

\mode<beamer>{
\newcommand<>\bluebr[1]
{\alt#2{\textcolor{blue}{\uline{#1}}}{#1}}
}

\mode<handout>{
\newcommand<>\bluebr[1]{#1}
}

\begin{document}
\begin{frame}
\visible<1-2>{Text}
\bluebr<2>{highlighted} in frame 2
\end{frame}

\end{document}