I want to create a new command to set the column colour, but it's causing the following error:
! Undefined control sequence.
\redcolumn ->\columncolor
{red}
l.10 A & B
\\
I don't know if it's because I'm calling a command with a parameter or because of where I'm trying to call the new command, but here's the source code:
\documentclass[letterpaper,20pt]{extarticle}
\usepackage[table,xcdraw]{xcolor}
\newcommand{\redcolumn}{\columncolor{red}}
\begin{document}
\begin{tabular}{l >{\columncolor{red}}l}
A & B \\
\end{tabular}
\begin{tabular}{l >{\redcolumn}l}
A & B \\
\end{tabular}
\end{document}
The first tabular uses \columncolor, and it works. The second uses my new command, and it fails. How have I misunderstood \newcommand?
\newcolumntypedoes what I need. – Don Kirkby Nov 17 '15 at 07:11