树形图的第二层如何对齐?

树形图的第二层如何对齐?

我怎样才能解决这个问题?

在此处输入图片描述

\documentclass[margin=5mm]{standalone}
\usepackage[utf8]{inputenc}
\usepackage[edges]{forest}

\begin{document}

\begin{forest}
    for tree={
        l sep=1cm,
        child anchor=north,
        parent anchor=south,forked edges,
        edge={->,>=latex}}
    [Circuit Elements
        [Active
        [a
        ]
        [a
        ]
        ]
        [Passive
        [b
        ]
        [b
        ]
        ]
    ]
        \end{forest}

    \end{document}

答案1

forked edges相当于for tree=forked edge。因此,要么改为forked edgesforked edge要么将其移出 的范围for tree

\documentclass[border=10pt,multi,tikz]{standalone}
\usepackage[edges]{forest}

\begin{document}
\begin{forest}
  for tree={
    l sep=1cm,
    child anchor=north,
    parent anchor=south,
    forked edge,
    edge={->,>=latex},
  }
  [Circuit Elements
    [Active
      [a
      ]
      [a
      ]
    ]
    [Passive
      [b
      ]
      [b
      ]
    ]
  ]
\end{forest}

\end{document}

树的分叉边缘

相关内容