Sender: |
|
Date: |
Thu, 6 Aug 2009 08:25:51 +0100 |
Reply-To: |
|
Subject: |
|
MIME-Version: |
1.0 |
Content-Transfer-Encoding: |
7bit |
In-Reply-To: |
|
Content-Type: |
text/plain; charset=ISO-8859-1 |
From: |
|
Parts/Attachments: |
|
|
Joseph Wright wrote:
> Will is on the nail here. The advantage of two different letters for
> optional argument and optional argument + default is that it avoids this
> question. Perhaps that scheme is better over all, even though we then
> need an extra letter. How about:
>
> - n = optional argument with no default
> - o = optional argument with default (which must therefore be specified)
> - b = optional braced argument (as Will wanted "n" for this)
Suggestion (2):
- o = standard optional LaTeX argument with no default value.
- d = delimited optional argument where both the delimiters and default
must be given.
- b or n = optional braced argument (now have a choice!).
This means that "o" is a shortcut for "d[]{\NoValue}", and that any
other case is handled "in full" using d. This seems like a reasonable
balance between making simple optional arguments easy and having a
consistent syntax:
\DeclareDocumentCommand \foo { o m } { }
\DeclareDocumentCommand \foo { d[]{Stuff} m } { }
\DeclareDocumentCommand \foo { d(){0,0} m } { } % Optional co-ordinates
Alternatively, the order could be reversed for d:
\DeclareDocumentCommand \foo { d[{\NoValue}] m } { }
which looks more like the current \newcommand syntax, but would need
braces around the second argument (I don't like this idea, hence d
currently doesn't work this way!).
(By the way, xparse-alt currently uses "-NoValue-" rather than \NoValue,
but I think this was a mistake: once the discussion is complete-ish and
I know what is needed, I'll go back and change this.)
--
Joseph Wright
|
|
|