# How to join two trees with forest/tikz

I beg your pardon if I make some mistakes, I'm fully new here. I'm trying to do a presentation with Beamer about syntactic structures and I need to draw two trees. The second tree (which begins with ForceP) is a kind of zoom/split of a section of the first tree. I also need to link them with an arrow.

I've done it with two trees (drawn with forest) and a separate arrow with tikzpicture. Do you know how I can get it more precise? Perhaps using some anchors, tikzmark or labels in the trees? Thanks a lot!

\documentclass[10pt]{beamer}

%------- CODIFICA ------------------------------------
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[italian]{babel}
%---- LINGUISTICA -----------------------------------
\usepackage{tikz}
\usepackage{tikz-qtree}
\usetikzlibrary{tikzmark,arrows.meta}
\usepackage{forest}
\useforestlibrary{linguistics}

\begin{document}
\forestset{
xlist/.style={
phantom,
for children={no edge,replace by={[,append,
delay={content/.wrap pgfmath arg={\csname @alph\endcsname{##1}.}{n()+##1}}
]}}
},
xlist/.default=0
}
\begin{columns}
\begin{column}{5cm}
\begin{forest}
[CP,tikz={\node [draw,red,fit=()(!1)(AB)] {};}
[SpecCP] [C' [C$_0$] [IP,name=AB [SpecIP] [I' [I$_0$] [VP [,roof]]]]]]
\end{forest}
\end{column}

\begin{column}{5cm}
\begin{forest}
[ForceP,tikz={\node [draw,red,fit to=tree] {};}
[SpecForce]
[Force' [Force$_0$]
[\ldots [FinP [SpecFin]
[Fin' [Fin$_0$] [IP [,roof]]]
]]]]
\end{forest}
\end{column}
\end{columns}
\begin{tikzpicture}[remember picture, overlay]
\draw [-Latex, red] (2.80,5) [out=75, in=230]to (5.9,4);
\end{tikzpicture}
\end{document}


• You don't seem to be using the xlist style? – cfr Jul 11 '17 at 19:14
• When you say 'more precise', what are you looking to do exactly? You could draw the two trees as one, by using a phantom root. This can be done with forest alone. (Well, of course, it is using tikz and so on, but I mean that you don't need anything additional.) – cfr Jul 11 '17 at 19:28

The simplest solution may be to use a phantom root and draw both trees as one.

\documentclass[border=10pt,beamer]{standalone}
\usepackage[linguistics]{forest}
\usetikzlibrary{arrows.meta}
\begin{document}
\begin{frame}{Two in One}
\centering
\begin{forest}
[, phantom, for children={fit=band}, s sep'+=20pt
[CP, name=CP
[SpecCP]
[C'
[C$_0$]
[IP, name=AB
[SpecIP]
[I'
[I$_0$]
[VP
[,roof]
]
]
]
]
]
[ForceP, tikz+={
\node (fit1) [draw, red, fit to={name=CP,1,name=AB}] {};
\node (fit2) [draw, red, fit to=tree] {};
\draw [-Latex, red] (fit1.east) [out=75, in=230]to (fit2.west);
}
[SpecForce
]
[Force'
[Force$_0$]
[\ldots
[FinP
[SpecFin]
[Fin'
[Fin$_0$]
[IP
[,roof]
]
]
]
]
]
]
]
\end{forest}
\end{frame}
\end{document}