Graphics, Figures & Tables"Movement" in table of figures with beamer

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
daviddoria
Posts: 60
Joined: Tue Sep 30, 2008 9:24 pm

"Movement" in table of figures with beamer

Post by daviddoria »

I am trying to make a 2x3 table of figures where (across the top row first) one figure is displayed at a time and then continued to display until all the figures are displayed (so at the end all 6 are visible). However, the trick is that the 5th one should be replaced by a different picture in the 6th slide, so the last picture is actually the 7th slide. This pretty much works, but there is significant "movement" between slides.

Code: Select all

\documentclass{beamer}
\usetheme{Berkeley}
\usepackage{graphicx}

\begin{document}

%no errors, but jitter
\begin{frame}
\begin{tabular}{ccc}
\only<1-7>{\includegraphics[width=0.3\linewidth]{1}&}
\only<2-7>{\includegraphics[width=0.3\linewidth]{2}&}
\only<3-7>{\includegraphics[width=0.3\linewidth]{3}\\}
\only<4-7>{\includegraphics[width=0.3\linewidth]{4}&}
\only<5>{\includegraphics[width=0.3\linewidth]{5}&}
\only<6-7>{\includegraphics[width=0.3\linewidth]{6}&}
\only<7>{\includegraphics[width=0.3\linewidth]{7}}
\end{tabular}
\end{frame}

\end{document}
I tried to make a version that didn't use includegraphics so the example would compile without you all needing the actual images, but it is giving me compile errors about the alignment characters?

Code: Select all

\documentclass{beamer}
\usetheme{Berkeley}
\usepackage{graphicx}

\begin{document}

\begin{frame}
\begin{tabular}{ccc}
\only<1-7>{
\begin{figure}[!ht]
\fbox{\rule{0pt}{2in} \rule{0.3\linewidth}{0pt}}
\end{figure} &
}
\only<2-7>{
\begin{figure}[!ht]
\fbox{\rule{0pt}{2in} \rule{0.3\linewidth}{0pt}}
\end{figure} &
}
\only<3-7>{
\begin{figure}[!ht]
\fbox{\rule{0pt}{2in} \rule{0.3\linewidth}{0pt}}
\end{figure} \\
}
\only<4-7>{
\begin{figure}[!ht]
\fbox{\rule{0pt}{2in} \rule{0.3\linewidth}{0pt}}
\end{figure} &
}
\only<5>{
\begin{figure}[!ht]
\fbox{\rule{0pt}{2in} \rule{0.3\linewidth}{0pt}}
\end{figure} &
}
\only<6-7>{
\begin{figure}[!ht]
\fbox{\rule{0pt}{2in} \rule{0.3\linewidth}{0pt}}
\end{figure} &
}
\only<7>{
\begin{figure}[!ht]
\fbox{\rule{0pt}{2in} \rule{0.3\linewidth}{0pt}}
\end{figure} 
}
\end{tabular}
\end{frame}

\end{document} 
Does anyone know how to prevent this?

Thanks,

Dave

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

"Movement" in table of figures with beamer

Post by gmedina »

Hi Dave,

I think that you can achieve your goal without using the tabular environment. The following code could give you some ideas; I used rectangles of different colour to simulate the 7 figures (some manual adjustment will be necessary in order to obtain the correct horizontal spacing for the red rectangle that will replace the yellow one):

Code: Select all

\documentclass{beamer}
\usetheme{Berkeley}
\usepackage{graphicx}

\begin{document}

\begin{frame}
  \frametitle{Six (or seven?) rectangles}
  \onslide<1->{\color{red!20}\rule{3cm}{2cm}\quad}
  \onslide<2->{\color{red!30}\rule{3cm}{2cm}\quad}
  \onslide<3->{\color{red!40}\rule{3cm}{2cm}}

  \vspace*{.5cm}

  \onslide<4->{\color{red!50}\rule{3cm}{2cm}\quad}
  \onslide<5>{\color{yellow}\rule{3cm}{2cm}}
  \hspace*{-3.5pt}\onslide<6->\llap{\color{red!60}\rule{3cm}{2cm}}\hspace{11pt}
  \onslide<7->\color{red!70}\rule{3cm}{2cm}
\end{frame}

\end{document} 
1,1,2,3,5,8,13,21,34,55,89,144,233,...
Post Reply