m column doesn't center text vertically

I want vertically centered text in a simple table like this:

\documentclass{article}
\usepackage{array}
\newcolumntype{Z}{>{\centering\arraybackslash}m{0.2cm}}

\begin{document}
\begin{tabular}{|Z|Z|Z|Z|}
\hline
4 & 3 & 2 & 1 \\
\hline
\end{tabular}

\end{document}


but the text is not vertically centered, it almost touches the upper hline. What should I do to fix this?

1 Answer

The paragraph box containing the cells is vertically centred (using \vcenter) But that isn't the same thing as centring the digits in the actual content, note that a line box is the same height whether the content is ( or 1 or .

You can add

\setlength\extrarowheight{2pt}


before the table to get a better appearance.