I was trying to redefine an old command \lightrule with the new syntax from xparse.
When I try to use \newlightrule unexpectedly it displays Misplaced \noalign error.
Minimal Working Example and desired result follows.
\documentclass[margin=2mm]{standalone}
\usepackage[table]{xcolor}
\usepackage{booktabs}
\newcommand{\lightrule}{
\arrayrulecolor{black!30}%
\midrule[\lightrulewidth]%
\arrayrulecolor{black}%
}
\usepackage{xparse}
\NewDocumentCommand{\newlightrule}{}{
\arrayrulecolor{black!30}%
\midrule[\lightrulewidth]%
\arrayrulecolor{black}%
}
\begin{document}
\begin{tabular}{c l}
\toprule
test & test\
\midrule
test & test\
\lightrule
test & test\
\bottomrule
\end{tabular}
\end{document}


\NewExpandableDocumentCommand. – Clara May 13 '23 at 10:44xparseunless you have an old latex release – David Carlisle May 13 '23 at 10:45