1

I'm trying to use Beamer (also Beamerposter) with multicols. But unfortunately, when I insert a block, the block spans the full width of the page rather than just the column that it's in. Compare this to the columns environment, where the block only spans the column that it's defined within. However, I like multicols because I like how it automatically wraps text to the next column, whereas with columns I have to explicitly specify what goes in the first column and what in the second. Is there a way around this -- can I use Beamer blocks within the multicols environment?

Below is an example of what happens, with the code provided at the bottom.

enter image description here

\documentclass{beamer}
\usetheme{Boadilla}

\usepackage{multicol}
\newcommand{\sometext}{
  Here is a bunch of text repeated over and over and over again.
  Here is a bunch of text repeated over and over and over again.
}

\begin{document}
    
    \begin{frame}{With columns}
        \begin{columns}
            \begin{column}{.45\linewidth}
                \textbf{Here the example block only spans one column.}
                \begin{example}
                    \sometext
                \end{example}
            \end{column}
            \begin{column}{.45\linewidth}
                \sometext
            \end{column}
        \end{columns}
    \end{frame}

    \begin{frame}{With multicols}
        \begin{multicols}{2}
            \textbf{Here, the example block spans both columns.}
            \begin{example}
                \sometext
            \end{example}
            \sometext
        \end{multicols}
    \end{frame}
    
\end{document}

Any help is appreciated, thanks!

1 Answer 1

1

I wouldn't use multicols with beamer. They lack many of the nice features of beamer columns to customise alignments and overlays.

If you really must use them, you can work around the problem with a minipage:

\documentclass{beamer}
\usetheme{Boadilla}

\usepackage{multicol}
\usepackage{lipsum}

\begin{document}
    
    \begin{frame}
    \frametitle{With multicols}
        \begin{multicols}{2}
            \textbf{Here, the example block spans both columns.}
            \begin{minipage}{\columnwidth}
            \begin{example}
               \lipsum[2][1-3]
            \end{example}
            \smallskip
            \end{minipage}
            \lipsum[2]
        \end{multicols}
    \end{frame}
    
\end{document}

enter image description here

Alternatively you could load the tcolorbox inner beamer theme, which replaces normal beamer blocks with tcolorboxes:

\documentclass{beamer}
\usetheme{Boadilla}

\usepackage{multicol}
\usepackage{lipsum}
\useinnertheme{tcolorbox}

\begin{document}
    
    \begin{frame}
    \frametitle{With multicols}
        \begin{multicols}{2}
            \textbf{Here, the example block spans both columns.}
            \begin{example}
               \lipsum[2][1-3]
            \end{example}
            \lipsum[2]
        \end{multicols}
    \end{frame}
    
\end{document}

enter image description here

2
  • Thanks so much for your answer! The tcolorbox example does not work for me (I am using Overleaf). Overleaf is happy with \usepackage{tcolorbox}, but it throws an error when calling \useinnertheme{tcolorbox}. Do you know a way around this?
    – Joe
    Commented Dec 2, 2022 at 22:16
  • @Joe Overleaf uses an old version of texlive which does not yet have the tcolorbox inner theme. You can manually upload the .sty file from raw.githubusercontent.com/samcarter/beamertheme-tcolorbox/main/… Commented Dec 2, 2022 at 22:21

You must log in to answer this question.

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