Received: from mout.gmx.net (mout.gmx.net [212.227.17.22]) by h1439878.stratoserver.net (8.14.4/8.14.4/Debian-2ubuntu2.1) with ESMTP id t6M8mHuX016762 for ; Wed, 22 Jul 2015 10:48:18 +0200 Received: from relay.uni-heidelberg.de ([129.206.100.212]) by mx-ha.gmx.net (mxgmx105) with ESMTPS (Nemesis) id 0LnUX4-1YjIpQ2m3q-00hhaE for ; Wed, 22 Jul 2015 10:48:11 +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 t6M8i1Ob001972 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 22 Jul 2015 10:44:02 +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 t6M7pNo5021036; Wed, 22 Jul 2015 10:44:01 +0200 Received: by LISTSERV.UNI-HEIDELBERG.DE (LISTSERV-TCP/IP release 16.0) with spool id 12436624 for LATEX-L@LISTSERV.UNI-HEIDELBERG.DE; Wed, 22 Jul 2015 10:44:01 +0200 Received: from relay.uni-heidelberg.de (relay.uni-heidelberg.de [129.206.100.212]) by listserv.uni-heidelberg.de (8.13.8/8.13.8) with ESMTP id t6M8i1vM020028 for ; Wed, 22 Jul 2015 10:44:01 +0200 Received: from aso-006-i434.relay.mailchannels.net (aso-006-i434.relay.mailchannels.net [23.91.64.115]) by relay.uni-heidelberg.de (8.14.1/8.14.1) with ESMTP id t6M8hsIi001824 for ; Wed, 22 Jul 2015 10:43:58 +0200 X-Sender-Id: netnames|x-authuser|joseph.wright@morningstar2.co.uk Received: from smtp3.easily.co.uk (ip-10-213-14-133.us-west-2.compute.internal [10.213.14.133]) by relay.mailchannels.net (Postfix) with ESMTPA id 70010A0480 for ; Wed, 22 Jul 2015 08:43:51 +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); Wed, 22 Jul 2015 08:43:52 +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: 1437554632001:18173936 X-MC-Ingress-Time: 1437554632000 Received: from [185.40.134.3] (port=56370 helo=palladium.local) by smtp3.easily.co.uk with esmtpa (Exim 4.43) id 1ZHpcz-0003Nu-3L for LATEX-L@LISTSERV.UNI-HEIDELBERG.DE; Wed, 22 Jul 2015 09:43:49 +0100 References: User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed X-AuthUser: joseph.wright@morningstar2.co.uk X-MIME-Autoconverted: from quoted-printable to 8bit by listserv.uni-heidelberg.de id t6M8i1vM020029 Message-ID: <55AF57C2.1070908@morningstar2.co.uk> Date: Wed, 22 Jul 2015 09:43:46 +0100 Reply-To: Mailing list for the LaTeX3 project Sender: Mailing list for the LaTeX3 project From: Joseph Wright Subject: Re: New arguments for sub and superscripts in xparse To: LATEX-L@LISTSERV.UNI-HEIDELBERG.DE In-Reply-To: Precedence: list List-Help: , List-Unsubscribe: List-Subscribe: List-Owner: List-Archive: X-MIME-Autoconverted: from 8bit to quoted-printable by relay.uni-heidelberg.de id t6M8i1Ob001972 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:fZVWRoEngDs=:Q2Czkj8eduIh+Vypj2mBWJp6mW ThHAHouXbEAk6QAlvzCbKNMPEp0wRTYLFThrcsTvoQyOvZprv0OAagfBBbXhRNvHkVUv8qppP kcpt4zybXjprmE+7tAXfPYDZ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7lTS4RM07e91fnfQ0G8VKtIQxoUeAaz5UZ9YfRAVPBSv0H6yv33wHeV WEVIt6Nan8mWAHMEkeVRF9Y4NlXNJ/JUnda1sER0vTi6lc+i3dmPHlkQQ1vVVaGkQw8xX0ayJ DizAWz8DrZs+T12l0Pm4I5cRPN6Lipk5GxfQekaJaltn/xb+WHOX54UFKOtRit+TukBtafeRE 7GErF6b4bjkR8BL3BqJdImTawod2x0wrDYU+xqWRcYhXfYoxzRdjLkmpcjJwtaJQXoK95fuRp OCDf7i6E8gAzlHBqv1y63NrmecVeaDAJQFd940TdLB7LJ1OWELvwz1VjvEIMFQNdZDrwttdA= = X-UI-Loop:V01:BxEz3YjVSkw=:GeEkTTWgivQ95PWJg/Ji7IEMkQYAr7c4UhQqYqnMjHU= X-UI-Out-Filterresults: notjunk:1;V01:K0:zJaoJs93Rlk=:A12j5Cd/f8V9IeYdd7+x+o /k0U8Ca0kLmVNlTubORZuSDpVKBZTw+cSEUkyyHQ6s4bjTJ9a6NdWV9alV16pjIIR95WvtJ0R hxBHhb/C3DUA4EzIpx6qYJjC4EE/RO1L0nM1YoqB4XTMbcf97RMZ+rwNHgp3Ghd1GHJga9qKL ZWeC+g3Cb3vNBS39J/6mH5kbS4TvWYW8zIp2IuLQaYKKyitvTTvwvxaYp8f24cfaIQ1HRnQel AOc8XbOmhro9sHCidfsju44E6DTZAlo3agtfj2+I6B6i/W0iatBy4EyROE4IUAKJanargcRlC ttZPtIWLl697kGCkexsAOZr8mWvuMalkqJ1qfD0mjzDFtjyHJB13PW08A4fp4smMA3WFKjQ+4 WajAZhStR0Vqmv9eevECFCCTtqb2EHorI/57kf9sBOYxKj6pWqlPBoHDWuaLJu/5ibL1qJUKV jAJkUvma/vpmlh76ozm9nH7sBZjCyU+GVxXas0NyZSaGHv3kPHeB X-Scanned-By: MIMEDefang 2.71 on 85.214.41.38 Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by h1439878.stratoserver.net id t6M8mHuX016762 Status: R X-Status: X-Keywords: X-UID: 7803 On 16/05/2015 18:54, Manuel Blanco wrote: > Hello, > > I'm looking for two new argument types in xparse (say L and U, but you > can choose the names yourself) to grab sub or superscripts as optional > arguments. I write here since I'm looking for non-hackish solutions, > so probably written in the same way as xparse itself. > > For instance, if we have a command \foo defined with { m o L U } it > should be able to grab \foo{a}[b]_{c}^{d} with `c` and `d` as #3 and > #4. That is, that arguments should check for tokens _ and ^ (like t_ > and t^) and in case they are pressent grab the next argument. > > There's a problem with the naming, since l and u are already taken, L > and U should be followed by the “default” of the optional arguments, > but that would live us without the option to say > \IfValueT{#3}{\sb{\mathrm{#3}}}. I think that with L{} and > U{} is enough (but if you think of a better naming tell!). > > And I think that's all the important. > > --- > > (Now this are just thoughts.) > > In any case, may be not now, but in the future, it would be nice to > have certain control over subscripts (and super..). Right now > subscripts are the most “uncontrolled” optional arguments. But xparse > seems pretty good to add control over them within a macro. > > In an ideal future it would be perfect if xparse could process them > even if they are in different order like ^{a}_b, but for now it's okey > if they are just grabbed in the order they are written (i.e., L{} U{} > => _{a}^{bc}). > > That, with an acceptable interface, would bring us certain power about > limits within the commands we define. Thinking, it may be better > suited as a package alone and not for xparse. > > Thanks! > Manuel Following some discussion at TUG2015, we think this can be done but in a slightly different way. If we think about TeX primitive sub/superscript syntax, the optional tokens are in a non-fixed order. Looked at in a generalised way, that means these are in a sense keyvals but without the 'normal' format. I see you suggested "k" in your follow-up mail: we think that is a sensible ID for a general keyval-like type, so for example \DeclareDocumentCommand\int{k{_^}}{% % #1 = Argument to _ or \NoValue if not seen % #2 = Argument to ^ or \NoValue if not seen } \DeclareDocumentCommand\foo{k{_^!*}}{% % #1 = Argument to _ or \NoValue if not seen % #2 = Argument to ^ or \NoValue if not seen % #3 = Argument to ! or \NoValue if not seen % #4 = Argument to * or \NoValue if not seen } with a K version as well. I will probably work on implementation soon. -- Joseph Wright