tags:

views:

261

answers:

3

I have some trouble with tables in LaTeX. My table has 4 columns. The are too broad to fit the \textwidth, so I searched for a line break and found \tabularnewline. Now the content in the first column breaks into 2 lines but the content in the other 3 columns is now at the bottom of the cell. I would like to center it in the column, or at least it should be at the ceiling. How can I do that?

I tried tabular, tabular* and tabularx. I would like to write as little commands as possible. Is there maybe a way to do it similarly easily as in HTML?

A: 

Not as easy as I hoped it would be but \multirow does exactly what I wanted.

DaClown
A: 

Did you try using the paragraph format specifier for one or more of the columns?

That is p{<length>} as in:

\begin{tabular}{|rrp{4.5cm}l|}
  ...

Multirow seems like overkill for most of the use cases I am envisioning.

NB: The "length" can be computed from other values as is 0.4\textwidth, but is always a constant. Don't know off hand how rubber reacts in this case.

dmckee
I tried that, but all examples I found use fixed values which I find unfunctional. Also the cell content wasn't in the vertical center.
DaClown
Ah, well. Fixed values are the part and parcel of the `p` specifier, which is why I avoid them when possible. I think you can use the usual formatting commands to adjust how things layout inside the each cell.
dmckee
+1  A: 

\usepackage{array} in your preamble

then you can use \begin{tabular}{c c m} -- the 'm' will give you vertical middle alignment. also: 't' will give you top alignment, and 'b' will give you bottom.

Mica
\begin{tabular}{c c m} does not work. Do I have to specify a width for "m"?
DaClown
oh... yes i believe you do. sorry. it works like p{width}
Mica