Beamer 中的子图对齐

Beamer 中的子图对齐

我有 4 张大小相同的图像(350x200 像素)。我想在 beamer 中将它们用作 2x2 矩阵的子图。以下是代码-

\documentclass[aspectratio=43,11pt]{beamer}
\usetheme{Madrid}
\usecolortheme{seahorse}
\usefonttheme{serif}
\usepackage{subcaption}

\begin{document}
\begin{frame}{Sub-figure Alignment}
    \begin{columns}
        \begin{column}{0.25\textwidth}
            Some content here.\\
            Some content here.\\
            Some content here. 
        \end{column}
        \begin{column}{0.65\textwidth}
            \begin{figure}
                \centering
                \begin{subfigure}{0.45\textwidth}
                    \centering
                    \includegraphics[width=\linewidth]{img}
                    \caption{Two line long caption}
                    \label{fig:sub1}
                \end{subfigure}\hskip 1em%
                \begin{subfigure}{0.45\textwidth}
                    \centering
                    \includegraphics[width=\linewidth]{img}
                    \caption{One line caption}
                    \label{fig:sub2}
                \end{subfigure}

                \begin{subfigure}{0.45\textwidth}
                    \centering
                    \includegraphics[width=\linewidth]{img}
                    \caption{One line caption}
                    \label{fig:sub1}
                \end{subfigure}\hskip 1em%
                \begin{subfigure}{0.45\textwidth}
                    \centering
                    \includegraphics[width=\linewidth]{img}
                    \caption{Two line long caption}
                    \label{fig:sub2}
                \end{subfigure}
            \end{figure}
        \end{column}
    \end{columns}
\end{frame}
\end{document}

生成的 PDF 如下所示: 在此处输入图片描述

每张图片的标题都不同。有些标题有点长。我正在寻找一种方法来将图片垂直居中对齐,而不关心标题。

答案1

您可以使用子图的选项指定对齐方式:\begin{subfigure}[t]{0.45\textwidth}

\documentclass[aspectratio=43,11pt,t]{beamer}
\usetheme{Madrid}
\usecolortheme{seahorse}
\usefonttheme{serif}
\usepackage{subcaption}

\begin{document}
\begin{frame}{Sub-figure Alignment}
    \begin{columns}[T, onlytextwidth]
        \begin{column}{0.25\textwidth}
            Some content here.\\
            Some content here.\\
            Some content here. 
        \end{column}
        \begin{column}{0.65\textwidth}
                \vskip-\baselineskip
            \begin{figure}
                \centering
                \begin{subfigure}[t]{0.45\textwidth}
                    \centering
                    \includegraphics[width=\linewidth]{example-image}
                    \caption{Two line long caption}
                    \label{fig:sub1}
                \end{subfigure}\hskip 1em%
                \begin{subfigure}[t]{0.45\textwidth}
                    \centering
                    \includegraphics[width=\linewidth]{example-image}
                    \caption{One line caption}
                    \label{fig:sub2}
                \end{subfigure}

                \begin{subfigure}[t]{0.45\textwidth}
                    \centering
                    \includegraphics[width=\linewidth]{example-image}
                    \caption{One line caption}
                    \label{fig:sub1}
                \end{subfigure}\hskip 1em%
                \begin{subfigure}[t]{0.45\textwidth}
                    \centering
                    \includegraphics[width=\linewidth]{example-image}
                    \caption{Two line long caption}
                    \label{fig:sub2}
                \end{subfigure}
            \end{figure}
        \end{column}
    \end{columns}
\end{frame}
\end{document}

在此处输入图片描述

相关内容