Received: from mx0.gmx.net (mx0.gmx.net [213.165.64.100]) by h1439878.stratoserver.net (8.14.2/8.14.2/Debian-2build1) with SMTP id o8HNhw1l020458 for ; Sat, 18 Sep 2010 01:43:59 +0200 Received: (qmail 5642 invoked by alias); 17 Sep 2010 23:43:53 -0000 Delivered-To: GMX delivery to rainer.schoepf@gmx.net Received: (qmail invoked by alias); 17 Sep 2010 23:43:53 -0000 Received: from relay2.uni-heidelberg.de (EHLO relay2.uni-heidelberg.de) [129.206.210.211] by mx0.gmx.net (mx098) with SMTP; 18 Sep 2010 01:43:53 +0200 Received: from listserv.uni-heidelberg.de (listserv.uni-heidelberg.de [129.206.100.94]) by relay2.uni-heidelberg.de (8.13.8/8.13.8) with ESMTP id o8HNgK9d024695 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 18 Sep 2010 01:42:20 +0200 Received: from listserv.uni-heidelberg.de (localhost.localdomain [127.0.0.1]) by listserv.uni-heidelberg.de (8.13.1/8.13.1) with ESMTP id o8HN2dQb020290; Sat, 18 Sep 2010 01:42:09 +0200 Received: by LISTSERV.UNI-HEIDELBERG.DE (LISTSERV-TCP/IP release 16.0) with spool id 437386 for LATEX-L@LISTSERV.UNI-HEIDELBERG.DE; Sat, 18 Sep 2010 01:42:09 +0200 Received: from relay.uni-heidelberg.de (relay.uni-heidelberg.de [129.206.100.212]) by listserv.uni-heidelberg.de (8.13.1/8.13.1) with ESMTP id o8HNg915000715 for ; Sat, 18 Sep 2010 01:42:09 +0200 Received: from mail-bw0-f49.google.com (mail-bw0-f49.google.com [209.85.214.49]) by relay.uni-heidelberg.de (8.14.1/8.14.1) with ESMTP id o8HNfthU022854 for ; Sat, 18 Sep 2010 01:41:59 +0200 Received: by bwz19 with SMTP id 19so3559550bwz.22 for ; Fri, 17 Sep 2010 16:41:55 -0700 (PDT) Received: by 10.204.63.199 with SMTP id c7mr4411327bki.110.1284766915246; Fri, 17 Sep 2010 16:41:55 -0700 (PDT) Received: from irwin.vpn.uni-freiburg.de (p54A2B882.dip.t-dialin.net [84.162.184.130]) by mx.google.com with ESMTPS id d27sm4112712bku.10.2010.09.17.16.41.53 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 17 Sep 2010 16:41:54 -0700 (PDT) Received: by irwin.vpn.uni-freiburg.de (Postfix, from userid 500) id 97A4D775B; Sat, 18 Sep 2010 01:33:51 +0200 (CEST) Mail-Followup-To: LATEX-L@LISTSERV.UNI-HEIDELBERG.DE References: <0BFA7483-6E3E-45D0-9094-3DEE5D880A1E@gmail.com> <1816801436.1740507.1284759290533.JavaMail.fmail@mwmweb010> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Message-ID: <20100917233351.GA18324@oberdiek.my-fqdn.de> Date: Sat, 18 Sep 2010 01:33:51 +0200 Reply-To: Mailing list for the LaTeX3 project Sender: Mailing list for the LaTeX3 project From: Heiko Oberdiek Subject: Re: Consistently active characters To: LATEX-L@listserv.uni-heidelberg.de In-Reply-To: <1816801436.1740507.1284759290533.JavaMail.fmail@mwmweb010> Precedence: list List-Help: , List-Unsubscribe: List-Subscribe: List-Owner: List-Archive: X-GMX-Antispam: 0 (Mail was not recognized as spam); Detail=5D7Q89H36p77e5KAPs1l6v/Sb97LojnDtMgfETrECMLUO9erHzOJe+OynZRhvlGqb5A0X bbiCt2rAnnct/NAlbHMvoAL6GY+23tB3khNK7bp7qqSbssdDTHsQd8+gWzfjr4OMj5ambWQGofKK 3vIsQ==V1; X-Resent-By: Forwarder X-Resent-For: rainer.schoepf@gmx.net X-Resent-To: rainer@rainer-schoepf.de Status: R X-Status: X-Keywords: X-UID: 6402 On Fri, Sep 17, 2010 at 11:34:50PM +0200, Uwe Lueck wrote: > > \define_active_char:Nn {} > > > > which makes the active and assigns the given code to it, > > internally using the code that Will wrote. > > \begingroup > \catcode`\~=13 > \gdef\define_active_char:Nn#1#2{% > \catcode`#113% > \begingroup > \lccode`\~`#1% > \lowercase{\endgroup \def ~{#2}}% > } > \endgroup > > 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}% } 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} > The \endgroup trick here is from doc.sty's \do@noligs. doc.sty contains: \def\verbatim@nolig@list{\do\`\do\<\do\>\do\,\do\'\do\-} \def\do@noligs#1{% \catcode`#1\active \begingroup \lccode`\~=`#1\relax \lowercase{\endgroup\def~{\leavevmode\kern\z@\char`#1}}} \do@noligs is lucky, if used with \verbatim@nolig@list, because #1 always contains a command token that is not affected by \lowercase. However '`' could have an unexpected \lccode value. Therefore I suggest \def\do@noligs#1{% \catcode`#1\active \begingroup \lccode`\~=`#1\relax \lowercase{\endgroup\def~}{\leavevmode\kern\z@\char`#1}% } Yours sincerely Heiko