表格中的 toprule 和 caption 之间没有空格

表格中的 toprule 和 caption 之间没有空格

我希望顶部规则和标题之间没有空格。

该表的代码如下所示:

\documentclass[usenames,dvipsnames]{beamer}
\usepackage{xcolor}
\usepackage{tikz}
\usepackage{sgame}
\usetheme{Pittsburgh}
\usepackage{sgame, tikz} % Game theory packages
\usetikzlibrary{trees, calc} % For extensive form games
\usepackage{subfig} % Manipulation and reference of small or sub figures and tables
\usepackage{hyperref} % To create hyperlinks within the document
\usepackage[utf8]{inputenc} % Input encoding and font encoding 
\usepackage{setspace} % Setting the spacing between lines
\usepackage{amsthm, amsmath, amsfonts, mathtools, amssymb} % Math packages 
\usepackage{sgame, tikz} % Game theory packages
\usetikzlibrary{trees, calc} % For extensive form games
\usepackage{subfig} % Manipulation and reference of small or sub figures and tables
\usepackage{hyperref} % To create hyperlinks within the document
\usepackage{multirow,array}
\usepackage{caption}
\setbeamertemplate{caption}[numbered]
\captionsetup[table]{position=bottom} 
\usepackage{array}
\usepackage{graphicx}
\usepackage{multirow}
\usepackage{color}   
\usepackage{relsize}
\usepackage{bibentry}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\def\table{\def\figurename{Table}\figure} % necessary to merge the list of tables with the list of figures
\let\endtable\endfigure % necessary to merge the list of tables with the list of figures
\useoutertheme{miniframes} 
\useinnertheme{circles}
\usefonttheme[stillsansserifmath]{serif}
\useoutertheme{miniframes} 
\useinnertheme{circles}
\usefonttheme[stillsansserifmath]{serif}
\usepackage{siunitx}
\usepackage{siunitx}
\usepackage{dcolumn}
\usepackage{booktabs}
\usepackage{amsmath,amssymb,amsthm}
\usepackage{thmtools}
\usepackage{cleveref}
\usepackage[T1]{fontenc} % I’m accustomed to always loading it...
\usepackage{booktabs}
\usepackage{mwe}

\date[12. Dezember 2019]{12. Dezember 2019}

\makeatletter
\setbeamertemplate{footline}{
  \leavevmode%
  \hbox{%
  \begin{beamercolorbox}[wd=.0000\paperwidth,ht=2.25ex,dp=1ex,center]{author in head/foot}%
    \usebeamerfont{author in foot}\insertshortauthor
  \end{beamercolorbox}%
  \begin{beamercolorbox}[wd=.23\paperwidth,ht=2.25ex,dp=1ex,center]{title in head/foot}%
    \usebeamerfont{title in head/foot}\insertshorttitle
  \end{beamercolorbox}%
  \begin{beamercolorbox}[wd=.78\paperwidth,ht=2.25ex,dp=1ex,right]{date in head/foot}%
    \usebeamerfont{date in head/foot}\insertshortdate{}\hspace*{2em}
    \insertframenumber{} / \inserttotalframenumber\hspace*{2ex} 
  \end{beamercolorbox}}%
  \vskip0pt%
}
\setbeamertemplate{frametitle}[default][left]
\usepackage{makecell}
\newcommand*{\SuperScriptSameStyle}[1]{%
  \ensuremath{%
    \mathchoice
      {{}^{\displaystyle #1}}%
      {{}^{\textstyle #1}}%
      {{}^{\scriptstyle #1}}%
      {{}^{\scriptscriptstyle #1}}%
  }%
}
\newcommand*{\oneS}{\SuperScriptSameStyle{*}}
\newcommand*{\twoS}{\SuperScriptSameStyle{**}}
\newcommand*{\threeS}{\SuperScriptSameStyle{*{*}*}}

 \begin{document}
 \begin{table}[h] 
\caption*{\tiny Tabelle 1: Gesch\"azte Parameter, abh\"angige Variable: $Y$ = winpercent\strut}
\scalebox{0.4}{%
\begin{tabular}{cccccc}
\toprule \\
Intercept & \color{blue} chocolate & \color{orange}fruity & caramel & \color{blue}peanutyalmondy & nougat \\ 34.534\threeS & 19.748\threeS  & $9.422$\twoS & $2.224$ &$10.071$\threeS &   $0.804$ \\ \color{blue} crispedricewafer & \color{red} hard & bar & pluribus & \color{blue} sugarpercent & pricepercent \\ $8.919$\oneS & -$6.165$\oneS & $0.442$ & -$0.854$ & $9.087$\oneS & -$5.928$ \\ 
\bottomrule 
    \multicolumn{6}{l}{%
  \begin{minipage}{11.5cm}%
   \itshape {Hinweis: Sternchen bedeuten Signifikanz zu: \oneS 10\%, \twoS 5\% und \threeS 1\%} 
  \end{minipage}%
}
\end{tabular}}
\end{table}
\end{document}

答案1

您可能希望获得以下表格格式:

在此处输入图片描述 我没理会你的 beamer 风格。对于表,我使用 、booktabstabularx包:threeparttable\siunitx

\documentclass[table, dvipsname, ngerman]{beamer}
\usepackage{babel}
\usepackage{booktabs, tabularx, threeparttable}
\usepackage{siunitx}


\begin{document}
\begin{frame}
    \begin{table}[ht]
    \centering
    \small
Gesch\"azte Parameter, abh\"angige Variable: $Y$ = winpercent\par\smallskip
    \begin{threeparttable}
\begin{tabularx}{\linewidth}{@{} *{6}{>{\centering\arraybackslash}X} @{}}
    \toprule
Intercept \textcolor{blue}{chocolate}
    & \textcolor{orange}{fruity}& caramel           & \textcolor{blue}{peanuty\-almondy}  
    & nougat                    &                           \\  \addlinespace
34.534\tnote{*} 
    & 19.748\tnote{***}         &  9.422 \note{**}  &  2.224  
    & 10.071\tnote{***}         &  0.804                    \\  \addlinespace
\textcolor{blue}{crisped\-ricewafer} 
    & \textcolor{red}{hard}     & bar               & pluribus 
    & \textcolor{blue}{sugar\-percent}    & price\-percent  \\  \addlinespace
8.919\tnote{*}
    & $-6.165$\tnote{*}         &  0.442            & $-0.854$ 
    &  9.087\tnote{*}           & $-5.928$                  \\
    \bottomrule
\end{tabularx}
\begin{tablenotes}[para,flushleft]\scriptsize
\item[]\textit{Hinweis}: Sternchen bedeuten Signifikanz zu: 
\item[*]:    \SI{10}{\%}, 
\item[**]:   \SI{6}{\%} und 
\item[***]:  \SI{1}{\%}.
  \end{tablenotes}%
\end{threeparttable}
    \end{table}
\end{frame}
\end{document}

笔记:

  • 投影仪package load some packages as are几何形状,,xcolor...,\hyperref因此这些包不需要再次加载
  • 只需加载每个包即可(请再次检查您的序言并删除所有重复项)
  • 在序言中仅加载您使用的包
  • 在表格设计中使用tabularx表格环境,这使得单元格的内容可以在更多行中写入, since you use words, which is not considered inbabel` 你需要手动插入可能的连字符点
  • 对于表格注释的使用是明智的threeparttable,并且其\tnotetablenotes
  • 格式化单元格\twxtcolor{<color>}{<colored words>}比使用\color{<color>}
  • 适用于所有演示用途的单元siunitx

相关内容