致谢:Torbjørn T.
我已删除了$L$
此处发布的内容:Torbjørn T 示例。现在我需要将第二个居中机器学习。
\documentclass{article}
\usepackage{multirow}
\usepackage{amsmath}
\usepackage{setspace}
\usepackage{booktabs} % provides \toprule, \bottomrule,\midrule, \cmidrule
\begin{document}
\begin{table}[htbp]
\small
\centering
\begin{tabular}{*{7}{c}}
\toprule
& & & \multicolumn{2}{c}{\textbf{ML }} &
& \multicolumn{1}{c}{\textbf{ML }} \\
\cmidrule(lr){4-5} \cmidrule(lr){6-7}
$\lambda$ & $\gamma$ & $n$ & train & test & train & test \\
\midrule
0.01 & 0.006 & 30 & 0.7130 & \textbf{0.9243} & & \\
0.01 & 0.002 & 50 & & &0.7285 & \textbf{0.8814} \\
\bottomrule
\end{tabular}
\caption{Values.}
\label{mejorrmsepredictorbase}
\end{table}
\end{document}
答案1
这个怎么样:
\documentclass{article}
\usepackage{multirow}
\usepackage{amsmath}
\usepackage{setspace}
\usepackage{booktabs} % provides \toprule, \bottomrule,\midrule, \cmidrule
\begin{document}
\begin{table}[htbp]
\small
\centering
\begin{tabular}{*{7}{c}}
\toprule
& & & \multicolumn{2}{c}{\textbf{ML }} &
\multicolumn{2}{c}{\textbf{ML }} \\
\cmidrule(lr){4-5} \cmidrule(lr){6-7}
$\lambda$ & $\gamma$ & $n$ & train & test & train & test \\
\midrule
0.01 & 0.006 & 30 & 0.7130 & \textbf{0.9243} & & \\
0.01 & 0.002 & 50 & & &0.7285 & \textbf{0.8814} \\
\bottomrule
\end{tabular}
\caption{Values.}
\label{mejorrmsepredictorbase}
\end{table}
\end{document}
更新
区别就在于这一行:
& & & \multicolumn{2}{c}{\textbf{ML }} &
\multicolumn{2}{c}{\textbf{ML }} \\
你有过:
& & & \multicolumn{2}{c}{\textbf{ML }} & &
\multicolumn{1}{c}{\textbf{ML }} \\
因此,您只需将两列 ( & \multicolumn{1}{c}{\textbf{ML }}
) 合并为一列居中 ( \multicolumn{2}{c}{\textbf{ML }}
)
希望这是清楚的。
答案2
这可能不是一个很好的解决方法但它似乎有效:
\documentclass{article}
\usepackage{multirow}
\usepackage{amsmath}
\usepackage{setspace}
\usepackage{booktabs} % provides \toprule, \bottomrule,\midrule, \cmidrule
\begin{document}
\begin{table}[htbp]
\small
\centering
\begin{tabular}{*{7}{c}}
\toprule
& & & \multicolumn{2}{c}{\textbf{ML 100K}} & \multicolumn{2}{c}{\textbf{ML 1M}}
\\
\cmidrule(lr){4-5} \cmidrule(lr){6-7}
$\lambda$ & $\gamma$ & $n$ & train & test & train & test \\
\midrule
0.01 & 0.006 & 30 & 0.7130 & \textbf{0.9243} & & \\
0.01 & 0.002 & 50 & & &0.7285 & \textbf{0.8814} \\
\bottomrule
\end{tabular}
\caption{Values.}
\label{mejorrmsepredictorbase}
\end{table}
\end{document}