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.

How can one delete or undefine macros in Context? Is there a difference if i've used \def or \define to create a macro?

share|improve this question

1 Answer 1

up vote 7 down vote accepted

Why do you want to do 'undefine' a macro? Depending on what you want, try:

\let\macro\undefined

or

\let\macro\donothing

It does not matter whether you used \def or \define

share|improve this answer
2  
Note that the first is canonical Tex from Knuth (except that he uses the equals sign: \let\macro=\undefined) and is the preferred way to do it. –  Charles Stewart Mar 1 '11 at 10:32
2  
The second (\donothing is just a more descriptive synonym of \relax) is better if you do not want code that uses \macro to fail. I am guessing that the OP wants to ignore some ConTeXt environments, \startsomething ... \stopsomething. In that case, it is better to set them to \donothing rather than \undefined. –  Aditya Mar 1 '11 at 15:19
    
@CharlesStewart, @Aditya Doesn’t that rely on the fact that \undefined is indeed undefined itself? – And isn’t \@undefined used for that at so many other places? –  Robert Siemer Dec 1 '13 at 3:08
    
@RobertSiemer: \@undefined is used in LaTeX. ConTeXt only uses \undefined. In fact, \undefined is used about 120 times in the ConTeXt MkIV source files. –  Aditya Dec 1 '13 at 7:37
    
@RobertSiemer - It does rely on \undefined having the usual meaning of being undefined. It also depends on \let having the usual meaning of the Tex primitive, and the relevant catcodes being what you expect. Tex doesn't offer much in the way of safety precautions. –  Charles Stewart Dec 2 '13 at 13:28

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.