I am using MacTeX/TeXLive 2021 and the newest version of TeXStudio. For compiling, I am using Latexmk.
In the tree below, I would like for the green box placed on the VP to affect the positioning of the node so that the adjacent node (the one that says T \ blah \ \textsc{$+$blah}) is not positioned inside the box at all. If you have any tips on improving the way I drew the arrows, I would gladly accept them, but the main problem is the T node being partially within the green box.
I would also like to be able to draw an arrow from the green box as if it were a node, which I thought would be possible with this code, but using the same syntax for drawing the blue arrows did not work (presumably for the same reason the box is not aligning as a node). I have tried naming the node both within the Tikz code and the forest code (both \node (blah) and VP,name=blah), but neither seems to work.
I am assuming that somehow I need to make forest see the box around the VP as the VP itself and therefore align automatically, but I cannot seem to find a way to do so.
Thank you so much for your help!!
MWE Code:
\documentclass[12pt, letterpaper]{article}
\usepackage[margin=1in]{geometry}
\usepackage{setspace}
\setlength{\parindent}{0em}
%\setlength{\parindent}{.5in}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{pifont}
\usepackage{libertine}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{MnSymbol}
\usepackage[hidelinks]{hyperref}
\usepackage{ulem}
\newcommand{\xbar}[1]{\ensuremath{\overline{\textrm{#1}}}}
\usepackage[table,dvipsnames]{xcolor}
\usepackage{graphicx}
%%% Trees
\usepackage[linguistics]{forest}
\usepackage{tikz}
\usetikzlibrary{fit,arrows.meta,arrows,shapes.geometric,decorations.markings,decorations.pathreplacing,positioning}
\begin{document}
\scalebox{.7}{\begin{forest}
for tree={s sep=7mm, inner sep=0, l*=1.75}
[... \ CP [VP [VP [V \ blah] [DP [D \ $\varnothing$] [N \ blah]]] [VP [PP [blah,roof]] [VP [PP [\sout{blah blah blah},roof]] [VP [V \ \sout{blah}] [DP [D \ $\varnothing$] [N \ \sout{blah}]]]]]] [CP [\xbar{C} [C \ $\varnothing$] [TP [DP [D \ blah] [N \ $\varnothing$]] [\xbar{T} [T \ blah \ $+$\textsc{blah}] [$\langle$VP$\rangle$,tikz={\node (baseVP) [draw,thick,PineGreen,inner sep = 0, fit to=tree]{};} [VP,name=firstmovedvp [V \ \sout{blah}] [DP [D \ $\varnothing$] [N \ \sout{blah}]]] [VP [PP [\sout{blah},roof]] [VP [$\langle$PP$\rangle$ [\sout{blah blah blah},roof,name=extraposedbase]] [VP,name=lowvp [V \ \sout{blah}] [DP [D \ $\varnothing$] [N \ \sout{blah}]]]]]]]]] [PP [blah blah blah,roof,name=extraposedsurface]]]]
\draw[very thick,-{latex[length=2.5mm,width=2.5mm]},blue] (lowvp)..controls +(south east:15cm) and +(south west:11cm)..(firstmovedvp);
\draw[very thick,-{latex[length=2.5mm,width=2.5mm]},blue] (extraposedbase)..controls +(-55:13cm) and +(south east:14cm)..(extraposedsurface);
\end{forest}}
\end{document}


fit=bandas option to the node to which you also attach the green box. This way, the box won't overlap the sibling node. As for the blue arrows: would it be okay if they cross the tree? Then you could place them differently so that they stay inside the green box. – Jasper Habicht Oct 30 '21 at 21:52$\langle$VP$\rangle$, fit=band, tikz={\node (baseVP) [draw, thick, PineGreen, inner sep=0, fit to=tree] {};}. So, it should not be an option to the green box, but to the tree node directly. – Jasper Habicht Oct 30 '21 at 22:03\draw[very thick,-{Stealth},blue] (baseVP)..controls +(west:3cm) and +(south:2cm)..(finalVP);
It gives me an error.
– NLing Oct 30 '21 at 22:07draw tree processing orders helps, see section 3.4.3 of the manual, and https://tex.stackexchange.com/a/615302/16819 for a problem solved with this style. – Sašo Živanović Oct 30 '21 at 22:40\drawmacros at the end to wait until the box node has been added to the tree? – Jasper Habicht Oct 30 '21 at 23:44