如果我需要按小数点对齐,如何强制列名均匀分布?

如果我需要按小数点对齐,如何强制列名均匀分布?

我是一名使用表格的新手,我的大表格遇到了这个奇怪的问题。以下是可以重现此问题的部分代码:

\documentclass[floatsintext,man,12pt,a4paper]{apa6}
\usepackage[utf8]{inputenc}
\usepackage{csquotes}
\usepackage[style=apa,sortcites=true,sorting=nyt,backend=biber]{biblatex}

\usepackage{setspace} %not needed double spacing by default....
\usepackage{graphicx,rotating,booktabs}
%\usepackage{longtable}
\usepackage{array}
\usepackage{lscape}
\usepackage{adjustbox}
\usepackage{enumerate}
\usepackage{siunitx} %for decimal alignment
\DeclareLanguageMapping{american}{american-apa}

\begin{document}
\title{xx}

\shorttitle{Pxx}

\author{dd}
\affiliation{xx}

\leftheader{xxx}

\abstract{}

\keywords{xxx}


\begin{sidewaystable}[htbp]
\small
\caption{xxx}
\centering
\tabcolsep=0.11cm
\scalebox{0.9}{
\begin{tabular}{lS[table-align-text-post=false]@{}*{14}{S[add-integer-zero = false]@{}}}
\toprule
\multicolumn{1}{@{\hspace{1em}}l}{Items} & \multicolumn{1}{c}{ difference \textit{t}} &  \multicolumn{1}{c}{1} & \multicolumn{1}{c}{2} & \multicolumn{1}{c}{3} & \multicolumn{1}{c}{4} & \multicolumn{1}{c}{5} & \multicolumn{1}{c}{6} & \multicolumn{1}{c}{7} & \multicolumn{1}{c}{8} & \multicolumn{1}{c}{9} & \multicolumn{1}{c}{10} & \multicolumn{1}{c}{11} & \multicolumn{1}{c}{12} & \multicolumn{1}{c}{13} & \multicolumn{1}{c}{14}\\
\midrule
    8. Love & -6.84*** & -.20*  & .09  & .10   & .02  & .06  & .08  & .05  & .05  & .00    & .13  & .04  & .03  & .14  & -.11 \\
    9. Hate & 5.87* & .05  & .15  & .08  & .19*  & .26**  & .06  & .15  & .17  & .06  & .19*  & .08  & .27** & .14  & -.24** \\
\midrule\\[-2.5ex]
\multicolumn{14}{l}{\textit{Note.}*\textit{p}$<$.05, **\textit{p}$<$.01, ***\textit{p}$<$.001}  \\
\end{tabular}
}
\end{sidewaystable}

\end{document}

这是表格输出的屏幕截图。

我不明白为什么 4 和 5(第 6 和第 7 列)之间的空间比其他空间大得多。

更新:我通过添加 [table-align-text-post=false] 解决了 *** 和负数之间的空格问题,但我仍然无法解决第 6 列和第 7 列之间的空格问题......

答案1

第 5 列很宽,因为**以为中心,所以用白色空间来平衡。.另外,由于您从标题中删除了所有列间空间,但为数据保留了列间空间,因此布局有些紧张。

缩放表格是一件非常麻烦的事,而且由于没有它似乎也不太适合,所以我也将其删除了。

在此处输入图片描述

\documentclass[floatsintext,man,12pt,a4paper]{apa6}
\usepackage[utf8]{inputenc}
\usepackage{csquotes}
\usepackage[style=apa,sortcites=true,sorting=nyt,backend=biber]{biblatex}

\usepackage{setspace} %not needed double spacing by default....
\usepackage{graphicx,rotating,booktabs}
%\usepackage{longtable}
\usepackage{array}
\usepackage{lscape}
\usepackage{adjustbox}
\usepackage{enumerate}
\usepackage{siunitx} %for decimal alignment
\DeclareLanguageMapping{american}{american-apa}

\begin{document}
\title{xx}

\shorttitle{Pxx}

\author{dd}
\affiliation{xx}

\leftheader{xxx}

\abstract{}

\keywords{xxx}


\begin{sidewaystable}[htbp]
\small
\caption{xxx}
\centering
\tabcolsep=0.11cm
\begin{tabular}{@{}lS[table-align-text-post=false]*{14}{S[add-integer-zero = false]}@{}}
\toprule
 \multicolumn{1}{@{}{c}}{Items} & 
 \multicolumn{1}{c}{difference $t$} &  
 \multicolumn{1}{c}{1} & 
 \multicolumn{1}{c}{2} & 
 \multicolumn{1}{c}{3} & 
 \multicolumn{1}{c}{4} & 
 \multicolumn{1}{c}{5} & 
 \multicolumn{1}{c}{6} & 
 \multicolumn{1}{c}{7} & 
 \multicolumn{1}{c}{8} & 
 \multicolumn{1}{c}{9} & 
 \multicolumn{1}{c}{10} & 
 \multicolumn{1}{c}{11} & 
 \multicolumn{1}{c}{12} & 
 \multicolumn{1}{c}{13} & 
 \multicolumn{1}{c@{}}{14}\\
\midrule
    8. Love & -6.84\rlap{***} & -.20\rlap{*}  & .09  & .10   & .02  & .06  & .08  & .05  & .05  & .00    & .13  & .04  & .03  & .14  & -.11 \\
    9. Hate & 5.87\rlap{*} & .05  & .15  & .08  & .19*  & .26\rlap{**}  & .06  & .15  & .17  & .06  & .19\rlap{*}  & .08  & .27\rlap{**} & .14  & -.24** \\
\midrule\\[-2.5ex]
\multicolumn{14}{l}{\textit{Note.}*\textit{p}$<$.05, **\textit{p}$<$.01, ***\textit{p}$<$.001}  \\
\end{tabular}%

\end{sidewaystable}

\end{document}

相关内容