Tell me more ×
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.

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?

share|improve this question

1 Answer

up vote 5 down vote accepted

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.

share|improve this answer

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.