[Tex/LaTex] Beamer: vertically center picture inside overlayarea

beameroverlays

Is there an easy way to vertically center a picture inside an overlayarea environment?

Here is a MWE of a small animation:

\documentclass{beamer}
\begin{document}
\begin{frame}
\begin{columns}
\column{.45\columnwidth}
    \begin{overlayarea}{\columnwidth}{.7\textheight}
    \includegraphics<1>[width=\columnwidth,height=.7\textheight,keepaspectratio]{picture1}
    \includegraphics<2>[width=\columnwidth,height=.2\textheight,keepaspectratio]{picture2}
    \end{overlayarea}
\column{.45\columnwidth}
    \begin{itemize}[<+->]
    \item Point A
    \item Point B
    \end{itemize}
\end{columns}
\end{frame}

\end{document}

Picture1 and picture2 will appear on the top of the columns, instead of being vertically centered (in fact, it is the overlayarea that is vertically centered, and all the picture inside are visibly aligned on its top)

The command \vfill does not seem to work.

Currently, I can correct the alignment of picture by inserting this kind of code:

\only<2>{\vspace{.25\textheight}}

But this requires manual adjustment…

Best Answer

One possibility is to use a \parbox instead of overlayarea:

\PassOptionsToPackage{demo}{graphicx}
\documentclass{beamer}
\begin{document}

\begin{frame}
\begin{columns}
\column{.45\columnwidth}
\parbox[c][.7\textheight][c]{\columnwidth}{%
  \includegraphics<1>[width=\columnwidth,%
    height=.7\textheight,keepaspectratio]{image1}%
  \includegraphics<2>[width=\columnwidth,%
    height=.2\textheight,keepaspectratio]{image2}%
}
\column{.45\columnwidth}
    \begin{itemize}[<+->]
    \item Point A
    \item Point B
    \end{itemize}
\end{columns}
\end{frame}

\end{document}

enter image description here

The line \PassOptionsToPackage{demo}{graphicx} simply replaces actual figures with black rectangles; do not use that option in your actual document.

Related Question