1

According to http://en.wikibooks.org/wiki/LaTeX/Tables ('The tabular environment' paragraph), I would have expected to be able to use 'p', 'b', 'm' to define vertical text alignment for a column. This Problem with Table Vertical Alignment question from 2010 tells otherwise and provides (a bit inflexible) workarounds.

My question is, if there is something simple to vertically (top, bottom, center) align text in a cell?

Here my code (which aligns 'middle, middle, top', i.e. 'p b m' doesn't work at all...):

\documentclass[10pt]{article}
\usepackage{array}
\begin{document}

\begin{tabular}{|p{4cm}|b{4cm}|m{5cm}|}
\hline
  xxx & ab cd ... & ef gh ... \\[10ex]
\hline
  xxx & ij kl ... & mn op ...\\
\hline
\end{tabular}

\end{document}

(I also tried with \parbox and \newcolumntype to no avail, \multirow could be an option but didn't try out yet).

Edits: I'd like to achieve the following (as simple as possible;):

-----------------------------------------
| xxx       |           |               |
|           |           | ef gh ...     |
|           | ab cd ... |               |
-----------------------------------------
| xxx       | ij kl ... | mn op ...     |
-----------------------------------------

1 Answer 1

1

enter image description here

You say "it doesn't work" but you did not say what effect you wanted. Your table cells are single line entries so aligning on the top or bottom line of the cell is the same thing, hence p and b work the same way. The reaction between m and \\[10ex] is slightly caustic but the behaviour of \\[10ex] in tables is fairly weird at the best of times.

What alignment were you trying to achieve?

3
  • accepted answer for 'hence p and b work the same way'. Seems I cannot do what I wanted.
    – h2459jl
    Aug 20, 2012 at 9:15
  • Tex is Turing complete so you can always do what you want:) But you need to say what that is. It is very hard to tell given one line cells what alignment you want, if you edited the question (or asked a new one) someone would be able to help. Aug 20, 2012 at 9:33
  • I added 'Edits: I'd like to...' <a table figure> to my question (some days ago) in the hope to illustrate what I want...
    – h2459jl
    Aug 22, 2012 at 17:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .