I need to define a style contained in a macro without expanding this macro.
The problem is that if the macro contains several keys like or sets a value to a key like here:
\def\myconfiguration{text={The value of my great counter is \themycounter}}
it fails because pgfkey tries to first evaluate the macro, and then checks if a key is named text={The value ...}
, which of course is wrong.
So what is the good way to define a pgfkey style inside a macro, and make sure that this macro is not expanded at definition time?
MWE:
\documentclass{article}
\usepackage{pgfkeys}
\newcounter{mycounter}
\def\myconfiguration{text={The value of my great counter is \themycounter}}
\pgfkeys{
/prAtEnd/.cd,
% Text
text/.code={\def\sayhello{#1}},
configuration options/.style={
text={The counter value is \themycounter},
\myconfiguration %% This lines fails!
},
}
\begin{document}
\pgfkeys{/prAtEnd/.cd, configuration options}
\sayhello
\stepcounter{mycounter}
\sayhello
\stepcounter{mycounter}
\sayhello
\end{document}
-- EDIT --
I would like to have at the end the same result as if \myconfiguration
was replaced with it's definition, i.e. text={The value of my great counter is \number\value{mycounter}}
. So the output must be: