LATEX-L Archives

Mailing list for the LaTeX3 project

LATEX-L@LISTSERV.UNI-HEIDELBERG.DE

Options: Use Classic View

Use Monospaced Font
Show Text Part by Default
Condense Mail Headers

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

Print Reply
Content-Transfer-Encoding: 7bit
Sender: Mailing list for the LaTeX3 project <[log in to unmask]>
From: Joseph Wright <[log in to unmask]>
Date: Wed, 10 Sep 2008 19:54:44 +0100
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 (45 lines)
Hello all,

I'd mentioned to Morten that I would look at how one might implement
some kind of keyval system for package authors in LaTeX3 (at present my
xnotes2bib implementation is simply using keyval).  The limitations of
packages such as xkeyval are well known, so I've been looking at the
pgfkeys approach.  I think that I can get something working, but
wondered how others might see the syntax (or if I'm wasting my time!).

Thus far, I'm following pgfkeys, with a UNIX-file-like "tree" for keys
and "properties":

/module/key name = value % Assigns to key name
/module/key name/.code = some code % Defines key name
/module/key name/.code args = {#1#2#3}{Code using #1, #2 and #3}

The last item illustrates the issue best.  I suspect a more expl3
approach would be:

/module/key name/.code:Nn = 1 {some code} % Not sure about this
/module/key name/.code:pn = #1#2#3 {Code using #1, #2 and #3}

but then picking up the  end of the parameter list is more difficult.
Following pgfkeys, the parameter list needs to be stored, so this is
important.

For those of you not familiar, in the above the .code "property" has one
argument (I think the ".code 2 args" variant from pgfkeys can happily be
dropped in favour of simply using ".code args")

I  was wondering about

/module/key name/.code:n = some code % Allows #1 only
/module/key name/.code:x = some code % \edef version
/module/key name/.code:nn = #1#2#3 {Code using #1, #2 and #3}
/module/key name/.code:nx = #1#2#3 {Code using #1, #2 and #3} % \edef


as a middle way that takes the best of expl3 and pgfkeys. The same
approach could then be used for other properties.

I'd be interest to see how others see this.
-- 
Joseph Wright

ATOM RSS1 RSS2