# Hiding some slides in student handouts in Beamer

I am preparing lecture slides for a class. I would like to hide some of the slides from the students. As an example, I would like to be able to compile students.pdf which has only student slides 1 and 2 (i.e., "teacher slide" is hidden); but teacher.pdf which has all three slides.

\documentclass{beamer}

\begin{document}

\begin{frame}{Student slide 1}
blah blah blah
\end{frame}

\begin{frame}{Teacher slide}
secret stuff not to be shared with students
\end{frame}

\begin{frame}{Student slide 2}
blah blah blah
\end{frame}

\end{document}


How would I do this in beamer? In a regular document, e.g., article, I would use the comment environment.

I feel that the approach in Conditionally hidden slides in beamer is overkill for my needs.

• Highly related question: Hiding some items in student's handout using beamer, Gonzalo Medina has a great answer there that you can use as well. Test this: \mode<beamer>{\begin{frame}{teacher slide} ... \end{frame}} and compile with and without the handout option – Grimler Oct 18 '15 at 11:26
• You can also say e.g. \onslide<3| handout:0>{Stuff for teacher slide.} if you want just some slides within a frame included in the handout. – cfr Oct 18 '15 at 14:48

If you use the handout mode to produce the handout for students, as suggested in the comments, you can just specify the relevant bits as an argument passed to the frame environment. No need for an explicit \mode at all.

For example:

% \documentclass{beamer}% for teacher version
\documentclass[handout]{beamer}% for student version

\begin{document}

\begin{frame}{Student slide 1}
blah blah blah
\end{frame}

\begin{frame}<1-| handout:0>{Teacher slide}
secret stuff not to be shared with students
\end{frame}

\begin{frame}{Student slide 2}
blah blah blah
\end{frame}

\end{document}


Student output:

Teacher output:

As I mentioned in comments, you can use this within a frame, too. Anywhere where you can pass an overlay specification, in fact.

Another option is package multiaudience. One can define several desired audiences

\SetNewAudience{teacher}
\SetNewAudience{students}


and filter which part of the document is desired for every audience group or groups.

\begin{shownto}{teacher}
...
\end{shownto}


Command \DefCurrentAudience{students} fixes desired audience before compilation, although it can also be fixed in compilation command

pdlatex "\def\CurrentAudience{students}\input{your-tex-file}"


A complet example:

\documentclass{beamer}

\usepackage{multiaudience}

% Declare all possible audience groups
\SetNewAudience{teacher}
\SetNewAudience{students}

\DefCurrentAudience{students}

\begin{document}

\begin{frame}{Student slide 1}
blah blah blah
\end{frame}

\begin{shownto}{teacher}
\begin{frame}{Teacher slide}
secret stuff not to be shared with students
\end{frame}
\end{shownto}

\begin{frame}{Student slide 2}
blah blah blah
\end{frame}

\end{document}


The result for students:

and teachers