
I have seen the following definition in a class file (which we use internally):

\newcommand{\@TitleBackground}{default}


This provides \titlebackground as a command for changing \@TitleBackground, but how/why does it work? I would understand it if the second line was



but why does it work also without the argument, i.e, with \renewcommand having onle one parameter?

And does the shorter version has some advantages or disadvantages over the longer one?

• Although the macro you're asking about is different, the principle is the same as explained here: tex.stackexchange.com/q/509471/134574. – Phelype Oleinik Oct 23 at 12:08


\renewcommand{\@TitleBackground}{whatever}


and eventually do \def\@TitleBackground.


\renewcommand{\@TitleBackground}{whatever}


as before. So the difference is that in the second case {whatever} is looked at as an argument one more time than in the first version.

The difference is negligible. On my machine, doing a job like in the second case one million times require 1/100 of a second longer than the first way.

• So, they will get exactly the same result, will basically the same speed - but the shorter one hides the fact that the command needs an argument - not only from humans, but also from editors like TeXstudio that actually parse \newcommand .. correct? – Michal Kaut Oct 24 at 13:18
• @MichalKaut Yes, the second way is clearer under several aspects, clarity is usually preferable to efficiency at all costs. – egreg Oct 24 at 13:43