## LaTeX forum ⇒ Graphics, Figures & Tables ⇒ Tabular, parbox, vertical alignment

Information and discussion about graphics, figures & tables in LaTeX documents.
cacajean
Posts: 4
Joined: Fri Feb 04, 2011 7:02 pm

### Tabular, parbox, vertical alignment

Hello,

What i want to achieve is really simple:

I want to be able to align cell content at the top (which is the default behavior of tabular) while being able to manually break lines (and anything you could normally do in a paragraph environment). For instance:

I would expect this to work:

\begin{tabular}{|r|l|}
\hline
\parbox{3cm}{\raggedleft First Line\\SecondLine} &
\parbox{5cm}{\textbf{First line goes here}\\
Second line would be here\\
And so on, ...\\
... until the very end.} \\
\hline
\end{tabular}

However this produces the following result:

The left parbox is vertically centered. During the past two days, I've searched the whole LaTeX community in vain for a solution to this problem. I've come across solutions consisting in the use of raisebox that force you to manually grope for the right difference value depending on the content of the two cells. That is no solution to me. I want this to be automatic as it is in any document editor... I would be very surprised if LaTeX didn't allow this kind of construction!

Thank you!

frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am
\documentclass{article}\usepackage{array}\begin{document}\begin{tabular}{|>{\raggedleft}p{3cm}|>{\raggedright\arraybackslash}p{5cm}|}\hlineFirst line\\ Second line&\textbf{First line goes here}\newlineSecond line would be here\newlineAnd so on, \ldots \newline \ldots\ until the very end. \\\hline\end{tabular}\end{document}

table.png (3.27 KiB) Viewed 6030 times

cacajean
Posts: 4
Joined: Fri Feb 04, 2011 7:02 pm
Thanks a lot!
This looks like it's perfectly working.
However what if I want to use an eqparbox on the first column instead?

frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am
Try it and see. (The array package uses regular parboxes in the underlying code -- see its documentation.) Without a more specific question and some sample code, I'm at a loss to know how to respond.

frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am
By the way, according to the Board Rules, when you also post the question somewhere else as well, you are supposed to tell us that.

Tabular, parbox, vertical alignment at TeX SE