1

Why beamer column environment leaves more vertical space than minipage in the same conditions?

\documentclass{beamer}

\usepackage{lmodern}

\usepackage{mwe}

\newcommand{\SomeText}{Some text {}}


\begin{document}

\begin{frame}

\SomeText \SomeText \SomeText \SomeText \SomeText \SomeText

\setlength\fboxsep{0pt}
%\setlength\fboxrule{0pt}
\begin{figure}
    \begin{columns}[onlytextwidth]
        \fbox{%
        \begin{column}[t]{\dimexpr0.5\textwidth-0.5\columnsep-2\fboxrule\relax}
            \hfill{}\includegraphics[width=0.45\textwidth]{example-image-a}
        \end{column}}\hspace{\columnsep}%
        \fbox{%
        \begin{column}[t]{\dimexpr0.5\textwidth-0.5\columnsep-2\fboxrule\relax}
            \includegraphics[width=0.45\textwidth]{example-image-b}\hfill{}
        \end{column}}
    \end{columns}
    \caption{\SomeText}
\end{figure}

\SomeText \SomeText \SomeText \SomeText \SomeText \SomeText

\setlength\fboxsep{0pt}
%\setlength\fboxrule{0pt}
\begin{figure}
    \fbox{%
    \begin{minipage}[t]{\dimexpr0.5\textwidth-0.5\columnsep-2\fboxrule\relax}
        \hfill{}\includegraphics[width=0.45\textwidth]{example-image-a}
    \end{minipage}}\hspace{\columnsep}%
    \fbox{%
    \begin{minipage}[t]{\dimexpr0.5\textwidth-0.5\columnsep-2\fboxrule\relax}
        \includegraphics[width=0.45\textwidth]{example-image-b}\hfill{}
    \end{minipage}}
    \caption{\SomeText}
\end{figure}

\SomeText \SomeText \SomeText \SomeText \SomeText \SomeText

\end{frame}


\end{document}
8
  • I think the MWE can even be more simplified: pastebin.com/fjyZZ8yx Somehow the minipage influences the space after the caption. Commented Nov 16, 2016 at 15:14
  • @samcarter for me it seems that it is column that is giving additional padding. I placed a single picture, and the space after caption seems similar to the one with minipage.
    – cacamailg
    Commented Nov 16, 2016 at 18:52
  • Columns are not necessary for this example. They can be replaced by other environments, e.g. actionenv or an empty environment \newenvironment{test}{}{}. But with the center environment, the results are the same as for the minipage. Commented Nov 16, 2016 at 21:44
  • @samcarter internally column uses a minipage. So my guess is that the influence to the space after caption comes from columns.
    – cacamailg
    Commented Nov 16, 2016 at 22:36
  • 1
    I have no Idea. Maybe someone else knows.
    – cacamailg
    Commented Nov 17, 2016 at 15:50

1 Answer 1

1

The code below seems to do the trick. But I do not understand were the 3.5pt and 1.86pt come from.

\documentclass{beamer}
\let\Tiny\tiny

\usepackage{etoolbox}

\let\oldabovecaptionskip\abovecaptionskip
\let\oldbelowcaptionskip\belowcaptionskip

\BeforeBeginEnvironment{columns}{%
    \setlength{\abovecaptionskip}{\dimexpr\oldabovecaptionskip+3.5pt\relax}%
    \setlength{\belowcaptionskip}{\dimexpr\oldbelowcaptionskip-1.86pt\relax}%
    \begin{minipage}{\linewidth}}
\AfterEndEnvironment{columns}{\end{minipage}}

\begin{document}

\begin{frame}

\rule{\textwidth}{3pt}

\begin{figure}
    \rule{.5\textwidth}{1pt}
  \caption{Text}
\end{figure}

\rule{\textwidth}{3pt}

\begin{figure}
    \begin{columns}
        \begin{column}{.5\textwidth}
            \rule{\linewidth}{1pt}
        \end{column}
    \end{columns}
    \caption{Text}
\end{figure}

\rule{\textwidth}{3pt}

\begin{figure}
   \begin{minipage}{.5\textwidth}
        \rule{\linewidth}{1pt}
   \end{minipage}
   \caption{Text}
\end{figure}

\rule{\textwidth}{3pt}

\end{frame}


\end{document}

You must log in to answer this question.

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