Content-Type:
text/plain; charset=UTF-8
Date:
Thu, 30 Dec 2010 17:01:35 +0100
MIME-Version:
1.0
Message-ID:
<1713005794.1189899.1293724895711.JavaMail.fmail@mwmweb012>
Content-Transfer-Encoding:
8bit
|
I wrote:
> A better proposal than using different category codes is
> programming macros with optional arguments obeying
> a convention that makes a choice of delimiters available to users.
> Any macro package replacing \@ifnextchar[ by some
> \ifx\let@token\opt@arg@delim could be run this way.
>
> If no LaTeXY will adopt this, I will call it LüTeX :-)
I had thought of posting such a "feature request" earlier,
refrained from it for not having found a good idea how
to implement it. If I now found it so simple, I must have
overlooked a problem ...
This would mean that so many \foo in the LaTeX kernel
reading their optional argument by \@foo[#1] must be replaced.
At least I have now thought how such macros would have to
look like instead (sketch, \SetOptArgDels chooses delimiters,
\foo is an example command with one optional argument):
\def\SetOptArgDels#1#2{%
\let\opt@arg@del@l#1%
\def\read@pass@opt@arg##1#1##2#2{##1{##2}}}
\def\foo{%
\@ifnextchar\opt@arg@del@l
{\read@pass@opt@arg\@foo}%
{\@foo{DEFAULT}}}
\def\@foo#1...
-- where one had \def\@foo[#1]... so far.
Maybe this already is in xparse? Sorry, I cannot afford more right now ...
Fortunately,
1. there would be no need to change preamble-only commands,
2. as I realize at reading Heiko's comment, the "ambiguity" only
arises with macros whose *last* (e.g., only) arguments are optional.
Cheers,
Uwe.
|
|
|