提交时 tabularx 末尾的控制序列未定义

提交时 tabularx 末尾的控制序列未定义

我在 TabularX(即)末尾收到未定义的控制序列错误\end{tabularx}%。我尝试找到解决方法,但到目前为止没有结果。有人能帮我解决这个问题吗?我的代码中有两个子表。

\begin {table}[htp]
\caption{XXXXXXXXX}
\subfloat[XXXX\label{tbl:AAAAA}]{%
    \begin{tabularx}{\textwidth}{|l|c|c|c|X|l|}  % X fits the table in the page
        \hline
        \textbf{AA} & \multicolumn{1}{p{5.605em}|}{\textbf{Overall}} & \multicolumn{1}{p{6.42em}|}{\textbf{BB, winter}} & \multicolumn{1}{p{7.315em}|}{\textbf{CC, AA days}} & \textbf{Mod description} \bigstrut\\
        \hline
        Basic AA & 0.871 & 0.858 & 0.841 & AA with CC component \bigstrut\\
        \hline
        Liq AA + Model A & 0.869 & 0.853 & 0.834 & Standard AA calc  \bigstrut\\
        \hline
        Liq AA + Model B & 0.876 & 0.867 & 0.853 & Model A + cacllc induced calc \bigstrut\\
        \hline
        Liq AA + Model C & 0.867 & 0.854 & 0.834 & Model A + sftmp + smtmp \bigstrut\\
        \hline
        Liq AA+ Model D  & 0.868 & 0.855 & 0.825 & Model A + smtmp + distributed sftmp  \bigstrut\\
        \hline
        \textbf{Liq AA + Model E} & \textbf{0.885} & \textbf{0.881} & \textbf{0.872} & Model BB + sftmp + distributed smtmp  \bigstrut\\
        \hline
        Liq AA + Model F & 0.871 & 0.86  & 0.841 & Model C + Radiation induced calc \bigstrut\\
        \hline
        Liq AA + Model F.1 & 0.874 & 0.864 & 0.848 & Model D + Radiation induced calc\bigstrut\\
        \hline
    \end{tabularx}%
    }

\vspace{\floatsep} 
   
\subfloat[CXXXXCCXXXXX\label{tbl:tbl_XXXXX}]{%
    \begin{tabularx}{\textwidth}{|l|c|c|c|X|l|}  
        \hline
        \textbf{AAA} & \multicolumn{1}{p{5.605em}|}{\textbf{Overall AA}} & \multicolumn{1}{p{6.42em}|}{\textbf{AA, winter}} & \multicolumn{1}{p{7.315em}|}{\textbf{AA, aaa days}} & \textbf{AAA description} \bigstrut\\
        \hline
        Basic AA & 0.841 & 0.844 & 0.807 & HBV with snow component \bigstrut\\
        \hline
        Liq AA + Model A & 0.793 & 0.779 & 0.7   & Standard calcc  \bigstrut\\
        \hline
        Liq AA + Model B & 0.834 & 0.835 & 0.788 & Model A + ccccccc induced dddd \bigstrut\\
        \hline
        Liq CC + Model C & 0.846 & 0.85  & 0.811 & Model B + ccc + dddd \bigstrut\\
        \hline
        Liq DD + Model D  & 0.845 & 0.848 & 0.809 & Model D + aaa + distributed ccc\bigstrut\\
        \hline
        Liq EE + Model E & 0.846 & 0.85  & 0.811 & Model D + aaa+ distributed ccc \bigstrut\\
        \hline
        \textbf{Liq EE + Model F} & \textbf{0.847} & \textbf{0.851} & \textbf{0.813} & Model E + exexe induced calc \bigstrut\\
        \hline
    \end{tabularx}%
    }
\end{table}%

答案1

你说你的代码生成了“未定义的控制序列”错误消息,但你没有说哪个控制序列被标记为未定义。如果我使您的代码片段具有最低限度的可编译性(例如,通过添加前缀\documentclass{article} \usepackage{tabularx,subcaption} \let\bigstrut\relax \begin{document}和后缀\end{document}),我实际上不会收到任何错误消息。

无论如何,我认为您应该通过省略所有垂直线和大多数水平线,并使用规则绘制宏来使表格在视觉上更具吸引力booktabs。请参阅下文以了解此想法的实现。

在此处输入图片描述

\documentclass{article}
\usepackage[letterpaper,margin=1in]{geometry} % set page parameters suitably
\usepackage{tabularx,ragged2e}
\newcolumntype{L}{>{\RaggedRight\hspace{0pt}}X}
\usepackage{subcaption,booktabs}

\begin{document}
\begin{table}[htp]
\setlength{\extrarowheight}{2pt} %for a more open "look"
\caption{XXXXXXXXX}

\subfloat[XXXX\label{tbl:AAAAA}]{%
    \begin{tabularx}{\textwidth}{@{} lcccL @{}}
    \toprule
    \textbf{AA} & \textbf{Overall} & \textbf{BB, winter} & \textbf{CC, AA days} & \textbf{Mod description} \\
    \midrule
    Basic AA & 0.871 & 0.858 & 0.841 & AA with CC component \\
    Liq AA + Model A & 0.869 & 0.853 & 0.834 & Standard AA calc  \\
    Liq AA + Model B & 0.876 & 0.867 & 0.853 & Model A + cacllc induced calc \\
    Liq AA + Model C & 0.867 & 0.854 & 0.834 & Model A + sftmp + smtmp \\
    Liq AA+ Model D  & 0.868 & 0.855 & 0.825 & Model A + smtmp + distributed sftmp  \\
    \textbf{Liq AA + Model E} & \textbf{0.885} & \textbf{0.881} & \textbf{0.872} & Model BB + sftmp + distributed smtmp  \\
    Liq AA + Model F   & 0.871 & 0.86  & 0.841 & Model C + Radiation induced calc \\
    Liq AA + Model F.1 & 0.874 & 0.864 & 0.848 & Model D + Radiation induced calc\\
    \bottomrule
    \end{tabularx}}
    
\vspace{2\floatsep}   
 
\subfloat[CXXXXCCXXXXX\label{tbl:tbl_XXXXX}]{%
    \begin{tabularx}{\textwidth}{@{} lcccL @{}}  
    \toprule
    \textbf{AAA} & \textbf{Overall AA} & \textbf{AA, winter} & \textbf{AA, aaa days} & \textbf{AAA description} \\
    \midrule
    Basic AA & 0.841 & 0.844 & 0.807 & HBV with snow component \\
    Liq AA + Model A & 0.793 & 0.779 & 0.7   & Standard calcc  \\
    Liq AA + Model B & 0.834 & 0.835 & 0.788 & Model A + ccccccc induced dddd \\
    Liq CC + Model C & 0.846 & 0.85  & 0.811 & Model B + ccc + dddd \\
    Liq DD + Model D & 0.845 & 0.848 & 0.809 & Model D + aaa + distributed ccc\\
    Liq EE + Model E & 0.846 & 0.85  & 0.811 & Model D + aaa+ distributed ccc \\
    \textbf{Liq EE + Model F} & \textbf{0.847} & \textbf{0.851} & \textbf{0.813} & Model E + exexe induced calc \\
    \bottomrule
    \end{tabularx}}
    
\end{table}
\end{document}

相关内容