
Beamer プレゼンテーションで表をフォーマットしたいです。プレゼンテーションのフレーム全体のコードは次のとおりです。
\begin{frame}
\frametitle{Results}
\hspace{-29mm}
\vspace{-29mm}
\begin{center}
\begin{table}[h]
\caption{Error during the evalution}
\label{tab:3} \centering
\begin{tabular}{| c | c | c | c | c |c | c | c | c |}
\hline
\textbf{Subject} & \textbf{k=3} & \textbf{k=5} & \textbf{k=7} &
\textbf{k=9} & \textbf{k=11} & \textbf{k=13} & \textbf{k=15} \\ \hline
\textbf{Gramnar}& 4.708 & 3.454 & 2.489 & 2.223 & 2.380 & 2.615 & 2.622 \\ \hline
\end{tabular}
\end{table}
\end{center}
\end{frame}
私がしたいのは、プレゼンテーションの左端とテーブルの間のスペースを制御することです。テーブルはプレゼンテーション全体の左端に非常に近いようですが、右側には大きなスペースがあります。両側の空白のバランスをとるにはどうすればよいですか?
答え1
実際にはこのために作られたわけではありませんが、コラムが役に立つかもしれません:
\documentclass{beamer}
\begin{document}
\begin{frame}
\frametitle{Results}
\begin{columns}
\begin{column}{\paperwidth}
\begin{table}
\centering
\caption{Error during the evalution}
\label{tab:3} \centering
\begin{tabular}{| *{9}{c |} }
\hline
\textbf{Subject} & \textbf{k=3} & \textbf{k=5} & \textbf{k=7} &
\textbf{k=9} & \textbf{k=11} & \textbf{k=13} & \textbf{k=15} \\ \hline
\textbf{Gramnar}& 4.708 & 3.454 & 2.489 & 2.223 & 2.380 & 2.615 & 2.622 \\ \hline
\end{tabular}
\end{table}
\end{column}
\end{columns}
\end{frame}
\end{document}
答え2
\hspace{-29mm}
、、、または の指定子は\vspace{-29mm}
必要ありません。また、テーブルはテキスト幅よりも少し広いので、 を追加することで読みやすさを犠牲にすることなくこれを修正できます。\begin{center}
[h]
table
\small
\begin{frame}
\frametitle{Results}
\begin{table}
\small\centering
\caption{Error during the evalution}
\label{tab:3}
\begin{tabular}{|*9{c|}}
\hline
\textbf{Subject} & \textbf{k=3} & \textbf{k=5} & \textbf{k=7} &
\textbf{k=9} & \textbf{k=11} & \textbf{k=13} & \textbf{k=15} \\ \hline
\textbf{Grammar}& 4.708 & 3.454 & 2.489 & 2.223 & 2.380 & 2.615 & 2.622 \\ \hline
\end{tabular}
\end{table}
\end{frame}
答え3
テーブルが少し広すぎて、フレームのテキスト幅に収まりません。その結果、(余分な部分 \hspace{-29mm}
と を削除した場合\vspace{-29mm}
) 右側のテキスト境界に溢れてしまいます。これに対して、2 つの解決策があります。
- テキストの幅を広げる
- テーブルの幅を狭くします。
最初の可能性の例:
\documentclass{beamer}
\usepackage{changepage}
\begin{document}
\begin{frame}
\frametitle{Results}
\begin{table}
\begin{adjustwidth}{-2em}{-2em}% for local increasing text width
\centering
\caption{Error during the evalution}
\label{tab:3} \centering
\begin{tabular}{| *{9}{c |} }
\hline
\textbf{Subject} & \textbf{k=3} & \textbf{k=5} & \textbf{k=7} &
\textbf{k=9} & \textbf{k=11} & \textbf{k=13} & \textbf{k=15} \\ \hline
\textbf{Gramnar}& 4.708 & 3.454 & 2.489 & 2.223 & 2.380 & 2.615 & 2.622 \\ \hline
\end{tabular}
\end{adjustwidth}
\end{table}
\end{frame}
\end{document}
2 番目の可能性の例:
\documentclass{beamer}
\begin{document}
\begin{frame}
\frametitle{Results}
\begin{table}
\centering
\setlength\tabcolsep{4pt}
\caption{Error during the evalution}
\label{tab:3} \centering
\begin{tabular}{| *{9}{c |} }
\hline
\textbf{Subject} & \textbf{k=3} & \textbf{k=5} & \textbf{k=7} &
\textbf{k=9} & \textbf{k=11} & \textbf{k=13} & \textbf{k=15} \\ \hline
\textbf{Gramnar}& 4.708 & 3.454 & 2.489 & 2.223 & 2.380 & 2.615 & 2.622 \\ \hline
\end{tabular}
\end{table}
\end{frame}
\end{document}