Is there any option in tabular that can move the whole word to the next line whenever the length of the word is greater than the fixed cell size?
Currently I use
\begin{tabular}{ | p{2cm} | }
And that results in this format
+---------+
| First t-|
| hing |
+---------+
However I am looking for this shape
+---------+
| First |
| thing |
+---------+
Best Answer
You can use
\raggedright
:The second
tabular
will include a\raggedright
in each cell of thep
column, which will avoid the hyphenation.Note that you need to load the
array
package for this to work. You also need\arraybackslash
in at least the last column to have\\
correctly end the table row.Output:
If you need this for just a few cells, you can also use
\raggedright
in these cells:If it's more than one column, you can also define your own column type: