平衡簡報兩側的空間

平衡簡報兩側的空間

我想在我的投影機簡報中格式化表格。整個演示框架的程式碼如下:

\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})到右側文字邊框。為此,有兩種解決方案:

  • 增加文字寬度
  • 減少桌子的寬度。

第一種可能性的例子:

\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}

在此輸入影像描述

第二種可能性的例子:

\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}

在此輸入影像描述

相關內容