LATEX-L Archives

Mailing list for the LaTeX3 project

LATEX-L@LISTSERV.UNI-HEIDELBERG.DE

Options: Use Forum View

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

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

Print Reply
Subject:
From:
Lars Hellström <[log in to unmask]>
Reply To:
Mailing list for the LaTeX3 project <[log in to unmask]>
Date:
Sat, 18 Sep 2010 18:26:06 +0200
Content-Type:
text/plain
Parts/Attachments:
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:

\begingroup
    \catcode0=13\relax
\@firstofone{\endgroup
    \providecommand*{\MakeActiveDef}[1]{%
       \catcode#1=13%
       \begingroup
       \lccode0=#1%
       \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

ATOM RSS1 RSS2