2

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.
<recently read> \endtemplate 

l.339   d &
            e & f\

1 Answer 1

5

\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).

1
  • 1
    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
    Commented Apr 12, 2012 at 8:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .