I have the following tree produced by the LaTeX code at the end, which is a modification from Drawing a directory listing a la the tree command in TikZ

My problem: When I have a lot of nodes, I get Dimension too large error, as shown in the second picture. I saw something like \pgfkeys{/pgf/fpu=true}, but I can't make it work in my code. I need help to allow any number of nodes other than reducing the size of each node and the distances between them.

enter image description here

enter image description here

\usepackage[english, french]{babel}


    \global\advance\dirtree@plvl by 1
    \expandafter\xdef\csname dirtree@p@\the\dirtree@plvl\endcsname{\the\dirtree@lvl}
    \global\advance\dirtree@lvl by 1\relax
    \advance\dirtree@clvl by -\csname dirtree@p@\the\dirtree@plvl\endcsname
    \global\advance\dirtree@plvl by -1

        growth function=\dirtree@growth,
        every node/.style={anchor=south},
        every child node/.style={anchor=west},
        edge from parent path={(\tikzparentnode\tikzparentanchor) |- (\tikzchildnode\tikzchildanchor)}




    \begin{tikzpicture}[dirtree, event/.style={rectangle,thick,draw,fill=yellow!20,
        anchor=south}, level 1/.style={nodes=event}, line width=0.75mm]

\node[event] {Master}
child { node {1}
child { node {1-1}
child { node {1-2}
child { node {2}
child { node {2-1}
child { node {2-2}

Update: Zarko's answer (forest) doesn't help me:

enter image description here

  • There are four answers in this question, if this one fails, did you tried with some other? I think forest is a better option for trees.
    – Ignasi
    Commented Mar 22, 2018 at 14:50
  • Have you tried using forest and compiling with lualatex? It dynamically allocates memory and is less likely to give out of memory errors. Commented Mar 23, 2018 at 22:25
  • Also, could you give an example where the out of memory error actually occurs? The example you've given isn't big enough. Commented Mar 23, 2018 at 22:27
  • Change pgf@ya to -145cm will produce the same problem
    – user565739
    Commented Mar 23, 2018 at 22:30
  • It's not the problem of number of node, it's the huge content can't be fit in the document
    – user565739
    Commented Mar 23, 2018 at 22:31


You must log in to answer this question.

Browse other questions tagged .