6

I have a frame in beamer which looks like this:

 \begin{tabular}{ccccc}
  \includegraphics[width=.15\textwidth]{imgs/a1} & \pause
  \includegraphics[width=.15\textwidth]{imgs/a2} & \pause 
  \includegraphics[width=.15\textwidth]{imgs/a3} & \pause 
  \includegraphics[width=.15\textwidth]{imgs/a4} & \pause 
  \includegraphics[width=.15\textwidth]{imgs/a5} \\
 \end{tabular}

 \begin{tabular}{ccccc}
  \includegraphics[width=.15\textwidth]{imgs/b1} & \pause       \includegraphics[width=.15\textwidth]{imgs/b2} & \pause       \includegraphics[width=.15\textwidth]{imgs/b3} & \pause       \includegraphics[width=.15\textwidth]{imgs/b4} & \pause       \includegraphics[width=.15\textwidth]{imgs/b5} \pause \\
 \end{tabular}

What I want to do is display the images in the second table in order from right to left, that is, after the first table is displayed, I want b5 to appear first (at the rightmost position), then b4, etc.

Is there an "elegant" way to do so (i.e. not abusing \only<>)? Is tabular the proper environment for something like this?

2 Answers 2

7

you can specify the the pause numbers manually:

\documentclass{beamer}
\begin{document}
\begin{frame}
 \begin{tabular}{ccccc}
  \includegraphics[width=.15\textwidth]{lion.jpg} & \pause 
  \includegraphics[width=.15\textwidth]{lion.jpg} & \pause 
  \includegraphics[width=.15\textwidth]{lion.jpg} & \pause 
  \includegraphics[width=.15\textwidth]{lion.jpg} & \pause 
  \includegraphics[width=.15\textwidth]{lion.jpg}           \\
 \end{tabular}

\pause[10]
 \begin{tabular}{ccccc}
  \includegraphics[width=.15\textwidth]{lion.jpg} &  \pause[9]  
  \includegraphics[width=.15\textwidth]{lion.jpg} &  \pause[8] 
  \includegraphics[width=.15\textwidth]{lion.jpg} &  \pause[7]  
  \includegraphics[width=.15\textwidth]{lion.jpg} &  \pause[6] 
  \includegraphics[width=.15\textwidth]{lion.jpg}    \pause[5]\\
 \end{tabular}

% \pause[11]   % If you need to add more overlays after the images sequence you need to
% text         % specify the number of the first pause and then move on with normal
%              % pauses again, as shown in the commented code
% \pause
% text

\end{frame}
\end{document}

enter image description here

4

The tabular environment is not really necessary for this. Also, you can use a \foreach loop to automate things a bit.

Code

\documentclass{beamer}
\usepackage{pgffor}
\usepackage{mwe} % provides images used in this example

\begin{document}
\begin{frame}
Left to right
\begin{center}
  \foreach \img[count=\i] in {a,b,c} {
    \visible<\i->{\includegraphics[width=.15\textwidth]{image-\img} \hskip15pt}
  }
\end{center}

\bigskip

Right to left
\begin{center}
  \foreach \img[count=\i] in {a,b,c} {
    \pgfmathtruncatemacro{\r}{7-\i} % Here, 7 = 6 + 1 = number of last slide + 1
    \visible<\r->{\includegraphics[width=.15\textwidth]{image-\img} \hskip15pt}
  }
\end{center}
\end{frame}

\end{document}

Output

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .