[texhax] Beamer Vertical Alignment in Columns

Steve Schwartz s.schwartz at imperial.ac.uk
Tue Oct 18 17:13:50 CEST 2005


I've struggled to do something cleanly in Beamer; perhaps someone has
cracked it.

I use two columns. One has itemized text revealed one line at a time.
The other has a set of graphics which replace each other with each new
line. Because the graphics are different sizes, the simple approach
leads to vertical jitter, e.g.

\begin{columns}
  \begin{column}{0.5\textwidth}
     \begin{itemize}
       \item<1-> first point
       \item<2-> 2nd point
     \end{itemize}
  \end{column}
  \begin{column}{0.5\textwidth}
    \only<1>{\includegraphics{fig1}}
    \only<2>{\includegraphics{fig2}}
  \end{column}
\end{columns}

Actually, you get jitter even if the material in the left column doesn't
change from one slide to the next.

Having RTFM'd, I tried to use overprint (which doesn't seem to reuse the
vertical space occupied by fig1, so fig2 gets shifted down/off the
page). Anyway, overlayarea works as advertised, so the 2nd column
becomes

  \begin{column}{0.5\textwidth}
    \begin{overlayarea}{\textwidth}{0.85\textheight}
      \only<1>{\includegraphics{fig1}}
      \only<2>{\includegraphics{fig2}}
    \end{overlayarea}
  \end{column}

The problem is that the figures are placed at the TOP of the box defined
by the overlayarea specification. I'd like them vertically in the centre
(to match the itemized points, which now don't jitter up and down and
are vertically centred thanks to the way beamer handles columns). I've
tried inserting \vfill's (and \\) before and after the \includegraphics,
but this doesn't change the behaviour. I've worked around it by manually
inserting \vspace{..} before the \includegraphic, which requires some
hand-tuning. I've also tried dispensing with columns and using the array
package; that centres things with m{width} specifiers, but there's still
some jitter in the slide transition.

Any ideas? One might be to give the overlayarea zero/negligibly small
vertical height and persuade \includegraphics to set the graphic on it's
centre line rather than bottom; I guess it would be possible to write a
macro to do the necessary calculations.

Thanks
Steve

-- 
+-------------------------------------------------------------------+
Professor Steven J Schwartz      Phone: +44-(0)20-7594-7660
Space and Atmospheric Physics    Fax:   +44-(0)20-7594-7772
The Blackett Laboratory          E-mail: s.schwartz at imperial.ac.uk
Imperial College London          Office: Huxley 6M70 
London SW7 2BW, U.K.             Web: http://www.sp.ph.ic.ac.uk/~sjs
+-------------------------------------------------------------------+




More information about the texhax mailing list