为什么在相同条件下,beamer 列环境比 minipage 留下更多的垂直空间?
\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}
答案1
下面的代码似乎可以解决问题。但我不明白和3.5pt
来自1.86pt
哪里。
\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}