10

I want to use a two-column layout in my slides and place a block in each of these columns. Whenever I do this, the two boxes have a bigger distance from the top than when using a single box without columns.

See these two slides:

Bug

When not looking closely, one might not recognize the difference but when switching slides it is clearly visible that the distance between the frame-title and the start of the boxes is bigger on the two-column version.

Why is this the case? I checked multiple themes, it occured with each of them.

I want the two-column version to have the same distance from the top as the one column version. I think the spacing above the two column version is to big. By inserting \hspace{-0.5cm} in each of the columns (before the \begin{block}) I can achieve what I want but this is very hacky in my opinion.

Minimal working example (generating the two slides):

\documentclass[18pt]{beamer}
\usetheme{Frankfurt}

\begin{document}

\begin{frame}[t]{Frame with Columns}
 \begin{columns}[t]
   \begin{column}{0.4\textwidth}
      \begin{block}{Block 1}
        Text here
      \end{block}
    \end{column}
    \begin{column}{0.4\textwidth}
      \begin{block}{Block 2}
        More text here
      \end{block}
    \end{column}
  \end{columns}
\end{frame}

\begin{frame}[t]{Frame without Columns}
  \begin{block}{Block}
    Even more text here
  \end{block}
\end{frame}

\end{document}
  • I would say this can be considered as a bug. – yo' Sep 22 '12 at 6:54
11

It's a feature: a switch between vertical and horizontal mode.

Here is your MWE with a call to \leavevmode:

example with a call to <code>\leavevmode</code>

\documentclass[18pt]{beamer}
\usetheme{Frankfurt}

\begin{document}

\begin{frame}[t]{Frame with Columns}
 \begin{columns}[t]
   \column{0.4\textwidth}
   \begin{block}{Block 1}
     Text here
   \end{block}
   \column{0.4\textwidth}
   \begin{block}{Block 2}
     More text here
   \end{block}
 \end{columns}
\end{frame}

\begin{frame}[t]{Frame without Columns}
  \leavevmode\begin{block}{Block}
    Even more text here
  \end{block}
\end{frame}

\end{document}

As suggested by percusse, to keep a minimal top margin you can use \vspace with a negative distance (here, I choose -\baselineskip):

second version

\documentclass[12pt]{beamer}
\usetheme{Frankfurt}

\begin{document}

\begin{frame}[t]{Frame with Columns}

  \vspace{-\baselineskip}
  \begin{columns}[t]
    \column{0.4\textwidth}
    \begin{block}{Block 1}
      Text here
    \end{block}
    \column{0.4\textwidth}
    \begin{block}{Block 2}
      More text here
    \end{block}
  \end{columns}
\end{frame}

\begin{frame}[t]{Frame without Columns}
  \begin{block}{Block}
    Even more text here
  \end{block}
\end{frame}

\end{document}
  • Thanks for your comment, but now I have the big margins on both frames. Can I somehow get the narrow margins? I think the wide spacing is to big. – theomega Sep 21 '12 at 15:16
  • 1
    @theomega Then you can introduce a \vspace{-2.75ex} just before the columns environment to level. – percusse Sep 21 '12 at 22:38
  • @percusse how did you calculate the value -2.75ex? Is it theme dependent, because for my situation it is too large. (Also -\baselineskip is too much). – kap Feb 18 '16 at 20:30
  • Ok, in [tex.stackexchange.com/questions/119725/… I found a hint to [onlytextwidth,t] which apparently made -2.75ex to be the right value. I do not know whats going on behind the scenes, but It works now :-) – kap Feb 18 '16 at 20:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.