TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.)

share|improve this question
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. – Peter Grill Feb 11 '13 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.) – Lover of Structure Feb 11 '13 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... – Peter Grill Feb 11 '13 at 4:44
up vote 8 down vote accepted

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.

share|improve this answer

As we can fool the compiler as follows,


Does starred version matter? :-)

share|improve this answer
Um, I think you know that starred \newcommand* (and \DefineRobustCommand*) are just to aid error checking. But +1 for the wit. – Lover of Structure Feb 11 '13 at 5:40

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.