1.6.12

Centering images and overprint in Beamer


The overprint environment has a fixed width which defaults to the \textwidth (or maybe the similar \linewidth) and can be given using the optional argument. The whole environment is then centered, not just the image(s) inside it, which are internally left aligned. Because the environment is already as wide as the given space the centering effectively doesn't change its placement. You need to center the images inside the overprint area instead (e.g. using \centerline{\includegraphics[..]{..}}}or reduce the overprint environment to the image width manually so that it can be effectively centered.
\documentclass{beamer}
\begin{document}
\begin{frame}{Test}
  \begin{center}
  text before
  \pause
  \begin{overprint}%
    \onslide<2>\centerline{\includegraphics[scale=0.3]{images/stack1.pdf}}%
    \onslide<3>\centerline{\includegraphics[scale=0.3]{images/stack2.pdf}}%
    \onslide<4>\centerline{\includegraphics[scale=0.3]{images/stack3.pdf}}%
    \onslide<5>\centerline{\includegraphics[scale=0.3]{images/stack4.pdf}}%
    \onslide<6>\centerline{\includegraphics[scale=0.3]{images/stack5.pdf}}%
    \onslide<7>\centerline{\includegraphics[scale=0.3]{images/stack6.pdf}}%
    \onslide<8>\centerline{\includegraphics[scale=0.3]{images/stack7.pdf}}%
  \end{overprint}
  text after
  \end{center}
\end{frame}
\end{document}
or
\documentclass{beamer}
\begin{document}
\begin{frame}{Test}
    \begin{center}
  text before
  \pause

  \begin{overprint}[7cm]%
    \onslide<2>\includegraphics[width=7cm]{images/stack1.pdf}%
    \onslide<3>\includegraphics[width=7cm]{images/stack2.pdf}%
    \onslide<4>\includegraphics[width=7cm]{images/stack3.pdf}%
    \onslide<5>\includegraphics[width=7cm]{images/stack4.pdf}%
    \onslide<6>\includegraphics[width=7cm]{images/stack5.pdf}%
    \onslide<7>\includegraphics[width=7cm]{images/stack6.pdf}%
    \onslide<8>\includegraphics[width=7cm]{images/stack7.pdf}%
  \end{overprint}%

  text after
  \end{center}
\end{frame}
\end{document}
I replaced the scale key with width here to ensure that the images have the same width as the overprint environment. I prefer the first \centerline solution because you don't have to match any widths.

1 comentario:

  1. El Blog Del Latex Fino: Latex, Beamer Y Otras Cosas Útiles By The Latex Expert!: Centering Images And Overprint In Beamer >>>>> Download Now

    >>>>> Download Full

    El Blog Del Latex Fino: Latex, Beamer Y Otras Cosas Útiles By The Latex Expert!: Centering Images And Overprint In Beamer >>>>> Download LINK

    >>>>> Download Now

    El Blog Del Latex Fino: Latex, Beamer Y Otras Cosas Útiles By The Latex Expert!: Centering Images And Overprint In Beamer >>>>> Download Full

    >>>>> Download LINK lo

    ResponderEliminar