I am looking for an example of how to get pgfkeys to split a list of options so that: (1) some of the options are processed now, and (2) the rest of the options are passed to a second macro for further processing.
It seems that key filtering should be the answer to this, but I'm not sure how to go about it.
Let's start assuming that there is some command \theirmacro{...} whose single argument takes a key-value list of options. I know that it understands options optA and optB, but it may also accept other options (also later updates of theirpackage might even define new options of which I am not aware at this point). Furthermore, theirpackage might or might not be implemented using pgfkeys.
Now I want to define some new \mymacro{...} which additionally also understands optC and optD, and passes all other options to \theirmacro.
That is, calling \mymacro{optA=1,optC=2} should: (1) do something with the value of optC, and internally also call \theirmacro{optA=1} to process the rest of the options.
\mymacroand want to forward them to\theirmacro, right? In particular, you want to do the job within the body of\mymacro? In this case, you might benefit from an/.unknownkey handler rather than key filtering (although key filtering might also work). – Christian Feuersänger Nov 07 '12 at 19:37.unknownhandler is a better alternative than filtering, but I'm still a bit lost on how to do the “option collecting” bit. I'm also surprised that pgftikz doesn't seem to already have an option implemented for this. – Juan A. Navarro Nov 07 '12 at 22:52\theirmacro{option i=value i}whenever you encounter an unknown option. I'd say the performance overhead is neglectable compared to a bulk approach. And "option collecting" might turn out to be much more expensiv then you thought. – Christian Feuersänger Nov 08 '12 at 09:55\setkeys*and\setrmkeyscommands of the xkeyval package are very handy for this type of task, but you're in the world of pgfkeys.\setkeys*will collect unknown ('remaining') keys in the macro\XKV@rm, which you can use directly or pass to another method.\setrmkeyswill use the content of\XKV@rmto set the keys that were not recognized in the last run of\setkeys*or\setrmkeys*. – Ahmed Musa Nov 08 '12 at 12:35