我有一张包含多个 s 的幻灯片block
,每个 s 位于单独的 中column
。每个块应包含两个相互重叠的图像。在我的用例中,这些是tikzpicture
s,但在这里我只使用includegraphics
。
我想确保这些图像垂直居中,就像在矩阵中一样。如果您可以确保所有图像具有相同的大小,那么这种方法非常有用。但我不知道如何将不同大小的图像垂直居中在单独的块之间。
有什么想法吗?
另外,如何确保block
s 的高度相同?我尝试使用minipage
,如建议的那样这里,但这会导致我的tikzpicture
s 产生一些意想不到的影响。
图像
对于相同尺寸的图像:
对于不同尺寸的图像:
平均能量损失
\documentclass[aspectratio=169]{beamer}
\usetheme{Copenhagen}
\begin{document}
\begin{frame}[t]{Frametitle}
\begin{columns}[t]
\begin{column}{0.333\linewidth}
\begin{block}{Block1}
\centering
\includegraphics[width=\linewidth,height=0.33\textheight,keepaspectratio]{example-image-a}\\
\includegraphics[width=\linewidth,height=0.33\textheight,keepaspectratio]{example-image-b}
\end{block}
\end{column}
\begin{column}{0.333\linewidth}
\begin{block}{Block2}
\centering
\includegraphics[width=\linewidth,height=0.33\textheight,keepaspectratio]{example-image-c}\\
\includegraphics[width=\linewidth,height=0.33\textheight,keepaspectratio]{example-image-a}
\end{block}
\end{column}
\begin{column}{0.333\linewidth}
\begin{block}{Block3}
\centering
\includegraphics[width=\linewidth,height=0.33\textheight,keepaspectratio]{example-image-b}\\
\includegraphics[width=\linewidth,height=0.33\textheight,keepaspectratio]{example-image-c}
\end{block}
\end{column}
\end{columns}
\end{frame}
\end{document}
答案1
灵感来自这个帖子,我找到了解决办法。
代码
\documentclass[aspectratio=169]{beamer}
\usepackage[export]{adjustbox}
\usetheme{Copenhagen}
\begin{document}
\begin{frame}[t]{Frametitle}
\begin{columns}[t]
\begin{column}{0.333\linewidth}
\begin{block}{Block1}
\parbox[c][.33\textheight][c]{\columnwidth}{%
\centering
\includegraphics[width=\linewidth,height=0.33\textheight,keepaspectratio]{example-image-a}
}
\parbox[c][.33\textheight][c]{\columnwidth}{%
\centering
\includegraphics[width=\linewidth,height=0.33\textheight,keepaspectratio]{example-image-b}
}
\end{block}
\end{column}
\begin{column}{0.333\linewidth}
\begin{block}{Block2}
%\centering
\parbox[c][.33\textheight][c]{\columnwidth}{%
\centering%
\includegraphics[width=\linewidth,height=0.25\textheight,keepaspectratio]{example-image-c}%
}
\parbox[c][.33\textheight][c]{\columnwidth}{%
\centering%
\includegraphics[width=\linewidth,height=0.25\textheight,keepaspectratio]{example-image-a}%
}
\end{block}
\end{column}
\begin{column}{0.333\linewidth}
\begin{block}{Block3}
\parbox[c][.33\textheight][c]{\columnwidth}{%
\centering%
\includegraphics[width=\linewidth,height=0.33\textheight,keepaspectratio]{example-image-b}%
}
\parbox[c][.33\textheight][c]{\columnwidth}{%
\centering%
\includegraphics[width=\linewidth,height=0.33\textheight,keepaspectratio]{example-image-c}%
}
\end{block}
\end{column}
\end{columns}
\end{frame}
\end{document}