The Lazy Economist

Thoughts on Modelling, Statistics, and Efficient Working Habits

<a href=The Lazy Economist" width="1000" height="288" />

Automatic line breaks in LaTeX tables

Posted on August 7, 2019 by admin

Tables with lots of text in LaTeX often lead to tables that do not fit on a page. This post shows how to produce tables with automatic line breaks. Here is a simple example of a badly formatted table:

The tabularx package has the possibility to break lines automatically by using the column specifier X:

\ begin < table >[ ! htbp ] Number & Description \ \

1 & This is a mighty long text that could go over multiple lines but in a normal table is shown on one line and therefore the table does not fit on the page \ \

2 & This is a mighty long text that could go over multiple lines but in a normal table is shown on one line and therefore the table does not fit on the page \ \

3 & This is a mighty long text that could go over multiple lines but in a normal table is shown on one line and therefore the table does not fit on the page \ \

\ bottomrule

This results in the following table:

Another option is defining a new command to let you set the width of the columns: