Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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 ...     |
-----------------------------------------
share|improve this question

1 Answer 1

up vote 1 down vote accepted

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?

share|improve this answer
    
accepted answer for 'hence p and b work the same way'. Seems I cannot do what I wanted. –  Hans-Peter Aug 20 '12 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. –  David Carlisle Aug 20 '12 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... –  Hans-Peter Aug 22 '12 at 17:19

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.