53

I recently tried to set up a quartered page layout in beamer (separate question might follow) and \vfill failed in a column environment.

Minimal example:

\documentclass{beamer}
\begin{document}
\begin{frame}
    \begin{columns}
        \begin{column}{\textwidth}
                Blublub

                \vfill

                Blablabla

                Blublub

                \vfill

                Blablabla
        \end{column}
    \end{columns}
\end{frame}
\end{document}

What is the problem here? How can I fix or circumvent it?

0

2 Answers 2

42

The column environment is using a minipage environment internally which doesn't has a predefined height like the whole frame has. The \vfill macro fills out the rest of given the vertical space. Because there is no height defined it does nothing. You have to define the height, e.g. using \vbox as shown below:

\documentclass{beamer}
\begin{document}
\begin{frame}
    \begin{columns}
        \begin{column}{\textwidth}
                \vbox to .8\textheight{%
                Blublub

                \vfill

                Blablabla
                Blublub

                \vfill

                Blablabla
                }%
        \end{column}
    \end{columns}
\end{frame}
\end{document}
6
  • 1
    I was just finishing up my explanation when I got notified about Herbert's answer. Using minipage might be better than \vbox. I just thought not posting my almost finished explanation would be a waste. Apr 7, 2011 at 16:06
  • 1
    Also your answer needs to tweak .8 \textheight, similar to Herbert's answer, which is ok for a single case, but somehow a hack.
    – Turion
    Apr 7, 2011 at 16:13
  • 1
    @Turion: Yes, I forgot to mention that the height must be set manually depending on the style. I don't know if there is a length register which gives you the total usable height. It depends on the height of the frame header which is different for every style and I don't think the styles are calculating it for you. Apr 7, 2011 at 16:20
  • 1
    @MartinScharrer: Can you explain why using minipage superior to your vbox solution?
    – Dror
    Nov 14, 2011 at 19:11
  • 1
    @Dror: I said might be, not is. Nov 14, 2011 at 19:30
17
\documentclass{beamer}
\begin{document}
\begin{frame}{foo}{bar}
    \begin{columns}[t]
        \begin{column}{\textwidth}
          \minipage[c][0.7\textheight][s]{\columnwidth}
                Blublub

                \vfill

                Blablabla

                Blublub

                \vfill

                Blablabla
         \endminipage
        \end{column}
\end{columns}
\end{frame}
\end{document}
2
  • 7
    This works very well, thank you! But how did you choose the factor 0.7 in front of \textheight in the minipage declaration? It seems I'm looking for a \beamerbodyheight or \columnheight.
    – Turion
    Apr 7, 2011 at 16:10
  • I forgot about the name of the possible height, the reason why I choosed a fraction of \textheight
    – user2478
    Apr 7, 2011 at 16:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .