Equilibre o espaço nos dois lados da apresentação

Equilibre o espaço nos dois lados da apresentação

Quero formatar uma tabela na minha apresentação do beamer. O código para todo o quadro da apresentação é o seguinte:

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

O que eu quero é controlar o espaço entre a borda esquerda da apresentação com a minha mesa. Parece que a mesa está bem próxima da borda esquerda de toda a apresentação enquanto no lado direito há um grande espaço. Como posso equilibrar o espaço em branco entre os dois lados?

Responder1

Não foi feito para isso, mas uma coluna pode ajudar:

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

insira a descrição da imagem aqui

Responder2

Não há necessidade de \hspace{-29mm}, \vspace{-29mm}, \begin{center}ou o [h]especificador para table. Além disso, a tabela é um pouco mais larga que a largura do texto, portanto, a adição \smallpode corrigir isso sem sacrificar a legibilidade.

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

insira a descrição da imagem aqui

Responder3

Sua tabela é um pouco larga demais para caber na largura do texto do quadro. Conseqüentemente, ele se espalhará (se você excluir os excedentes \hspace{-29mm}e \vspace{-29mm}) para a borda direita do texto. Para isso estão disponíveis duas soluções:

  • aumentar a largura do texto
  • reduzir a largura da mesa.

Exemplo para a primeira possibilidade:

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

insira a descrição da imagem aqui

Exemplo para a segunda possibilidade:

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

insira a descrição da imagem aqui

informação relacionada