9

NB. I have completely rewritten this question to hopefully clarify things.

Executive Summary

When creating TikZ diagrams in Beamer, one can add overlay specifications to paths and nodes, as in \node<+-> {X};. Surprisingly, these overlay specifications behave differently than do pure Beamer overlay specifications! Instead of behaving like \uncover<+->{\node {X};} (as one would expect from pure Beamer \items), it behaves like \only<+->{\node {X};}.

Why is this, and is it possible to have \node treat its specification like pure Beamer? See the end of this post for detailed questions.

Background

Action Specifications in "Pure" Beamer

In the Beamer manual, the description of the actionenv environment states:

An ⟨overlay specification⟩ without an action is promoted to uncover@⟨overlay specification⟩.

Here's an example using itemize lists that shows the promotion of +- to uncover@+---when the rendering of covered material is set to invisible (default) and transparent, respectively--and compares its behavior to that of only@+-.

\documentclass{beamer}

\begin{document}
\begin{frame}{Action Specifications with \texttt{\textbackslash item}}
  \begin{columns}
  \column{0.35\textwidth}
    Below uses spec \texttt{<+->}
    \begin{itemize}
    \item<+-> X
    \item<+-> Y
    \item<+-> Z
    \end{itemize}
    Above uses spec \texttt{<+->}

    \vspace{\baselineskip}

    \setbeamercovered{transparent}
    Below uses spec \texttt{<+->}
    with \texttt{transparent}
    \begin{itemize}
    \item<+-> X
    \item<+-> Y
    \item<+-> Z
    \end{itemize}
    Above uses spec \texttt{<+->}
    with \texttt{transparent}

  \column{0.45\textwidth}
    Below uses spec \texttt{<only@+->}
    \begin{itemize}
    \item<only@+-> X
    \item<only@+-> Y
    \item<only@+-> Z
    \end{itemize}
    Above uses spec \texttt{<only@+->}
  \end{columns}
\end{frame}
\end{document}

enter image description here

Action Specifications for TikZ \nodes

However, this same behavior is not exhibited by overlay specifications given to TikZ \paths and \nodes:

\documentclass{beamer}
\usepackage{tikz}

\begin{document}
\begin{frame}{Action Specifications with \texttt{\textbackslash node}}
  \begin{columns}
  \column{0.35\textwidth}
    Below uses spec \texttt{<+->}\\
    \begin{tikzpicture}
      \node<+-> at (0, 0)   {X};
      \node<+-> at (0,-0.5) {Y};
      \node<+-> at (0,-1)   {Z};
    \end{tikzpicture}\\
    Above uses spec \texttt{<+->}

    \vspace{\baselineskip}

    \setbeamercovered{transparent}
    Below uses spec \texttt{<+->}
    with \texttt{transparent}\\
    \begin{tikzpicture}
      \node<+-> at (0, 0)   {X};
      \node<+-> at (0,-0.5) {Y};
      \node<+-> at (0,-1)   {Z};
    \end{tikzpicture}\\
    Above uses spec \texttt{<+->}
    with \texttt{transparent}

  \column{0.55\textwidth}
    Below uses spec \texttt{<only@+->}\\
    \begin{tikzpicture}
      \node<only@+-> at (0, 0)   {X};
      \node<only@+-> at (0,-0.5) {Y};
      \node<only@+-> at (0,-1)   {Z};
    \end{tikzpicture}\\
    Above uses spec \texttt{<only@+->}

    \vspace{\baselineskip}

    Below uses spec \texttt{<uncover@+->}\\
    \begin{tikzpicture}
      \node<uncover@+-> at (0, 0)   {X};
      \node<uncover@+-> at (0,-0.5) {Y};
      \node<uncover@+-> at (0,-1)   {Z};
    \end{tikzpicture}\\
    Above uses spec \texttt{<uncover@+->}
  \end{columns}
\end{frame}
\end{document}

enter image description here

Unlike when it is used with \items, the action specification <+-> (with or without setting transparent) does not allocate space for the \nodes. In other words, the nodes are used in a \only manner, not in the \uncover manner that I expected. Moreover, adding an explicit only@ or uncover@ causes those \nodes to appear on all slides, as if they were given no action specification at all!

Questions

  • Is there a way to recover full action specifications for paths and nodes? Yes, using \uncover<+>{\node at (0,0) {X};} etc. is a reasonable workaround, but is there another way to give the action specification to \node directly?

  • If not, where is the code for action-specification-aware \nodes within the Beamer source? I'd like to try my hand at modifying the code to fix this inconsistency, but I haven't been able to locate the relevant macros.

2
  • I don't see any problem if I choose to use <+-> spec. The <+> is more or less Show only on this slide and remove it on the next one.
    – percusse
    Sep 30, 2012 at 17:27
  • @percusse I think my original question was unclear. Even with <+->, there is still a difference: \item<+-> leaves space for all \items even on slides where they are invisible, but \node<+-> doesn't. I've re-written my question to hopefully clarify. Oct 5, 2012 at 20:17

1 Answer 1

2

The notation <+> means replace the last instance, what you want is <+-> which means add step by step:

Code

\documentclass{beamer}
\usepackage{tikz}

\begin{document}

\begin{frame}{Ti\textit{k}Z}
  \setbeamercovered{transparent}
  \begin{tikzpicture}
    \node<+-> at (0,0) {X};
    \node<+-> at (1,0) {Y};
    \node<+-> at (2,0) {Z};

    \draw (current bounding box.south west)
          rectangle (current bounding box.north east);
  \end{tikzpicture}
\end{frame}

\end{document}

Result

enter image description here

1
  • Thanks for the answer. This doesn't quite do what I want, though: \item<+-> leaves space for the \item even on slides where it is invisible, but \node<+-> does not. I have re-written my question to hopefully clarify. Oct 5, 2012 at 20:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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