LATEX-L Archives

Mailing list for the LaTeX3 project

LATEX-L@LISTSERV.UNI-HEIDELBERG.DE

Options: Use Forum View

Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Joseph Wright <[log in to unmask]>
Reply To:
Mailing list for the LaTeX3 project <[log in to unmask]>
Date:
Thu, 6 Aug 2009 08:25:51 +0100
Content-Type:
text/plain
Parts/Attachments:
text/plain (40 lines)
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

ATOM RSS1 RSS2