2

How could I draw two circles in the following tree without making them touch? I need one circle from State to AspP, and the other only around Mood and the lowest MoodP. Here is the code for the syntactic tree.

\documentclass[a4paper,12pt, twoside]{report}
\usepackage{tikz-cd}
\usepackage[linguistics]{forest}
\begin{document}
   \begin{forest}
for tree={s sep=10mm, inner sep=0, l=0}
[MoodP
[AspP
[Asp]
[InitP
[Init]
[ProcP
[Proc] [State]]]]
[MoodP
[Mood][,phantom]
]
]
\end{forest}
\end{document}

The result should be like this one, without the two circles touching. enter image description here

2 Answers 2

5

You can use fit. Just name the nodes you want to enclose. You can adjust rotate, xscale, yscale and shift for a more precise fit.

enter image description here

\documentclass[a4paper,12pt, twoside]{report}
\usepackage{tikz-cd}
\usepackage[linguistics]{forest}
\begin{document}
   \begin{forest}
for tree={s sep=10mm, inner sep=0, l=0}
[MoodP
[AspP, name=C
[Asp, name=E]
[InitP
[Init]
[ProcP
[Proc, name=F] [State, name=D]]]]
[MoodP, name=A
[Mood, name=B][,phantom]
]
]
\node[draw, ellipse, rotate=-50, xscale=.5, fit = {(A) (B)}]{};
\node[draw, ellipse, rotate=47, xscale=.4, yscale=1.2, fit = {(C) (D) (E) (F)}, shift={(-.7,-.1)}]{};
\end{forest}
\end{document}

If you want true circles, you'll have to change the geometry of your tree a bit. For example:

enter image description here

\documentclass[a4paper,12pt, twoside]{report}
\usepackage{tikz-cd}
\usepackage[linguistics]{forest}
\begin{document}
   \begin{forest}
for tree={s sep=2cm, inner sep=0, l sep=1cm}
[MoodP, s sep=4cm
[AspP
[Asp, name=E]
[InitP
[Init]
[ProcP
[Proc, name=F] [State, name=D]]]]
[MoodP, name=A
[Mood, name=B][,phantom]
]
]
\node[draw, circle, fit = {(A) (B)}]{};
\node[draw, circle, fit = {(D) (E) (F)}]{};
\end{forest}
\end{document}
2
  • Thanks! However, I would also need to include into the circle Asp, Init and Proc. Is there a way to keep them as circles?
    – MariaCo
    Jan 29 at 13:39
  • 1
    I edited my response to enclose the other nodes. If you want circles you will have to change the geometry of your tree. See the my update or the solution by @Thruston
    – Sandy G
    Jan 29 at 15:20
3

Here's an approach with circles. I had to include some more phantoms to move the right hand part of the tree to the right.

\documentclass[tikz]{standalone}
\usepackage{tikz-cd}
\usepackage[linguistics]{forest}
\begin{document}
   \begin{forest}
for tree={s sep=10mm, inner sep=0, l=0}
[MoodP
[AspP
[Asp]
[InitP
[Init]
[ProcP
[Proc] [State]]]]
[MoodP
[Mood [,phantom [,phantom][,phantom]]][,phantom]
]
]
\draw (1.9,-1.1) circle [radius=12mm];
\draw (-1.5,-2.7) circle [radius=25mm];
\end{forest}
\end{document}

enter image description here

The location of the circles and the radiuses were just trial-and-error.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .