Is there a way to delete a variable so that any future references would raise an undefined control sequence error? I am dealing with a big document that has a lot of custom variables and macros with very similar spelling. I would like to irreversibly remove those that I am sure will not appear later in the document to effectively detect typos rather than end up with a document filled with egregious errors.
Asked
Active
Viewed 109 times
1 Answers
3
TeX doesn't really have anything calld variables but you can undefine a control sequence by \let it to any undefined command, conventioally \undefined and \@undefined are left undefined for this use, so:
\def\abc{xyz}
\abc
\let\abc\undefined
\abc % error
But \undefined here is not a special keyword, and only works by convention that it is not defined so
\def\abc{xyz}
\abc
\let\abc\someothercommandwithnodefinition
\abc % error
would be the same
David Carlisle
- 757,742