height - Vertical spacing of cells containing a parbox -
i have complicated longtable several levels of nested tabular environments. text wrapping inside cells , have contents aligned @ top use \parbox[t][][t], however, height of parbox computed without margin such following \hline overlaps text.
a minimal example reproduce behavior is
\documentclass{article} \begin{document} \begin{tabular} {|p{0.2\textwidth}|} \hline cell looks good. \\ \hline \parbox[t][][t]{1.0\linewidth}{ not happy this. } \\ \hline \end{tabular} \end{document}
this produces following output (sorry, can't post images yet): image of generated output
of course, there no reason use parbox in example above, need them in actual document.
i avoid providing height of parbox (such \parbox[t][5cm][t]). there clean way add margin either bottom of parbox or before hline?
sorry answer own question, have found solution adding vspace each cell outside parbox.
here's code:
\documentclass{article} \begin{document} \newcommand{\pb}[1]{\parbox[t][][t]{1.0\linewidth}{#1} \vspace{-2pt}} \begin{tabular} {|p{0.2\textwidth}|} \hline cell looks good. \\ \hline \pb{ i'm happy this. } \\ \hline \end{tabular} \end{document}
the output: image of generated output
i missed before because didn't have space between closing brace of parbox , vspace. turns out space crucial.
Comments
Post a Comment