I would like to use a DeclareDocumentCommand in order to be able to define a different command (using arguments from the first). I would like to make the internal arguments long. Here is the code I have as well as the output.
\documentclass{article}
\usepackage{xparse}
\begin{document}
\DeclareDocumentCommand{\DC}{m}{%
\DeclareDocumentCommand{#1}{+m}
{%
##1
}
}
\DC{test}
\test{Will this
break?}
\end{document}
and I get an "unknown argument type e" error.
However if I do
\documentclass{article}
\usepackage{xparse}
\begin{document}
\DeclareDocumentCommand{\test}{+m}{%
#1
}
\test{Will this
break?}
\end{document}
It works fine.
\DC{\test}
– Andrew Stacey Jul 8 '14 at 9:26t
) is being picked up as the name thene
is parsed as an arg spec. (Arguably we should trap this.) As @LoopSpace says, if you want to define one command using another you need to give the command name. However, this looks borderline for usingxparse
: without context, it's hard to see how this is a 'well-defined' document command. – Joseph Wright♦ Jul 8 '14 at 9:38\DC{\test}
over\NewDocumentCommand{\test}{+m}{#1}
? – egreg Jul 8 '14 at 10:48