After you define a command using \newcommand, is it possible to undefine it?
My motivation is that I'm writing a thesis, where each chapter is in a separate source file. Some chapters define their own commands that are used nowhere else, so I'd like them to be visible only within that chapter.
I'd therefore like to be able to do something like:
\chapter{Some Chapter}
\newcommand{foo}{...}
... % chapter body
\forgetcommand{foo}
% end of chapter
Is there anything like the fictitious \forgetcommand macro above?
\let\foo\undefined. – Werner Nov 23 '11 at 22:09\providecommand- it seems to be more in line with what you may be after. – Werner Nov 23 '11 at 22:31\undef\foo. For some reason, I cannot add an answer, just comments. – Hendrikto Dec 28 '21 at 14:48