我要将 10e-1 和 10e-3 置于 4 个多列的中心。我该怎么做?
\usepackage{siunitx}
\usepackage{multirow}
\usepackage{booktabs}
\begin{table}[htp]
\centering
\begin{tabular}{lS[table-format=1.4]
S[table-format=1.4]
S[table-format=1.4]
S[table-format=1.4]}
\toprule
{\emph{Nodi}} & \multicolumn{4}{c}{PEP} \\
\cmidrule(lr){2-5}
& \num{10e-1} & & & \num{10e-3} \\
\cmidrule(lr){2-5}
& {BC} & {PNC} & {BC} & {PNC} \\
\midrule
1 & 1.1107 & 1.1112 & 1.001 & 1.001 \\
3 & 1.3046 & 1.1488 & 1.003 & 1.0029 \\
7 & 1.597 & 1.1734 & 1.007 & 1.006 \\
12 & 1.8435 & 1.188 & 1.0117 & 1.0089 \\
20 & 2.0836 & 1.2009 & 1.0201 & 1.0122 \\
25 & 2.1777 & 1.2064 & 1.0246 & 1.0134 \\
35 & 2.3101 & 1.2141 & 1.0347 & 1.0153 \\
50 & 2.4443 & 1.2223 & 1.0488 & 1.0167 \\
65 & 2.5501 & 1.228 & 1.0636 & 1.0175 \\
75 & 2.6109 & 1.2308 & 1.0723 & 1.0178 \\
90 & 2.6915 & 1.235 & 1.0864 & 1.0184 \\
100 & 2.7417 & 1.237 & 1.0954 & 1.0186 \\
\bottomrule
\end{tabular}
\end{table}
答案1
为了使两个元素在四列中居中,只需将它们视为一个\multicolumn
元素:
& \multicolumn{4}{c}{\num{10e-1}\quad\num{10e-3}} \\
代码:
\documentclass{article}
\usepackage{siunitx}
\usepackage{booktabs}
\begin{document}
\begin{table}[htp]
\centering
\begin{tabular}{lS[table-format=1.4]
S[table-format=1.4]
S[table-format=1.4]
S[table-format=1.4]}
\toprule
{\emph{Nodi}} & \multicolumn{4}{c}{PEP} \\
\cmidrule(lr){2-5}
& \multicolumn{4}{c}{\num{10e-1}\quad\num{10e-3}} \\
\cmidrule(lr){2-5}
& {BC} & {PNC} & {BC} & {PNC} \\
\midrule
1 & 1.1107 & 1.1112 & 1.001 & 1.001 \\
3 & 1.3046 & 1.1488 & 1.003 & 1.0029 \\
7 & 1.597 & 1.1734 & 1.007 & 1.006 \\
12 & 1.8435 & 1.188 & 1.0117 & 1.0089 \\
20 & 2.0836 & 1.2009 & 1.0201 & 1.0122 \\
25 & 2.1777 & 1.2064 & 1.0246 & 1.0134 \\
35 & 2.3101 & 1.2141 & 1.0347 & 1.0153 \\
50 & 2.4443 & 1.2223 & 1.0488 & 1.0167 \\
65 & 2.5501 & 1.228 & 1.0636 & 1.0175 \\
75 & 2.6109 & 1.2308 & 1.0723 & 1.0178 \\
90 & 2.6915 & 1.235 & 1.0864 & 1.0184 \\
100 & 2.7417 & 1.237 & 1.0954 & 1.0186 \\
\bottomrule
\end{tabular}
\end{table}
\end{document}