\begin{frame}[fragile]{Class Data Example}
\begin{table}[htbp]
\begin{center}
\begin{tiny}
\begin{tabular}{p{8mm} p{8mm} p{10mm} p{8mm} p{8mm} p{10mm} p{10mm}} \hline
Student & Gender & Level & GPA & \raggedright Credit Hours & Transport & Hours Slept \\ \hline
1 & M & Sophomore & 3.10 & 32 & Car & 7 \\
2 & M & Junior & 3.20 & 66 & Car & 8 \\
3 & F & Senior & 3.49 & 94 & Bus & 8 \\
4 & M & Senior & 2.68 & 89 & Walk & 10 \\
5 & F & Junior & 3.73 & 69 & Bicycle & 8 \\
6 & F & Junior & 3.39 & 59 & Car & 8 \\
7 & F & Senior & 3.80 & 86 & Walk & 8 \\
8 & M & Junior & 3.11 & 75 & Car & 8 \\
9 & F & Sophomore & 3.10 & 27 & Car & 7 \\
10 & M & Senior & 3.10 & 96 & Walk & 3 \\ \hline
\end{tabular}
\end{tiny}
\end{center}
\end{table}
\end{frame}
答案1
你有“坏盒子”警告因为单元格的内容要么不能正确填充单元格,要么填充过满。
以下是无需使用较小字体的替代方法。相反,堆叠一些列标题,或许可以考虑使用众所周知的缩写。
\documentclass{beamer}
\usepackage{booktabs,makecell,siunitx}
\begin{document}
\begin{frame}{Class Data Example}
\centering
%\small
\begin{tabular}{ S[table-format = 2] c l c c l S[table-format = 2] }
\toprule
{Student} & Gender & Level & GPA & \makecell[b]{Credit \\ hours} & Transport & {\makecell[b]{Hours \\ slept}} \\
\midrule
1 & M & Soph & 3.10 & 32 & Car & 7 \\
2 & M & Jr & 3.20 & 66 & Car & 8 \\
3 & F & Sr & 3.49 & 94 & Bus & 8 \\
4 & M & Sr & 2.68 & 89 & Walk & 10 \\
5 & F & Jr & 3.73 & 69 & Bicycle & 8 \\
6 & F & Jr & 3.39 & 59 & Car & 8 \\
7 & F & Sr & 3.80 & 86 & Walk & 8 \\
8 & M & Jr & 3.11 & 75 & Car & 8 \\
9 & F & Soph & 3.10 & 27 & Car & 7 \\
10 & M & Sr & 3.10 & 96 & Walk & 3 \\
\bottomrule
\end{tabular}
\end{frame}
\end{document}