3

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.

Picture of MWE

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}

NLing
  • 373
  • You should add fit=band as 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
  • @JasperHabicht I got an error with that. I tried both replacing {fit to=tree} and adding it after, but both produced errors. Should it be placed elsewhere? – NLing Oct 30 '21 at 22:01
  • 1
    It should be $\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
  • @JasperHabicht thank you so much!! Do you happen to know how to draw an arrow from the box? (I've edited the above Q to include this one.). Like if I had another named (finalVP):

    \draw[very thick,-{Stealth},blue] (baseVP)..controls +(west:3cm) and +(south:2cm)..(finalVP);

    It gives me an error.

    – NLing Oct 30 '21 at 22:07
  • (edit: 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.) – NLing Oct 30 '21 at 22:12
  • The problem of drawing the arrow from the box occurs because the box node is not yet added at the time. Often, changing one of the draw 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
  • @JasperHabicht I don't think I can choose a comment as a correct answer. Could you put what you said in an answer so it can show up as 'solved'? Thank you again for your help!! – NLing Oct 30 '21 at 22:44
  • @SašoŽivanović I understand this, but how would I tell the \draw macros at the end to wait until the box node has been added to the tree? – Jasper Habicht Oct 30 '21 at 23:44
  • 1
    @JasperHabicht The OP wisely posted a new question about that. And I answered it ;-) https://tex.stackexchange.com/q/620765/16819 – Sašo Živanović Oct 31 '21 at 06:38

1 Answers1

1

Well, I am not able to answer all of your questions, but at least I can tell you how to solve the problem of overlapping. In order to make the forest mechanism obey the bounding box of the green rectangle, you need to add the option fit=band to the node to which the green rectangle is attached.

As for the blue arrows: I would probably try to draw them in a way that they do not overlap each other. This, however, is only possible if they are allowed to overlap the tree at some point.

I have currently no idea how to draw an arrow from the green box, but it has nothing to do with the alignment. Rather, I assume that the node is drawn too late in the rendering process so that it does not yet exist when the arrow is drawn. The forest package allows for rescheduling the drawing procedure, but I don't know the details good enough.

\documentclass[12pt, letterpaper]{article}
\usepackage[margin=1in]{geometry}
\usepackage{libertine}
\usepackage{amssymb}
\usepackage{ulem}

\newcommand{\xbar}[1]{\ensuremath{\overline{\textrm{#1}}}}

\usepackage[table,dvipsnames]{xcolor} \usepackage{graphicx}

%%% Trees \usepackage[linguistics]{forest} \usepackage{tikz} \usetikzlibrary{arrows.meta}

\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$, fit=band, 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.north east) to[out=45, in=-45] (extraposedsurface.south east); \end{forest}}

\end{document}

enter image description here