基本上,我希望单词Difference
位于中心,就像下面绘制的图片一样located in the square box
。
我在用
\multicolumn{1}{l}{Difference} & Mean
我改成了
\multirow{3}{l}{Difference} & Mean
但不起作用。
我的完整 MWE:
\documentclass[12pt,oneside]{book}
\usepackage[showframe]{geometry}
\usepackage{amsmath}
\usepackage{ragged2e}
\usepackage{makecell, multirow, tabularx}
\renewcommand\theadfont{\small\bfseries} % for bold in table using \small
\renewcommand\theadgape{}
\usepackage[svgnames, table]{xcolor}
\usepackage{hhline, boldline}
\usepackage{seqsplit, caption} %for table spacing to second row
\usepackage{booktabs, ragged2e} % Use booktabs rules and get rid of vertical rules, ragged2e to ragged text
\usepackage{siunitx} %for table spacing to second row
\usepackage{threeparttable} %to add footnote below table
\usepackage{tabulary}
\usepackage{graphicx}
\begin{document}
\begin{table}[h!]
\centering
\sisetup{table-number-alignment=center}
\begin{tabularx}{\textwidth}{l>{\raggedright\arraybackslash}XcS[table-format=-1.5]S[table-format=1.5]}
\toprule
& & & {\thead{Statistic}}& {\thead{Std. Error}} \\
\midrule
\multicolumn{1}{l}{Difference} & Mean
& & 30.9524 & 5.864 \\
\cmidrule{2-5}
& \multirow{2}{=}{95\% Confidence Interval for Mean} & Lower Bound & 17.6861 & \\
\cmidrule{3-5}
& & Upper Bound & \ 44.2186 \\
\cmidrule{2-5}
& 5\% Trimmed Mean & & 31.7460 \\
\cmidrule{2-5}
& Median & & 30.9524 \\
\cmidrule{2-5}
& Range & & 66.6667 \\
\cmidrule{2-5}
& Interquartile Range & & 25.0000 \\
\cmidrule{2-5}
& Skewness & & -0.8959 & 0.687 \\
\cmidrule{2-5}
& Kurtosis & & 1.8087 & 1.334 \\
\bottomrule
\end{tabularx}
\end{table}
\end{document}
答案1
给你,用multirow
。我借此机会改进了其他多行的垂直居中,使用十进制值作为行的“数量”(考虑到 booktabs 规则的垂直填充)。
\documentclass[12pt,oneside]{book}
\usepackage[showframe]{geometry}
\usepackage{amsmath}
\usepackage{ragged2e}
\usepackage{makecell, multirow, tabularx}
\renewcommand\theadfont{\small\bfseries} % for bold in table using \small
\renewcommand\theadgape{}
\usepackage[svgnames, table]{xcolor}
\usepackage{hhline, boldline}
\usepackage{seqsplit, caption} %for table spacing to second row
\usepackage{booktabs, ragged2e} % Use booktabs rules and get rid of vertical rules, ragged2e to ragged text
\usepackage{siunitx} %for table spacing to second row
\usepackage{threeparttable} %to add footnote below table
\usepackage{tabulary}
\usepackage{graphicx}
\begin{document}
\begin{table}[h!]
\centering
\sisetup{table-number-alignment=center}
\begin{tabularx}{\textwidth}{l>{\raggedright\arraybackslash}XcS[table-format=-1.5]S[table-format=1.5]}
\toprule
& & & {\thead{Statistic}}& {\thead{Std. Error}} \\
\midrule
\multirow{12.2}{*}{Difference} & Mean
& & 30.9524 & 5.864 \\
\cmidrule{2-5}
& \multirow{2.4}{=}{95\% Confidence Interval for Mean} & Lower Bound & 17.6861 & \\
\cmidrule{3-5}
& & Upper Bound & \ 44.2186 \\
\cmidrule{2-5}
& 5\% Trimmed Mean & & 31.7460 \\
\cmidrule{2-5}
& Median & & 30.9524 \\
\cmidrule{2-5}
& Range & & 66.6667 \\
\cmidrule{2-5}
& Interquartile Range & & 25.0000 \\
\cmidrule{2-5}
& Skewness & & -0.8959 & 0.687 \\
\cmidrule{2-5}
& Kurtosis & & 1.8087 & 1.334 \\
\bottomrule
\end{tabularx}
\end{table}
\end{document}