# Beamer: How to uncover content precisely once, in the current slide?

Although not explicit in the beamer manual, I figure that <+> overlay specification means "the current slide only". I am now in the process of composing a fairly complicated slide show with beamer and I am stuck with the exact semantics of <+>. Here is my attempt, which seems to work great for ordinary text, but messes up stuff after that:

\PassOptionsToPackage{usenames,dvipsnames}{xcolor}
\documentclass{beamer}
\usepackage{listings,tikz}
\lstset{
basicstyle=\scriptsize\ttfamily,
tabsize=2,
extendedchars=true,
breaklines=true,
keywordstyle=\color{RoyalBlue}\textbf,
stringstyle=\color{WildStrawberry}\ttfamily,
escapechar=
}

\newcommand\M[1]{\tikz[overlay,remember picture]{\node[yshift=0.7ex](#1){};}}
\newcommand\PC[1]{\tikz[overlay,remember picture]{\node[circle,inner sep=2pt,fill=red!50] at (#1) {};}}

\begin{document}
\begin{frame}[fragile]\frametitle{Program}
\begin{lstlisting}[language=pascal]
Program My;
VAR
one, two: Integer;
Begin \M{pc1}
one := 1; \M{pc2}
two := 2; \M{pc3}
one := one + two; \M{pc4}
two := two + one; \M{pc5}
end. \M{pc6}
\end{lstlisting}
\uncover<+>{One}%
\uncover<+>{Two}%
\uncover<+>{Three}%
\uncover<+>{Four}%
\begin{uncoverenv}<+->\PC{pc1}\end{uncoverenv}%
\begin{uncoverenv}<+->\PC{pc2}\end{uncoverenv}%
\begin{uncoverenv}<+->\PC{pc3}\end{uncoverenv}%
\begin{uncoverenv}<+>\PC{pc4}\end{uncoverenv}% Note that we use <+> here, not <+->
\begin{uncoverenv}<+->\PC{pc5}\end{uncoverenv}%
\begin{uncoverenv}<+->\PC{pc6}\end{uncoverenv}%
\uncover<+->{After}%
\end{frame}
\end{document}


Here is what I get (see the attached animated gif)

• Texts "one", "two", etc. are shown as expected; one per slide.
• Program counters 1-3 show as expected, from the current slide till the end.
• Program counter 4 shows and disappears (as expected?)
• Program counters 5-6 never show up.

A similar problem occurs with hard coded numbers, e.g., with the following input:

\PassOptionsToPackage{usenames,dvipsnames}{xcolor}
\documentclass{beamer}
\usepackage{listings,tikz}
\lstset{
basicstyle=\scriptsize\ttfamily,
tabsize=2,
extendedchars=true,
breaklines=true,
keywordstyle=\color{RoyalBlue}\textbf,
stringstyle=\color{WildStrawberry}\ttfamily,
escapechar=
}

\newcommand\M[1]{\tikz[overlay,remember picture]{\node[yshift=0.7ex](#1){};}}
\newcommand\PC[1]{\tikz[overlay,remember picture]{\node[inner sep=1pt,circle,radius=2pt,fill=red!50] at (#1) {};}}

\begin{document}
\begin{frame}[fragile]\frametitle{Program}
\begin{lstlisting}[language=pascal]
Program My;
VAR
one, two: Integer;
Begin \M{pc1}
one := 1; \M{pc2}
two := 2; \M{pc3}
one := one + two; \M{pc4}
two := two + one; \M{pc5}
end. \M{pc6}
\end{lstlisting}
\uncover<+>{One}%
\uncover<+>{Two}%
\uncover<+>{Three}%
\uncover<+>{Four}%
\uncover<5-6>{\PC{pc1}}
\uncover<6-6>{\PC{pc2}}
\uncover<7-7>{\PC{pc3}}
\uncover<8-8>{\PC{pc4}}
\uncover<9>{\PC{pc5}}
\uncover<10>{\PC{pc6}}
\uncover<11>{After}%
\end{frame}
\end{document}


The output looks like this:

However, and this is really strange, the problem is not there when I use the ordinary <+-> overlay specification, as explained in the beamer manual. That is, if I write

\PassOptionsToPackage{usenames,dvipsnames}{xcolor}
\documentclass{beamer}
\usepackage{listings,tikz}
\lstset{
basicstyle=\scriptsize\ttfamily,
tabsize=2,
extendedchars=true,
breaklines=true,
keywordstyle=\color{RoyalBlue}\textbf,
stringstyle=\color{WildStrawberry}\ttfamily,
escapechar=
}

\newcommand\M[1]{\tikz[overlay,remember picture]{\node[yshift=0.7ex](#1){};}}
\newcommand\PC[1]{\tikz[overlay,remember picture]{\node[inner sep=1pt,circle,radius=2pt,fill=red!50] at (#1) {};}}

\begin{document}
\begin{frame}[fragile]\frametitle{Program}
\begin{lstlisting}[language=pascal]
Program My;
VAR
one, two: Integer;
Begin \M{pc1}
one := 1; \M{pc2}
two := 2; \M{pc3}
one := one + two; \M{pc4}
two := two + one; \M{pc5}
end. \M{pc6}
\end{lstlisting}
\uncover<+>{One}%
\uncover<+>{Two}%
\uncover<+>{Three}%
\uncover<+>{Four}%
\uncover<+->{\PC{pc1}}
\uncover<+->{\PC{pc2}}
\uncover<+->{\PC{pc3}}
\uncover<+->{\PC{pc4}}
\uncover<+->{\PC{pc5}}
\uncover<+->{\PC{pc6}}
\uncover<11>{After}%
\end{frame}
\end{document}


I obtain:

• I see exactly what I'd expect (pc5 and pc6 both appear) provided I give it enough runs for TikZ to get the positions correct. – Joseph Wright Jan 19 '14 at 10:29
• Are you sure? I run pdflatex like ten times. I edited my question to add the output I get. pc5 and pc6 never appear in my output. – Yossi Gil Jan 19 '14 at 10:41
• Yes: I've just run TeX Live's update system to be sure there is not a package issue. With an up to date TL and a clean folder, two runs of the example gives the expected output. – Joseph Wright Jan 19 '14 at 10:51
• I tried with a clean directory. Nothing better. Are you using tikz 3.0? (I don't). Will have to reinstall texlive for this since the updater is not working with Ubuntu 13.10. – Yossi Gil Jan 19 '14 at 11:35
• No, just the package versions currently included in TeX Live. Note that if you are getting odd effects with the TikZ stuff this is really nothing to do with + notation, as you'd see the same with hard-coded numbers. – Joseph Wright Jan 19 '14 at 11:38

As it turns out <+>` indeed refers to a single slide, and does not have any side effects. What I witnessed is most probably a bug in one of the packages of TeX live. I installed my version sometime on November 2013. Updating it today, Jan 19th 2014, resolved the problem.