# forest trees, boxes and arrow

I am trying to learn forest, but I am having some problems with it.

\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}


What I want to do is: 1) reduce the height of the box including Z and Y; 2) the thick non-dotted arrow should start from the bottom of the box.

Any help is very appreciated!

• Your example doesn't compile, and produces lots of errors. So you should fix those errors first or ask about the errors specifically. – Alan Munn Mar 22 '17 at 23:06
• It should work now. – RobertP. Mar 22 '17 at 23:23
• What do you mean by too high exactly? What should it look like? – cfr Mar 23 '17 at 0:15
• By the way, isn't it rude not to attribute code you've got from others? – cfr Mar 23 '17 at 0:16
• @cfr I think pretty nice empty nodes is yours and mine was fairly nice empty nodes. :) – Alan Munn Mar 23 '17 at 4:05

Something like this?

\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}

• thanks @cfr! how can I now name the box, so that I can draw an arrow starting from it? – RobertP. Mar 23 '17 at 2:07
• @RobertP. There's already an arrow starting from it. But you can use the corners of the box by adding coordinate (A) or whatever after the relevant point e.g. (!us.north) coordinate (top). You can't name the box as a whole because it is a path and not a node. (Actually, paths can be named, but it wouldn't be useful here.) – cfr Mar 23 '17 at 2:54