将图像与表格环境对齐

将图像与表格环境对齐

我正在努力调整我的图片在表格环境中如下:

\documentclass[t]{beamer}                                                                                                                                 
\usepackage{multirow}

\begin{document}

\begin{frame}[c]{Aligning images with a tabular environment}

  \centering

  \begin{tabular}{|c | c |}
    \hline
    \includegraphics[width=2cm]{img/440px-DandelionFlower} &
    \multirow{2}{*}{\includegraphics[width=2cm]{img/440px-Blackwell_dens_leonis}}\\
    \includegraphics[width=2cm]{img/440px-TaraxacumOfficinaleSeed} & \\
    \hline
  \end{tabular}

\end{frame}

\end{document}

但正如您在输出中看到的那样,一个图像似乎偏离了表格。我怎样才能让图像适合其单元格? 输出

答案1

借助单元格中的adjustbox和选项:[t]multrow

在此处输入图片描述

\documentclass[demo]{beamer}
\usepackage{multirow}
\usepackage[export]{adjustbox}

\begin{document}

\begin{frame}[c]{Aligning images with a tabular environment}
    \centering
\begin{tabular}{|c | c |}
    \hline
    \includegraphics[width=2cm,height=2cm,
                     valign=t, margin=0pt 3pt 0pt 3pt]{img/440px-DandelionFlower}
        &   \multirow[t]{2}{*}{\includegraphics[width=2cm,height=4.2cm,
                            valign=t, margin=0pt 3pt 0pt 3pt]{img/440px-Blackwell_dens_leonis}}\\
    \includegraphics[width=2cm,height=2cm,
                     valign=t, margin=0pt 3pt 0pt 3pt]{img/440px-TaraxacumOfficinaleSeed}
        &   \\
    \hline
\end{tabular}
\end{frame}

相关内容