# Horizontal and vertical alignment of a picture in a table

I want to align a picture in a cell of a table. Following works as I want for the text in the top left cell and the picture is already vertically aligned, but not horizontally:

\begin{tabular}{m{0.04\textwidth}|m{0.325\textwidth}|m{0.6\textwidth}}
\toprule
\centering{a} & b & \includegraphics[draft]{test}\\ \midrule
d             & e & f\\
\bottomrule
\end{tabular}


However placing \includegraphics{test} into a \centering{} results in following error message:

! Misplaced \noalign.
\midrule ->\noalign
{\ifnum 0=}\fi \@aboverulesep =\aboverulesep \global \@...
l.338 ...test}}\\ \midrule
?
! Extra alignment tab has been changed to \cr.

l.339   d &
e & f\\

-

\centering does not take an argument, making \centering{a} be no different from \centering a. Also, \centering used in your instance has no effect within a tabular. Horizontal \centering is obtained using

\hfill\includegraphics[..]{...}\hfill\null


Alternatively, if you want the entire column to use \centering, you can use

>{\centering\arraybackslash}m{..}


as the column type (the above support is also provided by array).

-
Thank you. I've just found a tex-faq discussing the problem of “misplaced \noalign” complaints when using \centering, \raggedright, \raggedleft` in a table. –  Hotschke Apr 12 '12 at 8:41