add tag
JeT
**Question**

How can I represent the keys used in a document with that type of tree visual ?

![course.png](/image?hash=c8a0ca03d18ad5480db10e1a12acbf627e18580c77d4154b4928f65225fc3929)

**Context**

Keys correspond to the same idea as registry on widows (It’s a shortcut yes). 

![blob](/image?hash=df7a221492fc65356b8a7b125746f7eb7046a456132eb9e1395c2ac6ab30eb19)

However, I miss a visual way, as on registry to see the different branches of the keys in a document. 

With just a visual (like the tree above), I know the architecture of my keys in my document. And if I get back to that document in a long time, just a glimpse and I can have the big picture. 

Following Marmot's comments, it does not seem trivial and there does not seem to be a consensus on this. But using that type https://tex.stackexchange.com/questions/488785/list-of-newcommands-used/488798#488798 of framework could work.

So... Any way to plug forest on keys to have a visual on their ramifications and options ? 

MWE could be this one :https://topanswers.xyz/tex?q=1375
Top Answer
user 3.14159
This is not an answer but a basis for further discussions. Many things can be improved, and for some of them I know better ways, but this is merely to avoid that the interpretations of what should be achieved does not differ too much. Some ongoing work is deferred to [this repository](https://github.com/marmotghost/pgf-pathology). If you download the files
* [pgf-pathology.sty](https://github.com/marmotghost/pgf-pathology/blob/main/pgf-pathology.sty)
* [pgf-pathology.code.tex](https://github.com/marmotghost/pgf-pathology/blob/main/pgf-pathology.code.tex)

then you should be able to compile 
```
\documentclass{article}
\usepackage{pgf-pathology}
\usepackage[edges]{forest}
\begin{document}

% install the trackers 
\pgfkeys{install tracking for={.is family},
install tracking for={.initial},
install tracking for={.code}}

% sample keys
\pgfkeys{/JeT/.is family,/JeT/.cd,	
	beamer/.is family,
	beamer/.cd,
	theme/.code={pft},
	color/.initial={red},
	favorite beer/.initial={Hopf},
	/JeT/.cd,
	homework/.is family,
	homework/.cd}


% a sample tree (usage will be improved)

\FolderForestContent{/JeT/}
\bracketset{action character=@}
\begin{forest}
for tree={grow'=0,folder}
@\ForestContent
\end{forest}
\end{document}
```
and get
![Screen Shot 2020-11-09 at 5.52.23 PM.png](/image?hash=a915a49b2ab58dc6a12668402130aa0acf5d113d9f6d997b344466a46bb45226)
As you can see, 
```
\pgfkeys{install tracking for={.is family},
install tracking for={.initial},
install tracking for={.code}}
```
installs some trackers for key handlers. This means whenever the user uses one of the handlers `.is family`, `.initial` or `.code`, the key and its path will be "recorded". In its current implementation this information can be surveyed with the command `\FolderForestContent`, which takes a folder as argument, into something that can be fed into a `forest` tree. This command will not survive in its present form.  


**HISTORICAL ARTIFACTS**: The following comes with some trackers that can be installed locally. These trackers keep track of the pgf keys that get set. One can install them individually for different handlers. In the example they get installed for `.is family`, `/.code` and `/.initial`. A macro converts the information into something that can be fed into `forest`. 
```
\documentclass{article}
\usepackage{pgf}
\usepackage[edges]{forest}
\makeatletter
\newif\if@pgf@folder@debug
\@pgf@folder@debugtrue
\@pgf@folder@debugfalse
\def\folder@debug@message#1{\if@pgf@folder@debug
\typeout{#1}%
\fi
}%
\def\pgf@folder@add@entry#1#2{% add #1 to #2
\folder@debug@message{master=#2}%
\edef\pgf@folder@tmpm{#2}%
\ifcsname pgf@folder@entries@#2\endcsname
  \folder@debug@message{before in}%
  \edef\pgf@folder@tmpb{\csname pgf@folder@entries@#2\endcsname}%
  \folder@debug@message{b=\pgf@folder@tmpb}%
  \edef\pgf@folder@tmpa{\noexpand\pgfutil@in@{,#1,}{,\pgf@folder@tmpb,}}% test if #1 is in #2
  \pgf@folder@tmpa
  \ifpgfutil@in@%
    \folder@debug@message{#1 already exists in list #2=\csname pgf@folder@entries@#2\endcsname.}%
	% the key is already in, so nothing to do
  \else
	\folder@debug@message{adding #1 to list #2.}%
	\expandafter\edef\csname pgf@folder@entries@#2\endcsname{\csname pgf@folder@entries@#2\endcsname,#1}%
  \fi
\else
 	\folder@debug@message{creating list #2 and adding #1.}%
 	\expandafter\edef\csname pgf@folder@entries@#2\endcsname{#1}%
\fi
}%

% this is \pgfutil@for, just that the role of commas is taken by slashs
\long\def\pgfutil@for@path#1:=#2\do#3{%
\expandafter\def\expandafter\pgfutil@fortmp\expandafter{#2}%
\ifx\pgfutil@fortmp\pgfutil@empty
\else 
\expandafter\pgfutil@forloop@path#2/\pgfutil@nil/\pgfutil@nil\@@#1{#3}%
\fi
}
% called by \pgfutil@for@path
\long\def\pgfutil@forloop@path#1/#2/#3\@@#4#5{%
\def#4{#1}%
\ifx#4\pgfutil@nnil 
\else
#5%
\def#4{#2}%
\ifx#4\pgfutil@nnil 
\else 
#5%
\pgfutil@iforloop@path#3\@@#4{#5}%
\fi 
\fi
}%
% called by \pgfutil@forloop@path
\long\def\pgfutil@iforloop@path#1/#2\@@#3#4{%
\def#3{#1}%
\ifx#3\pgfutil@nnil 
\expandafter\pgfutil@fornoop 
\else 
#4\relax 
\expandafter\pgfutil@iforloop@path\fi#2\@@#3{#4}%
}
% pathology: disect paths
\def\pgfkeys@folders@split@path#1{%
\c@pgf@counta0\relax
\expandafter\edef\csname pgf@folder@current@folder@0\endcsname{}%
\pgfutil@for@path\pgfkeys@temp:=#1\do{%
\ifx\pgfkeys@temp\pgfkeys@empty
\folder@debug@message{empty}%
\else% to do: maybe add subfolders here?
\advance\c@pgf@counta by1\relax
\expandafter\edef\csname pgf@folder@current@folder@\the\c@pgf@counta\endcsname{%
\csname pgf@folder@current@folder@\the\numexpr\c@pgf@counta-1\endcsname/%
\pgfkeys@temp}%
\folder@debug@message{found \pgfkeys@temp}%
\edef\pgfkeys@folder@current@key{\pgfkeys@temp}%
\edef\pgfkeys@folder@current@master{\csname pgf@folder@current@folder@\the\numexpr\c@pgf@counta-1\endcsname/}%
\pgf@folder@add@entry\pgfkeys@temp\pgfkeys@folder@current@master%
\fi
\edef\pgfkeys@folder@current@master{\csname pgf@folder@current@folder@\the\numexpr\c@pgf@counta-1\endcsname/}%
}}
% tracker
\def\pgf@folder@tracker{%
\folder@debug@message{======================}%
\folder@debug@message{Oh, a family.}%
\folder@debug@message{complete path=\pgfkeyscurrentpath|name=\pgfkeyscurrentname|
	default:\pgfkeysdefaultpath|current key=\pgfkeyscurrentkey}%
\expandafter\pgfkeys@folders@split@path\expandafter{\pgfkeyscurrentpath}%
\ifx\pgfkeys@folder@current@master\pgfutil@empty
\folder@debug@message{master empty}%
\edef\pgfkeys@folder@current@master{/}%
\else
\folder@debug@message{master=\pgfkeys@folder@current@master, current key=\pgfkeys@folder@current@key}%
\fi
%\pgf@folder@add@entry\pgfkeys@folder@current@key\pgfkeys@folder@current@master%
}%

\newcommand\FolderForestContent[2][]{\expandafter\pgf@folder@forest\expandafter{#2}}%
\long\def\pgf@folder@forest#1{\xdef\ForestContent{[#1}%
\expandafter\pgf@folder@forest@i\expandafter{#1}%
\xdef\ForestContent{\ForestContent]}}%
\long\def\pgf@folder@forest@i#1{\ifcsname pgf@folder@entries@#1\endcsname
\expandafter\pgfutil@for\expandafter\pgf@folder@tmpa\expandafter:\expandafter=\csname pgf@folder@entries@#1\endcsname\do{%
\folder@debug@message{item=\pgf@folder@tmpa}%
\xdef\ForestContent{\ForestContent[\pgf@folder@tmpa}
\begingroup
\edef\pgf@folder@tmpb{\pgf@folder@tmpa}%
\expandafter\pgf@folder@forest@i\expandafter{#1\pgf@folder@tmpb/}\endgroup%
\xdef\ForestContent{\ForestContent]}}%
\fi}%
\pgfkeys{install tracking for/.code={\pgfkeys{/handlers/#1/.append code={\pgf@folder@tracker}}}}
\makeatother
\begin{document}

% install the trackers 
\pgfkeys{install tracking for={.is family},
install tracking for={.initial},
install tracking for={.code}}

% sample keys
\pgfkeys{/JeT/.is family,/JeT/.cd,	
	beamer/.is family,
	beamer/.cd,
	theme/.code={pft},
	color/.initial={red},
	/JeT/.cd,
	homework/.is family,
	homework/.cd}


% a sample tree (usage will be improved)

\FolderForestContent{/JeT/}
\bracketset{action character=@}
\begin{forest}
for tree={grow'=0,folder}
@\ForestContent
\end{forest}
\end{document}
```

![Screen Shot 2020-11-08 at 7.55.50 PM.png](/image?hash=95db30895347443d1b45e3533110feb9746ebd5c469d338f2a750280202e187e)

Enter question or answer id or url (and optionally further answer ids/urls from the same question) from

Separate each id/url with a space. No need to list your own answers; they will be imported automatically.