58

According to section 3.10 of the beamer manual, the t option top-aligns either every frame (when used as a class option) or a single frame (when used as optional argument of a frame environment). According to section 12.7, t can also be used to top-align the columns of a columns environment (a multi-column area within a frame). However, I didn't succeed to combine the two tasks, i.e. to top-align columns within a top-aligned frame. Did I miss something? How can the correct alignment be achieved?

Note: For columns, there's also a T option that (quoting section 12.7) should be tried "[i]f strange things seem to happen in conjunction with the t option". Adding T to the second column comes close to the desired result, but doesn't achieve it (the second column is positioned somewhat higher than the first column).

\documentclass{beamer}

\begin{document}

\begin{frame}[t]{Frame title}
  \begin{columns}[t]
    \begin{column}{0.5\textwidth}
      \begin{itemize}
      \item First column, first item
      \item First column, second item
      \end{itemize}
    \end{column}
    \begin{column}{0.5\textwidth}% Alternative A doesn't work
%     \begin{column}[T]{0.5\textwidth}% Alternative B comes close
      \begin{itemize}
      \item Second column, first item
      \end{itemize}
    \end{column}
  \end{columns}
\end{frame}

\end{document}

EDIT: Thanks to Stefan for posting a workaround solution. I'm still interested in why such a workaround is necessary resp. why top-aligned columns work within centered frames by default. Is this a bug in beamer?

3 Answers 3

27

You could set \topsep and \partopsep to zero. Here's a definition of an itemize version with this in mind, achieving vertical top alignment. It's similar to a solution I remember which Uwe Lück posted some time ago to a mailing list.

\documentclass{beamer}
\makeatletter
\newenvironment{myitemize}{%
   \setlength{\topsep}{0pt}
   \setlength{\partopsep}{0pt}
   \renewcommand*{\@listi}{\leftmargin\leftmargini \parsep\z@ \topsep\z@ \itemsep\z@}
   \let\@listI\@listi
   \itemize
}{\enditemize}
\makeatother   
\begin{document}    
\begin{frame}[t]{Frame title}
  \begin{columns}[t]
    \begin{column}{0.5\textwidth}
      \begin{myitemize}
      \item First column, first item
      \item First column, second item
      \end{myitemize}
    \end{column}
    \begin{column}{0.5\textwidth}
      \begin{myitemize}
      \item Second column, first item
      \end{myitemize}
    \end{column}
  \end{columns}
\end{frame}
\end{document}

enter image description here

1
  • Note that this also works when you have some figure (via includegraphics) in the second column: using myitemize lets the option T work as one would expect (see here)
    – Alf
    Nov 9, 2017 at 9:31
29

Update

This known bug was solved some time ago. There is no need for workaround solutions or including special lines of code in preambles.

\documentclass{beamer}
\begin{document}
\begin{frame}[t]{Test Columns}
\begin{columns}
\column{.5\linewidth}
First Column
\begin{itemize}
\item First Item First Item First Item First Item
\item Second Item Second Item Second Item Second Item
\end{itemize}
\column{.5\linewidth}
Second Column
\begin{itemize}
\item First Item First Item First Item First Item
\item Second Item Second Item Second Item Second Item
\end{itemize}
\end{columns}
\end{frame}
\begin{frame}{Test Columns}
\begin{columns}
\column{.5\linewidth}
First Column
\begin{itemize}
\item First Item First Item First Item First Item
\item Second Item Second Item Second Item Second Item
\end{itemize}
\column{.5\linewidth}
Second Column
\begin{itemize}
\item First Item First Item First Item First Item
\item Second Item Second Item Second Item Second Item
\end{itemize}
\end{columns}
\end{frame}
\end{document}

works as expected

enter image description here

Original answer

This problem was reported (issue #78) at Github beamer development repository. The suggested solution was:

I know how to fix it, and it's quite easy, but I'm not sure if it will break something else. If you need the fix badly, replace lines 256--260 in beamerbaseframe.sty which read:

\def\beamer@initfirstlineunskip{%
  \def\beamer@firstlineitemizeunskip{%
    \vskip-\partopsep\vskip-\topsep\vskip-\parskip%
    \global\let\beamer@firstlineitemizeunskip=\relax}%
  \everypar{\global\let\beamer@firstlineitemizeunskip=\relax}}

with

\def\beamer@initfirstlineunskip{}%

Its state is still 'on hold'.

Instead of modifying beamer files, we can include some lines in our preamble.

\documentclass{beamer}
\makeatletter
\define@key{beamerframe}{t}[true]{% top
  \beamer@frametopskip=.2cm plus .5\paperheight\relax%
  \beamer@framebottomskip=0pt plus 1fill\relax%
  \beamer@frametopskipautobreak=\beamer@frametopskip\relax%
  \beamer@framebottomskipautobreak=\beamer@framebottomskip\relax%
  \def\beamer@initfirstlineunskip{}%
}
\makeatother   
\begin{document}    
\begin{frame}[t]{Frame title}
  \begin{columns}[t]
    \begin{column}{0.5\textwidth}
      \begin{itemize}
      \item First column, first item
      \item First column, second item
      \end{itemize}
    \end{column}
    \begin{column}{0.5\textwidth}
      \begin{itemize}
      \item Second column, first item
      \end{itemize}
    \end{column}
  \end{columns}
\end{frame}
\end{document}
2
12

It may be worth trying minipage, instead of creating the custom modifications in the preamble, especially if it is going to be something that is not used a lot of times:

\documentclass{beamer}

\begin{document}

\begin{frame}[t]{Frame title}
    \begin{minipage}[t]{0.45\textwidth}
        \vspace{0pt}
        \begin{itemize}
            \item First column, first item
            \item First column, second item
        \end{itemize}
    \end{minipage}%
    \hfill
    \begin{minipage}[t]{0.45\textwidth}
        \vspace{0pt}
        \begin{itemize}
            \item Second column, first item
        \end{itemize}
    \end{minipage}
\end{frame}

\end{document}

where the \vspace{0pt} is there just to give LaTeX a common reference to align the contents in both minipage.

1
  • 1
    for top-aligned columns which start in the middle of a page (rather than as a first element after slide header), this is the correct solution! Mar 11, 2020 at 13:08

You must log in to answer this question.

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