我创建了一个表格,我认为它需要\makecell{}
、\multirow{}
和multicolumn{}
才能正确显示。问题是元素的空间排列不太好。
- 下部和上部子标题(第 5 列和第 6 列)未正确对齐。
- 第 1-4 列的位置不合理(居中或底部对齐都可以)。
- 我必须使用 hack(
\B
)来分隔我的空间\hline
,以便它不会重叠第 3 列和第 4 列的文本。
对于我可能做错的事情或更好的方法,有什么建议吗(对于该问题的一次性性质表示歉意)?
\documentclass{article}
\usepackage{makecell, multirow, ctable}
\newcommand\B{\rule[-2.5ex]{0pt}{0pt}}
\begin{document}
\begin{table}[h]
\centering
\caption{title}
\small
\begin{tabular}{cccccc}
\specialrule{.2em}{.1em}{.1em}
\multirow{2}{*}{Condition} & \multirow{2}{*}{\textit{N}} & \multirow{2}{*}{\makecell{Mean Proportion \\ Taxonomic \\ Responses}} & \multirow{2}{*}{\makecell{Taxonomic \\ Responding Exact \\ Binomial Test \textit{p}}} & \multicolumn{2}{c}{\makecell{95\% Binomial \\ Confidence Intervals}} \\
\cline{5-6}
& & & & Lower & Upper \B \\
\hline
Alien & \textit{n} = 65 & .74 & \\
Alike & \textit{n} = 63 & .68 & \\
Similar & \textit{n} = 50 & .68 & \\
No Reminder & \textit{n} = 59 & .40 & \\
\hline
\end{tabular}
\label{table:e1rt}
\end{table}
\end{document}
答案1
由于您加载,因此使用命令进行了一些改进booktabs
和代码简化:\multirowcell
makecell
\documentclass{article}
\usepackage{array}
\usepackage{makecell, multirow, booktabs}
\usepackage{caption}
\begin{document}
\begin{table}[h]
\centering
\caption{title}
\footnotesize\setlength{\extrarowheight}{2pt}
\begin{tabular}{c>{$}c<{$}cccc}
\toprule
\multirowcell{3}[-1pt]{Condition} & \multirowcell{3}[-1pt]{$N$} & \multirowcell{3}[-1pt]{Mean Proportion \\ Taxonomic \\ Responses}& \multirowcell{3}[-1pt]{Taxonomic \\\strut Responding Exact \\ Binomial Test $p$} & \multicolumn{2}{c}{\makecell{95\% Binomial \\ Confidence Intervals}} \\
\cmidrule(lr){5-6}
& & & & \multicolumn{1}{c}{Lower} & \multicolumn{1}{c}{Upper} \\
\midrule
Alien & n = 65 & .74 & \\
Alike & n = 63 & .68 & \\
Similar & n = 50 & .68 & \\
No Reminder & n = 59 & .40 & \\
\bottomrule
\end{tabular}
\label{table:e1rt}
\end{table}
\end{document}
答案2
我认为你可以使用以下方法改进它booktabs
:
\documentclass{article}
\usepackage{array}
\usepackage{makecell, multirow, booktabs}
\renewcommand{\arraystretch}{1.2}
\usepackage{siunitx}
\usepackage{caption}
\begin{document}
\begin{table}[h]
\centering
\caption{title}
\footnotesize
\begin{tabular}{c>{$}c<{$}S[table-format=.2,add-integer-zero=false]ccc}
\toprule
\multirow{2}{*}{Condition} & \multirow{2}{*}{$N$} & \multicolumn{1}{c}{\multirow{2}{*}{\makecell{Mean Proportion \\ Taxonomic \\ Responses}}} & \multirow{2}{*}{\makecell{Taxonomic \\ Responding Exact \\ Binomial Test $p$}} & \multicolumn{2}{c}{\makecell{95\% Binomial \\ Confidence Intervals}} \\
\cmidrule{5-6}
& & & & \multicolumn{1}{c}{Lower} & \multicolumn{1}{c}{Upper} \\
\midrule
Alien & n = 65 & .74 & \\
Alike & n = 63 & .68 & \\
Similar & n = 50 & .68 & \\
No Reminder & n = 59 & .40 & \\
\bottomrule
\end{tabular}
\label{table:e1rt}
\end{table}
\end{document}