Received: from mx0.gmx.net (mx0.gmx.net [213.165.64.100]) by h1439878.stratoserver.net (8.14.2/8.14.2/Debian-2build1) with SMTP id o8O7qMDU013391 for ; Fri, 24 Sep 2010 09:52:23 +0200 Received: (qmail 29502 invoked by alias); 24 Sep 2010 07:52:17 -0000 Delivered-To: GMX delivery to rainer.schoepf@gmx.net Received: (qmail invoked by alias); 24 Sep 2010 07:52:17 -0000 Received: from relay2.uni-heidelberg.de (EHLO relay2.uni-heidelberg.de) [129.206.210.211] by mx0.gmx.net (mx043) with SMTP; 24 Sep 2010 09:52:17 +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 o8O7qhBh027682 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 24 Sep 2010 09:52:44 +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 o8O7nlug002618; Fri, 24 Sep 2010 09:50:33 +0200 Received: by LISTSERV.UNI-HEIDELBERG.DE (LISTSERV-TCP/IP release 16.0) with spool id 465460 for LATEX-L@LISTSERV.UNI-HEIDELBERG.DE; Fri, 24 Sep 2010 09:39:50 +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 o8O7dowk017889 for ; Fri, 24 Sep 2010 09:39:50 +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 o8O7fmJs020461 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Fri, 24 Sep 2010 09:41:53 +0200 Received: from ueams02.uea.ac.uk (ueams02.uea.ac.uk [139.222.131.131]) by ueamailgate01.uea.ac.uk (8.13.8/8.13.8) with ESMTP id o8O7de36018367; Fri, 24 Sep 2010 08:39:40 +0100 Received: from [139.222.201.111] by ueams02.uea.ac.uk with esmtp (Exim 4.69) (envelope-from ) id 1Oz2sZ-0007lM-Bb; Fri, 24 Sep 2010 08:39:35 +0100 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-GB; rv:1.9.2.8) Gecko/20100802 Thunderbird/3.1.2 MIME-Version: 1.0 References: <4C9C4200.8090706@gmx.de> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Bayes-Prob: 0.0001 (Score 0, tokens from: @@RPTN, outgoing) X-Spam-Score: 0.00 () [Hold at 10.00] SPF(none,0) X-CanIt-Geo: ip=139.222.131.131; country=GB; region=I9; city=Norwich; latitude=52.6333; longitude=1.3000; http://maps.google.com/maps?q=52.6333,1.3000&z=6 X-CanItPRO-Stream: UEA:outgoing (inherits from UEA:default,base:default) X-Canit-Stats-ID: 58934617 - f4492cfe2dd7 - 20100924 X-Scanned-By: CanIt (www . roaringpenguin . com) on 139.222.131.184 X-Spam-Check-Skipped: Loadavg 14.78 Message-ID: <4C9C55C2.6020300@morningstar2.co.uk> Date: Fri, 24 Sep 2010 08:39:46 +0100 Reply-To: Mailing list for the LaTeX3 project Sender: Mailing list for the LaTeX3 project From: Joseph Wright Subject: Re: xparse: replace optional argument To: LATEX-L@listserv.uni-heidelberg.de In-Reply-To: <4C9C4200.8090706@gmx.de> Precedence: list List-Help: , List-Unsubscribe: List-Subscribe: List-Owner: List-Archive: X-GMX-Antispam: 0 (Mail was not recognized as spam); Detail=5D7Q89H36p77e5KAPs1l6v/Sb97LojnDtMgfETrECMLUO9erHzOJe+OynZRhvlGqb5A0X bbiCt2rAnnct/NAlbHMvoAL6GY+23tB3khNK7au3fkL89Y026H2WJg1zsjGg0I0r5V9ldzzR5wBB /r19Q==V1; X-Resent-By: Forwarder X-Resent-For: rainer.schoepf@gmx.net X-Resent-To: rainer@rainer-schoepf.de Status: R X-Status: X-Keywords: X-UID: 6443 On 24/09/2010 07:15, Arno Trautmann wrote: > Hi all, > > again, a question about xparse, still hoping this is the right list for > that. > I want to do something like > > \NewDocumentCommand\mycommand{O{#2}m}{#1 and #2.} > > which should give the same result for \mycommand[a]{a} and > \mycommand{a}, i.e. “#1 is equal to #2 if #1 is not given“. Is there a > simple way to do this to avoid an if-construct: > > \IfNoValue{#1}{\def\temp{#2}}{\def\temp{#1}} > > and then use \temp instead of #1? If not, would this be possible (and > wanted) to be implemented? Well, \IfNoValue is expandable so you can carry through {\IfNoValueTF{#1}{#2}{#1}} to further stages without any issues (i.e. without needing the \def). That's probably not quite what you want, though. I'll have a think about this. -- Joseph Wright