longtable 包与未知包发生冲突

longtable 包与未知包发生冲突

我有一个包含数十个包的论文模板。当我使用 longtable 时,它​​给出了以下错误:

! Undefined control sequence.
\longtable ->\tpltable

l.266 \end{tabularx}

注意:下面的代码在模板外运行得很好。

\documentclass{article} 
\usepackage{array, booktabs, multirow, longtable}
\usepackage{ltablex} %  <-- added (as suggested by Bernard in his comment) 

\begin{document}

\begin{tabularx}{\textwidth}{lXXXXXXXXX} %  <-- changed from \begin{longtable}
    \caption{List first page}
\label{tab:Ch2VCOB}\\
    \toprule 
         &       & \multicolumn{3}{l}{SD-heuristic} &       & \multicolumn{4}{l}{SA-TH} \\
        \cmidrule{3-5}\cmidrule{7-10}    Test Instance & \multicolumn{1}{l}{Upper Bound} & \multicolumn{1}{l}{Obj} & \multicolumn{1}{l}{Gap (\%)} &
        \multicolumn{1}{l}{Time} &  & \multicolumn{1}{l}{Obj. (std.)} & \multicolumn{1}{l}{Gap (\%)} & \multicolumn{1}{l}{Best} & \multicolumn{1}{l}{Time}  \\
\endfirsthead

\caption{continued from previous page} \\
    \toprule
         &       & \multicolumn{3}{l}{SD-heuristic} &       & \multicolumn{4}{l}{SA-TH} \\
        \cmidrule{3-5}\cmidrule{7-10}    Test Instance & \multicolumn{1}{l}{Upper Bound} & \multicolumn{1}{l}{Obj} & \multicolumn{1}{l}{Gap (\%)} &
        \multicolumn{1}{l}{Time} &  & \multicolumn{1}{l}{Obj. (std.)} & \multicolumn{1}{l}{Gap (\%)} & \multicolumn{1}{l}{Best} & \multicolumn{1}{l}{Time}  \\
\endhead

\bottomrule
    \endlastfoot 
