如何在 Beamer 中将简单表格左移?

如何在 Beamer 中将简单表格左移?

在此处输入图片描述

我有一张非常简单的桌子

\begin{frame}
    \begin{table}[ht!]
        \begin{tabular}{p{1.5cm}p{12cm}}
            \toprule   
            \textbf{Artist} &  Description  \\   
            
            Eminem
            & Marshall Bruce Mathers III, known professionally as Eminem, is an American rapper, songwriter, and record producer. Eminem is among the best-selling music artists of all time, with estimated worldwide sales of more than 220 million records. \\
            \bottomrule
        \end{tabular}
    \end{table}
\end{frame}

我想利用屏幕左侧的空间。

我尝试使用 hspace{-1cm}。但没有任何变化!

有人可以帮忙吗?

答案1

我会按照以下方式编写您的表格:

  • 我不会将桌子向左移动(结果会令人不快)
  • 对于表使用tabularx
  • 减少tabcolsep
\documentclass{beamer}
\usepackage{booktabs, tabularx}

\begin{document}
\begin{frame}
    \begin{table}
    \setlength\tabcolsep{3pt}
        \begin{tabularx}{\linewidth}{p{1.5cm}X}
            \toprule
            \textbf{Artist} &  Description  \\

            Eminem
            & Marshall Bruce Mathers III, known professionally as Eminem, is an American rapper, songwriter, and record producer. Eminem is among the best-selling music artists of all time, with estimated worldwide sales of more than 220 million records. \\
            \bottomrule
        \end{tabularx}
    \end{table}
\end{frame}
\end{document}

在此处输入图片描述

附录: 您是否知道表格的宽度大于 beamer 框架的默认宽度?如果您坚持将框架内容向左移动 10 毫米,则可以使用changepage包及其宏adjustwidth

\documentclass{beamer}
\usepackage{changepage}
\usepackage{booktabs}

\begin{document}
\begin{frame}
\begin{adjustwidth}{-10mm}{}
    \begin{table}
        \begin{tabular}{p{1.5cm}p{12cm}}
            \toprule
            \textbf{Artist} &  \textbf{Description}  \\
            Eminem
            & Marshall Bruce Mathers III, known professionally as Eminem, is an American rapper, songwriter, and record producer. Eminem is among the best-selling music artists of all time, with estimated worldwide sales of more than 220 million records. \\
            \bottomrule
        \end{tabular}
    \end{table}
\end{adjustwidth}
\end{frame}
\end{document}

你会得到这个结果:

在此处输入图片描述

这是你想要的吗?在这种情况下,我宁愿考虑相应地减小使用的字体大小或采取其他措施。

正如您在评论中指出的那样,这个表实际上不是您的问题。因此您的问题并不十分清楚。

相关内容