编辑2:我只需要更新我的软件......
编辑:这个错误只发生在我身上。我使用 TexMaker。只有当两个条件同时起作用时,它才会失败:1) 文档中有这个表格,2)\usepackage{caption}
序言中有这个表格。当其中一个条件不满足时,文档可以毫无问题地编译。我删除了该.aux
文件,并尝试使用新文档。结果相同。我该怎么办??
xltabular
我与一起使用landscape
。(经过一些调整后)效果很好。但是,我必须将表格放在使用包的长文档中caption
。加载此包时,表格会中断:
! 未定义控制序列。\LT@c@ption ...ndcsname }{#3}\LT@captionlistentry {#2} l.122 \end{xltabular} 错误消息顶行末尾的控制序列从未被 \def'ed。如果您拼错了(例如,\hobx'),请输入 I' 和正确的拼写(例如,`I\hbox')。否则请继续,我会忘记未定义的内容。
例子:
\documentclass[11pt, a4paper, oneside]{report}
\usepackage[left=4cm,right=2cm,top=2.5cm,bottom=2.5cm]{geometry} % control the geometry of the page
\usepackage{xltabular} % long tabularx
\usepackage{makecell}
\usepackage{multirow}
\usepackage[table]{xcolor}
\usepackage{lscape}
\usepackage[T1]{fontenc}
\usepackage{caption} % it breaks xltabular
\usepackage{amsmath}
\usepackage{lipsum}
\newcolumntype{s}{>{\hsize=.6\hsize}X}
\newcolumntype{S}{>{\hsize=1.1\hsize}X}
\begin{document}
\begin{landscape}
\setlength\LTcapwidth{\linewidth} % so that the caption spans the whole width of the table
\begin{xltabular}{\linewidth}{>{\small\raggedright\arraybackslash}s>{\small}S>{\small}S>{\small}S>{\small}S}
\caption{table caption which has to be long to show that it does not break the line... so I just keep on typing a bit more that I would have.\label{table label}}\\
\hline
A \newline \makecell[r]{\textit{B}} & \multirow{2}{\linewidth}{\centering 1} & \multirow{2}{\linewidth}{\centering 2} & \multirow{2}{\linewidth}{\centering 3} & \multirow{2}{\linewidth}{\centering 4} \\
\hline
\endhead
\multicolumn{5}{c}{1st thing} \\* \hline
& \makecell[c]{$\Uparrow$} & \makecell[c]{$\Uparrow$} & \makecell[c]{$\Uparrow$} & \makecell[c]{$\Uparrow$ | $\Downarrow$} \\*
1st A \newline \vspace{-4ex} \begin{flushright}\textit{1st B} \vspace{-3ex}\end{flushright} & \lipsum[23] & \lipsum[23] & \lipsum[23] & \lipsum[23] \\
\hline
\multicolumn{5}{c}{2nd thing} \\* \hline
& \makecell[c]{$\Uparrow$} & \makecell[c]{$\Uparrow$} & \makecell[c]{$\Uparrow$} & \makecell[c]{$\Uparrow$ | $\Downarrow$} \\*
2nd A \newline \vspace{-4ex} \begin{flushright}\textit{2nd B} \vspace{-3ex}\end{flushright} & Blabla. & Bleble. & Blibli. & Bloblo. \\
\hline
\noalign{\break} % \\* does not work with \hline and \pagebreak gives an error
\multicolumn{5}{c}{3rd thing} \\* \hline
& \makecell[c]{$\Uparrow$} & \makecell[c]{$\Uparrow$} & \makecell[c]{$\Uparrow$} & \makecell[c]{$\Uparrow$ | $\Downarrow$} \\*
3rd A \newline \vspace{-4ex} \begin{flushright}\textit{3rd B} \vspace{-3ex}\end{flushright} & \lipsum[23] & \lipsum[23] & \lipsum[23] & \lipsum[23] \\
\hline
\multicolumn{5}{c}{4th thing} \\* \hline
& \makecell[c]{$\Uparrow$} & \makecell[c]{$\Uparrow$} & \makecell[c]{$\Uparrow$} & \makecell[c]{$\Uparrow$ | $\Downarrow$} \\*
4th A \newline \vspace{-4ex} \begin{flushright}\textit{4th B} \vspace{-3ex}\end{flushright} & Blabla. & Bleble. & Blibli. & Bloblo. \\
\hline
\multicolumn{5}{c}{5th thing} \\* \hline
& \makecell[c]{$\Uparrow$} & \makecell[c]{$\Uparrow$} & \makecell[c]{$\Uparrow$} & \makecell[c]{$\Uparrow$ | $\Downarrow$} \\*
5th A \newline \vspace{-4ex} \begin{flushright}\textit{5th B} \vspace{-3ex}\end{flushright} & Blabla. & Bleble. & Blibli. & Bloblo. \\
\hline
\end{xltabular}
\vspace{-2ex}
\footnotesize
{\noindent Some comments below the table.\\ \par}
\end{landscape}
\end{document}
我无法删除它,\usepackage{caption}
因为文档中的其他一些东西也需要它。
PD.\lipsum[23][2]
导致后面\lipsum[23]
跟着文本 [2],这就是为什么我不能将它用于lipsum
较短的单元格。