7

The xparse documentation gives examples of names of \NewDocumentCommands enclosed in braces, and without braces, as demonstrated in the two commands below. Is there any difference in functionality whatsoever between the two? I never use braces and better be safe than sorry.

\documentclass{article}
%=======================
\usepackage{xparse}
%-----------------------
\ExplSyntaxOn
\NewDocumentCommand\myExp{m}{#1}
\NewDocumentCommand{\myExpAlt}{m}{#1}
\ExplSyntaxOff
%-----------------------
\begin{document}
  \myExp{101}

  \myExpAlt{123}
\end{document}

1 Answers1

5

There is no difference, similar to the notation used with \newcommand and friends, as long as you pass it a control sequence. Technically you're passing an argument to \newcommand, which is then set using \def internally, so you should use {<csname>}. However, if you don't use braces, the first token is grabbed.

Werner
  • 603,163