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:
Sun, 9 Aug 2009 08:30:16 +0100
Content-Type:
text/plain
Parts/Attachments:
text/plain (64 lines)
Joseph Wright wrote:
> 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!).

I've been thinking about this some more.  I can see that Lars has a good
point that it would be better to have only mandatory arguments for
xparse specifiers, and also Will is right that asking people to put the
default in each time is not great.  That takes me back to the original
idea in xparse of using o and O to differentiate these cases. Of course,
there is then an issue with \long arguments.

Suggestion (3):

- Stick with xparse idea of using a "modifier" to make arguments \long
  (possible choices: !, +, *, >, of which I think I like "+" best)

- Letters as follows:
  * m = mandatory
  * l = read up to left brace
  * o = optional with \NoValue default
  * O = optional with default to be given
  * d = delimited with \NoValue default
  * D = delimited with default to be given
  * b = optional braced argument with \NoValue default
  * B = optional braced argument with default to be given
  * s = star (short-cut for "t*")
  * t = arbitrary single token test
  * u = "up to" argument as Will suggests

- b/B is included here as the more I think about it the more I don't
  like the idea of "overloading" d/D to do this. This is a special case,
  and I think should be handled as such.

- Could consider retaining c/C for co-ordinate pairs. If so, I'd go with
  Will's suggestion that it is always optional as far as xparse is
  concerned, and trap a missing value using \NoValue.

That leads to calls which look like:

\DeclareDocumentCommand \foo { o m }
\DeclareDocumentCommand \foo { o +m }
\DeclareDocumentCommand \foo { O{default} m }
\DeclareDocumentCommand \foo { d() l m }
\DeclareDocumentCommand \foo { u{\bar} t+ +m }
\DeclareDocumentCommand \foo { s D<>{default} b o +m }

This does not seem too bad to me: what do other people think?
-- 
Joseph Wright

ATOM RSS1 RSS2