siunitx“S”列,“额外的对齐标签已更改为\cr”latex错误

siunitx“S”列,“额外的对齐标签已更改为\cr”latex错误

是什么导致了“额外的对齐标签已更改为 \cr”消息?

\documentclass{article}
\usepackage{geometry}
\usepackage{booktabs, makecell}
\renewcommand\theadfont{\small\bfseries}
\renewcommand\theadgape{}
\newlength\colwidth
\usepackage[skip=1ex,labelfont=bf,font=small]{caption}
\usepackage{siunitx}

\begin{document}


\begin{table*}
\centering
\caption{Evaluation of actual }
\label{tab:Comput_time}
\setlength{\tabcolsep}{0pt}
\begin{tabular*}{\textwidth}{
  @{\extracolsep{\fill}}
  S[table-format=1.4]
  @{}
}
\toprule
 & \multicolumn{13}{c}{Frameworks without and with feature engineering and optimization modules}\\
 %\multicolumn{5}{c}{Models with feature engineering and optimization modules}
\cmidrule{1-14}
\multicolumn{2}{c}{ELM} &
  \multicolumn{2}{c}{CNN} &
  \multicolumn{2}{c}{SVM} &
  \multicolumn{2}{c}{SDPSO-ELM} &
  \multicolumn{2}{c}{F-RBF-CNN} &
  \multicolumn{2}{c}{SSA-SVM-CS}&
  \multicolumn{2}{c}{FA-HELF}\\
\cmidrule{1-2}\cmidrule{3-4}\cmidrule{5-6}\cmidrule{7-8}\cmidrule{9-10}\cmidrule{11-12}\cmidrule{13-14}
 &
 & {CT} & {MAPE}
 & {CT} & {MAPE}
 & {CT} & {MAPE}
 & {CT} & {MAPE}
 & {CT} & {MAPE}
 & {CT} & {MAPE}
 & {CT} & {MAPE} \\
 &
 & {(\si{\second})} & {(\%)}
 & {(\si{\second})} & {(\%)}
 & {(\si{\second})} & {(\%)}
 & {(\si{\second})} & {(\%)}
 & {(\si{\second})} & {(\%)}
 & {(\si{\second})} & {(\%)}
 & {(\si{\second})} & {(\%)} \\
\midrule
170 & 2.25 & 185 & 2.20 & 115 & 2.98  & 242 & 1.65 & 512 & 0.99 & 355 & 0.89  & 285 & 0.42\\ [1ex]

\midrule
\bottomrule
\end{tabular*}
\end{table*}
\end{document}

在此处输入图片描述

答案1

一些评论和建议 - 前两个对于正确编译您的代码至关重要,其余的主要是“很高兴知道”类别:

  • 您目前正在定义tabular*由以下部分组成的环境:单列,但您随后继续引用最多 14 列。有些事情不对劲...

    尝试S[table-format=1.4]用替换*{7}{S[table-format=3.0]S[table-format=1.2]},即 7 对S[table-format=3.0]S[table-format=1.2],总共 14 列。

  • 您还需要删除和&之前两个不必要且适得其反的符号。{CT}{(\si{\second})}

  • 我会将第一行居中全部 14 个列,而不仅仅是第 2 至 14 列。

  • 您似乎有多个不需要的\toprule\midrule\cmidrule语句。删除它们。

  • \centering指令是不必要的,因为tabular*环境占据了文本块的整个宽度。我会删除它。

  • table*除非您的文档使用多列设置,否则不要使用环境。请使用table环境。

在此处输入图片描述

\documentclass{article}
\usepackage{geometry}
\usepackage{booktabs}%, makecell}
%\renewcommand\theadfont{\small\bfseries}
%\renewcommand\theadgape{}
%\newlength\colwidth % doesn't seem to be needed either
\usepackage[skip=1ex,labelfont=bf,font=small]{caption}
\usepackage{siunitx}

\begin{document}

\begin{table}
\caption{Evaluation of actual (what?)}
\label{tab:Comput_time}
\setlength{\tabcolsep}{0pt}
\begin{tabular*}{\textwidth}{@{\extracolsep{\fill}}
  *{7}{S[table-format=3.0]S[table-format=1.2]} }
%\toprule
\multicolumn{14}{c}{Frameworks without and with feature engineering and optimization modules}\\
 %\multicolumn{5}{c}{Models with feature engineering and optimization modules}
%%%%%\cmidrule{1-14}
\midrule
  \multicolumn{2}{c}{ELM} &
  \multicolumn{2}{c}{CNN} &
  \multicolumn{2}{c}{SVM} &
  \multicolumn{2}{c}{SDPSO-ELM} &
  \multicolumn{2}{c}{F-RBF-CNN} &
  \multicolumn{2}{c}{SSA-SVM-CS}&
  \multicolumn{2}{c}{FA-HELF}\\
\cmidrule{1-2} \cmidrule{3-4}  \cmidrule{5-6} \cmidrule{7-8}
\cmidrule{9-10}\cmidrule{11-12}\cmidrule{13-14}
  {CT} & {MAPE} & {CT} & {MAPE} & {CT} & {MAPE} & 
  {CT} & {MAPE} & {CT} & {MAPE} & {CT} & {MAPE} & {CT} & {MAPE} \\
  {(\si{\second})} & {(\%)} & {(\si{\second})} & {(\%)} & 
  {(\si{\second})} & {(\%)} & {(\si{\second})} & {(\%)} & 
  {(\si{\second})} & {(\%)} & {(\si{\second})} & {(\%)} & 
  {(\si{\second})} & {(\%)} \\
\midrule
  170 & 2.25 & 185 & 2.20 & 115 & 2.98  & 242 & 1.65 & 
  512 & 0.99 & 355 & 0.89  & 285 & 0.42\\ %%%%[1ex]
%%%%\midrule
\bottomrule
\end{tabular*}
\end{table}
\end{document}

相关内容