你好,我需要一些帮助来运行这个表。
这是我的代码
\begin{center}
\begin{tabular}{lcc}
\hline \noalign{\smallskip} & mpg & mpg & mpg\\
\noalign{\smallskip}\hline \noalign{\smallskip}weight & -.0060087 & -294.196 & 4\\
& \begin{footnotesize}(4.50)**\end{footnotesize} & \begin{footnotesize}(5.28)**\end{footnotesize}\\
\noalign{\smallskip}foreign & & 1,767.292 & 5\\
& \begin{footnotesize}(4.50)**\end{footnotesize} & \begin{footnotesize}(5.28)**\end{footnotesize}\\
\noalign{\smallskip}foreign*weight & & & 1,767.292\\
& \begin{footnotesize}\end{footnotesize} & \begin{footnotesize}(2.52)*\end{footnotesize}\\
\noalign{\smallskip}\_cons & 11,253.061 & 11,905.415 & 7\\
& \begin{footnotesize}(9.61)**\end{footnotesize} & \begin{footnotesize}(10.28)**\end{footnotesize}\\
\noalign{\smallskip}$R^2$ & 0.22 & 0.28 & 7\\
$N$ & 74 & 74 & 7\\
\noalign{\smallskip}\hline\end{tabular}\\
\smallskip\begin{footnotesize}\ * $p<0$.05; ** $p<0$.01\end{footnotesize}\\
\smallskip
\end{center}
答案1
就是这个。我需要threeparttable
表格注释包,makecell
以便表格单元格中可以换行,并且行与行之间可以有更好的间距。代码更紧凑:
\documentclass{article}
\usepackage{makecell, booktabs, caption}
\captionsetup{labelfont = sc}
\renewcommand \cellalign{tc}
\setcellgapes{3pt}
\makegapedcells
\usepackage{siunitx}
\sisetup{group-digits = integer, group-separator = {,},group-four-digits}
\usepackage[para]{threeparttable}
\begin{document}
\begin{table}
\centering
\begin{threeparttable}
\caption{A Simple Table}\label{mylabel}
\begin{tabular}{lccc}
\toprule
& mpg & mpg & mpg\\
\midrule
weight & \makecell{\num[group-digits, group-separator=\,]{-.0060087}\\\footnotesize(4.50)\tnote{**}} & \makecell{\num{-294.196}\\\footnotesize(5.28)\tnote{**}} & 4\\
foreign & \makecell{\\\footnotesize(4.50)\tnote{**}} & \makecell{\num{1767.292}\\\footnotesize(5.28)\tnote{**}} & 5\\
foreign\tnote{*}\enspace weight & &\makecell{\\\footnotesize(2.52)\tnote{*}} & \num{1767.292}\\
\_cons & \makecell{\num{11253.061}\\\footnotesize(9.61)\tnote{**}} & \makecell{\num{11905.415}\\\footnotesize(10.28)\tnote{**}} & 7\\
$R^2$ & 0.22 & 0.28 & 7\\
$N$ & 74 & 74 & 7\\
\bottomrule
\end{tabular}
\smallskip\footnotesize
\begin{tablenotes}
\item[*]$p<0.05 $
\item[**]$p<0.01 $
\end{tablenotes}
\end{threeparttable}
\end{table}
\end{document}