0

This question already has an answer here:

I want to use the block environment together with the column environment in a beamer document.

The margin/spacing is getting wrong/ugly in this combination. I want that the blocks are exactly as wide as a normal text would occupy (so that the text margins are still correct).

\documentclass{beamer}

\setbeamersize{text margin left=5mm}
\setbeamersize{text margin right=5mm}

\setbeamercolor{block title}{fg=white,bg=red}
\setbeamercolor{block body}{fg=black,bg=gray}
\setbeamercolor{background canvas}{bg=yellow}

\begin{document}

% Frame 1 -----------------------
\begin{frame}
\frametitle{No Column Environment}
    \begin{block}{Block Title}
    Block Text.
    \end{block}
\end{frame}

% Frame 2 -----------------------
\begin{frame}
\frametitle{Column Environment -- Only Left Block Environment}

\begin{columns}
    \column{.50\textwidth}
        \begin{block}{Block Title}
        Block Text.
        \end{block}
    \column{.50\textwidth}
        \color{blue}\vrule width\textwidth height\textwidth
\end{columns}
\end{frame}

% Frame 3 -----------------------
\begin{frame}
\frametitle{Column Environment -- Left and Right Block Environment}

\begin{columns}
    \column{.50\textwidth}
        \begin{block}{Block Title}
        Block Text.
        \end{block}
    \column{.50\textwidth} 
        \begin{block}{Block Title}
        Block Text.
        \end{block} 
\end{columns}
\end{frame}

% Frame 4 -----------------------
\begin{frame}
\frametitle{Column Environment Only}

\begin{columns}
    \column{.50\textwidth}
        \color{blue}\vrule width\textwidth height\textwidth
    \column{.50\textwidth}
        \color{blue}\vrule width\textwidth height\textwidth
\end{columns}
\end{frame}

\end{document}

enter image description here

The reason for the yellow background is, so that it is clear where the page has its borders.

Trying the idea from samcarter in one of the comments leads to.

\begin{frame}
    \begin{columns}[onlytextwidth] 
        \begin{column}{.45\textwidth} 
        \begin{block}{Block Title} Block Text. 
        \end{block}%
        \end{column} \hfill%
        \begin{column}{.45\textwidth} 
        \begin{block}{Block Title} Block Text. 
        \end{block} 
        \end{column} 
    \end{columns}
    \begin{block}{Block Title}
    Block Text.
    \end{block}
\end{frame}

enter image description here


Bug?! I Opened an Issue on GitHub

I opened an issue on github: https://github.com/josephwright/beamer/issues/381


Similar or Duplicate or Related

marked as duplicate by user36296 beamer Mar 3 '17 at 11:59

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

2

Setting the width of the columns environment to fixed value will solve your issue. You can do so i.e. using the option [onlytextwidth]:

\documentclass{beamer}

\setbeamersize{text margin left=5mm}
\setbeamersize{text margin right=5mm}

\setbeamercolor{block title}{fg=white,bg=red}
\setbeamercolor{block body}{fg=black,bg=gray}
\setbeamercolor{background canvas}{bg=yellow}

\begin{document}

% Frame 1 -----------------------
\begin{frame}
\frametitle{No Column Environment}
    \begin{block}{Block Title}
    Block Text.
    \end{block}
\end{frame}

% Frame 2 -----------------------
\begin{frame}
\frametitle{Column Environment -- Only Left Block Environment}

\begin{columns}[onlytextwidth]
    \column{.47\textwidth}
        \begin{block}{Block Title}
        Block Text.
        \end{block}
    \column{.47\textwidth}
        Right Column Text.
\end{columns}
\end{frame}

% Frame 3 -----------------------
\begin{frame}
\frametitle{Column Environment -- Left and Right Block Environment}

\begin{columns}[onlytextwidth]
    \column{.47\textwidth}
        \begin{block}{Block Title}
        Block Text.
        \end{block}
    \column{.47\textwidth}
        \begin{block}{Block Title}
        Block Text.
        \end{block}
\end{columns}
\end{frame}

\end{document}

enter image description here

(You have to do some fine tuning of the widths of the actual columns)

  • Thanks. I was hoping that I do not have to do fine tuning. The right border is still "dancing". – Dr. Manuel Kuehner Mar 2 '17 at 20:21
  • Well, I set the column width to .47\textwidth so that there is a gap. Maybe the manual will help you figure out the correct (not ad hock dreamt up) values . . . – DG' Mar 2 '17 at 20:26
  • 1
    the boarder problem with onlyextwidth is an old problem of the rectangular blocks, does not happen with rounded blocks. I think we already had this questions somewhere... I'm going to search – user36296 Mar 2 '17 at 20:34
  • @samcarter Thanks for the info. I tried to search the problem before -- if you find the answer/question that you mention, then please let me know – Dr. Manuel Kuehner Mar 2 '17 at 20:36
  • 2
    @Dr.ManuelKuehner no need to delete anything – DG' Mar 2 '17 at 21:02

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