# Uppercase column in tabular

I need one column of my table to be uppercased. My code which does not work as I want:

\documentclass{article}

\usepackage{array}

\begin{document}

\begin{tabular}{c>{\MakeUppercase}c}
a & b
\end{tabular}

\end{document}


What's the problem?

-
\MakeUppercase takes an argument. Compare by replacing \MakeUppercase with \sffamily and \textsf. –  Guido Oct 31 '12 at 22:40

Our own Martin Scharrer's collcell package is ideal for this sort of thing:

\documentclass{article}

\usepackage{array}
\usepackage{collcell}
\newcolumntype{U}{>{\collectcell\MakeUppercase}c<{\endcollectcell}}
\begin{document}

\begin{tabular}{cU}
a & b
\end{tabular}

\end{document}

-
If you use a macro like \MakeUpperCase with no {} then it will take the first token following as argument but in this case that token is not b but:
\MakeUppercase #1->\protect \MakeUppercase  {#1}

the \ignorespaces token that LaTeX places at the front of each cell so that white space after & is ignored.