# Dealing with a wide table that exceeds the document margins

I am looking for "global" and "local" solutions to the case where I have a table that goes "much" beyond the right and left margins of the page (meaning: cases where having no margins to the page would not solve the problem).

Such solution can include:

• Reducing the font size of the text inside the table.
• Making the table cells to implement some sort of "wordwrap" solution. (I found such a solution here.)

I would appreciate any help with mentioning other solutions that I might have overlooked, and on how to implement the two options I mentioned above.

-
Place it in a box and scale it \scalebox{\textwidth}{... your table here}. –  Yiannis Lazarides Feb 3 '12 at 17:48
Another option would be tabularx or tabulary. Also, one could modify the horizontal column padding. –  Werner Feb 3 '12 at 18:02
@YiannisLazarides This is really frowned upon in my opnion, unless the table contains something that nobody would read, but in that case you don't need that table. –  tohecz Feb 3 '12 at 18:03
On of the best things you can to is to use sidewaystable floating environment from rotating package. This allows the table to be typeset rotated, hence having much larger width. In the case the table is too long as well, you can combine it with longtable package and split the table to multiple pages. –  tohecz Feb 3 '12 at 18:06
@tohecz I am also not very fond of such solutions, but given a well designed table that needs 3-5% correction this is an acceptable solution. Without seeing the table it is difficult to say. –  Yiannis Lazarides Feb 3 '12 at 18:08
show 1 more comment

The tabularx package provides the tabularx environment with the format

\begin{tabularx}{<width>}{<col spec>}
% tabularx contents
\end{tabularx}


It also provides the X column type that stretches the column to fill the remaining length of <width> given the other elements in <col spec>. It is most often used with <width> given as \linewidth (or \textwidth) which allows the table to fit within the text block horizontally.

A similar approach and interface exists when using the tabulary package.

Another attempt at fitting the table within the text block margin (horizontally) would be to modify the padding inserted between columns. This is given by \tabcolsep. Default is 6pt for the standard document classes. However, reducing this might only help if the table is marginally too large.

-
actually latex puts in 2\tabcolsep even without the rules so the spacing isn't increased that much. In standard tabular it doesn't increase at all as the rules overprint the tabskip glue. In array package based environments the spacing is increased by the width of the ruke. –  David Carlisle Feb 3 '12 at 19:50
@DavidCarlisle: Thanks for correcting me! –  Werner Feb 3 '12 at 19:57