我尝试了许多现有的方法来对齐下表系数,但它们在这个特定的代码设置下不起作用(代码缩小了字母的大小)。
并且我感到非常抱歉,这个代码在更大的文档下,我不确定为什么这部分不起作用。
\documentclass[msom,blindrev]{informs3} % current default for manuscript submission
\usepackage{natbib}
%\usepackage[square,sort,comma,numbers]{natbib}
\usepackage{comment}
\usepackage{setspace}% http://ctan.org/pkg/setspace
\usepackage{url}
\usepackage{siunitx}
\def\bibfont{\small}%
\def\bibsep{\smallskipamount}%
\def\bibhang{24pt}%
\def\newblock{\ }%
\def\BIBand{and}%
\begin{document}
\begin{table}
\renewcommand{\arraystretch}{1.1} % this reduces the vertical spacing between rows
\linespread{0.5}\selectfont\centering
\caption{XXX}
\centering
%\footnotesize
\tabcolsep=0.11cm
\scalebox{0.7}{
\begin{tabular}{|lrr|}
\hline
XXX&Model 3&Model 4\\
\hline
Coors, bottle, 16-pack vs. Budlight, can, 18-pack &0&-0.063\\
Budlight, bottle, 18-pack vs. Budlight, can, 18-pack &0.106**&0.114**\\
Miller Lite, can, 18pack vs. Budlight, can, 18-pack &0.094&0.256**\\
Miller Lite, bottle, 18-pack vs. Budlight, can, 18-pack &0.147***&0.070\\
Budweiser, bottle, 18-pack vs. Budlight, can, 18-pack &0&0.120**\\
Budweiser, can, 18-pack vs. Budlight, can, 18-pack &0&-0.017\\
Budlight, can, 12-pack vs. Budlight, can, 18-pack &0&0.050\\
\hline
***$p<0.005$ **$p<0.05$ &&\\
\hline
\end{tabular}
}
\label{dztable}
\end{table}
\end{document}
答案1
这是一种使用\siunitx
和的方法threeparttable
:
\documentclass{article}%
\usepackage{siunitx, threeparttable}
\begin{document}
\begin{table}
\begin{threeparttable}
\centering\footnotesize
\caption{XXX}
\label{dztable}
\centering
\setlength\extrarowheight{2pt}
\begin{tabular}{|l@{\enspace vs.\enspace}lS[table-format=1.3, table-space-text-post=\textsuperscript{***}]S[table-format=-1.3, table-space-text-post=\textsuperscript{**}]|}
\hline
\multicolumn{2}{|l}{XXX} & {Model 3}&{Model 4}\\
\hline
Coors, bottle, 16-pack & Budlight, can, 18-pack &0&-0.063\\
Budlight, bottle, 18-pack & Budlight, can, 18-pack &0.106\textsuperscript{**}&0.114\textsuperscript{**}\\
Miller Lite, can, 18pack & Budlight, can, 18-pack &0.094&0.256\textsuperscript{**}\\
Miller Lite, bottle, 18-pack & Budlight, can, 18-pack &0.147\textsuperscript{***}&0.070\\
Budweiser, bottle, 18-pack & Budlight, can, 18-pack &0&0.120\textsuperscript{**}\\
Budweiser, can, 18-pack & Budlight, can, 18-pack &0&-0.017\\
Budlight, can, 12-pack & Budlight, can, 18-pack &0&0.050\\[2pt]
\hline
\end{tabular}
\begin{tablenotes}[para]\smallskip\footnotesize
\item[**]$p<0.05$
\item[***]$p<0.005$%
\end{tablenotes}
\end{threeparttable}
\end{table}
\end{document}
答案2
无需使用\scalebox
“包装器”收缩表格材料。我建议您使用包的功能dcolumn
将第 2 列和第 3 列中的数字与小数点对齐。最后,我建议您通过 (a) 删除所有垂直线和 (b) 使用包的线条绘制宏booktabs
而不是 来创建更“开放”的外观\hline
。
\documentclass[msom,blindrev]{article}% I don't have the "informs3" class
\usepackage{dcolumn,booktabs,caption}
\captionsetup{skip=0.5\baselineskip}
\newcolumntype{d}[1]{D..{#1}}
\newcommand\mc[1]{\multicolumn{1}{c}{#1}} % handy shortcut macro
\begin{document}
\begin{table}
\renewcommand{\arraystretch}{1.1}
\caption{XXX} \label{dztable}
\centering
\begin{tabular}{@{}ld{1.5}d{2.4}}
\toprule
XXX & \mc{Model 3} & \mc{Model 4} \\
\midrule
Coors, bottle, 16-pack vs.\ Budlight, can, 18-pack
& 0 & -0.063 \\
Budlight, bottle, 18-pack vs.\ Budlight, can, 18-pack
& 0.106^{**} & 0.114^{**} \\
Miller Lite, can, 18pack vs.\ Budlight, can, 18-pack
& 0.094 & 0.256^{**} \\
Miller Lite, bottle, 18-pack vs.\ Budlight, can, 18-pack
& 0.147^{***} & 0.070 \\
Budweiser, bottle, 18-pack vs.\ Budlight, can, 18-pack
& 0 & 0.120^{**} \\
Budweiser, can, 18-pack vs.\ Budlight, can, 18-pack
& 0 & -0.017 \\
Budlight, can, 12-pack vs.\ Budlight, can, 18-pack
& 0 & 0.050 \\
\midrule
$^{***}\ p<0.005$ $^{**}\ p<0.05$ \\
\bottomrule
\end{tabular}
\end{table}
\end{document}
附录,在 OP 指出“真实”表格太长而无法放在一页之后发布:如果表格太高而无法放在一页上,并且如果您不想\scalebox
机械地减小其尺寸,您可能需要考虑使用longtable
环境而不是table
/tabular
组合。
如果您觉得下图与上图非常相似,那肯定不是巧合。:-)
\documentclass[msom,blindrev]{article}% I don't have the "informs3" class
\usepackage{dcolumn,booktabs,longtable}
\newcolumntype{d}[1]{D..{#1}} % to align numbers on decimal markers
\newcommand\mc[1]{\multicolumn{1}{c}{#1}} % handy shortcut macro
\begin{document}
\begin{longtable}{@{}ld{1.5}d{2.4}@{}}
%% Set table headers and footers
\caption{XXX} \label{dztable} \\
\toprule
XXX & \mc{Model 3} & \mc{Model 4} \\
\midrule
\endfirsthead
\multicolumn{3}{@{}l}{\emph{(cont'd from previous page)}}\\
\addlinespace
\toprule
XXX & \mc{Model 3} & \mc{Model 4} \\
\midrule
\endhead
\addlinespace
\multicolumn{3}{r@{}}{\emph{(cont'd on the following page)}}\\
\endfoot
\bottomrule
\endlastfoot
%% Body of table
Coors, bottle, 16-pack vs.\ Budlight, can, 18-pack
& 0 & -0.063 \\
Budlight, bottle, 18-pack vs.\ Budlight, can, 18-pack
& 0.106^{**} & 0.114^{**} \\
Miller Lite, can, 18pack vs.\ Budlight, can, 18-pack
& 0.094 & 0.256^{**} \\
Miller Lite, bottle, 18-pack vs.\ Budlight, can, 18-pack
& 0.147^{***} & 0.070 \\
Budweiser, bottle, 18-pack vs.\ Budlight, can, 18-pack
& 0 & 0.120^{**} \\
Budweiser, can, 18-pack vs.\ Budlight, can, 18-pack
& 0 & -0.017 \\
Budlight, can, 12-pack vs.\ Budlight, can, 18-pack
& 0 & 0.050 \\
\midrule
$^{***}\ p<0.005$, $^{**}\ p<0.05$ \\
\end{longtable}
\end{document}