长桌主体和头部宽度不一样

长桌主体和头部宽度不一样

我遇到了一个问题:长桌主体和头部的宽度不一样:

这里是代码:

\begin{center}
\begin{longtable}{ | c | c | c | c | c | c |} \hline
Num de logt : & \makecell{type de \\ financement}  &  \makecell{surface utile \\ ponderree} & taux de loyer & loyer & total charges\\ \hline
\endfirsthead

Num de logt : & \makecell{type de \\ financement}  &  \makecell{surface utile \\ ponderree} & taux de loyer & loyer & total charges\\ \hline
\endhead

\hline \multicolumn{6}{|r|}{{Continued on next page}} \\ \hline
\endfoot

\\
\endlastfoot

1054& HLM/O  & 74.00 & 4.69  &  347.361 &  64.811 \\ \hline
1054& HLM/O  & 74.00 & 4.69  &  347.361 &  64.811 \\ \hline
1054& HLM/O  & 74.00 & 4.69  &  347.361 &  64.811 \\ \hline
1054& HLM/O  & 74.00 & 4.69  &  347.361 &  64.811 \\ \hline
1054& HLM/O  & 74.00 & 4.69  &  347.361 &  64.811 \\ \hline
\end{longtable}

结果如下:https://drive.google.com/file/d/1h8xkPUXgC5fVSNgEAklf2C3pCLFIEK7d/view?usp=sharing

答案1

使用您的代码经过第二次编译后我获得:

在此处输入图片描述

虚假的最后一行是您定义的结果lastfoot

\\
\endlastfoot

如果你删除\\,你将获得

在此处输入图片描述

记住:longtable必须编译两次!

您的表格的完整代码:

\documentclass{article}
\usepackage{longtable, makecell} 

\begin{document}    
\begin{longtable}{ | c | c | c | c | c | c |} \hline
Num de logt : & \makecell{type de \\ financement}  &  \makecell{surface utile \\ ponderree} & taux de loyer & loyer & total charges\\ \hline
\endfirsthead
Num de logt : & \makecell{type de \\ financement}  &  \makecell{surface utile \\ ponderree} & taux de loyer & loyer & total charges\\ \hline
\endhead
\hline
\multicolumn{6}{|r|}{{Continued on next page}} \\ 
\hline% i would omit it, it gives ugly result
\endfoot
\endlastfoot
%
1054& HLM/O  & 74.00 & 4.69  &  347.361 &  64.811 \\ \hline
1054& HLM/O  & 74.00 & 4.69  &  347.361 &  64.811 \\ \hline
1054& HLM/O  & 74.00 & 4.69  &  347.361 &  64.811 \\ \hline
1054& HLM/O  & 74.00 & 4.69  &  347.361 &  64.811 \\ \hline
1054& HLM/O  & 74.00 & 4.69  &  347.361 &  64.811 \\ \hline
\end{longtable}
\end{document}

相关内容