I am applying How to fit landscape multi-page table to textwidth to fit longtable to textwidth in this example:
\documentclass{article}
\usepackage{longtable}
\usepackage{lipsum}
\begin{document}
\lipsum[1][1-4]
%\resizebox{\textwidth}{!}{
\begingroup % localize the following settings
\setlength\LTcapwidth{\textwidth} % default: 4in (rather less than \textwidth...)
\setlength\LTleft{0pt} % default: \parindent
\setlength\LTright{0pt} % default: \fill
\begin{longtable}{@{\extracolsep{\fill}}|l|rcc|rcc|rcc|rcc|}
longtable aaaaa aaaa aaaa aaa aaaa & 11.11 & 2 & 0.000 & 22.22 & 2 & 0.000 & 333.33 & 2 & 0.137 & 44.44 & 2 & 0.000\\
\end{longtable}
\endgroup
%}
\end{document}
However, the outcome shows I haven't been successful:
What is wrong?
I check the answer of @DavidCarlisle. However, the proposed manipulations cause a problem with \cline:
\begingroup % localize the following settings
\setlength\LTcapwidth{\textwidth} % default: 4in (rather less than \textwidth...)
\setlength\LTleft{0pt} % default: \parindent
\setlength\LTright{0pt} % default: \fill
\tiny
\setlength{\tabcolsep}{0.4pt}
\begin{longtable}{@{\extracolsep{\fill}}|p{3cm}|rcc|rcc|rcc|rcc|}
Sample&\multicolumn{3}{c|}{AAAA}&\multicolumn{3}{c|}{BBBB}&\multicolumn{3}{c|}{CCCC}&\multicolumn{3}{c|}{DDDDD}\\\cline{2-13}
lllllllllongtable & 11.11 & 2 & 0.000 & 22.22 & 2 & 0.000 & 33.33 & 2 & 00.00 & 44.44 & 2 & 0.000\\
\end{longtable}
\endgroup
How to avoid this problem?



tabular*,\extracolsep{\fill}}allows the table to expand to the specified width, your table is too wide, so you need to use a multi-line cell (change the firstltop{2cm}or whetever width you want) or use a smaller font such as\small– David Carlisle Apr 22 '19 at 20:57\resizebox? It works so nice. – Viesturs Apr 22 '19 at 20:59resizeboxon material that contains text as it will lead to inconsistent font sized and distances. – leandriis Apr 22 '19 at 21:00\resizeboxshould never be used for tables, as it makes the font size inconsistent. B.t. w., do you use marginal notes? – Bernard Apr 22 '19 at 21:01\smallfont size,\setlength{\tabcolsep}{4pt}to reduce the horizontal whie space between columns and ap{1.5cm}column for the first column. – leandriis Apr 22 '19 at 21:03\resizeboxto a table, I wish I'd never implemented it. You wouldn't justify a paragraph by just scaling it to an arbitrary font size, why inflict that in tables? – David Carlisle Apr 22 '19 at 21:07