What do the pgfkeys key handlers `.get` and `.store in` do?
When I need to retrieve the value of a key in a macro, I use the key
handlers .get and .store in. Here is what is written in the pgfkeys
documentation:
Key handler key /.get= macro Executes a \let command so that macro
contains the contents stored in key .
Key handler key /.store in= macro This handler has the following effect:
When you write key = value , the code \def macro { value } is executed.
Thus, the given value is "stored" in the macro .
I don't really understand the differences between these two handlers.
Actually, I would expect .store in to be sufficient, and yet I need both.
Why?
Code
Below is typically what I write (without understanding it...) when I use
pgfkeys:
\documentclass[margin=.5cm]{standalone}
\usepackage{pgfkeys}
\newcommand{\DisplayKey}[1]{
\pgfkeys{
/a/.initial=1,
/a/.get=\aKey,
/a/.store in=\aKey,
}
\pgfkeys{#1}
a is \aKey
}
\begin{document}
\DisplayKey{a=7}
\end{document}
Output
No comments:
Post a Comment