I would like to construct a tikz figure that visualizes a directory structure, and enables me to label each folder with a description. These descriptions should be aligned for visual appeal. The closest I've gotten is to create two separate forest diagram, but the alignment isn't working, even when I specify a inner ysep manually in the options.
As an aside, is there a way to automate the generation of the left arrows, rather than typing it as part of the label each time?
MWE:
\documentclass[border=5pt]{standalone}
\usepackage{forest}
\definecolor{folderbg}{RGB}{124,166,198}
\definecolor{folderborder}{RGB}{110,144,169}
\def\Size{4pt}
\tikzset{
folder/.pic={
\filldraw[draw=folderborder,top color=folderbg!50,bottom color=folderbg]
(-1.05*\Size,0.2\Size+5pt) rectangle ++(.75*\Size,-0.2\Size-5pt);
\filldraw[draw=folderborder,top color=folderbg!50,bottom color=folderbg]
(-1.15*\Size,-\Size) rectangle (1.15*\Size,\Size);
}
}
\forestset{is file/.style={
edge path={
\noexpand\path [draw, \forestoption{edge}]
(!u.south west) +(7.5pt,0) |- (.child anchor) \forestoption{edge label};
}
}
}
\begin{document}
\begin{forest}
for tree={
font=\ttfamily,
grow'=0,
child anchor=west,
parent anchor=south,
anchor=west,
calign=first,
inner xsep=7pt,
edge path={
\noexpand\path [draw, \forestoption{edge}]
(!u.south west) +(7.5pt,0) |- (.child anchor) pic {folder} \forestoption{edge label};
},
inner ysep=4pt,
before typesetting nodes={
if n=1
{insert before={[,phantom]}}
{}
},
fit=band,
before computing xy={l=15pt},
}
[{base}
[{makefile}, is file
]
[data
[external
]
[interim
]
[processed
]
[raw
]
]
[docs
]
[output
[figures
]
[paper
]
[presentation
]
[tables
]
]
[src
[analysis
]
[data
]
[external
]
[tools
]
[visualization
]
]
]
\end{forest}
\begin{forest}
for tree={
grow'=0,
child anchor=west,
parent anchor=south,
anchor=west,
calign=first,
inner xsep=7pt,
% edge path={
% \noexpand\path [draw, \forestoption{edge}]
% (!u.south west) +(7.5pt,0) (.child anchor) \forestoption{edge label};
% },
no edge,
inner ysep=4pt,
% l=10pt,
% l sep=20pt,
before typesetting nodes={
if n=1
{insert before={[,phantom]}}
{}
},
fit=band,
before computing xy={l=0pt},
}
[{$\leftarrow$ Everything should be in a self-contained directory}
[{$\leftarrow$ This allows you to run {\ttfamily make} commands}]
[{}
[{$\leftarrow$ Data from third party sources}]
[{$\leftarrow$ Intermediate data that has been transformed}]
[{$\leftarrow$ Final data sets used for analysis}]
[{$\leftarrow$ Original, immutable data dump}]
]
[{$\leftarrow$ Related literature and documentation}
]
[
{}
[{$\leftarrow$ Figures used in the draft and slides}]
[{$\leftarrow$ All the \texttt{.tex} files used to generate the draft}]
[{$\leftarrow$ All the \texttt{.tex} files used to generate the presentation}]
[{$\leftarrow$ Tables used in the draft and slides}]
]
[{}
[{$\leftarrow$ Source code for data analysis}]
[{$\leftarrow$ Scripts used to download or generate the data}]
[{$\leftarrow$ Code from third party sources}]
[{$\leftarrow$ Helper scripts}]
[{$\leftarrow$ Scripts for visualization of the data}]
]
]
\end{forest}
\end{document}


justtrees(from @cfr). You may find it useful. Nice answer (+1). – Zarko Feb 21 '20 at 07:29