
質問: Beamer ドキュメントのフレーム内に表が完全に表示されません。教えてください
\documentclass[12pt,fleqn]{beamer}
\usepackage{booktabs}
\begin{document}
\begin{frame}
\frametitle{A large table}
\resizebox{\textwidth}{!}{%
\begin{tabular}{*{5}{c}}
\toprule
$x$ & $y$ & $x^2$ & $y^2$ & $xy$ \\
\midrule
43 & 29 & 1849 & 841 & 1247 \\
44 & 31 & 1936 & 961 & 1364 \\
46 & 19 & 2116 & 361 & 874 \\
40 & 18 & 1600 & 324 & 720 \\
44 & 19 & 1936 & 361 & 836 \\
42 & 27 & 1764 & 729 & 1134 \\
45 & 27 & 2025 & 729 & 1215 \\
42 & 29 & 1764 & 841 & 1218 \\
38 & 41 & 1444 & 1681 & 1558 \\
40 & 30 & 1600 & 900 & 1200 \\
42 & 26 & 1764 & 676 & 1092 \\
57 & 10 & 3249 & 100 & 570\\
\bottomrule
\end{tabular}%
}
\end{frame}
\end{document}
答え1
表では絶対に使用しないでください\resizebox
。フォント サイズが一定でなくなり、表が読みにくくなる場合があります。
tabular*
またはなどの、テーブル全体の幅を指定できる環境を使用しますtabularx
。また、標準のフォント サイズ ( \small
、など) や の値を変更することもできます\tabcolsep
。
この場合、`tabular* を使用した次のコードを提案します。
\documentclass[12pt,fleqn]{beamer}
\usepackage{booktabs}
\begin{document}
\begin{frame}
\frametitle{A large table}
\centering\begin{tabular*}{\framewidth}{@{\extracolsep{\fill}}*{5}{c}}
\toprule
$x$ & $y$ & $x^2$ & $y^2$ & $xy$ \\
\midrule
43 & 29 & 1849 & 841 & 1247 \\
44 & 31 & 1936 & 961 & 1364 \\
46 & 19 & 2116 & 361 & 874 \\
40 & 18 & 1600 & 324 & 720 \\
44 & 19 & 1936 & 361 & 836 \\
42 & 27 & 1764 & 729 & 1134 \\
45 & 27 & 2025 & 729 & 1215 \\
42 & 29 & 1764 & 841 & 1218 \\
38 & 41 & 1444 & 1681 & 1558 \\
40 & 30 & 1600 & 900 & 1200 \\
42 & 26 & 1764 & 676 & 1092 \\
57 & 10 & 3249 & 100 & 570\\
\bottomrule
\end{tabular*}
\end{frame}
\end{document}