[texhax] Recording options with pgfkeys

José Romildo Malaquias j.romildo at gmail.com
Wed May 5 14:16:49 CEST 2010

I want to define some options with pgfkeys in LaTeX. Some keys should be
stored in its own macro as well as in a collective macro that could be
used later to reuse those options when calling another macro.

For instance, consider the hypothetic command below whose options are
dealt with pgfkeys:


This would define macros in the body of \mycmd that would look like this

  \def\my at fontfamily{\ttfamily}
  \def\my at fontsize{\small}
  \def\my at collected@options{fontfamily=\ttfamily,fontsize=\small}

and in the definion of \mycmd, I would use all of them:

    % ... do something with the individual option commands
    \my at fontfamily\my at fontsize
    % ... and also make all of the options available to another
    % ... command without having to pass them individually
    \expandafter\my at other@cmd\expandafter[\expandafter{\my at collected@options}]{#2}%

The option values should not be expanded in the definition of
\def\my at collected@options. This means that the call to \my at other@cmd
will see the options




without expanding \ttfamily and \small. That would be done by the call
to \pgfkeys in its body.

How can I implement this? Any help?


More information about the texhax mailing list