How to find the .store macro of a pgfkey if exists? or whatever other method

How to know if a pgfkey defined in some package is accessible by pgfkeysvalueof or by a .store macro, and how find this macro without digging the package code ? Or whatever other method to find the value of the key.

For example, the key line width is not reachable by \pgfkeysvalueof{/tilz/line width} that returns an empty string.

\pgfkeys{/tikz/line width/.show code} gives :

\pgfkeysshower=\long macro:
\pgfkeys@code ...keysshower }\show \pgfkeysshower
l.3 \pgfkeys{/tikz/line width/.show code}


How to interprete this ?

In the question But where is my scale pgfkeys? the use of \pgfkeys{/tikz/scale/.show code} gives :

> \pgfkeysshower=\long macro:
\pgfkeys@code ...keysshower }\show \pgfkeysshower


but it is not \pgftransformscale {#1} that is used but :

\pgfgettransformentries\aa\ab\ba\bb\xhsift\yshift


How to guess that from \pgfkeys{/tikz/scale/.show code} result ?

I'd like a general approach to deal with existing pgfkeys.

• The answer as far as I know is 'no' (keys don't always save their value: it depends on the code choice of the person setting them up). Does that constitute an answer? – Joseph Wright Mar 9 '18 at 15:45
• I understand that each person deals with the keys as he wants. But one says scale=2 where is this value ? Why the natural mecanism of pgfkeys doen't store this value some where (pgfkeysvalueof or some macro if defined) as one says scale=2. If the person doesn't need to store it, how can I naturally retrieve the value I gave ? even for scale, it is not the real value because af xscale or yscale possible interference. How to find a lead to find it : \pgfgettransformentries is not obvious... – Tarass Mar 9 '18 at 17:28
• What I mean is that pgfkeys could 'automatically' save every key value, but it doesn't. So depending on how the key is implemented, there may be no simple way to recover the value. (We've had a similar discussion for l3keys, where I may well end up storing the key values in all cases.) – Joseph Wright Mar 9 '18 at 17:38
• There are so many edge cases that this won't work in general. Because /.store in is simply performing /.code={\def....{#1}}. So it is going to get confused with other /.code handlers. Some of them don't even store anything but simply set things such as line width which is only required for PDF literals and postscript specials. And the value is directly passed to low levels – percusse Mar 9 '18 at 18:18
• Your best bet is to grep or search for the key definition and look at what the key is doing. – percusse Mar 9 '18 at 18:19

The pgfkeys package does not automatically store all key values anywhere. Thus there is no general way to recover them: this will depend on how each key is treated by the code attached to it. (Some keys may be impossible to recover.)