
Ich möchte in meiner Beamer-Präsentation eine Tabelle formatieren. Der Code für den gesamten Rahmen der Präsentation lautet wie folgt:
\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}
Ich möchte den Abstand zwischen dem linken Rand der Präsentation und meiner Tabelle steuern. Es scheint, dass die Tabelle sehr nah am linken Rand der gesamten Präsentation liegt, während auf der rechten Seite ein großer Abstand besteht. Wie kann ich den Leerraum zwischen den beiden Seiten ausgleichen?
Antwort1
Nicht wirklich dafür geeignet, aber eine Spalte könnte helfen:
\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}
Antwort2
\hspace{-29mm}
, \vspace{-29mm}
, \begin{center}
, oder der [h]
Spezifizierer für sind nicht erforderlich table
. Außerdem ist die Tabelle etwas breiter als die Textbreite, sodass das Hinzufügen \small
dieses Problem beheben kann, ohne die Lesbarkeit zu beeinträchtigen.
\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}
Antwort3
Ihre Tabelle ist etwas zu breit, um in die Textbreite des Rahmens zu passen. Folglich quillt sie (wenn Sie Überschüsse \hspace{-29mm}
und löschen \vspace{-29mm}
) bis zum rechten Textrand über. Dafür stehen zwei Lösungen zur Verfügung:
- Textbreite vergrößern
- Reduzieren Sie die Breite der Tabelle.
Beispiel für die erste Möglichkeit:
\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}
Beispiel für die zweite Möglichkeit:
\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}