In order to understand the pgfkeys system in Tikz, I would like to print/visualize the key tree.
A detailed documentation is given in the user manual, chapter “Key Management”.
Is this conveniently possible?
This would include querying and iterating the tree (possibly with something like lua) and naturally visualizing it with a tikz tree package. However, a log output would be equally fine. This is not about typesetting but understanding what is stored within the tree.
I see two motivations:
1. Debugging
I do not understand why in following example the second node for the second placement of mypic becomes red. I raised this in a separate question. Here I would like to see where the keys mynodestyle={text=orange,font=\relsize{2}} I provided are stored in the tree
\documentclass{standalone}
\usepackage{tikz,relsize}
\tikzset{
mynodestyle/.style={text=red,font=\relsize{1}},
pics/mypic/.style={code={%
\node[mynodestyle] at (0,0) {Hello};
\node at (0,-1) {I should not be in style.};
}}
}
\begin{document}
\begin{tikzpicture}
\path (0,0) pic {mypic};
\path (0,-2) pic [mynodestyle={text=orange,font=\relsize{2}}] {mypic}; % Unexpected behavior
\end{tikzpicture}
\end{document}
However, @Schrödinger's cat states
(I would agree that TikZ should give an error because of the additional =... stuff but this does not happen.)
Also using
\pgfkeysvalueof{/tikz/mynodestyle}
\pgfkeysvalueof{/tikz/mynodestyle/.style}
\pgfkeysgetvalue{/tikz/mynodestyle/.style}{\myvalue}
\myvalue
did not help me.
2. Convenient Exploration
The documentation of pgf/tikz is quite lengthy. Furthermore, a PDF file format provides not the fastest means to navigate and list matches. Having a method to find/collect/grep options/keys and what the defaults are would be helpful. I could imagine that this would also be interesting for tools like texlab.
Related questions:

/pgfand which under/tikz? Should the tree be based on the keys used in a certain document, or just some illustration? From what is written it is not clear to me whether @AlanMunn's link is really what you are asking. – Jun 04 '20 at 18:32trace-pgfkeysis unfortunately not available. Only commented code in the forest package is using it. – Hotschke Jun 05 '20 at 07:53pgfmanual sec 88.4.4 Defining Styles: Key handle<key>/.stylesets things up so that whenever<key>=<value>is encountered in a key list, then the<key list>, with every occurrence of#1replaced byvalue, is processed instead. You don't specify a#1inmynodestyle/.style, so nothing happened when you write[mynodestyle={...}]. If you append a,#1after your<key list>ofmynodestyle/.style, the code will work well. – ZhiyuanLck Jun 05 '20 at 08:11mynodestyle/.value forbiddenwill raise en error if you domynodestyle={<stg>}. – Qrrbrbirlbel Aug 08 '22 at 09:24