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.

I've noticed that items inside and outside Beamer's columns environment are not aligned horizontally. Is there a way to fix this?

Code

\documentclass{beamer}

\begin{document}

\begin{frame}[t]{Title}
\begin{itemize}
    \item item outside columns
    \item item outside columns
\end{itemize}

\begin{columns}
    \column{.6\textwidth}
    \begin{itemize}
        \item item in first column
    \end{itemize}

    \column{.4\textwidth}
    text in second column
\end{columns}
\end{frame}

\end{document}

Output

enter image description here

share|improve this question

2 Answers 2

up vote 2 down vote accepted
\documentclass{beamer}

\begin{document}

\begin{frame}[t]{Title}
\begin{itemize}
    \item item outside columns
    \item item outside columns
\end{itemize}

\begin{columns}[totalwidth=\textwidth]
    \column{.6\textwidth}
    \begin{itemize}
        \item item in first column
    \end{itemize}

    \column{.4\textwidth}
    text in second column
\end{columns}
\end{frame}

\end{document}

Image of the resulting slide

share|improve this answer
    
Thanks! Actually, setting totalwidth=\textwidth or simply use the option onlytextwidth would solve my problem. No need for the 1.02 scale factor. –  Kevin C Oct 20 '13 at 21:54
    
Thanks, you are completely right. I modified my answer accordingly. –  samcarter Oct 21 '13 at 3:26
    
@KevinC These items are not horizontally aligned. They are vertically aligned. ;-) –  Paul Gaborit Oct 21 '13 at 6:09
    
@PaulGaborit: I never really understood the distinction between horizontal vs vertical alignments. But I thought my issue is more consistent with the tag description of horizontal alignment: "adjusting the horizontal position of several equation or table components". In my case, it's the adjustment of horizontal position of several items. –  Kevin C Oct 21 '13 at 13:42
    
@KevinC The straight line that connects your items is vertical. So your alignment is a vertical alignment. –  Paul Gaborit Oct 21 '13 at 16:04

To add to samcarter's answer, the following picture illustrates the effect of passing the option [totalwidth=\textwidth] (or equivalently [onlytextwidth]) to the columns environment.

enter image description here

As one can see from scenario 4, by default, the columns environment occupies the whole \paperwidth. Thus in scenario 3, there is extra space between two columns when their total width is only \textwidth, which is shorter than \paperwidth. With the onlytextwidth option specified, the columns environment takes the same width as \textwidth, and so the horizontal alignment of items is correct, as shown in scenario 2.

Code

\documentclass[handout]{beamer}
\usepackage{tikz}

\newcommand\colwidth[1]{\tikz{
    \draw[|-|](0,0)-- node[fill=white]{\texttt{#1}} (\textwidth,0);
}}

\newcommand\colenv[3][]{
    \begin{columns}[#1]
        \column{.6 #2}
        \begin{itemize}
            \item item in first column
        \end{itemize}
        \colwidth{.6\textbackslash{}#3}

        \column{.4 #2}
        text in second column
        \colwidth{.4\textbackslash{}#3}
    \end{columns}
}

\begin{document}

\begin{frame}

\alert{1. Outside \texttt{columns} environment}
\begin{itemize}
    \item item outside columns
\end{itemize}
\colwidth{\textbackslash{}textwidth}

\bigskip

\alert{2. \texttt{columns} environment with width options}
\colenv[onlytextwidth]{\textwidth}{textwidth} % equivalently, [totalwidth=\textwidth]

\bigskip

\alert{3. \texttt{columns} environment w/o width option, width=\texttt{\textbackslash{}textwidth}}
\colenv{\textwidth}{textwidth}

\bigskip

\alert{4. \texttt{columns} environment w/o width option, width=\texttt{\textbackslash{}paperwidth}}
\colenv{\paperwidth}{paperwidth}

\end{frame}

\end{document}
share|improve this answer

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.