# Custom macro for multicolumn with & without xparse

The following example has two normal LaTeX \newcommand macros and two xparse \NewDocumentCommand for specifying multicolumn text. The only difference between each pair of commands is one has the alignment character as part of the macro and one does not. However, the xparse version that requires the alignment character to be outside of the macro does NOT work and results in Misplaced \omit. error.

\documentclass{article}
\usepackage{xparse}

\newcommand{\MulticolumnA}[3]{&\multicolumn{#1}{#2}{#3}}
\newcommand{\MulticolumnB}[3]{ \multicolumn{#1}{#2}{#3}}

\NewDocumentCommand{\MulticolumnX}{m m m}{&\multicolumn{#1}{#2}{#3}}
\NewDocumentCommand{\MulticolumnY}{m m m}{ \multicolumn{#1}{#2}{#3}}

\begin{document}
$\begin{tabular}{lllllll} {a} \MulticolumnA{4}{l}{A-abcdefghijkli}\\ {a}&\MulticolumnB{4}{l}{B-abcdefghijkli}\\ {a} \MulticolumnX{4}{l}{X-abcdefghijkli}\\ %{a}&\MulticolumnY{4}{l}{Y-abcdefghijkli}\\ {col1}&col2&{col3}&{col4}&{col5}\\ \end{tabular}$
\end{document}

Above compiles as is, but does not compile if the one line is uncommented.

-