我需要在第一列和第二列之间添加一条垂直线(eta 平方和平均值的右侧),但我似乎不知道该怎么做。这是我的代码示例。我需要将垂直线放置在水平线之间,但不要“接触它们”。如果您能提供任何关于如何做到这一点的提示,我将不胜感激。:) 谢谢!
\documentclass[a4paper, 11pt]{article}
\usepackage{fullpage} % changes the margin
\usepackage{setspace}
\usepackage{libertine}
\usepackage{mathtools}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage{tikz}
\usepackage{enumitem}
\usepackage{subcaption}
\usepackage{booktabs}
\usepackage{float} % for placing figures
\usepackage{titlesec} % for formatting APA-style headings
\usepackage{xcolor}
\usepackage{fancyhdr}
\usepackage{titling}
\usepackage{listings}
\usepackage[bookmarksopen=true]{hyperref} % show PDF bookmarks upon opening
\usepackage{bookmark} % produce bookmarks
\begin{document}
\begin{table}[H]
\begin{threeparttable}
\caption{xxx.}
\label{tab:simresults}
\centering
\begin{tabular}{lrccc}
\hline
& & a & b & c \\
\hline
$\eta^2$ & DIF item proportion & \emph{0.52} & \emph{0.13} & \emph{0.00} \\
\multirow{3}{*}{Mean}&0.20 & 0.91 & 9.83 & 0.00 \\
&0.60 & 0.71 & 8.44 & 0.00 \\
&0.80 & 0.51 & 7.40 & -0.01\\
\hline
\hline
\end{tabular}
\end{threeparttable}
\end{table}
\end{document}
答案1
如果您想要一条不接触水平规则的垂直线,请使用以下规则booktabs
:它们有一些垂直填充,会打断垂直线。
amsmath
无关:如果你加载了 ,则无需加载mathtools
。后者会帮你加载。
因此我建议这样的布局:
\documentclass[a4paper, 11pt, svgnames]{article}
\usepackage{fullpage} % changes the margin
\usepackage{setspace}
\usepackage{libertine}
\usepackage{mathtools}
\usepackage{graphicx}
\usepackage{tikz}
\usepackage{enumitem}
\usepackage{subcaption}
\usepackage{booktabs}
\usepackage{array, threeparttable, multirow}
\usepackage{float} % for placing figures
\usepackage{titlesec} % for formatting APA-style headings
\usepackage{xcolor}
\usepackage{fancyhdr}
\usepackage{titling}
\usepackage{listings}
\usepackage[bookmarksopen=true]{hyperref} % show PDF bookmarks upon opening
\usepackage{bookmark} % produce bookmarks
\begin{document}
\begin{table}[H]
\begin{threeparttable}
\caption{Main effects of the simulated conditions on outcome variables.}
\label{tab:simresults}
\centering
\begin{tabular}{l!{\color{Silver!40!Lavender}\vrule width 1.8pt}rccc}
\toprule
\multicolumn{1}{c}{} & & Hit Rate & Cluster Length & Bias in Slope \\
\midrule
$\eta^2$ & DIF item proportion & \emph{0.52} & \emph{0.13} & \emph{0.00} \\
\multirow{3}{*}{Mean}&0.20 & 0.91 & 9.83 & 0.00 \\
&0.60 & 0.71 & 8.44 & 0.00 \\
&0.80 & 0.51 & 7.40 &\llap{$-$}0.01\\
\bottomrule
\end{tabular}
\begin{tablenotes}[flushleft]\small%
\item \emph{Note.} italics = Eta squared (explained variance proportion). See supplements for higher order effects. * Not all single steps are printed.
\end{tablenotes}
\end{threeparttable}
\end{table}
\end{document}
答案2
我猜你正在寻找:
\documentclass[a4paper, 11pt]{article}
\usepackage{fullpage} % changes the margin
\usepackage{makecell, multirow}
\usepackage[referable]{threeparttablex}
\usepackage[skip=1ex, font=footnotesize,labelfont=bf]{caption}
\usepackage{siunitx}
\usepackage{etoolbox}
\newrobustcmd\I{\itshape}
\begin{document}
\begin{table}[ht]
\sisetup{detect-all,
table-format=-1.2}
\setcellgapes{2pt}
\makegapedcells
\centering
\begin{threeparttable}
\caption{Main effects of the simulated conditions on outcome variables.}
\label{tab:simresults}
\begin{tabular}{lr|*{3}{S}}
\hline
\multicolumn{2}{c}{}
& {\makecell{Hit\\ Rate}}
& {\makecell{Cluster\\ Length}}
& {\makecell{Bias\\ in Slope}} \\
\hline
$\eta^2$ & DIF item proportion
&\I 0.52 &\I 0.13 &\I 0.00 \\
\multirow{3}{*}{Mean}
& 0.20 & 0.91 & 9.83 & 0.00 \\
& 0.60 & 0.71 & 8.44 & 0.00 \\
& 0.80 & 0.51 & 7.40 & -0.01 \\
\hline
\hline
\end{tabular}
\begin{tablenotes}[flushleft, para]\small
\note{See supplements for higher order effects.}
\item[$\eta^2$] explained variance proportion
\item[*] not all single steps are printed.
\end{tablenotes}
\end{threeparttable}
\end{table}
\end{document}
在序言中仅考虑此表所需的包。