I have a sentence in a table that is too long and makes my table go out of the page. How can I make the sentence divide into several lines so it doesn't ruin the layout of the table?
\begin{table}[!htb]
\caption{}
\centering
\begin{tabular}{llll}
\hline
Material & Production & Description & Reference \\
\hline
& a bene placito a bene placito a bene placito a bene placito & & \\
\hline
\end{tabular}
\end{table}
Thanks in advance.
Best Answer
Use
p{<width>}
for the column that has the long sentence. The width may be in cm, pt or another width that is valid for LaTeX.To have a nicer tabular, I suggest loading the
array
andbooktabs
packages, and use\toprule
,midrule
andbottomrule
instead of\hline
.p{}
-columns are set justified by default, so you may also consider to set the wide column ragged right. Standard LaTeX\raggedright
does not hyphenate word, so if your text is very ragged, you need hyphenation in the ragged column. Load the package ragged2e in the preamble and use the command\RaggedRight
instead of\raggedright
. In your example, you will no see any difference, but try a narrow column with some long words. Here is a modified MWE: