需要帮助修复放错位置的 \omit。错误

需要帮助修复放错位置的 \omit。错误

我正在处理相当大的文档,然后在某个时候我使用了\begin{landscape}并在横向页面上创建了一个表格。

但后来,我一直收到Misplaced \omit. 错误。与此问题类似的所有答案都无法解决问题。错误消息:

Misplaced \omit.

\multispan ->\omit 
                   \@multispan 
l.298 \chapter
              {Methodology}
I expect to see \omit only after tab marks or the \cr of
an alignment. Proceed, and I'll ignore this case.

以下 MWE 重现了该问题:

\documentclass[a4paper, 10pt]{report}
\usepackage[utf8]{inputenc}
\usepackage{floatrow}
\newfloatcommand{capbtabbox}{table}[][\FBwidth]
\usepackage{caption}
\usepackage{booktabs}
\usepackage{floatrow}
\usepackage{pdflscape}
\usepackage{afterpage}
\usepackage{capt-of}
\usepackage{tabulary}
\usepackage{float}
\restylefloat{table}

\newcolumntype{L}{>{\centering\arraybackslash}m{3cm}}

\title{Replicate problem}
\author{The Author }
\date{November 2019}

\begin{document}

\maketitle

\chapter{Introduction}
This is the first chapter....


\afterpage{
    \clearpage
    \thispagestyle{empty}
    \begin{landscape}
        \centering 
        \begin{table}
        \RawFloats
        \label{distance-duration}
        \begin{tabular}{lccccccr}
            \toprule
            \multicolumn{1}{m{1.7cm}}{\textbf{Author(s)}  }  & \multicolumn{1}{m{1.5cm}}{\textbf{modes detected} } & \textbf{Classifier used}  & \textbf{Features}   & \multicolumn{1}{m{1.5cm}}{\textbf{Population}  }  & \multicolumn{1}{m{2cm}}{\textbf{External Data used}  }  & \textbf{Period} & \textbf{Accuracy} \\
            \midrule


        Author 1 & 4 & DT & \multicolumn{1}{m{4cm}}{distance, velocity \& acceleration statistics} & 45 users [GeoLife] & No &6 months & 72.80\%\\
        \hline

    Author 2 &5 & Fuzzy engine &speed  \multicolumn{1}{m{4cm}}{acceleration statistics} &4,882 users &No &6.65 days & N/A\\
        \bottomrule
        \end{tabular}
         \hfill
        \end{table} 
        \captionof{table}{A summary of previous studies and methods employed \textit{(*N/A = Not available)}.} 
    \end{landscape}
    \clearpage
}

\end{document}

答案1

tabularx我根据和的组合提出以下建议makecell

在此处输入图片描述

\documentclass[a4paper, 10pt]{report}

\usepackage{booktabs}
\usepackage{pdflscape}
\usepackage{afterpage}

\usepackage{makecell}
\renewcommand{\theadfont}{\normalsize\bfseries}

\usepackage{tabularx}
\renewcommand\tabularxcolumn[1]{m{#1}}



\begin{document}

\afterpage{
    \clearpage
    \thispagestyle{empty}
    \begin{landscape}
        \centering 
        \begin{table}
        \caption{A summary of previous studies and methods employed \textit{(*N/A = Not available)}.} 
        \label{distance-duration}
        \begin{tabularx}{\linewidth}{lccXcccr}
            \toprule
            \thead{Author(s)}  & \thead{modes\\ detected} & \thead{Classifier used}  & \thead{Features}   & \thead{Population}  & \thead{External\\ Data used}  & \thead{Period} & \thead{Accuracy} \\
            \midrule
        Author 1 & 4 & DT & distance, velocity \& acceleration statistics & 45 users [GeoLife] & No &6 months & 72.80\%\\
        \midrule
    Author 2 &5 & Fuzzy engine &  speed acceleration statistics &4,882 users &No &6.65 days & N/A\\
        \bottomrule
        \end{tabularx}
         \hfill
        \end{table} 
    \end{landscape}
    \clearpage
}

\end{document}

答案2

根据对我的问题的第一条评论(speed \multicolumn是错误的),我注意到speed \multicolumn{1}{m{4cm}}{acceleration statistics}当我真正想要输入时我错误地输入了\multicolumn{1}{m{4cm}}{ speed acceleration statistics}

我的错,解决这个问题就解决了。

相关内容