\tabularnewline
            A\_2\_5\_1  & 85    & 85    & 0     & 13    &       & 85 (0)   & 0     & 85    & 0      \\
            A\_2\_5\_2  & 160   & 160   & 0     & 6     &       & 160 (0)   & 0     & 160   & 0      \\
            A\_2\_5\_3  & 105   & 105   & 0     & 3     &       & 105 (0)   & 0     & 105   & 0      \\
            A\_2\_5\_4  & 105   & 105   & 0     & 6     &       & 105 (0)   & 0     & 105   & 0      \\
            A\_2\_10\_1 & 50    & 50    & 0     & 8     &       & 50 (0)    & 0     & 50    & 2      \\
            A\_2\_10\_2 & 150   & 110   & 26.7  & 18    &       & 110 (0)   & 26.7  & 110   & 2     \\
            A\_2\_10\_3 & 220   & 220   & 0     & 32    &       & 220 (0)   & 0     & 220   & 5      \\
            A\_2\_10\_4 & 150   & 150   & 0     & 15    &       & 150 (0)   & 0     & 150   & 4      \\
            A\_2\_15\_1 & 215   & 215   & 0     & 72    &       & 215 (0)   & 0     & 215   & 10    \\
            A\_2\_15\_2 & 320   & 240   & 25    & 31    &       & \textbf{258.3 (8.7)} & 19.3  & \textbf{\emph{275}}   & 35     \\
            A\_2\_15\_3 & 205   & 205   & 0     & 29    &       & 205 (0)   & 0     & 205   & 60     \\
            A\_2\_15\_4 & 255   & 255   & 0     & 56    &       & 255 (0)   & 0     & 255   & 3     \\
            A\_2\_20\_1 & 255   & 245   & 3.9   & 186   &       & \textbf{255 (0)}   & 0     & \textbf{\emph{255}}   & 80     \\
            A\_2\_20\_2 & 270   & \textbf{270}   & 0     & 90    &       & 265.9 (1.9) & 1.5   & 270   & 90    \\
            A\_2\_20\_3 & 260   & 250   & 3.8   & 73    &       & \textbf{260 (0)}  & 0     & \textbf{\emph{260}}   & 10     \\
            A\_2\_20\_4 & 380   & \textbf{345}   & 9.2   & 86    &       & 335 (5.6)   & 11.8  & 345   & 200   \\
            A\_3\_5\_1  & 205   & 145   & 29.3  & 0     &       & 145 (0)   & 29.3  & 145   & 0      \\
            A\_3\_5\_2  & 115   & 115   & 0     & 1     &       & 115 (0)   & 0     & 115   & 0     \\
            A\_3\_5\_3  & 125   & 125   & 0     & 0     &       & 125 (0)   & 0     & 125   & 0    \\
            A\_3\_5\_4  & 190   & 190   & 0     & 0     &       & 190 (0)   & 0     & 190   & 0      \\
            A\_3\_10\_1 & 205   & 205   & 0     & 3     &       & 205 (0)   & 0     & 205   & 2      \\
            A\_3\_10\_2 & 230   & 200   & 13    & 3     &       & \textbf{230 (0)}   & 0     & \textbf{\emph{230}}   & 3     \\
            A\_3\_10\_3 & 305   & 305   & 0     & 3     &       & 305 (0)   & 0     & 305   & 3     \\
            A\_3\_10\_4 & 300   & 300   & 0     & 6     &       & 300 (0)   & 0     & 300   & 3      \\
            A\_3\_15\_1 & 330   & 315   & 4.5   & 67    &       & \textbf{330 (0)}   & 0     & \textbf{\emph{330}}   & 60    \\
            A\_3\_15\_2 & 425   & 375   & 11.8  & 51    &       & \textbf{392.1 (7.5)} & 7.7   & \textbf{\emph{415}}   & 50    \\
            A\_3\_15\_3 & 330   & 280   & 15.2  & 48    &       & \textbf{291 (5.2)}   & 11.8  & \textbf{\emph{305}}   & 45    \\
            A\_3\_15\_4 & 475   & 390   & 17.9  & 18    &       & \textbf{409.8 (11.3)} & 13.7  & \textbf{\emph{425}}   & 15   \\
            A\_3\_20\_1 & 345   & 290   & 15.9  & 111   &       & \textbf{307.2 (10.4)} & 11    & \textbf{\emph{320}}   & 100   \\
            A\_3\_20\_2 & 415   & 310   & 25.3  & 77    &       & \textbf{382.1 (9.8)} & 7.9   & \textbf{\emph{415}}   & 70     \\
            A\_3\_20\_3 & 360   & 325   & 9.7   & 212   &       & \textbf{326 (2.1)}   & 9.4   & \textbf{\emph{330}}   & 200   \\
            A\_3\_20\_4 & 480   & 435   & 9.4   & 38    &       & \textbf{453.8 (5.8)} & 5.5   & \textbf{\emph{470}}   & 35    \\
            A\_4\_5\_1  & 140   & 140   & 0     & 0     &       & 140 (0)   & 0     & 140   & 0     \\
            A\_4\_5\_2  & 150   & 150   & 0     & 0     &       & 150 (0)   & 0     & 150   & 0     \\
            A\_4\_5\_3  & 165   & 165   & 0     & 0     &       & 165 (0)   & 0     & 165   & 0     \\
            A\_4\_5\_4   & 230   & 230   & 0     & 0     &       & 230 (0)   & 0     & 230   & 0      \\
            A\_4\_10\_1 & 310   & 240   & 22.6  & 5     &       & \textbf{256.2 (19.4)} & 17.4  & \textbf{\emph{310}}   & 5   \\
            A\_4\_10\_2 & 370   & 370   & 0     & 2     &       & 370 (0)   & 0     & 370   & 0     \\
            A\_4\_10\_3 & 445   & 350   & 21.3  & 4     &       & \textbf{356 (10.7)}   & 20    & \textbf{\emph{375}}   & 10   \\
            A\_4\_10\_4 & 285   & 285   & 0     & 3     &       & 285 (0)   & 0     & 285   & 3     \\
            A\_4\_15\_1 & 545   & 360   & 33.9  & 18    &       & \textbf{361.2 (8)} & 33.7  & \textbf{\emph{370}}   & 10     \\
            A\_4\_15\_2 & 610   & \textbf{455}   & 25.4  & 42    &       & 451.9 (7.7) & 25.9  & \textbf{\emph{475}}   & 200    \\
            A\_4\_15\_3 & 450   & 410   & 8.9   & 39    &       & \textbf{414.8 (6.3)} & 7.8   & \textbf{\emph{430}}   & 40    \\
            A\_4\_15\_4 & 515   & \textbf{435}   & 15.5  & 38    &       & 428.3 (8) & 16.8  & \textbf{\emph{455}}   & 200   \\
            A\_4\_20\_1 & 585   & 480   & 17.9  & 132   &       & \textbf{481 (9)}   & 17.8  & \textbf{\emph{520}}   & 125   \\
            A\_4\_20\_2 & 440   & 385   & 12.5  & 187   &       & \textbf{406.9 (8.4)} & 7.5   & \textbf{\emph{425}}   & 175   \\
            A\_4\_20\_3 & 425   & 300   & 29.4  & 202   &       & \textbf{335 (9.7)}   & 21.2  & \textbf{\emph{370}}   & 200   \\
            A\_4\_20\_4 & 500   & 445   & 11    & 90    &       & \textbf{460.2 (5.1)} & 8     & \textbf{\emph{465}}   & 90     \\
            A\_5\_5\_1  & 200   & 200   & 0     & 0     &       & 200 (0)   & 0     & 200   & 0      \\
            A\_5\_5\_2  & 200   & 200   & 0     & 1     &       & 200 (0)   & 0     & 200   & 0      \\
            A\_5\_5\_3  & 220   & 220   & 0     & 1     &       & 220 (0)   & 0     & 220   & 0      \\
            A\_5\_5\_4  & 175   & 175   & 0     & 1     &       & 175 (0)   & 0     & 175   & 0      \\
            A\_5\_10\_1 & 350   & 350   & 0     & 3     &       & 350 (0)   & 0     & 350   & 0      \\
            A\_5\_10\_2 & 345   & 345   & 0     & 2     &       & 345 (0)   & 0     & 345   & 0      \\
            A\_5\_10\_3 & 285   & 270   & 5.3   & 5     &       & 270 (0)   & 5.3   & 270   & 0      \\
            A\_5\_10\_4 & 380   & 380   & 0     & 2     &       & 380 (0)   & 0     & 380   & 0      \\
            A\_5\_15\_1 & 590   & 445   & 24.6  & 61    &       & \textbf{446.4 (6.3)} & 24.3  & \textbf{\emph{265}}   & 60   \\
            A\_5\_15\_2 & 695   & 495   & 28.8  & 50    &       & \textbf{530.3 (18.4)} & 23.7  & \textbf{\emph{565}}   & 50  \\
            A\_5\_15\_3 & 395   & 335   & 15.2  & 52    &       & \textbf{346.2 (7.5)} & 12.4  & \textbf{\emph{380}}   & 50   \\
            A\_5\_15\_4 & 520   & 485   & 6.7   & 77    &       & \textbf{486 (12.7)}   & 6.5   & \textbf{\emph{500}}   & 125 \\
            A\_5\_20\_1 & 760   & 635   & 16.4  & 130   &       & \textbf{669.7 (9.1)} & 11.9  & \textbf{\emph{690}}   & 125  \\
            A\_5\_20\_2 & 645   & \textbf{485}   & 24.8  & 165   &       & 481.7 (13) & 25.3  & \textbf{\emph{515}}   & 200   \\
            A\_5\_20\_3 & 645   & \textbf{565}   & 12.4  & 146   &       & 529.1 (9.2) & 18    & 545   & 200  \\
            A\_5\_20\_4 & 560   & 485   & 13.4  & 270   &       & \textbf{485.9 (10.6)} & 13.2  & \textbf{\emph{505}}   & 200 \\
\end{tabularx}  %  <-- changed
\end{document} 

答案1

谷歌建议的代码是

https://github.com/alexmajy/neptunethesis/blob/master/setup/format.tex#L563

确实

\let\tpltable\longtable
\gdef\wuhaobiao{%五号字
    \def\tabular{\wuhao\gdef\@halignto{}\@tabular}
    \def\endtabular{\endarray $\egroup}
    \def\longtable{\wuhao\tpltable}

如果longtable已经定义\wuhaobiao执行此代码后,在标有then的区域内,longtable将像以前一样工作,但前缀为\wuhao。但是,如果\longtable尚未定义,\longtable则将扩展为 use\tpltable并给出未定义的错误,即使longtable包稍后加载。

所以你需要使用

\usepackage{longtable}

在输入此代码之前。

相关内容