Vertically center cells of a table?

Vertically centering cell entries is possible via the m{<width>} column type from the array package. Horizontal centering is obtained by prepending the column entries with \centering\arraybackslash (also supported by array). For completeness and brevity, the MWE below defines the new column type M which does all of the above:

enter image description here

\documentclass[a4paper]{article}
%\usepackage{showframe}% http://ctan.org/pkg/showframe
\usepackage[margin=1.0in]{geometry}% http://ctan.org/pkg/margin
\usepackage{booktabs}% http://ctan.org/pkg/booktabs
\usepackage{array}% http://ctan.org/pkg/array
\newcolumntype{M}{>{\centering\arraybackslash}m{\dimexpr.25\linewidth-2\tabcolsep}}
\begin{document}
\begin{table}[ht]
  \centering
  \begin{tabular}{MMMM}
    \toprule
    A & B & D & E \\
    \midrule
    \rule{15pt}{10pt} & One & Two & Three \\ 
    \rule{15pt}{10pt} & Three & One & Two \\ 
    \rule{15pt}{10pt} & Two & Three & One \\ 
    \bottomrule
  \end{tabular}
\end{table}
\end{document}​

For images, I've used \rule{15pt}{10pt}, although the above solution works for any image size.

The table width is also chosen to fit exactly within the text block, making each of the four columns the same width (.25\linewidth-2\tabcolsep). To see this, uncomment the showframe package which highlights the text block boundary.


Images are always set with their base on the baseline (if they aren't rotated). So what you need is to lower the graphics; the easiest way is to say

\raisebox{-.5\height}{\includegraphics[scale=0.35]{img1.eps}}

If the height of the row is to be taken into consideration, then a slightly more complex calculation is necessary:

\raisebox{\dimexpr-.5\height+.5\ht\strutbox\relax}
  {\includegraphics[scale=0.35]{img1.eps}}

The adjustbox package has many features that ease this kind of job; after \usepackage{adjustbox} you can say

\adjustbox{valign=m}{\includegraphics[scale=0.35]{img1.eps}}