我想将我的表格置于 Latex 中两列文档的中间。我尝试了 {table*} 和“\centering”命令,效果不错,但并不完全。它使表格左对齐,而不是使其在两列之间居中。这是我的代码。如果您能提供任何有关如何正确居中此表格的提示,我将不胜感激。
\begin{table*}
\centering
\caption{Monte Carlo Simulation Results vs. Historical Food Distributions}
\label{table:DistributionComparison}
\begin{tabular}{@{}llllcll@{}}
\toprule
\multicolumn{2}{l}{Simulation} & \multicolumn{2}{l}{Historical} & Difference between means & & \\ \midrule
$M_1$ & $(SD_1)$ & $M_2$ & $(SD_2)$ & $M_1$ - $M_2$ {[}95\% CI{]} & $t(460)$ & $p$ \\ \midrule
146,797 & (3,786) & 122,468 & (27,411) & 24,330 {[}21,080, 27,578{]} & 14.7132 & \textless{}0.001 \\
\bottomrule
\end{tabular}
\begin{tablenotes}
\small
\item Note. $ N=462$. CI = Confidence Interval; $n_1 = 450$. $n_2 = 12$.
\end{tablenotes}
\end{table*}
答案1
您没有提供完整的代码来编译和测试,所以我猜测注释被向左移动是因为表格本身应该居中。
首先,table*
环境会创建全宽的空间,但您的表格没有那么宽。我从未使用过tablesnotes
这种方式,我猜是因为它不是表格的一部分,所以它会移动到左边距,并留出一个小的缩进,就像tablesnotes
创建列表一样。
如果希望注释与表格对齐,请删除tablesnotes
并在下面插入一行\bottomrule
,并将所有单元格合并
\multicolumn{7}{@{}l}{\small Note. ...}
或者threeparttable
按照下面的例子应用,我建议
\documentclass[twocolumn]{article}
\usepackage{booktabs}
\usepackage{threeparttable}
\usepackage{kantlipsum}
\begin{document}
\kant[1-4]
\begin{table*}
\centering
\begin{threeparttable}
\caption{Monte Carlo Simulation Results vs. Historical Food Distributions}
\label{table:DistributionComparison}
\begin{tabular}{@{}llllcll@{}}
\toprule
\multicolumn{2}{c}{Simulation}
& \multicolumn{2}{c}{Historical}
& Difference between means
& & \\
\midrule
$M_1$ & $(SD_1)$ & $M_2$ & $(SD_2)$ & $M_1$ - $M_2$ {[}95\% CI{]} & $t(460)$ & $p$ \\
\midrule
146,797 & (3,786) & 122,468 & (27,411) & 24,330 {[}21,080, 27,578{]} & 14.7132 & $<0.001$ \\
\bottomrule
\end{tabular}
{\small Note. $ N=462$. CI = Confidence Interval; $n_1 = 450$. $n_2 = 12$.}
\end{threeparttable}
\end{table*}
\kant[2-5]
\end{document}
答案2
像这样?
使用taltblr
表格(相当于tabularray
并threeparttable
使用该stfloat
包),您可以将表格置于页面顶部或底部的中心(如果它插入在第一列并且在此点之后有足够的空间用于表格):
\documentclass[twocolumn]{article}
\usepackage{stfloats}
\usepackage{tabularray}
\UseTblrLibrary{booktabs}
\usepackage{lipsum}
\begin{document}
\lipsum[1-2]
\begin{table*}[b]
\centering
\begin{talltblr}[
caption = {Monte Carlo Simulation Results vs. Historical Food Distributions},
label = {table:DistributionComparison},
note{} = {Note: $ N=462$, CI = Confidence Interval, $n_1 = 450$, $n_2 = 12$.}
]{colspec = {@{} *{7}{Q[c, mode=math]} @{}},
row{1} = {c, mode=text}
}
\toprule
\SetCell[c=2]{c} Simulation
& & \SetCell[c=2]{c} Historical
& & Difference between means
& & \\
\cmidrule[r]{1-2}
\cmidrule[lr]{3-4}
\cmidrule[lr]{5-5}
M_1 & (SD_1) & M_2 & (SD_2) & M_1 - M_2\ [95\,\% CI] & t(460) & p \\
\midrule
146,797 & (3,786) & 122,468 & (27,411) & 24,330\ [21,080, 27,578] & 14.7132 & <0.001 \\
146,797 & (3,786) & 122,468 & (27,411) & 24,330\ [21,080, 27,578] & 14.7132 & <0.001 \\
\bottomrule
\end{talltblr}
\end{table*}
\lipsum[3-6]
\end{document}