\usepackage{longtable}
\begin{landscape}
\begin{table}[!htb]
\centering
\resizebox{\linewidth}{!}{%
\begin{longtable}{|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|}
% Table here
\end{longtable}%
}%
\end{table}
\end{landscape}
I am unable to get the table to span over multiple pages while fitting the table to the width of the landscape page.
Would you know how to do this, please let me know.
Best Answer
First off, don't use both
table
andlongtable
-- the two environments shouldn't (and mustn't) be nested. Separately, since alongtable
isn't a float (in the LaTeX sense of the word), there's no point providing location directives such as[!htb]
.Second, to force the width of the
longtable
environment to be equal to\textwidth
, type something likeNote that the code above also resets the
\LTcapwidth
macro; since you're working inlandscape
mode, you'll almost certainly want to override this macro's default value of 4 inches. The@{\extracolsep{\fill}}
directive, by the way, is exactly the same as what one would use in atabular*
environment. It tells LaTeX to insert\fill
-- an infinitely stretchable amount of whitespace -- in each intercolumn space.For more information on using the
longtable
environment, see the longtable user guide; if you're using TeXLive or MikTeX, the user guide may be brought up by typingtexdoc longtable
in a command window.