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 Jan 2011 17:32:14 +0000
Content-Type:
text/plain
Parts/Attachments:
text/plain (33 lines)
On 06/01/2011 17:15, Frank Mittelbach wrote:
> xparse offer a fairly general snytax including variable delimiters and default
> values per argument and more. Perhaps you should *indeed* have a look at it
> one day :-) and it could be easily used on top of 2e if so desired

Also, while it's not implemented at the moment at a documented level, in 
principal you could globally alter the '[ ... ]' convention to some 
other delimiters for optional arguments by changing how the 'o' argument 
spec. is handled

> what is not offered right now is mandatory arguments with arbitrary delimiters
> on the left or right, though one could achieve even those in an emergency
> using "u" argument type twice (I guess)

It's unlikely to come up a lot, but I'd use an argument processor:

\documentclass{article}
\usepackage{xparse}
\ExplSyntaxOn
\NewDocumentCommand \test { > { \StripPrefix } u { stop } } {
   Argument~received:~`#1'
   }
\NewDocumentCommand \StripPrefix { m } { \StripPrefixAux #1 \q_stop }
\cs_new:Npn \StripPrefixAux start #1 \q_stop {
   \tl_set:Nn \ProcessedArgument {#1}
}
\ExplSyntaxOff
\begin{document}
\test start some test text stop outside!
\end{document}
-- 
Joseph Wright

ATOM RSS1 RSS2