Hi Wolfgang,
thank you for the explanation and the solution.
Best,
Mathieu
On Fri, Jan 14, 2011 at 10:32 AM, Wolfgang Schuster
Am 14.01.2011 um 10:15 schrieb Mathieu Boespflug:
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.
When you write a module you put \unprotect and \protect at the begin and end of the file because they make @, !, ? and _ to a normal letter like abc which can be used in macros. When you load a file with \usemodule or \environment this isn’t necessary because context adds already calls both commands when the file is opened and closed for reading and this mechanism is used even if you aren’t aware of this.
PS For \environment this is only true when you use it in a document with \starttext or when you write it before \startproduct, \startcomponent etc.
PPS You can abuse \nonknuthmode to make your module to work
\startbuffer[definitions] \pushcatcodes\nonknuthmode % \startnonknuthmode \def\lambdax{\lambda_x} \popcatcodes % \stopnonknuthmode \stopbuffer
\savebuffer[definitions][p-definitions.tex]
\startbuffer[more] \def\morex{\more_x} \stopbuffer
\savebuffer[more][p-more.tex]
\usemodule[definitions,more]
\starttext blah $\lambdax$ blah. \morex \stoptext
Wolfgang
___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@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 ___________________________________________________________________________________