# [NTG-context] Bad interaction between new interpretation of underscore and modules

Mathieu Boespflug mboes at tweag.net
Fri Jan 14 10:15:23 CET 2011

Thank you for the solution, Wolfgang.  But it seems rather painful to
have to replace every occurrence of _ in my definitions module with
the very verbose \normalsubscript just because it's a module. The new
default catcode for _ introduces extra difficulty when defining math
macros. Would it be possible to at least have a macro to revert to the
old behaviour? Also, I'm still stumped as to why modules make any
difference here. I would have expected this problem to also show up if
the definitions were made inline at the top of the source file for the
document.

All the best,

Mathieu

On Thu, Jan 13, 2011 at 10:50 PM, Wolfgang Schuster
>
> Am 13.01.2011 um 17:18 schrieb Mathieu Boespflug:
>
>> Hi all,
>>
>> today's beta introduced a really strange problem. Consider two source files:
>>
>> definitions.tex:
>> \startmodule[definitions]
>> \def\lambdax{\lambda_x}
>> \stopmodule[definitions]
>>
>> main.tex:
>> \usemodule[definitions]
>> \starttext
>> blah $\lambdax$ blah.
>> \stoptext
>>
>> This results in the following compile error:
>>
>> ! Undefined control sequence.
>> \lambdax ->\lambda_x
>>
>> l.5 blah $\lambdax >>$ blah.
>> ?
>>
>> However, if you change "\usemodule[definitions]" into "\input
>> definitions" instead, then there is no compile error! My understanding
>> is that the underscore is a valid character for macro names now
>> outside of math mode, which is what is causing the problem. But I
>> really don't understand what magic is going on in the modules code to
>> trigger this.
>>
>> I would be very interested in an explanation of what is going on.
>
> You need \normalsubscript in your module. You define a command and
> in this case it doesn’t matter that you plan to use it in math mode,
> the _ is now a normal letter like “a” and this won’t change when you
> call \lambdax in your document.
>
> Write
>
>  \def\lambdax{\lambda\normalsubscript x}
>
> and it will work again.
>
> Wolfgang
>
> ___________________________________________________________________________________
> If your question is of interest to others as well, please add an entry to the Wiki!
>
> maillist : ntg-context at ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
> archive  : http://foundry.supelec.fr/projects/contextrev/
> wiki     : http://contextgarden.net
> ___________________________________________________________________________________
>