1

I wrote a table by longtable. It works correctly but I would like to improve the layout of the width a column. In the figure below you can see the result:enter image description here

As you can see, the last colums is very close to the page header, so I want to reduce the width of the column B (it has too much space that it does not need).

I tried to modify the width of columns B and C (column C is too far from column B) but the result does not change.

Can you help me? I post also my code:

\landscape
\begin{longtable}{p{2.5cm}p{0.5cm}p{2cm}p{4cm}p{3.5cm}p{2.5cm}p{1.5cm}}

\caption{Table name.......................}
\label{tab:Summary} \\

\toprule
\textbf{AAAAAA} &\textbf{BBBBB} &\textbf{CCCCC} &\textbf{DDDDD DDDDDD} &    \textbf{EEEE EEEEEEE} & \textbf{IFFFF ffff} &\textbf{EEEEEEEEE}\\

\midrule
\endfirsthead
% intestazione normale
\multicolumn{2}{l}{\footnotesize\itshape\tablename~\thetable:
continued from previous page} \\
\toprule
\textbf{AAAAAA} &\textbf{BBBBB} &\textbf{CCCCC} &\textbf{DDDDD DDDDDD} &    \textbf{EEEE EEEEEEE} & \textbf{IFFFF ffff} &\textbf{EEEEEEEEE}\\
\midrule
\endhead

\midrule
\multicolumn{2}{r}{\footnotesize\itshape\tablename~\thetable:
Continued on next page} \\
\endfoot
% piede finale
\bottomrule
\multicolumn{2}{r}{\footnotesize\itshape\tablename~\thetable:
It ends from the previous page.} \\
\endlastfoot
% corpo della tabella
AAAAAA al. & AAAAAA & BBBBBBB & description description description description & description description description description description & bbbbbbb & aaaaaa and bbbbb\\

\hline
AAAAAA al. & AAAAAA & BBBBBBB & description description description description & description description description description description & bbbbbbb & aaaaaa and bbbbb\\

\hline
AAAAAA al. & AAAAAA & BBBBBBB & description description description description & description description description description description & bbbbbbb & aaaaaa and bbbbb\\

\hline
AAAAAA al. & AAAAAA & BBBBBBB & description description description description & description description description description description & bbbbbbb & aaaaaa and bbbbb\\

\hline
AAAAAA al. & AAAAAA & BBBBBBB & description description description description & description description description description description & bbbbbbb & aaaaaa and bbbbb\\

\hline
AAAAAA al. & AAAAAA & BBBBBBB & description description description description & description description description description description & bbbbbbb & aaaaaa and bbbbb\\

\hline
AAAAAA al. & AAAAAA & BBBBBBB & description description description description & description description description description description & bbbbbbb & aaaaaa and bbbbb\\

\hline
AAAAAA al. & AAAAAA & BBBBBBB & description description description description & description description description description description & bbbbbbb & aaaaaa and bbbbb\\

\hline



\end{longtable}
\endlandscape

Can you help me? Thanks in advance

  • 1
    Use a larger number in the \multicolumn declaration of the footer. – Ulrike Fischer Nov 21 '15 at 11:28
  • I'm not sure I fully understand your suggestion. I modified my code in this way: \multicolumn{4}{r}{\footnotesize\itshape\tablename~\thetable: (i replaced 2 with 4 in the three declaration of the footer) but in this way the columns are overlapped. Can you help me? – Laura Nov 21 '15 at 13:57
  • 1
    Make the BBB column larger again, 0.5cm is not enough. – Ulrike Fischer Nov 21 '15 at 14:03
  • why don't you use l and let the table make columns that match the data rather than specifying the column width with p{0.5cm} and then saying teh column is too wide? – David Carlisle Nov 21 '15 at 19:15
  • \landscape .. \endlandscape is wrong and will have weird effects in the rest of the document. use \begin{landscape}.. \end{landscape} – David Carlisle Nov 21 '15 at 20:24
2

for single-line entries it's more natural to use l and let the table find the natural width of the content, also you need to allow the note in the foot to span more columns. Also landscape is an environment.

enter image description here

\documentclass{article}

\usepackage{longtable,pdflscape,booktabs}

\begin{document}
\begin{landscape}
\begin{longtable}{lllp{2cm}p{4cm}lp{3.5cm}}

\caption{Table name.......................}
\label{tab:Summary} \\

\toprule
\textbf{AAAAAA} &\textbf{BBBBB} &\textbf{CCCCC} &\textbf{DDDDD DDDDDD} &    \textbf{EEEE EEEEEEE} & \textbf{IFFFF ffff} &\textbf{EEEEEEEEE}\\

\midrule
\endfirsthead
% intestazione normale
\multicolumn{7}{l}{\footnotesize\itshape\tablename~\thetable:
continued from previous page} \\
\toprule
\textbf{AAAAAA} &\textbf{BBBBB} &\textbf{CCCCC} &\textbf{DDDDD DDDDDD} &    \textbf{EEEE EEEEEEE} & \textbf{IFFFF ffff} &\textbf{EEEEEEEEE}\\
\midrule
\endhead

\midrule
\multicolumn{7}{r}{\footnotesize\itshape\tablename~\thetable:
Continued on next page} \\
\endfoot
% piede finale
\bottomrule
\multicolumn{7}{r}{\footnotesize\itshape\tablename~\thetable:
It ends from the previous page.} \\
\endlastfoot
% corpo della tabella
AAAAAA al. & AAAAAA & BBBBBBB & description description description description & description description description description description & bbbbbbb & aaaaaa and bbbbb\\

\hline
AAAAAA al. & AAAAAA & BBBBBBB & description description description description & description description description description description & bbbbbbb & aaaaaa and bbbbb\\

\hline
AAAAAA al. & AAAAAA & BBBBBBB & description description description description & description description description description description & bbbbbbb & aaaaaa and bbbbb\\

\hline
AAAAAA al. & AAAAAA & BBBBBBB & description description description description & description description description description description & bbbbbbb & aaaaaa and bbbbb\\

\hline
AAAAAA al. & AAAAAA & BBBBBBB & description description description description & description description description description description & bbbbbbb & aaaaaa and bbbbb\\

\hline
AAAAAA al. & AAAAAA & BBBBBBB & description description description description & description description description description description & bbbbbbb & aaaaaa and bbbbb\\

\hline
AAAAAA al. & AAAAAA & BBBBBBB & description description description description & description description description description description & bbbbbbb & aaaaaa and bbbbb\\

\hline
AAAAAA al. & AAAAAA & BBBBBBB & description description description description & description description description description description & bbbbbbb & aaaaaa and bbbbb\\

\hline



\end{longtable}
\end{landscape}
\end{document}

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.