答案1
只要数据大小相同,这才会看起来不错
\documentclass{memoir}
% not really needed since this is memoir
\usepackage{booktabs,array}
\begin{document}
\begin{table}
\centering
\begin{tabular}{lllllllllll}
\toprule
$p=p_0$
& \multicolumn{2}{l}{$n=10$}
& \multicolumn{2}{l}{$14$}
& \multicolumn{2}{l}{$20$}
& \multicolumn{2}{l}{$27$}
& \multicolumn{2}{l}{$50$}
\\
\cmidrule(lr){2-3}
\cmidrule(lr){4-5}
\cmidrule(lr){6-7}
\cmidrule(lr){6-7}
\cmidrule(lr){8-9}
\cmidrule(lr){10-11}
& 1 & 2
& 1 & 2
& 1 & 2
& 1 & 2
& 1 & 2
\\
\midrule
1.234 & 1.234 & 1.234 & 1.234 & 1.234 & 1.234 & 1.234 & 1.234 &
1.234 & 1.234 & 1.234
\\
\bottomrule
\end{tabular}
\end{table}
\end{document}
答案2
我对标题和字体进行了一些改进。稍微改变了表头布局:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[showframe]{geometry}
\usepackage{booktabs,array, threeparttable, caption}
\usepackage{newtxtext, newtxmath}
\begin{document}
\begin{table}
\centering
\captionsetup{singlelinecheck=off, labelsep=newline}
\begin{threeparttable}
\caption{Exact sizes of the usual test (1) and the new test (2) when $α= 0.05$}
\begin{tabular}{*{11}{l}}
\toprule
\multicolumn{1}{r}{$n = $} & \multicolumn{2}{l}{$10$}
& \multicolumn{2}{l}{$14$}
& \multicolumn{2}{l}{$20$}
& \multicolumn{2}{l}{$27$}
& \multicolumn{2}{l}{$50$}
\\
\cmidrule(lr){2-3}
\cmidrule(lr){4-5}
\cmidrule(lr){6-7}
\cmidrule(lr){8-9}
\cmidrule(lr){10-11}
$p=p₀$ & 1 & 2 & 1 & 2 & 1 & 2 & 1 & 2 & 1 & 2
\\
\midrule
0.05 & 0.012 & 0.012 & 0.004 & 0.030 & 0.016 & 0.016 & 0.010 & 0.044 & 0.012 & 0.038 \\
0.10 & 0.013 & 0.013 & 0.009 & 0.044 & 0.011 & 0.043 & 0.015 & 0.047 & 0.030 & 0.030 \\
0.15 & 0.010 & 0.050 & 0.012 & 0.047 & 0.022 & 0.022 & 0.026 & 0.026 & 0.027 & 0.044 \\
0.20 & 0.006 & 0.033 & 0.012 & 0.044 & 0.022 & 0.044 & 0.030 & 0.049 & 0.033 & 0.049 \\
0.25 & 0.020 & 0.020 & 0.028 & 0.010 & 0.038 & 0.017 & 0.042 & 0.042 & 0.033 & 0.048 \\
\bottomrule
\end{tabular}
\end{threeparttable}
\end{table}
\end{document}
答案3
可能会对你有帮助,至少我相信这个模板:)
\documentclass[10pt,a4paper]{article}
\begin{document}
\begin{table}
\centering
\caption{Fill up the table for yourself :)}
\label{my-label}
\begin{tabular}{lllllllllllllll}
\hline
\multicolumn{1}{c}{a} & \multicolumn{3}{l}{b} & \multicolumn{3}{l}{c} & \multicolumn{3}{l}{d} & \multicolumn{3}{l}{f} & \multicolumn{2}{l}{g} \\ \cline{2-3} \cline{5-6} \cline{8-9} \cline{11-12} \cline{14-15}
& 1 & 2 & & 1 & 2 & & 1 & 2 & & 1 & 2 & & 1 & 2 \\ \hline
1 & 2 & 3 & & 5 & 6 & & 8 & 9 & & 10 & 11 & & 12 & 13 \\
2 & 2 & 3 & & 5 & 6 & & 8 & 9 & & 10 & 11 & & 12 & 13 \\
3 & - & - & & - & - & & - & - & & - & - & & - & - \\
4 & - & - & & - & - & & - & - & & - & - & & - & - \\
5 & - & - & & - & - & & - & - & & - & - & & - & - \\
6 & - & - & & - & - & & - & - & & - & - & & - & - \\
7 & - & - & & - & - & & - & - & & - & - & & - & - \\
8 & - & - & & - & - & & - & - & & - & - & & - & - \\
9 & - & - & & - & - & & - & - & & - & - & & - & - \\
10 & - & - & & - & - & & - & - & & - & - & & - & - \\ \hline
\end{tabular}
\end{table}
\end{document}
得到你想要的
最后要注意的是,一定要为自己填写表格。
答案4
如果表格以某种方式适合文本宽度,您可以让 TeX 自动计算列间距(但要检查它是否太小)。
我提供两种解决方案,一种针对具有相同位数的条目,一种针对其他情况,使用siunitx
。
\documentclass{article}
\usepackage{booktabs,siunitx}
\usepackage{newtxtext, newtxmath}
\begin{document}
\begin{table}[htp]
\centering
\caption{Exact sizes of the usual test~(1) and the new test~(2) when $\alpha=0.05$}
\setlength{\tabcolsep}{0pt}
\begin{tabular*}{\textwidth}{
@{\extracolsep{\fill}}
l *{10}{c}
@{}
}
\toprule
{$p=p_0$} &
\multicolumn{2}{l}{$n=10$} &
\multicolumn{2}{l}{$14$} &
\multicolumn{2}{l}{$20$} &
\multicolumn{2}{l}{$27$} &
\multicolumn{2}{l@{}}{$50$}
\\
\cmidrule{2-3}\cmidrule{4-5}\cmidrule{6-7}\cmidrule{8-9}\cmidrule{10-11}
&
\multicolumn{1}{l}{1} & \multicolumn{1}{l}{2} &
\multicolumn{1}{l}{1} & \multicolumn{1}{l}{2} &
\multicolumn{1}{l}{1} & \multicolumn{1}{l}{2} &
\multicolumn{1}{l}{1} & \multicolumn{1}{l}{2} &
\multicolumn{1}{l}{1} & \multicolumn{1}{l@{}}{2}
\\
\midrule
0.05 & 0.012 & 0.012 & 0.004 & 0.030 & 0.016 & 0.016 & 0.010 & 0.044 & 0.012 & 0.038 \\
0.10 & 0.013 & 0.013 & 0.009 & 0.044 & 0.011 & 0.043 & 0.015 & 0.047 & 0.030 & 0.030 \\
0.15 & 0.010 & 0.050 & 0.012 & 0.047 & 0.022 & 0.022 & 0.026 & 0.026 & 0.027 & 0.044 \\
0.20 & 0.006 & 0.033 & 0.012 & 0.044 & 0.022 & 0.044 & 0.030 & 0.049 & 0.033 & 0.049 \\
0.25 & 0.020 & 0.020 & 0.028 & 0.010 & 0.038 & 0.017 & 0.042 & 0.042 & 0.033 & 0.048 \\
\bottomrule
\end{tabular*}
\end{table}
\begin{table}[htp]
\centering
\caption{Exact sizes of the usual test~(1) and the new test~(2) when $\alpha=0.05$}
\setlength{\tabcolsep}{0pt}
\begin{tabular*}{\textwidth}{
@{\extracolsep{\fill}}
S[table-format=1.2]
*{10}{S[table-format=1.3]}
@{}
}
\toprule
{$p=p_0$} &
\multicolumn{2}{l}{$n=10$} &
\multicolumn{2}{l}{$14$} &
\multicolumn{2}{l}{$20$} &
\multicolumn{2}{l}{$27$} &
\multicolumn{2}{l@{}}{$50$}
\\
\cmidrule{2-3}\cmidrule{4-5}\cmidrule{6-7}\cmidrule{8-9}\cmidrule{10-11}
&
\multicolumn{1}{l}{1} & \multicolumn{1}{l}{2} &
\multicolumn{1}{l}{1} & \multicolumn{1}{l}{2} &
\multicolumn{1}{l}{1} & \multicolumn{1}{l}{2} &
\multicolumn{1}{l}{1} & \multicolumn{1}{l}{2} &
\multicolumn{1}{l}{1} & \multicolumn{1}{l@{}}{2}
\\
\midrule
0.05 & 0.012 & 0.012 & 0.004 & 0.030 & 0.016 & 0.016 & 0.010 & 0.044 & 0.012 & 0.038 \\
0.10 & 0.013 & 0.013 & 0.009 & 0.044 & 0.011 & 0.043 & 0.015 & 0.047 & 0.030 & 0.030 \\
0.15 & 0.010 & 0.050 & 0.012 & 0.047 & 0.022 & 0.022 & 0.026 & 0.026 & 0.027 & 0.044 \\
0.20 & 0.006 & 0.033 & 0.012 & 0.044 & 0.022 & 0.044 & 0.030 & 0.049 & 0.033 & 0.049 \\
0.25 & 0.020 & 0.020 & 0.028 & 0.010 & 0.038 & 0.017 & 0.042 & 0.042 & 0.033 & 0.048 \\
\bottomrule
\end{tabular*}
\end{table}
\end{document}
我省略了标题的格式,这可能取决于您使用的类。使用该caption
包,您可以轻松按自己喜欢的方式格式化。