18

I'm aware that my table is too wide as it keeps going off the page on the right.

Is there a way to fix this?

I'm using lyx as I am a learner.

1

2 Answers 2

11
\noindent\resizebox{\textwidth}{!}{%
... your tabular ...
}

In LyX insert the two lines in ERT (Evil Red Text) mode (Ctrl-L) just before and after your tabular. In the documents preamble add \usepackage{graphicx} if not already present.

This is how you add a new package: Use custom latex package in LyX

9
  • it works! but I'm getting a compilation error on lyx. Any idea on how to solve it? (again, it is able to compile the pdf)
    – Rho
    Jul 6, 2014 at 17:45
  • what error message? Did yoo loaded graphicx?
    – user2478
    Jul 6, 2014 at 19:28
  • If you are getting an error. Try switching out of longtable mode by right clicking the table-->More-->Settings-->and unchecking longtable Mar 10, 2016 at 4:08
  • This does the wrong thing. It scales the entire table instead of doing overflow in the columns. Oct 5, 2016 at 10:31
  • it depends on what you want!
    – user2478
    Oct 5, 2016 at 10:49
9

You can fix the width of the table to fit the width of your general text.

To fix the width of the table in LyX 2.0, right-click in a cell in the column, move to More... and choose Settings.... In the Table Settings tab, you can set the value near the bottom, under Table-wide settings.

This, however, will set the width of your table, but not the content of the table. If, e.g., you have a cell with a lot of text that extends beyond the margin, then also pick a width for that (those) column(s) under Column settings in the same tab. This will also allow line breaks in the text.

1
  • 2
    That should be the selected answer, as the current one doesn't use LyX capabilities, but hard coded directives \noindent\resizebox
    – mins
    Apr 29, 2023 at 11:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .