`longtabu` 的奇怪问题

`longtabu` 的奇怪问题

我想与大家分享一个 LaTeX 无法编译的相当简单的例子。

我使用包longtabu提供的环境tabu。我按照booktabs文档中的建议使用命令tabu

\documentclass[11pt]{book}
\usepackage[a4paper,showframe]{geometry}

\RequirePackage[latin1]{inputenc}


\usepackage{booktabs}
\usepackage{tabu}
\usepackage{longtable}

\usepackage[english]{babel}

\begin{document}



\begin{footnotesize}

\begin{longtabu} to 0.75\textwidth{cX[L]ll}
% We use commands from 'booktabs' package because it is recommended by 'tabu'.
%
\caption[Short caption for index.]{Long caption to be shown at the top of the first page of the table.\label{tab:label}}
\toprule
Col 1 & Col 2 & Col 3 & Col 4\\
\midrule
\endfirsthead
%
\caption[]{(Cont.) Long caption to be shown at the top of the rest of the table.}
\toprule
Col 1 & Col 2 & Col 3 & Col 4\\
\midrule
\endhead
%
\bottomrule
\endfoot
%
\endlastfoot
% Now the regular content :
$\Phi(z)$ &
Description wich is quite long, normally. &
$]0,1[$ &
This is a reference page.
\\
\addlinespace
$\Phi(z)$ &
Description wich is quite long, normally. &
$]0,1[$ &
This is a reference page.
\\
\addlinespace
$\Phi(z)$ &
Description wich is quite long, normally. &
$]0,1[$ &
This is a reference page.
\\
\addlinespace
$\Phi(z)$ &
Description wich is quite long, normally. &
$]0,1[$ &
This is a reference page.
\\
\addlinespace
$\Phi(z)$ &
Description wich is quite long, normally. &
$]0,1[$ &
This is a reference page.
\\
\addlinespace
$\Phi(z)$ &
Description wich is quite long, normally. &
$]0,1[$ &
This is a reference page.
\\
\addlinespace
$\Phi(z)$ &
Description wich is quite long, normally. &
$]0,1[$ &
This is a reference page.
\\
\addlinespace
$\Phi(z)$ &
Description wich is quite long, normally. &
$]0,1[$ &
This is a reference page.
\\
\addlinespace
$\Phi(z)$ &
Description wich is quite long, normally. &
$]0,1[$ &
This is a reference page.
\\
\addlinespace
$\Phi(z)$ &
Description wich is quite long, normally. &
$]0,1[$ &
This is a reference page.
\\
\addlinespace
$\Phi(z)$ &
Description wich is quite long, normally. &
$]0,1[$ &
This is a reference page.
\\
\addlinespace
$\Phi(z)$ &
Description wich is quite long, normally. &
$]0,1[$ &
This is a reference page.
\\
\addlinespace
$\Phi(z)$ &
Description wich is quite long, normally. &
$]0,1[$ &
This is a reference page.
\\
\addlinespace
$\Phi(z)$ &
Description wich is quite long, normally. &
$]0,1[$ &
This is a reference page.
\\
\addlinespace
$\Phi(z)$ &
Description wich is quite long, normally. &
$]0,1[$ &
This is a reference page.
\\
\addlinespace
$\Phi(z)$ &
Description wich is quite long, normally. &
$]0,1[$ &
This is a reference page.
\\
\addlinespace
$\Phi(z)$ &
Description wich is quite long, normally. &
$]0,1[$ &
This is a reference page.
\\
\addlinespace
$\Phi(z)$ &
Description wich is quite long, normally. &
$]0,1[$ &
This is a reference page.
\\
\addlinespace
$\Phi(z)$ &
Description wich is quite long, normally. &
$]0,1[$ &
This is a reference page.
\\
\addlinespace
$\Phi(z)$ &
Description wich is quite long, normally. &
$]0,1[$ &
This is a reference page.
\\
\addlinespace
$\Phi(z)$ &
Description wich is quite long, normally. &
$]0,1[$ &
This is a reference page.
\\
\addlinespace
$\Phi(z)$ &
Description wich is quite long, normally. &
$]0,1[$ &
This is a reference page.
\\
\addlinespace
$\Phi(z)$ &
Description wich is quite long, normally. &
$]0,1[$ &
This is a reference page.
\\
\addlinespace
$\Phi(z)$ &
Description wich is quite long, normally. &
$]0,1[$ &
This is a reference page.
\\
\addlinespace
$\Phi(z)$ &
Description wich is quite long, normally. &
$]0,1[$ &
This is a reference page.
\\
\addlinespace
$\Phi(z)$ &
Description wich is quite long, normally. &
$]0,1[$ &
This is a reference page.
\\
\addlinespace
$\Phi(z)$ &
Description wich is quite long, normally. &
$]0,1[$ &
This is a reference page.
\\
\addlinespace
$\Phi(z)$ &
Description wich is quite long, normally. &
$]0,1[$ &
This is a reference page.
\\
\addlinespace
$\Phi(z)$ &
Description wich is quite long, normally. &
$]0,1[$ &
This is a reference page.
\\
\addlinespace
$\Phi(z)$ &
Description wich is quite long, normally. &
$]0,1[$ &
This is a reference page.
\\
\addlinespace
\bottomrule
\end{longtabu}
\end{footnotesize}

\end{document} 

.log文件中我收到此错误:

! Misplaced \noalign.
\toprule ->\noalign 
                    {\ifnum 0=`}\fi \@aboverulesep =\abovetopsep \global \@b...
l.88 \end{longtabu}

I expect to see \noalign only after the \cr of
an alignment. Proceed, and I'll ignore this case.

! Missing } inserted.
<inserted text> 
                }
l.88 \end{longtabu}

I've inserted something that you may have forgotten.
(See the <inserted text> above.)
With luck, this will get me unwedged. But if you
really didn't forget anything, try typing `2' now; then
my insertion and my current dilemma will both disappear.

以及许多其他类似的错误。而且编译器没有结束。我不得不强制它停止。

问题可能与caption句子有关,因为如果我删除它们,示例就会被编译并生成适当的文档。

我遗漏了什么?也许这是一个愚蠢的问题,但我不明白发生了什么,所以我真的很感激你的帮助。

先感谢您。

答案1

您忘记用行尾来结束标题\\longtabu基于以下代码:长桌(看手册第 1 页第二段),因此长桌手册实际上是 文档的一部分。该手册第 11 页记录了对 字幕longtabu的需求。\\

建议:如果你添加一行

\tabulinesep=3pt

在表格之前,您可以获得更好的间距。试试这个:

\documentclass[11pt,a4paper]{book}
\usepackage[a4paper,showframe]{geometry}

\RequirePackage[latin1]{inputenc}


\usepackage{booktabs}
\usepackage{tabu}
\usepackage{longtable}

\usepackage[english]{babel}

\begin{document}
\begin{footnotesize}

\tabulinesep=3pt
\begin{longtabu} to 0.75\textwidth{cX[L]ll}
% We use commands from 'booktabs' package 
% because it is recommended by 'tabu'.
%
\caption[Short caption for index.]{Long caption to be %
shown at the top of the first page %
of the table.\label{tab:label}}\\ % **NB**
\toprule
Col 1 & Col 2 & Col 3 & Col 4\\
\midrule
\endfirsthead
%
\caption[]{(Cont.) Long caption to be shown at %
the top of the rest of the table.}\\  % **NB**
\toprule
Col 1 & Col 2 & Col 3 & Col 4\\
\midrule
\endhead
%
\bottomrule
\endfoot
%
\endlastfoot
% Now the regular content :
$\Phi(z)$ &
Description wich is quite long, normally. &
$]0,1[$ &
This is a reference page.
\\
\addlinespace
$\Phi(z)$ &
Description wich is quite long, normally. &
$]0,1[$ &
This is a reference page.
\\
\addlinespace
$\Phi(z)$ &
Description wich is quite long, normally. &
$]0,1[$ &
This is a reference page.
\\
\addlinespace
$\Phi(z)$ &
Description wich is quite long, normally. &
$]0,1[$ &
This is a reference page.
\\
\addlinespace
$\Phi(z)$ &
Description wich is quite long, normally. &
$]0,1[$ &
This is a reference page.
\\
\addlinespace
$\Phi(z)$ &
Description wich is quite long, normally. &
$]0,1[$ &
This is a reference page.
\\
\addlinespace
$\Phi(z)$ &
Description wich is quite long, normally. &
$]0,1[$ &
This is a reference page.
\\
\addlinespace
$\Phi(z)$ &
Description wich is quite long, normally. &
$]0,1[$ &
This is a reference page.
\\
\addlinespace
$\Phi(z)$ &
Description wich is quite long, normally. &
$]0,1[$ &
This is a reference page.
\\
\addlinespace
$\Phi(z)$ &
Description wich is quite long, normally. &
$]0,1[$ &
This is a reference page.
\\
\addlinespace
$\Phi(z)$ &
Description wich is quite long, normally. &
$]0,1[$ &
This is a reference page.
\\
\addlinespace
$\Phi(z)$ &
Description wich is quite long, normally. &
$]0,1[$ &
This is a reference page.
\\
\addlinespace
$\Phi(z)$ &
Description wich is quite long, normally. &
$]0,1[$ &
This is a reference page.
\\
\addlinespace
$\Phi(z)$ &
Description wich is quite long, normally. &
$]0,1[$ &
This is a reference page.
\\
\addlinespace
$\Phi(z)$ &
Description wich is quite long, normally. &
$]0,1[$ &
This is a reference page.
\\
\addlinespace
$\Phi(z)$ &
Description wich is quite long, normally. &
$]0,1[$ &
This is a reference page.
\\
\addlinespace
$\Phi(z)$ &
Description wich is quite long, normally. &
$]0,1[$ &
This is a reference page.
\\
\addlinespace
$\Phi(z)$ &
Description wich is quite long, normally. &
$]0,1[$ &
This is a reference page.
\\
\addlinespace
$\Phi(z)$ &
Description wich is quite long, normally. &
$]0,1[$ &
This is a reference page.
\\
\addlinespace
$\Phi(z)$ &
Description wich is quite long, normally. &
$]0,1[$ &
This is a reference page.
\\
\addlinespace
$\Phi(z)$ &
Description wich is quite long, normally. &
$]0,1[$ &
This is a reference page.
\\
\addlinespace
$\Phi(z)$ &
Description wich is quite long, normally. &
$]0,1[$ &
This is a reference page.
\\
\addlinespace
$\Phi(z)$ &
Description wich is quite long, normally. &
$]0,1[$ &
This is a reference page.
\\
\addlinespace
$\Phi(z)$ &
Description wich is quite long, normally. &
$]0,1[$ &
This is a reference page.
\\
\addlinespace
$\Phi(z)$ &
Description wich is quite long, normally. &
$]0,1[$ &
This is a reference page.
\\
\addlinespace
$\Phi(z)$ &
Description wich is quite long, normally. &
$]0,1[$ &
This is a reference page.
\\
\addlinespace
$\Phi(z)$ &
Description wich is quite long, normally. &
$]0,1[$ &
This is a reference page.
\\
\addlinespace
$\Phi(z)$ &
Description wich is quite long, normally. &
$]0,1[$ &
This is a reference page.
\\
\addlinespace
$\Phi(z)$ &
Description wich is quite long, normally. &
$]0,1[$ &
This is a reference page.
\\
\addlinespace
$\Phi(z)$ &
Description wich is quite long, normally. &
$]0,1[$ &
This is a reference page.
\\
\addlinespace
\bottomrule
\end{longtabu}
\end{footnotesize}

\end{document} 

相关内容