Received: from mail.proteosys.com ([213.139.130.197]) by nummer-3.proteosys with Microsoft SMTPSVC(6.0.3790.3959); Thu, 3 Dec 2009 19:05:21 +0100 Received: by mail.proteosys.com (8.14.3/8.14.3) with ESMTP id nB3I5Oox004730 for ; Thu, 3 Dec 2009 19:05:24 +0100 Received: from listserv.uni-heidelberg.de (listserv.uni-heidelberg.de [129.206.100.94]) by relay.uni-heidelberg.de (8.14.1/8.14.1) with ESMTP id nB3I2tfU028373 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 3 Dec 2009 19:02:56 +0100 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 nB3G8T5E025664; Thu, 3 Dec 2009 19:02:54 +0100 Received: by LISTSERV.UNI-HEIDELBERG.DE (LISTSERV-TCP/IP release 15.5) with spool id 364298 for LATEX-L@LISTSERV.UNI-HEIDELBERG.DE; Thu, 3 Dec 2009 19:02:54 +0100 Received: from relay2.uni-heidelberg.de (relay2.uni-heidelberg.de [129.206.210.211]) by listserv.uni-heidelberg.de (8.13.1/8.13.1) with ESMTP id nB3I2sCd011821 for ; Thu, 3 Dec 2009 19:02:54 +0100 Received: from smtp.ampere.inpg.fr (smtp.ampere.inpg.fr [147.171.64.83]) by relay2.uni-heidelberg.de (8.13.8/8.13.8) with ESMTP id nB3I2gWQ018128 for ; Thu, 3 Dec 2009 19:02:46 +0100 Received: from localhost (localhost [127.0.0.1]) by smtp.ampere.inpg.fr (Postfix) with ESMTP id D7B2498099 for ; Thu, 3 Dec 2009 19:02:36 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at ampere.inpg.fr Received: from smtp.ampere.inpg.fr ([127.0.0.1]) by localhost (smtp.ampere.grenoble-inp.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id oV0eFb2HdFbm for ; Thu, 3 Dec 2009 19:02:36 +0100 (CET) Received: from [192.168.0.1] (cap69-1-82-233-38-63.fbx.proxad.net [82.233.38.63]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.ampere.inpg.fr (Postfix) with ESMTPSA id 977BD98096 for ; Thu, 3 Dec 2009 19:02:36 +0100 (CET) User-Agent: Mozilla-Thunderbird 2.0.0.22 (X11/20090706) MIME-Version: 1.0 References: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit Message-ID: <4B17FD3C.4050303@free.fr> Date: Thu, 3 Dec 2009 19:02:36 +0100 Reply-To: Mailing list for the LaTeX3 project Sender: Mailing list for the LaTeX3 project From: "Julien RIVAUD (_FrnchFrgg_)" Subject: Re: Rescanning an argument with a special catcode for the colon To: LATEX-L@LISTSERV.UNI-HEIDELBERG.DE In-Reply-To: Precedence: list List-Help: , List-Unsubscribe: List-Subscribe: List-Owner: List-Archive: X-ProteoSys-SPAM-Score: -6.599 () BAYES_00,RCVD_IN_DNSWL_MED X-Scanned-By: MIMEDefang 2.65 on 213.139.130.197 Return-Path: owner-latex-l@LISTSERV.UNI-HEIDELBERG.DE X-OriginalArrivalTime: 03 Dec 2009 18:05:22.0028 (UTC) FILETIME=[2E3422C0:01CA7443] Status: R X-Status: X-Keywords: X-UID: 6195 Sorry, I messed with Thunderbird's settings and my answer was sent in HTML. Joseph Wright a écrit : > A couple of things here. First, active characters tend to be bad news. In my own siunitx package, I've moved from using an approach like yours in v1 to trying a different system in v2, based on \tl_replace_all_in:Nnn: > > \cs_set:Nn \my_int_function:n #1 { > \tl_set:Nn \l_my_tmp_tl {#1} > \tl_replace_all_in:Nnn \l_my_tmp_tl { . } { \cheminsommet } > \tl_replace_all_in:Nnn \l_my_tmp_tl { : } { \cheminface } > % Do more stuff with the input > } > > The reason for this is two-fold. First, active characters can cause a lot of problems (see what happens when two packages try to do something like this). Note that those characters would be set active only in the call of the function; outside of it the catcode is preserved (or so I think). In fact, in my first version of the \chemin macro, I did some kind of replace, but without expl3 that meant an ugly thing with a lot of ad-hoc looping code. Won't search/replace be slower than setting . and : to macros ? Anyway, the question here is more to play with expl3 than anything else, getting rid of chemin as it is now isn't a priority at all... :) > Second, the \tl_replace_all_in:Nnn approach means that there is only one level of replacement, which is often what people expect if they protect characters. I think the general feeling is that the team are aiming to avoid active characters as far as possible. > Fair enough. > If you do want to use \tl_rescan:Nnx, what is wrong with > > \group_begin: > \char_make_active:N \: > \char_make_active:N \. > \cs_gset:Npn \my_int_function:n #1 { > \tl_set_rescan:Nnx \l_my_tmp_tl > { > \char_make_active:N \: > \char_make_active:N \. > \cs_set_eq:NN . \cheminsommet > \cs_set_eq:NN : \cheminface > } > {#1} > % Stuff with \l_my_tmp_tl > } > \group_end: > > or > > \group_begin: > \char_make_active:N \: > \char_make_active:N \. > \cs_gset_eq:NN . \cheminsommet > \cs_gset_eq:NN : \cheminface > \cs_gset:Npn \my_int_function:n #1 { > \tl_set_rescan:Nnn \l_my_tmp_tl > { > \char_make_active:N \: > \char_make_active:N \. > } > {#1} > % Stuff with \l_my_tmp_tl > } > \group_end: > > (The later makes active . and : globally available, so works without x-type expansion of the tl. I'd personally go for the first of these two solutions as it again is independent of what others do.) > I think I have tried such solutions, wouldn't TeX complain about nonexistent \char_make_active because a colon cannot anymore be in the name of a macro ? Julien