I would like to know what is the best practice to do a table and a longtable in landscape mode over the full width of the page by resizing automatically my columns.
Indeed:
- I would like to use a table if I have a few rows
and
- when I have a lot of lines, I would like split correctly my table on two pages, for example.
Having evaluated several solutions, I have not obtained what I wished.
For example with the code above my table is split, i don't see the last column :
\documentclass[%
paper=A4, % paper size --> A4 is default in Germany
twoside=true, % onesite or twoside printing
openright, % doublepage cleaning ends up right side
parskip=full, % spacing value / method for paragraphs
chapterprefix=true, % prefix for chapter marks
12pt, % font size
headings=normal, % size of headings
bibliography=totoc, % include bib in toc
listof=totoc, % include listof entries in toc
titlepage=on, % own page for each title page
captions=tableabove, % display table captions above the float
draft=false, % value for draft version
]{scrbook}%
\begin{document}
\chapter{TEST}
\begin{landscape}
\begin{table}[!h]
\small % Switch from 12pt to 11pt; otherwise, table won't fit
\setlength\LTleft{0pt} % default: \parindent
\setlength\LTright{0pt} % default: \fill
\begin{longtable}{@{\extracolsep{\fill}}c*{6}{c}}
\toprule
{\bfseries Column 1 Text Text Text} & {\bfseries Column 2 Text} &
{\bfseries
Column 3 Text} & {\bfseries Column 4} & {\bfseries Column 5 Text} &
{\bfseries Column 6Text Text} & {\bfseries Column 7 Text Text}\\
\midrule
Text Text Text & Text Text& Text Text Text Text Text Text& Text Text
Text Text Text& Text & Text Text & Text \\
Text Text Text & Text Text& Text Text Text Text Text Text& Text Text
Text Text Text& Text & Text Text & Text \\
Text Text Text & Text Text& Text Text Text Text Text Text& Text
Text Text Text Text& Text & Text Text & Text \\
Text Text Text & Text Text& Text Text Text Text Text Text& Text Text
Text Text Text& Text & Text Text & Text \\
Text Text Text & Text Text& Text Text Text Text Text Text& Text Text
Text Text Text& Text & Text Text & Text \\
Text Text Text & Text Text& Text Text Text Text Text Text& Text Text
Text Text Text& Text & Text Text & Text \\
Text Text Text & Text Text& Text Text Text Text Text Text& Text Text
Text Text Text& Text & Text Text & Text \\
Text Text Text & Text Text& Text Text Text Text Text Text& Text Text
Text Text Text& Text & Text Text & Text \\
Text Text Text & Text Text& Text Text Text Text Text Text& Text Text
Text Text Text& Text & Text Text & Text \\
\bottomrule
\end{longtable}
\caption{}
\label{table:chap2}
\end{table}
\end{landscape}
\end{document}
And with lot of lines



\documentclassand end\end{document}so that it demonstrates some issue. Your code fragment doesn't show any issue at all as for example we do not know the page size, so perhaps it fits? or you just need to save 2mm or 5cm of width? But anyway you can not uselongtableinside atableenvironment use one or the other. – David Carlisle Oct 12 '17 at 18:40\LTleftis not parindent. (You do not need to reset either of those lengths or add\extracolsep) – David Carlisle Oct 12 '17 at 18:42tableenvironment that table is just too wide because the headings are so much wider than the data and set on one lineColumn 6Text Textis so much wider then the data in that column, so the fix here is specific to this table (change that heading) and probably does not apply to your real document table. – David Carlisle Oct 12 '17 at 21:09wide headingby\begin{tabular}{@{}c@{}}wide\\heading\end{tabular}but there is no general rule it is editing the content of your document for that specific table. – David Carlisle Oct 13 '17 at 06:55