[Tex/LaTex] One image per overlay

beamergraphicsoverlays

I would that the images would appeared for each overlay. Eg, in overlay 1 I have img1.pdf, in overlay 2 I have img2.pdf, and in overlay 3 I have img3.pdf. How I do this?

\begin{center}
  \begin{tikzpicture}
    \node (img1) {\includegraphics[width=.5\linewidth]{img1.pdf}};
    \pause
    \node (img2) {\includegraphics[width=.5\linewidth]{img2.pdf}};
    \pause
    \node (img3) {\includegraphics[width=.5\linewidth]{img3.pdf}};
  \end{tikzpicture}
\end{center}

Best Answer

\node (as well as all TikZ paths) is overlay-aware so you can use

\node<overlay spec.> [options] {contents};

A complete example:

\documentclass{beamer}
\usepackage{tikz}

\begin{document}

\begin{frame}
\begin{center}
  \begin{tikzpicture}
    \node<1> (img1) {\includegraphics[width=.5\linewidth]{example-image-a}};
    \node<2> (img2) {\includegraphics[width=.5\linewidth]{example-image-b}};
    \node<3> (img3) {\includegraphics[width=.5\linewidth]{example-image-c}};
  \end{tikzpicture}
\end{center}
\end{frame}

\end{document}

An animation of the result:

enter image description here

With your numbering schema you can use a loop:

\documentclass{beamer}
\usepackage{tikz}

\begin{document}

\begin{frame}
\begin{center}
  \begin{tikzpicture}
    \foreach \Value in {1,2,3}
      \node<\Value> (img\Value) {\includegraphics[width=.5\linewidth]{img\Value}};
  \end{tikzpicture}
\end{center}
\end{frame}

\end{document}
Related Question