2

I have the following code sample with the "forest"-environment.

\documentclass{article}
\usepackage[edges]{forest}

\begin{document}
\begin{forest}
for tree={grow=0, l=5cm, anchor=west, calign=center, child anchor=west, tier/.pgfmath=level() }
    [ Zuverlaessigkeit 
        [ Bedrohung, edge label={node[midway,left] {Gefaehrdet}}
            [ Entwurfsfehler ]
            [ Herstellungsfehler ]
            [ Betriebsfehler ]
        ]
        [ Eigenschaften, edge label={node[midway,below] {Definiert}} 
            [ Verfuegbarkeit ]
            [ Bestaendigkeit ]
            [ Sicherheit ]
            [ Integritaet ]
            [ Instandhaltbarkeit ]
        ]
        [ Behelfsmittel, edge label={node[midway,left] {Schuetzt}}
            [ Fehlerpraevention ]
            [ Fehlertoleranz ]
            [ Fehlervorausberechnung ]
            [ Fehlerbeseitigung ]
        ]
    ]
\end{forest}
\end{document}

It should look something like this: enter image description here

I have the problem that my node "Eigenschaften" doesn't align with the node "Zuverlaessigkeit". I want it to be on the same level. Does anybody have an idea? Thank you in advance!

  • Try l=2cm, calign=fixed angles. – marmot Sep 21 '18 at 19:43
  • Please see also this answer. – marmot Sep 21 '18 at 21:01
2

like this:

enter image description here

\documentclass{article}
\usepackage[edges]{forest}

\begin{document}
\begin{forest}
for tree={grow=0, l=5cm, anchor=west, calign=center, child anchor=west, tier/.pgfmath=level() }
    [ Zuverlaessigkeit
        [ Bedrohung, edge label={node[midway,left] {Gefaehrdet}}
            [ Entwurfsfehler ]
            [ Herstellungsfehler ]
            [ Betriebsfehler ]
        ]
        [ Eigenschaften,
          before computing xy={s/.average={s}{siblings}}, % <---
          edge label={node[midway,below] {Definiert}}
            [ Verfuegbarkeit ]
            [ Bestaendigkeit ]
            [ Sicherheit ]
            [ Integritaet ]
            [ Instandhaltbarkeit ]
        ]
        [ Behelfsmittel, edge label={node[midway,left] {Schuetzt}}
            [ Fehlerpraevention ]
            [ Fehlertoleranz ]
            [ Fehlervorausberechnung ]
            [ Fehlerbeseitigung ]
        ]
    ]
\end{forest}
\end{document}
1

Just spelling out my comment. No manual adjustment.

\documentclass{article}
\usepackage[edges]{forest}

\begin{document}
\begin{forest}
for tree={grow=0,l=1.2cm,anchor=west, calign=fixed angles, child anchor=west, tier/.pgfmath=level() }
    [ Zuverlaessigkeit 
        [ Bedrohung, edge label={node[midway,left] {Gefaehrdet}}
            [ Entwurfsfehler ]
            [ Herstellungsfehler ]
            [ Betriebsfehler ]
        ]
        [ Eigenschaften, edge label={node[midway,below] {Definiert}} 
            [ Verfuegbarkeit ]
            [ Bestaendigkeit ]
            [ Sicherheit ]
            [ Integritaet ]
            [ Instandhaltbarkeit ]
        ]
        [ Behelfsmittel, edge label={node[midway,left] {Schuetzt}}
            [ Fehlerpraevention ]
            [ Fehlertoleranz ]
            [ Fehlervorausberechnung ]
            [ Fehlerbeseitigung ]
        ]
    ]
\end{forest}
\end{document}

enter image description here

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.