Take the 2-minute tour ×
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 already checked this post in this site: Vertical centering of text within a table

What I am asking is quite similar to that question:

  1. I want all the cells to be vertically centered. This can be achieved by using the array package and the m{20em} descriptor.

  2. I want to add extra space to the rows; namely, I want the heights of the rows to be larger than default. This can be done by using

    \renewcommand{\arraystretch}{3}
    

    or

    \setlength{\extrarowheight}{3em}
    

Each of the above two requirements can be easily satisfied separately. However, if I want both effects, problems occur. The cells are not vertically centered, and the table looks really awkward as a whole!

To see the problem, the \extrarowheight needs to be set to a large value, 3em for example.

Any suggestions are welcome!

Here is an example:

\documentclass{article}
\usepackage{array}

\begin{document}

\setlength{\extrarowheight}{3em} 

%without the above command, the table looks fine.

\begin{center}

\begin{tabular}{r m{6em}}

\hline

Item 0 & bla bla \\\\

Item 1 & Long description of item 1 blaaaaaa blaaaaaaa blaaaaaaaa blaaaaaaaa blaaaaa blaaa blaaaaaaaaaa \\\\

Item 2 & blaaaaaaaaaaaa blaaaaaaa blaaaaaaaaaa \\\\

\hline

\end{tabular}

\end{center}

\end{document}
share|improve this question
    
Welcome to TeX.SE. It is always best to compose a fully compilable MWE that illustrates the problem including the \documentclass and the appropriate packages so that those trying to help don't have to recreate it. –  Peter Grill Nov 28 '11 at 22:41
    
Have a look at my answer to this question, perhaps it is useful here –  cmhughes Nov 28 '11 at 22:45

1 Answer 1

up vote 3 down vote accepted
\documentclass{article}
\usepackage{calc,array}
\newcommand{\cellstart}{\rule{0pt}{\heightof{A}+2ex}}
\newcommand{\cellfinish}{\rule[-2ex]{0pt}{2ex}}

\begin{document}


\begin{center}

\begin{tabular}{r >{\cellstart}m{6em}<{\cellfinish}}
\hline
Item 0 & bla bla \\
\hline
Item 1 & Long description of item 1 blaaaaaa blaaaaaaa blaaaaaaaa blaaaaaaaa blaaaaa blaaa
blaaaaaaaaaa \\
\hline
Item 2 & blaaaaaaaaaaaa blaaaaaaa blaaaaaaaaaa \\
\hline
\end{tabular}

\end{center}

\end{document}

Change the 2ex into what suits you.

However, I find that, in general, such a vertical centering doesn't help the readability of a table, particularly if an entry in the second column is very long.

share|improve this answer
    
Wow! That's great! It works! Thank you very much! Also thanks to @Thorsten (and maybe other guys) for editing my post! By the way, the thing I am editing is not really a table; it is actually the cover page of a document; I just want to use the tabular environment to make sure things are well-aligned. –  user789977 Nov 29 '11 at 9:03

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.