# How to connect two parents to the same child, with parents not in the same tree?

I'm trying to draw a specific tree, with two parents node linked to the same child. The problem is that one of the parent is outside the main tree.

Here's the code I have for the moment:

\documentclass{article}
\usepackage{tikz-qtree,tikz-qtree-compat}
%\usepackage{gb4e}
\usepackage{forest}

\begin{document}

%\begin{exe}
\begin{forest}
qtree edges/.style={for tree= parent anchor=north, child anchor=south}
[A, grow=north
[C, name=C, grow'=north
[D, grow=north ]
[E, name=t5, grow=north ]
]
[B, grow=north ]
]
\hspace{0.8cm}
[$F$, name=F, grow=north ]
%\draw (F.north) -- (C.south);
\end{forest}
%\end{exe}

\end{document}


I'd like the nodes F and C to be connected. I don't know why, but if I delete the dollar signs, node F doesn't even appear on my document.

Another thing is that I want the forest environment to be embedded in an example environment, but this doesn't work either.

There are various problems with your code. First, multirooted structures are not formally trees, so you can't expect tree drawing packages to handle them directly. See the following question for more discussion on techniques for this:

Furthermore, the syntax for a gb4e example requires that the example be introduced by the \ex macro (within the {exe} environment.)

To handle the multidominance, I've used Ignasi's suggestion to create a node relative to the -| path between node A and E. You could also use the TikZ positioning library, to manually place the node. I've also removed the tikz-qtree package, since it's not needed if you're using forest. Since your 'tree' grows upwards, I've added baseline to one of the terminal nodes so that it will align properly with the example number, and set the growth function globally for the tree. Also, you had a particular style for nodes in your example, but you never applied that style, and I've done that too.

You should also load gb4e after most other packages, since it can cause problems otherwise.)

\documentclass{article}
\usepackage{forest}

\usepackage{gb4e}

\begin{document}

\begin{exe}
\ex
\begin{forest}
qtree edges/.style={for tree={parent anchor=north, child anchor=south}},
for tree={grow=north},qtree edges
[A, name=A,
[C, name=C
[E,baseline,name=E  ]
[D,   ]
]
[B ]
]
\node  (F) at (A-|E) {F};
\draw (F.north) -- (C.south);
\end{forest}
\end{exe}

\end{document}


• If you want to vertically align F with E (like A with D) you can use \node (F) at (A-|t5) {F};. – Ignasi Nov 21 '13 at 15:40
• @Ignasi Thanks. That's a good trick to know. – Alan Munn Nov 21 '13 at 17:11
• Another way to simulate multidominance (by a manual \draw) is to put all the nodes in the same tree and make the proper ones phantom, like in this simplified version of OP's example: \begin{forest}[,phantom[A[B][C,name=C]][F,name=F]]\draw (F)--(C);\end{forest} – Sašo Živanović Dec 13 '13 at 8:39