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
Joseph Wright <[log in to unmask]>
Reply To:
Mailing list for the LaTeX3 project <[log in to unmask]>
Wed, 10 Jun 2009 08:25:23 +0100
text/plain (69 lines)
Hello all,

A while ago, I wrote the "keys3" package as an experiment in how
key-value methods might be implemented in LaTeX3. I've done various
refinements on the code to try to make it clear, but I'm not sure I've
succeeded.  So I'm thinking about the problem again.

For LaTeX2e, key-value input can be created in two broad ways:

- Using a key-by-key approach with dedicated macros. This is the method
used in keyval itself, xkeyval and kvoptions.
- Using a keyval list to create keys. This is what pgfkeys does, and
what I followed when creating keys3.

I note that the current template code also uses the second approach. The
complexity of xkeyval, in particular, really makes me think that some
kind of keyval method for generating keys is the best plan. So it is
then a question of the best way to do that.

I wonder if the pgfkeys idea of using one macro to create and set keys
is confusing. Currently, it is what I've done in keys3:

    % Some keys are created
    % Some keys are set

but do other people think that strict separation:

  \keys_generate:n {
    % Some keys are created
  \keys_set:n {
    % Some keys are set

is clearer?

The other question is how to make keys in this way. keys3 uses the idea
of properties:

  key name/.property = value

for example

  \module\my~key/.tl_set:N  = \l_module_my_tl,
  \module\my~key/.default:n = {default}

to create a key which will store its input in a tl. On the other hand,
template uses and "extended key-value" approach:

key name =<type> [default] <function>

for example:

  my key =n [default] \l_module_my_tl

Both ideas have some good points. template keeps everything in one line,
which probably makes it easier to see what goes with what. On the other
hand, the pgfkeys approach does not need any special layout of the input
to work.

I wonder how other people see the two schemes, and if there are other
ways that similar effects can be achieved.
Joseph Wright