3

I am using the script provided here to draw a multi-levels chart.

The chart should look like this: enter image description here

But when I run the same script in that should produce the above chart, I get distorted arrow. I am running the script using (TeXstudio 4.3.1 editor in Win. 11). This is the output I get: enter image description here

This is the script that should produce the first figure, but I am getting distorted arrow.

    \documentclass[border=10pt,multi,tikz]{standalone}
\usepackage[edges]{forest}
\usetikzlibrary{arrows.meta,shadows.blur}
\begin{document}
    \newlength\gap
    \setlength\gap{10mm}
    \begin{forest}
        forked edges,
        for tree={
            draw=blue!80!darkgray,
            fill=blue!80!darkgray!25,
            rounded corners,
            minimum width=(\textwidth-6*\gap)/3,
            minimum height=4ex,
            edge={-Latex},
            font=\sffamily,
            text centered,
            blur shadow,
        },
        where={level()<=1}{%
            parent anchor=children,
        }{%
            folder,
            grow'=0,
            l sep+=5pt,
            if level=2{%
                before typesetting nodes={child anchor=north},
                !u.s sep'+=10pt,
                edge path'={%
                    (!u.parent anchor) -- ++(0,-10pt) -| (.child anchor)
                },
            }{},
        }
        [Active Media
        [Gases
        [Atoms
        [He-Ne]
        [I]
        ]
        [Molecules
        [CO2]
        [CO]
        ]
        [Ions
        [Ar]
        [Kr]
        ]
        [Excimers
        [ArF]
        ]
        ]
        [Liquids
        [Dyes
        [Rhodamines]
        ]
        ]
        [Solids
        [Insulators
        [Nd:YAG]
        ]
        [Semiconductors
        [GaAs]
        ]
        ]
        ]
    \end{forest}
\end{document}

EDIT: In the reference code, I took the code in the chosen answer not the original post.

2 Answers 2

4

Use forked edge inside where instead of forked edges for the whole tree:

enter image description here

\documentclass[border=10pt,multi,tikz]{standalone}
\usepackage[edges]{forest}
\usetikzlibrary{arrows.meta,shadows.blur}
\begin{document}
    \newlength\gap
    \setlength\gap{10mm}
    \begin{forest}
        %forked edges,
        for tree={
            draw=blue!80!darkgray,
            fill=blue!80!darkgray!25,
            rounded corners,
            minimum width=(\textwidth-6*\gap)/3,
            minimum height=4ex,
            edge={-Latex},
            font=\sffamily,
            text centered,
            blur shadow,
        },
        where={level()<=1}{%
            parent anchor=children, forked edge
        }{%
            folder,
            grow'=0,
            l sep+=5pt,
            if level=2{%
                before typesetting nodes={child anchor=north},
                !u.s sep'+=10pt,
                edge path'={%
                    (!u.parent anchor) -- ++(0,-10pt) -| (.child anchor)
                },
            }{},
        }
        [Active Media
        [Gases
        [Atoms
        [He-Ne]
        [I]
        ]
        [Molecules
        [CO2]
        [CO]
        ]
        [Ions
        [Ar]
        [Kr]
        ]
        [Excimers
        [ArF]
        ]
        ]
        [Liquids
        [Dyes
        [Rhodamines]
        ]
        ]
        [Solids
        [Insulators
        [Nd:YAG]
        ]
        [Semiconductors
        [GaAs]
        ]
        ]
        ]
    \end{forest}
\end{document}
2

You introduced some differences, see screenshot:

  • left: the reference code
  • right: your code.

Not clear to me, why you did it, as the reference code compiles without pain. So a simple solution would be to use the reference code instead, i.e. to remove said changes.

file-compare

4
  • I took the code in the chosen answer not the original post.
    – None
    Dec 21, 2022 at 16:52
  • I understand, and your replicates the problem, while the reference compiles fine, with the same content. I do not understand why you introduced the few changes. // However, a solution was already proposed.
    – MS-SPO
    Dec 21, 2022 at 17:05
  • This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post. - From Review
    – Miyase
    Dec 21, 2022 at 23:56
  • 2
    @Miyase, it‘s analysis and observation, not critique. The code from the question is identical with the reference, besides a handful of changes. These do not change the content displayed,, but create the problem posted. // I simply wonder, what these changes were intended to do. A simple solution would be to revert to the reference. // This simple solution was missing: added to my answer.
    – MS-SPO
    Dec 22, 2022 at 4:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .