Received: from mail.proteosys.com ([213.139.130.197]) by nummer-3.proteosys with Microsoft SMTPSVC(6.0.3790.3959); Mon, 17 Aug 2009 09:28:18 +0200 Received: by mail.proteosys.com (8.14.3/8.14.3) with ESMTP id n7H7SHIO008880 for ; Mon, 17 Aug 2009 09:28:18 +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 n7H7ODmY010505 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 17 Aug 2009 09:24:13 +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 n7GM1AtG006563; Mon, 17 Aug 2009 09:24:08 +0200 Received: by LISTSERV.UNI-HEIDELBERG.DE (LISTSERV-TCP/IP release 15.5) with spool id 285319 for LATEX-L@LISTSERV.UNI-HEIDELBERG.DE; Mon, 17 Aug 2009 09:24:07 +0200 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 n7H7O7Lm016174 for ; Mon, 17 Aug 2009 09:24:07 +0200 Received: from ueamailgate01.uea.ac.uk (ueamailgate01.uea.ac.uk [139.222.131.184]) by relay2.uni-heidelberg.de (8.13.8/8.13.8) with ESMTP id n7H7Nqin002767 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Mon, 17 Aug 2009 09:23:56 +0200 Received: from ueams01.uea.ac.uk (ueams01.uea.ac.uk [139.222.131.78]) by ueamailgate01.uea.ac.uk (8.13.1/8.13.1) with ESMTP id n7H7NpmV030903 for ; Mon, 17 Aug 2009 08:23:51 +0100 Received: from [139.222.114.191] by ueams01.uea.ac.uk with esmtp (Exim 4.69) (envelope-from ) id 1McwZI-0002HH-1l for LATEX-L@LISTSERV.UNI-HEIDELBERG.DE; Mon, 17 Aug 2009 08:23:48 +0100 User-Agent: Thunderbird 2.0.0.22 (Windows/20090605) MIME-Version: 1.0 References: <4A7921CF.5020803@morningstar2.co.uk> <4A86949D.3090500@morningstar2.co.uk> <4A886BA8.2000209@morningstar2.co.uk> <0417DF73-EC19-4262-B9DF-5C870D47BFCE@gmail.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Canit-CHI2: 0.00 X-Bayes-Prob: 0.0001 (Score 0, tokens from: @@RPTN, outgoing) X-CanItPRO-Stream: UEA:outgoing (inherits from UEA:default,base:default) X-Canit-Stats-ID: 28348395 - 272960d04439 X-Scanned-By: MIMEDefang 2.65 on 213.139.130.197 X-Scanned-By: CanIt (www . roaringpenguin . com) on 139.222.131.184 Message-ID: <4A89058A.3060506@morningstar2.co.uk> Date: Mon, 17 Aug 2009 08:23:54 +0100 Reply-To: Mailing list for the LaTeX3 project Sender: Mailing list for the LaTeX3 project From: Joseph Wright Subject: Re: xparse To: LATEX-L@LISTSERV.UNI-HEIDELBERG.DE In-Reply-To: <0417DF73-EC19-4262-B9DF-5C870D47BFCE@gmail.com> Precedence: list List-Help: , List-Unsubscribe: List-Subscribe: List-Owner: List-Archive: X-ProteoSys-SPAM-Score: -6.599 () BAYES_00,RCVD_IN_DNSWL_MED Return-Path: owner-latex-l@LISTSERV.UNI-HEIDELBERG.DE X-OriginalArrivalTime: 17 Aug 2009 07:28:18.0729 (UTC) FILETIME=[4ABA9190:01CA1F0C] Status: R X-Status: X-Keywords: X-UID: 5930 Will Robertson wrote: > Hi Joseph, > > Thanks for the great efforts here! > I did a once-over on the documentation (and made a couple of minor > adjustments) and everything seems logical to me. > > To summarise the changes from the old xparse: > > - >{P} replaced by + > - >{W} dropped, since it is applied automatically when necessary (final > optional argument(s)) Actually, for the moment I've simply not used any space skipping at all. Of course, TeX skips spaces after the command name itself, but for something like: \foo{arg1}[arg2]{arg3} it seemed easier to explain if there is no space skipping at a LaTeX level. If other people disagree it is easy to change. > - c dropped, replaced by 'd()' I'm imagining that LaTeX3 at the document level might well not need this input type too much. > - g and G{} added: optional braced argument > - d** and D**{} added: pair-delimited argument > - u* and U*{} added: post-delimited argument Just u{}: mandatory argument, no default but takes multiple tokens. > - >{\processor} added: "transforming" input before it's sent through to > the main macro code > - Expandable document commands > > I think that's it. > > Nice to see the expandable document command definitions in there; I > suppose time will tell whether they turn out to be useful or not... I was quite happy that it turned out to be not too bad to code. I'd hope people will take not of the warning that it is to be used in exceptional circumstances. > > The only thing that sort of seems weird to me is that d** uses single > tokens only as delimiters whereas u* allows multiple tokens. Is there a > major technical reason that the d argument couldn't accept something > like d{<<}{>>} for \foo<<1>> ? Actually, I don't care at all to support > this sort of usage, but it just seems odd to have single tokens for one > and multiple tokens for the other. Only a comment; I don't think > anything needs to be done about it, at least at this stage. The reason is the optional nature of D-family arguments (o, O, d, D).: the same applies to t type arguments. For u (mandatory), all that is ultimately needed is: \cs_set:Npn \arg_grabber:w #1 { save #1 } so can be whatever. On the other hand, for D family arguments there is a test to see what the opening token is: \cs_set:Npn \arg_grabber:w { \peek_charcode:NTF { \arg_grabber_aux:w }{ \arg_grabber_aux:w } } \cs_set:Npn \arg_grabber_aux:w #1 { save #1 } To allow multiple opening tokens, there has to be one check (and removal) for each token. That looks rather awkward to write, as you have to be able to put back all of the removed opening tokens if not all are actually present. More generally, I'd hope that more complex options can be handled in better ways than opaque argument syntax. Something like: \foo[opt1][[opt2]]{arg} % Two opt args [...] and [[...]] is probably better handled as: \foo[opt1=text1,opt2=text2]{arg} in any case. > Lars, do you have any comments about whether the new xparse is something > you'd like to use in your own work? Your code, of course, was the big > motivation for the "argument processor" idea and I'd hope that while we > didn't manage to fit everything from xdoc2l3 into xparse there's still > enough that you'd like to use. I'd hope we cover enough for almost all non-verbatim circumstances. For example, taking Will's question of delimiters, you can make a mandatory delimited argument with multiple tokens: \DeclareDocumentCommand \foo { u{} u{} { \tl_if_empty:nTF {#1} { % Do stuff }{ % Probably should not happen! } } -- Joseph Wright