Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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...

share|improve this question
add comment

1 Answer 1

up vote 3 down vote accepted

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.

share|improve this answer
    
Interesting. So, what is the purpose of the overlayarea environment if a \parbox seems to do the same (or even a better) job? –  Lionel MANSUY Nov 21 '12 at 16:28
    
@LionelMANSUY quite frankly, I wouldn't know; in fact, overlayarea is defined using a \vbox of the given height and then a minipage of the given width using [t] for the optional argument so, in a sense, it's more general to use a minipage or a \parbox from scratch. –  Gonzalo Medina Nov 21 '12 at 17:50
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.