I have a table like this:
\begin{tabular}{|l|l|}
\hline
\multicolumn{2}{|l|}{\textbf{Item Name}} \\
\hline
Item Type & Item Subtype \\
\hline
\multicolumn{2}{|l|}{Item effect (long text).} \\
\hline
\multicolumn{2}{|l|}{Item description (long text).} \\
\hline
\end{tabular}
That produces this:
|-------------------------------|
| Item Name |
|-------------------------------|
| Item Type | Item Subtype |
|-------------------------------|
| Item effect (long text). |
|-------------------------------|
| Item description (long text). |
|-------------------------------|
The table will always be as wide as the longest row. In my case, the bottom two rows will often be very long, sometimes multiple sentences. But because cells do not wrap text and a row cannot change its height to accommodate that, the table will grow so wide that it leads off the right side of the page. How can I make the bottom two rows automatically wrap their text and expand the row height to match, without altering the row height of the top two rows?
Best Answer
Here is how to do it with
tabularx
: