[Tex/LaTex] Behavior of top alignment of columns in beamer

beamercolumnsgraphicsvertical alignment

I have two columns in a top-aligned frame which I want to be top-aligned as well. One column is an itemize environment, the other column includes a graphic via includegraphics.

I read in the beamer manual that the T option should be used when strange things happen. This is why I preferred to have T as a default option, but that is not a good idea as it does not result in proper top-alignment.

See the following example:

\documentclass{beamer}

% dummy text macro
\newcommand{\mylipsum}{bla bla bla bla bla bla bla bla bla bla bla bla bla bla}

\begin{document}

\begin{frame}[t]{A frame with 2 \texttt{columns}: \texttt{itemize} + \texttt{figure} }
    \begin{columns}
        \begin{column}{.5\textwidth}
            \begin{itemize}
                \item first item \mylipsum
                \item second item \mylipsum
                \item third item \mylipsum
                \item fourth item \mylipsum
            \end{itemize}
        \end{column}
        \begin{column}{.5\textwidth}
            \includegraphics[width=\textwidth]{test_image.png}
        \end{column}
    \end{columns}
\end{frame}

\begin{frame}[t]{A frame with 2 \texttt{columns [T]}: \texttt{itemize} + \texttt{figure} }
    \begin{columns}[T]
        \begin{column}{.5\textwidth}
            \begin{itemize}
                \item first item \mylipsum
                \item second item \mylipsum
                \item third item \mylipsum
                \item fourth item \mylipsum
            \end{itemize}
        \end{column}
        \begin{column}{.5\textwidth}
            \includegraphics[width=\textwidth]{test_image.png}
        \end{column}
    \end{columns}
\end{frame}

\end{document}

Surprisingly, the case with the option T results in worse top-alignment, as can be seen when comparing the two figures (adding T actually shifts the columns down…).

page 1 without the <code>T</code> option
page 2 with the <code>T</code> option

Why is the option T shifting the columns down and what am I missing here?

I am not sure if it plays a role, but here are the versions of beamer and XeTeX I am using (according to the output when compiling with xelatex):

This is XeTeX, Version 3.14159265-2.6-0.99992 (TeX Live 2015/Debian)
[...] 
LaTeX2e <2016/02/01>
[...]
Document Class: beamer 2015/01/05 3.36 A class for typesetting presentations (rcs-revision 8a39122e1f63)

Edit: I do not think that this question is a duplicate of that one as suggested: First of all, none of the answers solves the problem presented here and the problem here is specifically about the weird behavior of the T option.

Best Answer

With \begin{columns}[T] the columns are only top aligned relative to their top edges. But below the top edge of an itemize environment their is still a vertical distance of either \topsep or \partopsep. So you not only need to align the columns but also remove this distance. Stefan's answer to the linked question defines an environment myitemize to do so:

\documentclass{beamer}

% dummy text macro
\newcommand{\mylipsum}{bla bla bla bla bla bla bla bla bla bla bla bla bla bla}
\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]{A frame with 2 \texttt{columns}: \texttt{itemize} + \texttt{figure} }
    \begin{columns}
        \begin{column}{.5\textwidth}
            \begin{itemize}
                \item first item \mylipsum
                \item second item \mylipsum
                \item third item \mylipsum
                \item fourth item \mylipsum
            \end{itemize}
        \end{column}
        \begin{column}{.5\textwidth}
            \includegraphics[width=\textwidth,height=.7\textheight]{example-image}
        \end{column}
    \end{columns}
\end{frame}

\begin{frame}[t]{A frame with 2 \texttt{columns [T]}: \texttt{itemize} + \texttt{figure} }
    \begin{columns}[T]
        \begin{column}{.5\textwidth}
            \begin{itemize}
                \item first item \mylipsum
                \item second item \mylipsum
                \item third item \mylipsum
                \item fourth item \mylipsum
            \end{itemize}
        \end{column}
        \begin{column}{.5\textwidth}
            \includegraphics[width=\textwidth,height=.7\textheight]{example-image}
        \end{column}
    \end{columns}
\end{frame}

\begin{frame}[t]{A frame with 2 \texttt{columns [T]}: \texttt{myitemize} + \texttt{figure} }
    \begin{columns}[T]
        \begin{column}{.5\textwidth}
            \begin{myitemize}
                \item first item \mylipsum
                \item second item \mylipsum
                \item third item \mylipsum
                \item fourth item \mylipsum
            \end{myitemize}
        \end{column}
        \begin{column}{.5\textwidth}
            \includegraphics[width=\textwidth,height=.7\textheight]{example-image}
        \end{column}
    \end{columns}
\end{frame}

\end{document}

top aligned image and list

Related Question