Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I have a table that is very wide. Now I want to force it into one landscape page. I already set the page orientation to landscape but now I don't know how to force it into one page with scaling. Any hints?

share|improve this question

2 Answers 2

up vote 12 down vote accepted

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.

share|improve this answer
    
Thanks the adjustbox solution works. I just exchanged \textwidth and \textheight. But I don't know why but I had to use width = 0.9999 * \textheight to avoid an empty page before the table. –  RoflcoptrException Sep 22 '11 at 15:12
    
Maybe you have a hidden space somewhere? –  Martin Scharrer Sep 22 '11 at 15:27
    
What about fitting a table/figure (outside of a float) in a page along with the Section or Sub-Section title? I can see no success using \enlargethispage and \enlargethispage*, negative and positive \vspace(s) before and after the table/figure, \Needspace*{} and others. Is it possible to just subtract the "vertical space" occupied by the Section title and automatically scale the table/figure to the remaining height (by keeping, of course, its aspect ratio intact)? –  Nikos Alexandris Dec 8 '11 at 11:41
    
@NikosAlexandris: You can use \dimexpr\textheight-2\baselineskip\relax instead of only \textheight to reduce the height by about two lines (or any other length). –  Martin Scharrer Dec 8 '11 at 11:50
    
@MartinScharrer: The desired effect concerning the size of the table(s), for example, is achieved. Visually my two (sub-)tables within one (rotated) float seem to fit along with the Section title. However, pdflatex prefers to push the tables in the next page leaving a body-less heading. Also, the rotated caption of the figure-float is as long as the textheight! Should I just use \captionof and forget floating? –  Nikos Alexandris Dec 9 '11 at 12:20

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.