Note: this question follows my previous question about \pgfkeyssetvalue
.
The \pgfkeyssetvalue
is defined in pgfkeys.code.tex
file by:
\newtoks\pgfkeys@temptoks
% [...]
\long\def\pgfkeyssetvalue#1#2{%
\pgfkeys@temptoks{#2}\expandafter\edef\csname pgfk@#1\endcsname{\the\pgfkeys@temptoks}%
}
How to define \pgfkeyssetexpandedvalue
as \pgfkeyssetvalue
but where the second argument is expanded?
As this second argument can contains thinks like #1
, ... #9
, we can't use \edef
.
PS: The \pgfkeyssetexpandedvalue
macro can help to fix this bug revealed by “Example: Spherical and cartesian grids” isn't compiled to the right figure.
#1
or\def\foo{}
appearing within the argument, would you want\foo
to expand to the value it had before the definition (which is what edef would do)?#1
...#9
(and may be##
) should be kept as they are,\def
is not expandable and\foo
should be expanded.\edef
but without the error "Illegal parameter number in definition"! ;-)\foo
has been defined by\def\foo{abc}
you want\def\foo{}
in the argument to expand to\def abc{}
and generate an error when used, just as it would in\edef
but\def\foo#1{#1}
it normally doesn't make sense to keep#1
as#1
if\foo
has been expanded ?\foo
has been defined by\def\foo{abc}
, I would like that\pgfkeyssetexpandedvalue{xxx}{\foo{} #1 #2}
defines the same macro that\pgfkeyssetvalue{xxx}{abc #1 #2}
... if possible!