Is there any reason to define a 0-argument (read: zero-argument) macro with a starred command (\newcommand* instead of \newcommand or \DeclareRobustCommand* instead of \DeclareRobustCommand)? After all, if there are no arguments, there is nothing to verify about them.

One reason to use a starred version could be consistency in the appearance of one's own LaTeX code. A reason against could be if starred variants are slower, but I don't know whether this is the case.

(This has nothing to do with the choice of starredness - \somemacro of \somemacro* - which one is defining (and how to do the latter is btw not obvious, though it's definitely possible). This is about whether the definition of \somemacro should be performed using a starred or unstarred defining command.)

  • The xparse type of commands (where O type paramter is used) use a + before each parameter to determine if they are long or not. So you can have some parameters that can have a \par and others that do not. This is not possible using LaTeX \newcommand/\newcommand* as that applies to all the parameters. Commented Feb 11, 2013 at 4:19
  • @PeterGrill Good information. But just to prevent confusion by other people, I'll draw attention to the fact that your comment uses the letter "O", not the number "0" (from my question). (There is no misunderstanding between us, but this is for others reading what we wrote.) Commented Feb 11, 2013 at 4:39
  • Ahhh.. Ok. I don't know for surem but I can't see why it would matter for a zero argument macro -- but I am only guessing... Commented Feb 11, 2013 at 4:44

2 Answers 2


Be consistent, that's all. In many occasions, parameterless macros are used as "containers"; suppose you have such a container that stores some particular string you want to compare input with:


and then you have a complicated macro taking an argument that you want to compare with \fixed:

    %% the user called \complicated{foobar}
    <do something>
    <do something else>

the \ifx comparison will return "false" even if the call is \complicated{foobar}. Why? Because \fixed is \long, while \test isn't (this is actually an issue with some tests for font attributes using the macros in the LaTeX kernel). How to solve the issue? Using \long\def\test or saying

\newcommand{\test}{} % initialization (this line is necessary)

just after \newcommand{\fixed}{foobar} and using \renewcommand{\test}{#1} in the definition of \complicated.

If you don't use a parameterless macro in this way there's no practical difference between \newcommand{\foo}{bar} and \newcommand*{\foo}{bar}: the former will only occupy a tiny bit more of memory, because TeX has to store the \long flag.


As we can fool the compiler as follows,


Does starred version matter? :-)

  • Um, I think you know that starred \newcommand* (and \DefineRobustCommand*) are just to aid error checking. But +1 for the wit. Commented Feb 11, 2013 at 5:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .