0

After reading this answer (Making a (simple) directory tree), I was curious to see if I can reproduce this URL tree with the forest package :

enter image description here

As you can see, it is similar to a dirtree but some urls should be highlighted in blue.

Thanks for the help

1

It is easy to do that, except for punching in the texts.

\documentclass{article}
\usepackage[edges]{forest}
\begin{document}
\begin{forest}
highlight/.style={fill=cyan,fill opacity=0.4,rounded corners},
forked edges,
for tree={folder,grow'=0,font=\ttfamily,where n children=0{highlight}{}}
[question/
 [mes-exercises/
  [/]
  [unnecessary/]
  [\textunderscore id/]
 ]
 [mes-exercises/
  [/]
  [unnecessary/]
  [\textunderscore id/]
 ]
 [profil]
]
\end{forest}
\end{document}

enter image description here

Here is a tighter version thereof.

\documentclass{article}
\usepackage[edges]{forest}
\begin{document}
\begin{forest}
highlight/.style={fill=cyan,fill opacity=0.4,rounded corners,inner sep=1pt,
outer sep=1pt},
forked edges,
for tree={folder,grow'=0,font=\ttfamily,s sep=0.4ex,
    where n children=0{highlight}{}},
[question/
 [mes-exercises/
  [/]
  [unnecessary/]
  [\textunderscore id/]
 ]
 [mes-exercises/
  [/]
  [unnecessary/]
  [\textunderscore id/]
 ]
 [profil]
]
\end{forest}
\end{document}

enter image description here

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.