[Tex/LaTex] Dealing with a wide table that exceeds the document margins

marginstablesxtable

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.

Best Answer

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.

Related Question