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
Condense Mail Headers

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

Print Reply
Message-ID:
Sender:
Mailing list for the LaTeX3 project <[log in to unmask]>
Subject:
From:
Bruno Le Floch <[log in to unmask]>
Date:
Sat, 28 May 2011 13:08:11 -0400
Content-Type:
text/plain; charset=ISO-8859-1
MIME-Version:
1.0
Reply-To:
Mailing list for the LaTeX3 project <[log in to unmask]>
Parts/Attachments:
text/plain (33 lines)
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.)

Regards,
Bruno



[1] http://tex.stackexchange.com/questions/19177/how-can-i-create-an-oddly-delimited-macro-using-xparse

ATOM RSS1 RSS2