LATEX-L Archives

Mailing list for the LaTeX3 project


Options: Use Classic View

Use Monospaced Font
Show HTML Part by Default
Show All Mail Headers

Topic: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Lars Hellström <[log in to unmask]>
Sat, 18 Sep 2010 18:26:06 +0200
text/plain (39 lines)
Will Robertson skrev 2010-09-18 08.55:
> On 18/09/2010, at 9:03 AM, Heiko Oberdiek wrote:
>>     \providecommand*{\MakeActiveDef}[1]{%
>>       \catcode`#1\active
>>       \begingroup
>>         \lccode`\~`#1%
>>         \lowercase{\endgroup \def ~}%
>>     }
> Ah, this is nice. Better than what I was thinking of as you no longer need a stray active character floating around.
> I've added these tentatively to expl3 in the "candidates" module under the names \char_active_set:Npn, \char_active_set_eq:NN, and so on.

Note that in order to \lowercase something to an arbitrary character 
code, the something you start from must be ^^@; \lowercase doesn't 
change tokens whose \lccode is 0. This is of course not a problem, 
since you can always set the \catcode of ^^@ locally while defining the 
macro where an active ^^@ is needed:

       \lowercase{\endgroup \def ^^@}%

Another change used above is to make the command argument the 
_character code_ of the active to define, rather than a token with that 
character. It is easy to use ` to make that number if needed, but in 
several cases you rather start out from the character code.

Lars Hellström