1

I created a post earlier on the same topic (Vertical alignment in tables). I got an answer but it triggered another question.

Below the solution that has been provided. I would expect vertical centering but the text goes on top of each cell. Playing with p, m, and b to align vertically doesn't seem to work here. I have probably missed something...

\documentclass{article}
\usepackage[english]{babel}
\usepackage{array}

\begin{document}

\begin{tabular}{ |m{2cm}|m{2cm}|m{2cm}|@{}l@{}}
   \hline
     x &
     x &
     x &\\[5mm]
   \hline
\end{tabular}

\end{document}

1 Answer 1

2

enter image description here

As seen in the second row, the m column type is giving vertical centering of the cells, however the extra space from \\[..] is added afterwards so if your entries are only one line b and p are the same thing (and m isn't very different). As I noted in a comment on the previous answer, because m cells typically have large depth, you typically need to use a large value in the optional argument of \\[] before increasing the depth of the strut makes any difference. Or better try to avoid using the optional argument of \\ in tables.

2
  • Thanks for the explanations. So \\[..] is added afterwards and therefore m doesn't take the full height into account. Is that correct ? Is there another way to specify the height that would be considered by the m ?
    – ed82
    Commented Jan 21, 2013 at 17:10
  • If you don't use \\[] and do use \arraystretch the strut is enlarged for all rows and in p/m/t columns the first column gets a strut with the height and the last row gets a strut with the depth, but often simpler is just in any cell of the row use \vspace*{2cm} before and/or after the main text of the entry, that has a more direct effect and the space probably increases in a way that is more predictable Commented Jan 21, 2013 at 17:14

You must log in to answer this question.

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