[texhax] Recording options with pgfkeys

Joseph Wright joseph.wright at morningstar2.co.uk
Wed May 5 14:59:35 CEST 2010


On 05/05/2010 13:16, José Romildo Malaquias wrote:
> 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.

 From the context, I don't see why you can't do this relatively easily.
Something like:

\newcommand*\my at stored@options{} % Always exists
\newcommand*\my at fontfamily{}
\newcommand*\my at fontsize{}
\newcommand*\mycmd[2][]{%
   \pgfkeys{/myfamily/.cd,#1}%
   \def\my at stored@options{/myfamily/.cd,#1}%
   % Do stuff
}

\newcommand*\myothercmd[1]{%
   \expandafter\pgfkeys\expandafter{\my at stored@options}%
   % Do other stuff
}

\pgfkeys{
   /myfamily/.cd,
   fontfamily/.store in = \my at fontfamily,
   fontsize/.store in = \my at fontsize,
   % etc.

}

I've assumed that you will be storing your keys within their own
subpath. You also don't say quite how options might interact: there
are various options.

(Please don't post the same question in three places at once, at least 
without a cross-ref!)
-- 
Joseph Wright


More information about the texhax mailing list