Example: Filesystem tree

Published 2011-12-27 | Author: Frantisek Burian

Download as: [PDF] [TEX]  •  [Open in Overleaf]

Filesystem tree

Do you have a question regarding this example, TikZ or LaTeX in general? Just ask in the LaTeX Forum.
Oder frag auf Deutsch auf TeXwelt.de. En français: TeXnique.fr.

% Author: Frantisek Burian
\tikzstyle{every node}=[draw=black,thick,anchor=west]
  grow via three points={one child at (0.5,-0.7) and
  two children at (0.5,-0.7) and (0.5,-1.4)},
  edge from parent path={(\tikzparentnode.south) |- (\tikzchildnode.west)}]
  \node {texmf}
    child { node {doc}}		
    child { node {fonts}}
    child { node {source}}
    child { node [selected] {tex}
      child { node {generic}}
      child { node [optional] {latex}}
      child { node {plain}}
    child [missing] {}				
    child [missing] {}				
    child [missing] {}				
    child { node {texdoc}};


  • #1 Chris, December 28, 2011 at 12:11 a.m.

    Nice! But, I think you should make the boxes have the same size.

  • #2 Speravir, December 28, 2011 at 6:47 p.m.

    There’s a solution on TeX.stackexchange.com by Andrew Stacey (with a small, but, I think, important addition of mine), which works without dummy childs (this “[missing]” ones – where is the definition of them?), but is more difficult to understand, where to change the lengths (tip: look for “1cm”):


  • #3 Stefan Kottwitz, December 29, 2011 at 1:14 a.m.

    Hi Speravir,

    thanks for the information! I will read Andrew's example.

    Btw. [missing] is explained in the pgf/TikZ manual, 18. Making trees grow, 18.5.3 Missing Children.

  • #4 Frantisek Burian, January 1, 2012 at 6:21 p.m.

    Hi all!

    The Stacey's example is much better (Maybe can be published there ?). But if i searched for it, i hasn't been found yet. This example is not as complex as Stacey's, but it is constructed with simple code.



  • #5 Stefan Kottwitz, January 1, 2012 at 10:58 p.m.

    Hi Frantisek,

    I like your example because it's easy to understand, and it shows how to use missing children. Andrew's defines a nice growth function, a clever approach, and I think I will add it too, just will have a look at it soon.

  • #6 Hamy, July 2, 2013 at 5:36 p.m.

    For anyone needing it, here's how you turn on arrows from parent-->child:

    edge from parent path={[->] (\tikzparentnode.south) |- (\tikzchildnode.west)}]

  • #7 Andreas, August 23, 2013 at 10:28 p.m.

    I have a question concerning the aesthetics of this example. (It's a great example, by the way.)

    Backgorund to my question: The line from "texmf" to "doc" is thicker than the line from "texmf" to "texdoc". I suppose that this happens because near the root of the tree many lines overlap.

    My question: Is there any way to prevent this and thus to have the same line thicknes everywhere?

    Thank you.

Adding comments is currently not enabled.

Scientific and technical areas


LaTeX Beginners Guide

Limited discount 50%
coupon code tDRet6Y

Creative Commons License