TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
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. – yo' 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. – yo' 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

The tabularx package provides the tabularx environment with the format

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

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.

share|improve this answer
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

Once I had a package that measured the table and tried in turn normal, sideways, smaller font or longtable to see what fitted best. Not sure what happened to that, I think it is on ctan somewhere:-). If you want the column widths to adjust to the amount of data in the column tabulary is probably better than tabularx.

share|improve this answer
Hi David, How can I decide between tabulary and tabularx? – Tal Galili Feb 3 '12 at 19:49
@TalGalili How do you decide between blue and green:-) They are just different, both aim to make a table of a specified width, TX aims to distribute the widths evenly over the columns, TY aims to chose column widths to make the colums with more data wider. In any given case, if you chose one, you'll wish you used the other. – David Carlisle Feb 3 '12 at 20:28

to do this with tabularx: 1. on lyx go to documents -> settings -> Latex preamble. there should be a text box there. put this text in the box:

%% Hack by Heiko Oberdiek (on de.comp.text.tex)

%% Redefine the standard table

%% The width of the table. Adjust if needed


now click OK.

  1. create your table.
  2. right click the table and go to more -> settings -> Table settings under column settings, find the box next to "latex argument" and write "X" in it.
  3. you may need to repeat this for every column of your table.

done! this should evenly spread all columns within the line width.

share|improve this answer

Your Answer


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.