2

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}
9
  • 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. Oct 30, 2021 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, 2021 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. Oct 30, 2021 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, 2021 at 22:07
  • 1
    @JasperHabicht The OP wisely posted a new question about that. And I answered it ;-) tex.stackexchange.com/q/620765/16819 Oct 31, 2021 at 6:38

1 Answer 1

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

1
  • Thank you @JasperHabicht!!
    – NLing
    Oct 31, 2021 at 0:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.