使用 Beamer 时表格不适合框架

使用 Beamer 时表格不适合框架

这是我的 MWE:

\documentclass[pdf]{beamer}
\begin{document}
\begin{frame}
\begin{table}[ht]
\caption{GLIFT Label Propagation Rules for AND gate}
\centering
\begin{tabular}{c | c c c c}
\hline\hline
AND & (Trusted, 0) & (Trusted, 1) & (Untrusted, 0) & (Untrusted, 1) \\
\hline
(Trusted, 0) & Trusted & Trusted & Trusted & Trusted \\
(Trusted, 1) & Trusted & Trusted & Untrusted & Untrusted \\
(Untrusted, 0) & Trusted & Untrusted & Untrusted & Untrusted \\
(Untrusted, 1) & Trusted & Untrusted & Untrusted & Untrusted \\
\hline
\end{tabular}
\label{table:AND}
\end{table}
\end{frame}
\end{document}

问题是表格不适合放在框架中。 在此处输入图片描述

答案1

缩小\resizebox

\documentclass{beamer}
\usepackage{caption}
\begin{document}
\begin{frame}

\captionof{table}{GLIFT Label Propagation Rules for AND gate}\label{table:AND}
\resizebox{\linewidth}{!}{%
\begin{tabular}{@{} c | c c c c @{}}\hline\hline
AND & (Trusted, 0) & (Trusted, 1) & (Untrusted, 0) & (Untrusted, 1) \\
\hline
(Trusted, 0) & Trusted & Trusted & Trusted & Trusted \\
(Trusted, 1) & Trusted & Trusted & Untrusted & Untrusted \\
(Untrusted, 0) & Trusted & Untrusted & Untrusted & Untrusted \\
(Untrusted, 1) & Trusted & Untrusted & Untrusted & Untrusted \\
\hline
\end{tabular}}
\end{frame}

\end{document}

在此处输入图片描述

相关内容