[texhax] keyval question

Alexander Grahn A.Grahn at fz-rossendorf.de
Tue Dec 12 11:26:36 CET 2006


Hello,

I want to allow some option which requires an argument to be repeatetly
used in the option list of a command:

\mycommand[myopt=a, myopt=b, ..., otheropt]{...}

using the `keyval' package. There is no problem with this if each
option is processed immediatly by some macro, say `\process',
while parsing the option list of \mycommand:

\define at key{mypackage}{myopt}{%
  \process{#1}%
}

However, things are getting complicated, if the option argument processing
is to be deferred to a later place, e. g. after \set at keys has finished. I
tried to build a list consisting of several \process commands with
their corresponding arguments:

\define at key{mypackage}{myopt}{%
  \gdef\processall{%
    \processall% initially empty
    \process{#1}% append to list
  }%
}

This code fails as expected, because when \processall is eventually
invoked somewhere in \mycommand, it is interpreted as a recursive macro
which it should not be in this case. The error is `TeX capacity exceeded'.

Therefore, I'd like to know if there is a way to define \processall such
that, after finishing \setkeys, it looks like:

\processall := \process{a}\process{b}\process{c}

and can be invoked somewhere in the body of \mycommand.

Thanks!

Alexander


More information about the texhax mailing list