2

I'm trying to use a longtable in landscape. I obtain a compilation error (I use XeLaTex) and I don't know where is the problem. The code is:

\begin{landscape}
\begin{longtable}{ccccccc}
\caption{My table.}
\label{tab:table} \\
\toprule
\multicolumn{1}{c}\textbf{} & \multicolumn{1}{c}\textbf{A} & \multicolumn{1}{c}\textbf{B} & \multicolumn{1}{c}\textbf{C} & \multicolumn{1}{c}\textbf{D} & \multicolumn{1}{c}\textbf{E} & \multicolumn{1}{c}\textbf{F}\\
\midrule
\endfirsthead
\multicolumn{7}{l}{\footnotesize\itshape\tablename~\thetable: continue from previous page} \\ 
\toprule
\multicolumn{1}{c}\textbf{} & \multicolumn{1}{c}\textbf{A} & \multicolumn{1}{c}\textbf{B} & \multicolumn{1}{c}\textbf{C} & \multicolumn{1}{c}\textbf{D} & \multicolumn{1}{c}\textbf{E} & \multicolumn{1}{c}\textbf{F}\\
\midrule
\endhead
\midrule
\multicolumn{7}{r}{\footnotesize\itshape\tablename~\thetable: continue to next page} \\
\endfoot
\bottomrule
\multicolumn{7}{r}{\footnotesize\itshape\tablename~\thetable: end} \\
\endlastfoot
% table body
\textbf{1} & 2 & 3 & 4 & 5 & 6 & 7\\
\midrule
\textbf{1} & 2 & 3 & 4 & 5 & 6 & 7\\
\midrule
\textbf{1} & 2 & 3 & 4 & 5 & 6 & 7 \\
\midrule
\textbf{1} & 2 & 3 & 4 & 5 & 6 & 7 \\
\midrule
\textbf{1} & 2 & 3 & 4 & 5 & 6 & 7 \\
\midrule
\textbf{1} & 2 & 3 & 4 & 5 & 6 & 7 \\
\midrule
\textbf{1} & 2 & 3 & 4 & 5 & 6 & 7 \\
\midrule
\textbf{1} & 2 & 3 & 4 & 5 & 6 & 7 \\
\midrule
\textbf{1} & 2 & 3 & 4 & 5 & 6 & 7 \\
\midrule
\textbf{1} & 2 & 3 & 4 & 5 & 6 & 7 \\
\midrule
\textbf{1} & 2 & 3 & 4 & 5 & 6 & 7 \\
\midrule
\textbf{1} & 2 & 3 & 4 & 5 & 6 & 7 \\
\midrule
\textbf{1} & 2 & 3 & 4 & 5 & 6 & 7 \\
\midrule
\textbf{1} & 2 & 3 & 4 & 5 & 6 & 7 \\
\bottomrule                                 
\end{longtable}
\end{landscape}

The error is:

 Package longtable Error: Column widths have changed in table 2.1 
 See the longtable package documentation for explanation. 
 Type  H <return>  for immediate help. 
 ...                                              

 l.901 \end{longtable}

Any ideas?

3

It's not an error. Compile again until the problem goes away: longtable uses previous runs to adjust the column width in order to get them the same size on all pages.

If you load the package longtable with the option pausing, the informative message is indeed changed into an error; omit that option, in case you're using it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.