# Why does >{\centering} in my column spec produce an error?

I want to create a column in a tabular with column specifier 'p' and centred text. I have tried to achieve this using the example below.

\documentclass{article}

\usepackage{array}

\begin{document}

\begin{table}
\begin{tabular}{c l >{\centering}p{2cm}}
a & b & c \\
a & b & c
\end{tabular}
\end{table}

\end{document}


Why does this create the following error, and what is the correct way to do this?

! Extra alignment tab has been changed to \cr.

l.10     a &
b & c
You have given more \span or & marks than there were
in the preamble to the \halign or \valign now in progress.
So I'll assume that you meant to type \cr instead.


I'm using Miktex 2.9

\documentclass{article}
\usepackage{array}
\begin{document}

\begin{tabular}{ c l >{\centering\arraybackslash}p{2cm}}
a & b & c \\
a & b & c
\end{tabular}

\end{document}


\centering redefines the double backslash. However, a better choice is to use

\documentclass{article}
\usepackage{array,ragged2e}
\begin{document}

\begin{tabular}{ c l >{\Centering}p{2cm}}
a & b & c \\
a & b & c
\end{tabular}

\end{document}

• Thanks, since you answered I have also discovered another option would be to use the \tabularnewline command instead of \\ in the table but your solution is better. Feb 13, 2012 at 14:22
• tabularnewline does nearly the same as \arraybackslash once
– user2478
Feb 13, 2012 at 15:29