如何使用 Beamer 将文本在表格单元格中垂直居中?

问题描述 投票:0回答:1

使用 Beamer 类在表格单元格中文本底部对齐。 我已经尝试过以前问题的答案中的解决方案,但没有一个对我有用。 它们包括使用

multicolumn
multirow
parbox
minipage
、嵌套表格环境等。

这是一个最小的工作示例:

\documentclass{beamer}

\usepackage{diagbox}
\usepackage{array}

\begin{document}
   
  \begin{frame}
     \begin{center}
       \vspace{\baselineskip}
       \begin{table}
       \begin{tabular}{|m{3cm}|c|c|}
          \hline
          \diagbox[width=3cm]{Text}{Text} & Text & Text\\
          \hline
          \begin{tabular}{l} Text \end{tabular} & \includegraphics[width=3cm]{example-image-a}  & \includegraphics[width=3cm]{example-image-a} \\
          \hline
          \begin{tabular}{l} Text \end{tabular} & \includegraphics[width=3cm]{example-image-a}  & \includegraphics[width=3cm]{example-image-a} \\
          \hline
       \end{tabular}
       \end{table}
     \end{center}
  \end{frame}

\end{document}

这是背页上的代码:

https://www.overleaf.com/read/xyhxppcggcxw#b44e1e

这是您可以编辑的副本:

https://www.overleaf.com/2546442868dkwtxcdnvryn#708448

tabular text-alignment beamer
1个回答
0
投票

您可以使用调整框中的

valign=...
选项来更改图像的垂直对齐方式:

\documentclass{beamer}

\usepackage{diagbox}
\usepackage{array}
\usepackage[export]{adjustbox}

\begin{document}
   
  \begin{frame}
     \begin{center}
       \vspace{\baselineskip}
       \begin{table}
       \begin{tabular}{|m{3cm}|c|c|}
          \hline
          \diagbox[width=3cm]{Text}{Text} & Text & Text\\
          \hline
          \begin{tabular}{l} Text \end{tabular} & \includegraphics[width=3cm,valign=c]{example-image-a}  & \includegraphics[width=3cm,valign=c]{example-image-a} \\
          \hline
          \begin{tabular}{l} Text \end{tabular} & \includegraphics[width=3cm,valign=c]{example-image-a}  & \includegraphics[width=3cm,valign=c]{example-image-a} \\
          \hline
       \end{tabular}
       \end{table}
     \end{center}
  \end{frame}

\end{document}

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.