# Conditionally hidden slides in beamer

When creating a presentation, I sometimes create extra slides that contain additional information, a more thorough explanation, or an extra plot pertaining to certain parts of my talk. These extra slides are usually in a separate PDF and the document is usually only opened if an audience member asks a question or requests information and one of my extra slides supplements my response nicely.

I am wondering if it's possible to insert these slides into my presentation with the two following options:

1. The extra slides are skipped when progressing through the presentation unless...
2. I click on a hyperlink placed somewhere on the slide. If clicked, we traverse to the extra slide. From this slide, continuing to the 'next' slide would send us back to the slide that got us here originally.

The above can be accomplished with two (or more) PDFs (one with the presentation, one -- or more -- with the supplemental slides) via hyperref but ideally I would like to only have one document.

I am not familiar enough with ifthen to know if it can be done with that package.

Any help would be much appreciated.

See Beamer manual sections 10.7 and 11. Basically, you can use an appendix to make a set of slides after your main presentation (they don't show up in the main ToC). And you can use \hyperlink commands to jump to particular slides (or overlays of slides, even). Short example:

\documentclass{beamer}
\usetheme{Warsaw}
\title{The Title}
\author{The Author}
\date{\today}
\begin{document}
\section{One}
\begin{frame}[label=main]
\end{frame}
\appendix
\section{More}
\begin{frame}[label=supplemental]
Supplemental content.
\end{frame}
\end{document}


If you need to exclude the appendix slides from the slide counter, see this question.

• Of course. I was definitely over-complicating the problem. That was almost too easy ;)
– user6967
Feb 6, 2012 at 5:30
• If I have \hyperlink{supplemental} in multiple frames then how to go back from the "supplemental content" to the frame from which I clicked the link. One way I can think of is to use the pdf viewer's "previous view" functionality. ( alt + left arrow in adobe reader")
– dips
Oct 24, 2013 at 16:46
• Untested, and may be worth a separate question, but does \Acrobatmenu{GoBack}{\beamerreturnbutton{}} give you a button that takes you to the previous view? Oct 25, 2013 at 21:03
• they do not appear in ToC but they do appear in slide show...why Jun 9, 2021 at 16:00
• @user3582228 that was the goal, yes. A set of slides in the appendix that don't show up in the ToC, but can be clicked into from a specified location in the main presentation. Normally, you'd have a much longer presentation, probably a concluding slide of Thanks or Questions, and you'd have to go past the last slide in the main presentation to see the appendix slides otherwise. Jun 15, 2021 at 17:38

When your extra information is not too long, you could try to use layers.

If somebody asks, you switch between layers in your document. After this, you can switch back to your presentation layer and continue.

This will not help if your additional material contains many slides (you could define multiple layers, but I think it will become complicated).

And you are restricted in the usage of or pdf-viewer.

Example:

\documentclass{beamer}

\usepackage{tikz}
\usepackage{ocg-p}
\usepackage{blindtext}
\usepackage{hyperref}
\usepackage{pgfplots, pgfplotstable}

%----------------------------------------------------------------%
\begin{document}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}
\frametitle{Title}
% Insert links to toggle layer visibility
\toggleocgs[]{pic remark}{Explanation}%Toggle layer

\begin{tikzpicture}
\begin{ocg}{Graphic}{pic}{1}
\begin{axis}[
ybar stacked, bar width=10mm,
width=0.9\textwidth, height=0.7\textheight,
symbolic x coords={AA,BB,CC,DD},
xtick=data,
nodes near coords, nodes near coords align={vertical},
]
\addplot [fill=red] coordinates { ({AA},712) ({BB},267) ({CC},240) ({DD},244)};
\addplot [fill=blue] coordinates { ({AA},433) ({BB},151) ({CC},1413) ({DD},50)};
\legend{Active,Inactive}
\end{axis}
\end{ocg}
%%
\begin{ocg}{Remarks}{remark}{0}
\node [overlay,anchor=south west] at (0,0)
{\parbox[b]{0.8\textwidth}{\blindtext}};
\end{ocg}
\end{tikzpicture}
\end{frame}

\end{document}


Result is a one page document:

If you click on Explanation you get (if your pdf viewer support layers):

An alternative solution is to have a button that skips the extra material. This has the disadvantage that you have to remember to press the “don’t show the extra material” button when you get to that slide, but it has two advantages. Firstly, the extra slide is right there next to the main material rather than hidden off in an appendix, which might make it easier to organise your material. But secondly, and more importantly, it means that the “extra material” slide can just be a <2> version of the main slide.

\documentclass{beamer}

\begin{document}

\begin{frame}
\frametitle{Slide 1}
\begin{itemize}
\item Say this.