Latex 弹出错误 放错了 \omit。Elsevier cas-sc 模板中的表格中的 \multispan ->\omit@multispan

Latex 弹出错误 放错了 \omit。Elsevier cas-sc 模板中的表格中的 \multispan ->\omit@multispan

\documentclass[a4paper,fleqn]{cas-sc}
\usepackage{booktabs, makecell}
\usepackage{siunitx}
\usepackage{longtable}
\begin{document}

\begin{table}%[!htbp]
\centering
\caption{{Week ahead forecasted load accuracy assessment of the proposed and existing forecasting frameworks in terms of \emph{r} on case study I.}}
\label{tab:R_WF_US}
    \setlength{\tabcolsep}{0pt}
    \sisetup{round-mode=places,
             round-precision=2,
             table-format=1.2,
             }
\begin{tabular*}{\columnwidth}{@{\extracolsep{\fill}}  l  *{4}{S} }
    \toprule
 & \multicolumn{4}{c}{Proposed and existing frameworks} \\
    \cmidrule{2-5}
\thead{Days}
        & {\thead{ANN \\ \emph{r}}}
            & {\thead{LSTM \\ \emph{r}}}
                & {\thead{CRBM \\ \emph{r}}}
                     & {\thead{FCRBM \\ \emph{r}}}\\

\midrule
    Sunday & 0.250 & 0.520 & 0.795 & 0.815 \\
    Monday & 0.321 & 0.515 & 0.778 & 0.912 \\
    Tuesday & 0.755 & 0.656 & 0.795 & 0.845 \\
    Wednesday & 0.250 & 0.566 & 0.615 & 0.998 \\
    Thursday & 0.445 & 0.465 & 0.809 & 0.877 \\
    Friday & 0.335 & 0.536 & 0.700 & 0.899 \\
    Saturday & 0.438 & 0.486 & 0.697 & 0.919 \\
    \midrule
Avg.& 0.400 & 0.534 & 0.751 & 0.895\\
\bottomrule
\end{tabular*}
\end{table}
\end{document} 

答案1

恐怕不能在列标题\thead中使用,因为它应该用括号括起来,但它使用了一些技巧,如果用括号括起来,这些技巧就无法发挥作用。罪魁祸首似乎是特定的文档类。S\noalign

一种解决方法,对表进行了一些修复。

\documentclass[a4paper,fleqn]{cas-sc}
\usepackage{booktabs, makecell}
\usepackage{siunitx}
\usepackage{longtable}
\usepackage{natbib}

\DeclareRobustCommand{\mythead}[1]{%
  \begin{tabular}{@{}c@{}}#1\end{tabular}%
}

\begin{document}

\begin{table}[pos=!htbp]
\centering

\caption{{Week ahead forecasted load accuracy assessment of
  the proposed and existing forecasting frameworks in terms
  of \textit{r} on case study I.}}
\label{tab:R_WF_US}

\setlength{\tabcolsep}{0pt}
\sisetup{
  round-mode=places,
  round-precision=2,
  table-format=1.2,
  detect-all,
}

\begin{tabular*}{\columnwidth}{@{\extracolsep{\fill}}  l  *{4}{S} @{}}
\toprule
Days & \multicolumn{4}{c@{}}{\makebox[0pt]{Proposed and existing frameworks}} \\
\cmidrule{2-5}
  & \mythead{ANN \\ \textit{r}}
  & \mythead{LSTM \\ \textit{r}}
  & \mythead{CRBM \\ \textit{r}}
  & \mythead{FCRBM \\ \textit{r}}\\

\midrule
    Sunday & 0.250 & 0.520 & 0.795 & 0.815 \\
    Monday & 0.321 & 0.515 & 0.778 & 0.912 \\
    Tuesday & 0.755 & 0.656 & 0.795 & 0.845 \\
    Wednesday & 0.250 & 0.566 & 0.615 & 0.998 \\
    Thursday & 0.445 & 0.465 & 0.809 & 0.877 \\
    Friday & 0.335 & 0.536 & 0.700 & 0.899 \\
    Saturday & 0.438 & 0.486 & 0.697 & 0.919 \\
    \midrule
Avg.& 0.400 & 0.534 & 0.751 & 0.895\\
\bottomrule
\end{tabular*}
\end{table}
\end{document} 

请注意,位置说明符必须用作键的值pos

我还将长标题设置在宽度为零的框中,因为它的自然宽度大于跨越列的自然宽度,因此最后一列会出现多余的宽度。

还要注意,detect-all为了按照表格的整体样式排版数字。不要\emph{r}使用(我猜你想模拟数学模式),而是使用\textit因为你想要斜体,而不是强调。

在此处输入图片描述

相关内容