2

Using array m{} to vertically align cells in a tabular, and changing row height with \\[] the last cell is not properly aligned:

\documentclass{article}
\usepackage{array}

\begin{document}
\begin{tabular}{|m{.3\linewidth}|m{.3\linewidth}|m{.3\linewidth}|}
  \hline
  A & B & C \\[1cm]
  \hline
  1 & 2 & 3 \\[2cm]
  \hline
\end{tabular}

\end{document}

Can't understand why. Any idea?

2

1 Answer 1

4

Actually you could say only the last is aligned: If you add a final column you get

\documentclass{article}
\usepackage{array}

\begin{document}
\begin{tabular}{|m{.3\linewidth}|m{.3\linewidth}|m{.3\linewidth}|@{}c@{}}
  \hline
  A & B & C& \\[1cm]
  \hline
  1 & 2 & 3& \\[2cm]
  \hline
\end{tabular}

\end{document}

enter image description here

where you can see that \\[1cm] adds space by adding a strut with depth which reacts rather strangely with m columns, especially of the added strut is actually in teh m column (ie if you have an m column as a final column.) It's usually better if you can avoid the length argument of \\ and instead use \arraystretch and/or \extrarowheight to increase the spacing.

1
  • 1
    One drawback using \arraystretch is that it does not modify the height and the depth of a row symmetrically, so that the content of a cell is no more vertically centred. If centring is important, it may be better, in my opinion, to use the cellspace package and its \cellspace[top/bottom]limit lengths.
    – Bernard
    Feb 23, 2014 at 13:55

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