答案1
欢迎!我推荐forest
这个。
\documentclass{article}
\usepackage[edges]{forest}
\begin{document}
\begin{forest}
for tree={grow=180,
edge={semithick,stealth-},math content,l sep=10em,draw}
[y,minimum width=1.2cm,minimum height=0.8cm
[x_1,edge label={coordinate[pos=0.8](a)}]
[x_2]
[x_3]
[x_4]
[x_5]
[x_6,edge label={coordinate[pos=0.2](b)}]
]
\path (a) -- (b) coordinate[midway] (c);
\node[draw] at ([yshift=1em]current bounding box.north-|c) (m) {Moderator};
\draw[semithick,-stealth] (m) -- (a);
\draw[semithick,-stealth] (m) -- (b);
\end{forest}
\end{document}
这是一种向树中添加一个普通文本的可能方法。
\documentclass{article}
\usepackage[edges]{forest}
\usepackage{amsmath}
\begin{document}
\begin{forest}
for tree={grow=180,
edge={semithick,stealth-},math content,l sep=10em,draw,
where n children=0{anchor=east}{},child anchor=east}
[y,minimum width=1.2cm,minimum height=0.8cm
[\text{Gym instructor},edge label={coordinate[pos=0.8](a)}]
[x_2]
[x_3]
[x_4]
[x_5]
[x_6,edge label={coordinate[pos=0.2](b)}]
]
\path (a) -- (b) coordinate[midway] (c);
\node[draw] at ([yshift=1em]current bounding box.north-|c) (m) {Moderator};
\draw[semithick,-stealth] (m) -- (a);
\draw[semithick,-stealth] (m) -- (b);
\end{forest}
\end{document}
如果树主要是非数学内容,请math content
从选项中删除for tree
,并在适当的地方添加$
符号。