[Tex/LaTex] Vertical alignment in tables

tablesvertical alignment

I would like to create a table where I control the height of the cells and wish to vertically center all the cells. At first sight, the issue here might look quite similar to Problem with Table Vertical Alignment but the solution proposed there doesn't fit my problem.

A minimal example is given below. The issue is that the two first columns are correctly centered but not the last one.

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

Does anyone understand what is wrong here ? Any pointers would be greatly appreciated.

Best Answer

Please always post complete documents showing all packages used (I happen to notice array package usage here but you didn't mention it as a requirement/)

Easiest workaround is to have an extra unused column that takes the \\ spacing:

But note that the argument to \\ doesn't add that amount of extra space, it just increases the standard strut depth by that amount so it doesn't have any effect unless the strut is deeper than the depth of the m entries.

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