[Tex/LaTex] Line break in the table item

horizontal alignmentline-breakingtables

I am creating table in LaTeX and I need to get the text to perform line break automaticaly when it's too long. And if possible, I'd like to get the text alignment to the left. Is it possible to handle this situation?

Best Answer

LaTeX needs to know where it should break the line, so you have to specify the width of the cell. You could use p columns, such as:

\begin{tabular}{p{3cm}...}

Similar to a parbox of 3 cm width, the text is automatically wrapped and left aligned. Even more, it's fully justified.

Here's an example:

\begin{tabular}{|l|c|r|p{1.7cm}|}
  \hline
left & centered & right & a fully justified paragraph cell\\
\hline
  l & c & r & p\\
  \hline
\end{tabular}

enter image description here

Note: those separation lines are just for showing the cell dimensions, I don't recommend to use such lines in tables, especially not the vertical ones.

You can see this and further examples of tables and explanation here: Creating tables with LaTeX.

Related Question