Based on this pgfkeys method, I tried to collect options in a macro for later re-use:
% Set options for a photo
% #1 = options, #2 = photo name, i.e. June
\newcommand\SetPhoto[2][]{%
\expandafter\def\csname #2photoOptions\endcsname{#1}%
}
\pgfkeys{
/Photo/.is family, /Photo,
defaults/.style = {bleed = 0pt,},
bleed/.initial = {},
}
% Place the photo using eariler options
% #1 = photo name
\newcommand\DoPhoto[1]{%
\pgfkeys{
/Photo, defaults,
\csname #1photoOptions\endcsname,
}%
% ...
% ... deal with placing the photo, \includegraphics and so on
% ...
}
And use it like this:
% somewhere early in the document
\SetPhoto[bleed=3mm]{June}
\SetPhoto[bleed=5mm]{July}
% typeset the photos with the given options
\DoPhoto{June}
\DoPhoto{July}
But pgfkeys sees the whole content of the macro (bleed=3mm) as a key:
! Package pgfkeys Error: I do not know the key '/Photo/bleed=3mm' and I am going to ignore it. Perhaps you misspelled it.
How to interpret the contents of a macro as key=value assignment?

\SetPhotowill be local, and\DoPhotowon't see it. I tried expanding the macro, but I didn't have success with that either. – Gambhiro Oct 15 '15 at 19:51\expandafter,\edefcombo". Can you give me any hint about it? – Nicola Gigante Nov 30 '17 at 05:18