Received: from mout.gmx.net (mout.gmx.net [212.227.15.15]) by h1439878.stratoserver.net (8.14.4/8.14.4/Debian-2ubuntu2.1) with ESMTP id t7P67oOZ004800 for ; Tue, 25 Aug 2015 08:07:52 +0200 Received: from relay.uni-heidelberg.de ([129.206.100.212]) by mx-ha.gmx.net (mxgmx002) with ESMTPS (Nemesis) id 0M1XlB-1Ybc6L2FVR-00tSLM for ; Tue, 25 Aug 2015 08:07:45 +0200 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 t7P661ms029512 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 25 Aug 2015 08:06:01 +0200 Received: from listserv.uni-heidelberg.de (listserv.uni-heidelberg.de [127.0.0.1]) by listserv.uni-heidelberg.de (8.13.8/8.13.8) with ESMTP id t7P2dDYq001903; Tue, 25 Aug 2015 08:06:01 +0200 Received: by LISTSERV.UNI-HEIDELBERG.DE (LISTSERV-TCP/IP release 16.0) with spool id 12512875 for LATEX-L@LISTSERV.UNI-HEIDELBERG.DE; Tue, 25 Aug 2015 08:06:01 +0200 Received: from relay2.uni-heidelberg.de (relay2.uni-heidelberg.de [129.206.210.211]) by listserv.uni-heidelberg.de (8.13.8/8.13.8) with ESMTP id t7P660E5014491 for ; Tue, 25 Aug 2015 08:06:00 +0200 Received: from aso-006-i434.relay.mailchannels.net (aso-006-i434.relay.mailchannels.net [23.91.64.115]) by relay2.uni-heidelberg.de (8.13.8/8.13.8) with ESMTP id t7P65u51008537 for ; Tue, 25 Aug 2015 08:06:00 +0200 X-Sender-Id: netnames|x-authuser|joseph.wright@morningstar2.co.uk Received: from smtp2.easily.co.uk (ip-10-204-4-183.us-west-2.compute.internal [10.204.4.183]) by relay.mailchannels.net (Postfix) with ESMTPA id AAA96A0348 for ; Tue, 25 Aug 2015 06:05:54 +0000 (UTC) X-Sender-Id: netnames|x-authuser|joseph.wright@morningstar2.co.uk Received: from smtp2.easily.co.uk (smtp2.easily.co.uk [10.45.8.167]) (using TLSv1 with cipher DHE-RSA-AES256-SHA) by 0.0.0.0:2500 (trex/5.5.1); Tue, 25 Aug 2015 06:05:55 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: netnames|x-authuser|joseph.wright@morningstar2.co.uk X-MailChannels-Auth-Id: netnames X-MC-Loop-Signature: 1440482755291:1258075827 X-MC-Ingress-Time: 1440482755291 Received: from [86.178.0.199] (port=57720 helo=palladium.home) by smtp2.easily.co.uk with esmtpa (Exim 4.43) id 1ZU7Mm-0004L3-6v for LATEX-L@LISTSERV.UNI-HEIDELBERG.DE; Tue, 25 Aug 2015 07:05:52 +0100 References: <55DBB7F6.1070307@clear.net.nz> <55DABA1D.3050706@morningstar2.co.uk> <55DCFDF7.7080305@clear.net.nz> X-Enigmail-Draft-Status: N1110 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 Content-Type: text/plain; charset=windows-1252 X-AuthUser: joseph.wright@morningstar2.co.uk Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by listserv.uni-heidelberg.de id t7P660E5014495 Message-ID: <55DC05BF.1040505@morningstar2.co.uk> Date: Tue, 25 Aug 2015 07:05:51 +0100 Reply-To: Mailing list for the LaTeX3 project Sender: Mailing list for the LaTeX3 project From: Joseph Wright Subject: Re: Catcode changes To: LATEX-L@LISTSERV.UNI-HEIDELBERG.DE In-Reply-To: <55DCFDF7.7080305@clear.net.nz> Precedence: list List-Help: , List-Unsubscribe: List-Subscribe: List-Owner: List-Archive: Envelope-To: X-GMX-Antispam: 0 (Mail was not recognized as spam); Detail=V3; X-GMX-Antivirus: 0 (no virus found) X-UI-Filterresults: notjunk:1;V01:K0:Rp7lU5/ukXs=:drp+Nv2v65bBWVccyhExodHKqq 6QOV/2ZREGQT5z+JH5uZTdllP0NkGEd8UkxS+itdY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-By: MIMEDefang 2.71 on 85.214.41.38 Status: R X-Status: X-Keywords: X-UID: 7832 On 26/08/2015 00:44, aparsloe wrote: > (1) I wanted to use \tl_replace_all:Nnn on a token list that might > contain braced groups. Using \tl_set_rescan:Nnn to change the category > codes of { and } seemed the most direct way of proceeding. (Then > resetting the category codes after replacement with an empty setup.) I see what you mean (I have a similar case in siunitx, for historical reasons). We'll explore what we can do with this: there are mapping-based approaches one can imagine that will enter brace groups. (We do that for \tl_lower_case:n, for example). However, for a general 'search and replace' I'd be slightly wary as the TeX convention that stuff in brace groups is 'special' is quite prevalent. (Depending on performance requirements, you might also look at l3regex if you are doing the replacement only very rarely.) > (2) Using \fp_to_scientific:n on the result of an l3fp calculation > produces, say, 6.023e23. I want to write this as 6.023 \times 10^{23}, > but the "e" of 6.023e23 doesn't have its "usual" catcode so > \tl_replace_once:Nnn doesn't find the "e". (I presume "e" has catcode > "other" -- I haven't checked.) Hence I rescan 6.023e23 with an empty > setup and then use \tl_replace_once:Nnn (which now does find the "e"). I see that we don't mention the catcode of "e" here: we should do (Bruno?). For this particular use case, I'd set up your search using a detokenized e \cs_generate_variant:Nn \tl_replace_all:Nnn { Nx } \tl_replace_all:Nnn { \tl_to_str:n { e } } { \times } but probably with a dedicated function \cs_new:Npn \__mymodule_format:n #1 { \__mymodule_format:w #1 \q_stop } \use:x { \cs_new:Npn \exp_not:N \__mymodule_format:w ##1 \tl_to_str:n { e } ##2 \exp_not:N \q_stop } { \exp_not:n { #1 \times 10 ^ {##2} } } which can be made more 'robust' if you need to allow for cases where there is no "e". -- Joseph Wright