我正在努力学习forest
,但遇到了一些问题。
\documentclass{article}
\usepackage[linguistics]{forest}
\forestset{%
pretty nice empty nodes/.style={
for tree={
calign=fixed edge angles,
parent anchor=children,
delay={if content={}{
inner sep=0pt,
edge path={\noexpand\path [\forestoption{edge}] (!u.parent anchor) -- (.children)\forestoption{edge label};}
}{}}
},
}
}
\begin{document}
\begin{forest}
[, pretty nice empty nodes
[
[X,name=x]
[Y,l=5mm,circle,dotted,draw,name=y] {\node[draw,fit=(y) (!us),rotate=135] {};}
]
[Z]
]
\draw[->,dotted, thick] (y) to [out=south,in=south] (x);
\end{forest}
\end{document}
我想要做的是:1)减少框的高度,包括 Z 和 Y;2)粗的非虚线箭头应该从框的底部开始。
非常感谢您的帮助!
答案1
像这样吗?
\documentclass[border=10pt,multi,tikz]{standalone}
\usepackage[linguistics]{forest}
\forestset{%
pretty nice empty nodes/.style={
for tree={
calign=fixed edge angles,
parent anchor=children,
delay={
if content={}{
inner sep=0pt,
edge path'={(!u.parent anchor) -- (.children)}
}{},
},
},
},
}
\begin{document}
\begin{forest}
for tree={circle}
[, pretty nice empty nodes
[
[X, name=x]
[Y, l=5mm, circle, dotted, draw, name=y]
{
\draw [red] (y.west) -- (!us.north) -- (!us.east) -- (y.south) -- cycle ;
}
]
[Z]
]
\draw[->,dotted, thick] (y) to [out=south,in=south] (x);
\end{forest}
\end{document}