Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Replacing \newcommand by \DeclareRobustCommand makes a new command robust. But what about \renewcommand? Is there a command to robustly renew a command?

It would be possible to first use \renewcommand and then use \MakeRobustCommand of the makerobust package, but isn't there a "one-command-way"? (And does that one provide a starred form, same as \DeclareRobustCommand*?)

share|improve this question
add comment

1 Answer

up vote 8 down vote accepted

The etoolbox command provides a \renewrobustcmd macro as well as a \newrobustcmd (and their starred versions). Both use the new e-TeX way to define robust commands. Note that \DeclareRobustCommand is not checking if the command already exists and will not cause any errors if it does. This might result in trouble when a macro is defined twice on two different places and you don't know about it. The etoolbox macro include the checks.

share|improve this answer
    
> "\DeclareRobustCommand is not checking if the command already exists and will not cause any errors if it does." - That is exactly the reason because of which I asked for a robust \renewcommand version. As I did not state that, it is good that you wrote it in the answer. Thanks! –  Stephen Sep 17 '11 at 10:21
add comment

Your Answer

 
discard

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.