![Problema estranho com `longtabu`](https://rvso.com/image/254727/Problema%20estranho%20com%20%60longtabu%60.png)
Gostaria de compartilhar com vocês um exemplo bastante simples que o LaTeX não é capaz de compilar.
Eu uso o longtabu
ambiente fornecido pelo tabu
pacote. Estou usando comandos booktabs
recomendados na documentação do 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}
No .log
arquivo recebo este erro:
! 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.
e muitos outros erros semelhantes. E o compilador não termina. Eu tenho que forçá-lo a parar.
O problema pode estar relacionado com caption
frases, pois se eu excluí-las, o exemplo é compilado e um documento próprio é produzido.
o que estou perdendo? Talvez seja uma pergunta boba, mas não consigo entender o que está acontecendo, então agradeceria muito a sua ajuda.
Agradeço antecipadamente.
Responder1
Você se esqueceu de encerrar a legenda com um fim de linha \\
. longtabu
é baseado no código deMesa comprida(vero manualpágina 1, segundo parágrafo), entãoo manual da mesa longana verdade faz parte da documentação do longtabu
. A necessidade de \\
legendas está documentada na página 11 desse manual.
Uma sugestão: se você adicionar uma linha
\tabulinesep=3pt
antes da mesa, você consegue um espaçamento melhor. Tente este:
\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}