Wednesday, 7 August 2013

Vertical spacing of cells containing a parbox

Vertical spacing of cells containing a parbox

I have a complicated longtable with several levels of nested tabular
environments. To get text wrapping inside cells and have the contents
aligned at the top I use \parbox[t][][t], however, the height of the
parbox is computed without any margin such that the following \hline
overlaps with the text.
A minimal example to reproduce this behavior is
\begin{tabular} {|p{0.2\textwidth}|}
\hline
This cell looks good. \\
\hline
\parbox[t][][t]{1.0\linewidth}{
Not so happy with this result.
} \\
\hline
\end{tabular}
This produces the following output (sorry, can't post images yet): image
of generated output
Of course, there is no reason to use a parbox in example above, but I need
them in the actual document.
I would like to avoid providing the height of the parbox (such as
\parbox[t][5cm][t]). Is there a clean way to add a margin either to the
bottom of a parbox or before an hline?

No comments:

Post a Comment