\documentclass{article}
\usepackage{array}
\usepackage{ragged2e}
% \newcolumntype{M}[1]{>{\hspace{0pt}\raggedright\arraybackslash}m{#1}}
% \newcolumntype{B}[1]{>{\hspace{0pt}\centering\arraybackslash}m{#1}}
\newcolumntype{L}[1]{>{\hspace{0pt}\raggedright\arraybackslash}p{#1}} % linksbündig mit Breitenangabe
\newcolumntype{C}[1]{>{\hspace{0pt}\centering\arraybackslash}p{#1}} % zentriert mit Breitenangabe
\newcolumntype{R}[1]{>{\hspace{0pt}\raggedleft\arraybackslash}p{#1}} % rechtsbündig mit Breitenangabe
% non working columntype pseudocode
\newcolumntype{Z}[5]{%
\ifthenelse{\equal{#2}{left}{!{\vrule width #4}>{\columncolor{#3}\raggedright\arraybackslash}p{#1}{\vrule width #5}}%
{\ifthenelse{\equal{#2}{center}{!{\vrule width #4}>{\columncolor{#3}\centering\arraybackslash}p{#1}{\vrule width #5}}%
{!{\vrule width #4}>{\columncolor{#3}\raggedleft\arraybackslash}p{#1}{\vrule width #5}}%
}%
\begin{document}
% desired results
\begin{tabular}{|L{2cm}|C{2cm}|R{2cm}}
first row & A & CC\\
second row& B& CA
\end{tabular}
% pseudocode
\begin{tabular}{|Z{2cm}{left}{white}{0}{0}|Z{2cm}{center}{white}{0}{0}|Z{2cm}{right}{white}{0}{0}|}
first row & A & CC\\
second row& B& CA
\end{tabular}
\end{document}
Is there any way to create conditional complex column types (or column types with more arguments)?
