Undefining Commands in LaTeX



I have wondered how to undefine existing commands in $\LaTeX$ for so long. Finally, I googled it up. It's easy. Simply
\makeatletter
\let\command\@undefined
\makeatother
and the \command has been undefined. This does not cause an error when \command was undefined before. After that, you can merrily
\newcommand{\command}{Hell Yeah.}
and be on your way.

Tags: - -

2 Replies to “Undefining Commands in LaTeX”

  1. Except that this does not work when the command is already defined. My usecase is a file definitions.tex with all the macros I use, but I want to use it in different projects that use different packages. Sometimes, the included packages define commands that I want to redefine, in other projects that is not the case. I don't want to change from renewcommand to newcommand all the time, I just want one definitions.tex that always works.

Leave a Reply

Your email address will not be published.