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

If an original definition of a command used \newcommand, is there an obligation for me to redefine it with \renewcommand instead of \renewcommand*?

If an original definition of a command used \newcommand*, is there an obligation for me to redefine it with \renewcommand* instead of \renewcommand?

Note that I am not asking about replacing a command \somecommand by \somecommand* or vice-versa (which is incidentally tricky and also amounts to adding a command with a technically different name). I am instead asking about whether the subtle changes in semantics of \somecommand effected by the * in the command's redefinition are a syntactic (or other type of) problem for LaTeX.

share|improve this question
I'm guessing the answer is "no", but it doesn't hurt to verify. I don't know how commands are processed internally. – Lover of Structure Feb 11 '13 at 4:10
I think the only possible issue is for a case where the original definition was \newcommand as that would allow a \par in the input, but with the redefinition using \renewcommand* you no longer allow that, so perhaps some portion of the input the was working before will now fail. I normally try to match the previous definition as there should be a reason to decide to chose the * or non * version. – Peter Grill Feb 11 '13 at 4:15
@PeterGrill That would mean the answer is "no": the reason for using a * in your example would be the semantics/content of the command, not an underlying (La)TeX constraint (such as some internal flag in a hash table being permanently set). – Lover of Structure Feb 11 '13 at 4:24
Yes, but if you are redefining something that is used in other packages you could possible break things by adding a * to something that was originally defined without a *. I don't think there are any checks to ensure that the number of parameters or types at all match the initial definition. The only check is if the macro already exists or not (hence the value of \renewcommand). Similar to the value of \newcommand to ensure that the macro did not already exist. – Peter Grill Feb 11 '13 at 4:24
@PeterGrill I would claim that your concern can be subsumed by the "semantics" category. But your points that (1) one needs to watch out for usage in other packages and (2) that there exist no checks for a changed number of arguments upon a command's redefinition are very good. – Lover of Structure Feb 11 '13 at 4:33
up vote 8 down vote accepted

In the case outlined in the question, a macro that is 'short' is redefined to be 'long':



\renewcommand{\foo}... % Now 'long'

If we assume that the fundamental meaning of \foo is not being altered, then anything which was valid as input for the original version is still valid with the new one. The old \foo did not accept \par, so with no change in semantics the new \foo should not get any \par tokens and the fact that it's now long will not make a difference. Of course, it does mean that we can't rely on TeX spotting a missing } or whatever.

A change the other way around:



\renewcommand*{\foo}... % Not 'long' any more

may of course lead to an issue if \foo can logically take \par tokens in arguments.

One thing to watch here is that even with identical definitions, long and short macros are not 'equivalent', even if there are no arguments. Thus

\newcommand{\fooa}{Some stuff}
\newcommand*{\foob}{Some stuff}

gives FALSE. As a result, if any other code wants to test the definition of \foo and you've altered it from 'short' to 'long', the test will fail quite apart from any change in the actual code. For that reason alone, I'd tend to maintain the 'long' status of any macro I redefine.

share|improve this answer
The last point comes up when macros are used as storage variables: there are some in the font system in the LaTeX kernel that are long for some reason, and so you have to test against long macros. – Joseph Wright Feb 11 '13 at 8:12
One minor informational addendum: If I do \renewcommand[*]{\somecommand}... with a starredness different from before, it is probably the case that my new definition contains original content in a way that it's nearly always different from anything else stored in (La)TeX's table of commands. So, this is usually not a practical problem when I've personally authored the new definition body. // In any event, your "One thing to watch" paragraph has exactly the type of detail I was looking for. – Lover of Structure Feb 11 '13 at 9:25
By the way, an elaboration of Joseph Wright's point about fonts is found in user egreg's answer here. – Lover of Structure Feb 11 '13 at 10:08

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.