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 t7PBsToL010705 for ; Tue, 25 Aug 2015 13:54:30 +0200 Received: from relay2.uni-heidelberg.de ([129.206.210.211]) by mx-ha.gmx.net (mxgmx010) with ESMTPS (Nemesis) id 0Lxcct-1YgWcm3GeZ-017I7z for ; Tue, 25 Aug 2015 13:54:24 +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 t7PBqvM4014883 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 25 Aug 2015 13:52:58 +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 t7PArm8u015547; Tue, 25 Aug 2015 13:52:57 +0200 Received: by LISTSERV.UNI-HEIDELBERG.DE (LISTSERV-TCP/IP release 16.0) with spool id 12533132 for LATEX-L@LISTSERV.UNI-HEIDELBERG.DE; Tue, 25 Aug 2015 13:52:57 +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 t7PBqvxm017745 for ; Tue, 25 Aug 2015 13:52:57 +0200 Received: from nov-007-i627.relay.mailchannels.net (nov-007-i627.relay.mailchannels.net [46.232.183.181]) by relay2.uni-heidelberg.de (8.13.8/8.13.8) with ESMTP id t7PBqp5H014821 for ; Tue, 25 Aug 2015 13:52:55 +0200 X-Sender-Id: netnames|x-authuser|joseph.wright@morningstar2.co.uk Received: from smtp3.easily.co.uk (ip-10-220-9-73.us-west-2.compute.internal [10.220.9.73]) by relay.mailchannels.net (Postfix) with ESMTPA id A09BE1205D2 for ; Tue, 25 Aug 2015 11:52:48 +0000 (UTC) X-Sender-Id: netnames|x-authuser|joseph.wright@morningstar2.co.uk Received: from smtp3.easily.co.uk (smtp3.easily.co.uk [10.21.145.197]) (using TLSv1 with cipher DHE-RSA-AES256-SHA) by 0.0.0.0:2500 (trex/5.5.1); Tue, 25 Aug 2015 11:52:49 +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: 1440503569220:2480146796 X-MC-Ingress-Time: 1440503569220 Received: from [139.222.114.163] (port=51289 helo=[139.222.114.163]) by smtp3.easily.co.uk with esmtpa (Exim 4.43) id 1ZUCmU-00022k-4g for LATEX-L@LISTSERV.UNI-HEIDELBERG.DE; Tue, 25 Aug 2015 12:52:46 +0100 References: <55DBB7F6.1070307@clear.net.nz> <55DABA1D.3050706@morningstar2.co.uk> <55DCFDF7.7080305@clear.net.nz> <55DC05BF.1040505@morningstar2.co.uk> X-Enigmail-Draft-Status: N1110 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-AuthUser: joseph.wright@morningstar2.co.uk Message-ID: <55DC570D.30300@morningstar2.co.uk> Date: Tue, 25 Aug 2015 12:52:45 +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: 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:s2etMxfroqw=:jjLNsR2E8E20PuneygogRNDArt jEkcqx794+O0v276Srvc9vku/Ur8UPpsnn7T5coxAoGgH5CHAVtOLL4SfzzByfb9VEnDTPRjp I29KIqlzJbCAv9x3o4SMQ2XTS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q6Z J4kx21WH6uq8ytDEg3jaBy4Czc5j5qaC5Qyt+AEzZ/OfB1m8xJI4xJrYCBok9hT6yJeBK3OlU blu5gjUl7Ka91SAXfg4yTv5IuG6knt2anVIDWEzXaLL8yi6ZCta1O9I6LCGX+JYXEAEBJ6PQG gQHakdgBJcbhWSXC1jNV9fthr5ixpIlnC3yw3zRastnZcP3lphxgpOgEB8d3dISTNgdNTfzOt nMDPQZMe0OForrOXPK7sjdVgB2epNa0IpnBIuBa9UYyKcKtMFECvJlT3dsrzmS7SrsUBNsTXC 0bMot/Hquzm26vj0s+rH3SHf2rs6Ljqj6SXilJBQBS9uCJbrtpowiKzEsLRHxkguT2w0ZH+Q= = X-UI-Loop:V01:18cbZJZi2y0=:JNk5EbeuCQjZxmHz6pSiEwlLO4Uk/RLugIR4sjjarEI= X-UI-Out-Filterresults: notjunk:1;V01:K0:ZejcXIBC2QE=:qybtZXaZqYrzcKINIgPthd 2SudlwkwTpoyDswl1WyyUGM526oZ2Aup+AfanEuQuRTHUObor6mTfui2DHoFX/hWlwcdL6him 97wmJ/RWzfihf+vGLuaA7F4G+gj3KofKR//UfYpX4KEhNHPA2vACPh+Ntoegk8KFr6yehwyn5 DAGteWUPECmiysIKYWxiQRAfH4NGNV5XxIdg/p41XT9HKWDuqVvdwWfi5vlTTI6/wLRdTNxdk edWBiJRw88chBResbjGcSpacxNvyjHR2kJfiG86u3JIpHHKc2eVe2nTERJwVUwI9z+t3JIYjH hfV+zRqAHAclruoCpwTvWVoMjyWrmGDoU6rJNdJuIPdxfqwY5BtbNNT1xwV/4iqU8h+iBJ0d4 QoMlxjtzPWC1dbkbIjtHFexJWMv2ucjw1m4H2rg7R+oe11XAaoEAP7j8w7Q86ej4H39YfK2G6 zd1hhaohUQ0MJMM5KRjZhZOaA4zlZFxXKOBG8Zney0X0vN2WtDv2 X-Scanned-By: MIMEDefang 2.71 on 85.214.41.38 Status: R X-Status: X-Keywords: X-UID: 7837 On 25/08/2015 12:34, Bruno Le Floch wrote: > On 8/25/15, Joseph Wright wrote: >> 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". > > Actually, should we just make the "e" output by \fp_to_scientific:n > into a letter "e" rather than an other "e"? That's trivial to change, > and would be in line with how \int_to_roman:n produces letter > catcodes. I don't remember my rationale for outputting an other "e". > > Bruno I can see the logic in both :-) As this is *not* a 'string' function then I'd imagine normal (letter) catcode would be reasonable. Either way it should be documented. -- Joseph Wright