LATEX-L Archives

Mailing list for the LaTeX3 project


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
Bruno Le Floch <[log in to unmask]>
Reply To:
Mailing list for the LaTeX3 project <[log in to unmask]>
Sat, 28 May 2011 13:33:22 -0400
text/plain (49 lines)
On 5/28/11, Joseph Wright <[log in to unmask]> wrote:
> On 28/05/2011 18:08, Bruno Le Floch wrote:
>> Hello all,
>> on the TeX.stackexchange Q&A website [1], was asked the following
>> question: how do I get with xparse a macro with three optional
>> arguments: <any number of *> <any number of '> <any positive integer>
>> (without the <>). This can be achieved by providing a new argument
>> type, which collects tokens as long as they obey a user-defined
>> condition. Namely,
>> \DeclareDocumentCommand{\X}
>>   {
>>     W { \token_if_eq_meaning:NNTF * }
>>     W { \token_if_eq_meaning:NNTF ' }
>>     W { \token_if_digit:NTF }
>>   }
>>   { \tl_show:n { #1 | #2 | #3 | #4 } }
>> would declare \X to first grab tokens as long as they are equal in
>> meaning to *, then grab tokens as long as they are equal in meaning to
>> ', and finally grab digit tokens.
>> Do you think that it would be useful to add yet another argument type
>> for that? (In the code I have now, I decided that the argument
>> grabbing would stop at the first { or space or }, or implicit such
>> token.)
> I have to say my initial reaction is 'not keen'. While xparse is a
> 'glue' layer between LaTeX2e and LaTeX3, and may not make it to a LaTeX3
> format, I think we don't want to encourage irregular input if we can
> avoid it. Do we _really_ want to suggest that this may even be
> considered as a good idea for a new format?
> On the other hand, I guess it does fall within the 'parsing' remit of
> xparse, and may be something that is occasionally useful. I'd like to
> see a real use case, I guess.

I have to say that I'm not fully keen either. The reason I'm asking
here is that I don't want to put some code out there which shows how
to add extra arguments types to xparse: as discussed earlier, this
would lead to clashes between packages, and is a bad idea. I don't
really have a use case (and I don't think that the OP's example is a
real use case). Perhaps for people who like syntax like "\input foo "
instead of "\input{foo}"? Or to grab the next word (or whatever)...