Fit a table into one page
You can use the adjustbox
package with:
\begin{adjustbox}{width=\textwidth,totalheight=\textheight,keepaspectratio}
% your table
\end{adjustbox}
You can also use the graphicx
package with:
\setkeys{Gin}{keepaspectratio}
\resizebox*{\textwidth}{\textheight}{your table}
but adjustbox
is more recommended. It doesn't read the whole table as an argument.
You can also add \rotatebox{90}{..}
or the angle=90
option to the adjustbox
environment to implement the rotation.
You might need to exchange \textwidth
and \textheight
because of the landscape mode. Also you should use an approximate font size first, e.g. try \tiny
or \scriptsize
and let the rest be done by scaling. You shouldn't scale the normal font size to a very small size. Many fonts are differently designed in different sizes, so using the closest possible size yields the best results.
I assume you want to scale down just the contents of the tabular environment, while leaving the fontsize of the caption unchanged. If you use the rotating
package, you can avail yourself of its sidewaystable
environment, which automatically rotates its contents by 90 degrees. (Internally, the package relies on the graphics/x
package.) With this environment, you needn't keep track of whether \textheight
and \textwidth
need to be interchanged or not.
\begin{sideswaystable}
\caption{A very wide table}\label{tab:verywide}
\centering
\scriptsize %% or \tiny -- see remark below
\begin{tabul...
...
\end{tabul...
\end{sidewaystable}
Remark: If the tabular material has so many columns that it won't fit on a rotated page even if the fontsize has been set to either \scriptsize
or \tiny
, you may want to consider seriously breaking up the table into two subtables and displaying them separately. Realistically, very few readers are going to bother reading something in a font size smaller than 5 or 6pt. Hence, if you have to use both the \tiny
fontsize instruction as well as the \adjustbox
command with a shrinkage factor of well below 1, chances that anyone is going to read your carefully designed tabular material are, well, smaller than tiny.