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:
Uwe Lueck <[log in to unmask]>
Reply To:
Mailing list for the LaTeX3 project <[log in to unmask]>
Date:
Sat, 18 Sep 2010 18:23:42 +0200
Content-Type:
text/plain
Parts/Attachments:
text/plain (54 lines)
Heiko Oberdiek <[log in to unmask]>, 18.09.2010 01:33:51:
>On Fri, Sep 17, 2010 at 11:34:50PM +0200, Uwe Lueck wrote:
[...]
>> Not tested exactly this way, sorry, but in a so far private package of mine, I have
>> 
>>     \providecommand*{\MakeActiveDef}[2]{%
>>       \catcode`#1\active
>>       \begingroup
>>         \lccode`\~`#1%
>>         \lowercase{\endgroup \def ~{#2}}%
>>     }
>
> But then the contents of #2 is converted to lowercase, too.
> The trick is to move the (parameter text and) definition text
> outside of \lowercase:
>
>    \providecommand*{\MakeActiveDef}[2]{%
>      \catcode`#1\active
>      \begingroup
>        \lccode`\~`#1%
>        \lowercase{\endgroup \def ~}{#2}%
>    }

I wanted to try this in my package ... actually it has been there already; I seem not to have pasted (which is somewhat clumsy with my favourite editor under Hatari), rather changed similar code of previous mails.

So this shows that Heiko's proposal already has been tested and he is right!

> or even
>
>    \providecommand*{\MakeActiveDef}[1]{%
>      \catcode`#1\active
>      \begingroup
>        \lccode`\~`#1%
>        \lowercase{\endgroup \def ~}%
>    }
>
> The latter allows definition of active chars with parameters:
>
>  \MakeActiveDef{\+}#1{Do something with #1}

Anyway, I usually consider definitions like

    \newcommand*{\foo}[2]{<core-code>{#2}}

mistakes and type 

    \newcommand*{\foo}[1]{<core-code>}

instead, maybe I didn't realize it here -- indeed I change my \MakeActiveDef according to Heiko's proposal ... tested successfully!

Thanks, cheers, 

    Uwe.

ATOM RSS1 RSS2