缺少 \endgroup 插入。\end{tabularx}

缺少 \endgroup 插入。\end{tabularx}

早上好,我正在尝试使用 tabularx 包创建一个表。我收到此错误:

Forbidden control sequence found while scanning use of \NC@find. \end{tabularx}

缺少 \endgroup 插入。\end{tabularx}

我认为我正在关闭括号,并且所有开始的命令都结束了。我遗漏了什么?

\documentclass[11pt]{report}
\usepackage[utf8]{inputenc}
\usepackage{float}
\usepackage{lipsum}
\usepackage{subfig}
\usepackage{adjustbox}
\usepackage{tabularx,booktabs}
\usepackage{mathtools}
\usepackage{array}
\usepackage{dcolumn}
\newcolumntype{P}[1]{>{\centering\arraybackslash}p{#1}}
\newcolumntype{P}{>{\raggedright\arraybackslash}X}
\setlength\tabcolsep{2pt}
\captionsetup{
    justification = centering
}
\usepackage{amsmath}
\usepackage{geometry}
\usepackage{booktabs}
\usepackage{graphicx}
\usepackage{xurl}
\usepackage{hyperref}
\DeclareMathOperator{\Pa}{Pa}
\newcolumntype{d}[1]{D{.}{.}{#1}}
\setlength\tabcolsep{2pt}
\linespread{1.5}\selectfont
\geometry{
    paper=a4paper, % Change to letterpaper for US letter
    inner=2.5cm, % Inner margin
    outer=3.8cm, % Outer margin
    bindingoffset=.5cm, % Binding offset
    top=2cm, % Top margin
    bottom=2cm, % Bottom margin
    %showframe, % Uncomment to show how the type block is set on the page
}

\begin{document}

\noindent
\begin{tabularx}{\textwidth}{@{} l cccc @{}} 
    \toprule
    & \multicolumn{4}{ c }{{\bfseries PISTOIA AREA}} \\ 
    \cmidrule(l){2-5}
    & \multicolumn{1}{P}{5 cells}
    & \multicolumn{1}{P}{7 cells}  
    & \multicolumn{1}{P}{11 cells} 
    & \multicolumn{1}{P@{}}{21 cells} \\ 
    Slope  &&& X &\\ 
    Longitudinal curv.  &&&&  X \\ 
    Cross sectional curv.  &&&& X \\ 
    \midrule
\bottomrule
\end{tabularx}

\end{document}

.log代码的第一行是:

This is pdfTeX, Version 3.14159265-2.6-1.40.20 (MiKTeX 2.9.7140 64-bit) (preloaded format=pdflatex 2019.8.30)  31 AUG 2019 12:10
entering extended mode

相关内容