Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I'am having draw two tree using the tikz-pgf package

 \begin{frame}

 \begin{columns}[c]

 \begin{column}{2cm}
    \begin{tikzpicture}[scale=0.5] 
    \tikzstyle{level 1}=[sibling distance=10mm] 
    \node{f} 
    child{node{a}}
    child{node{f} child{node{b}} child{[red] node{f }   child{node{a}} child{node{f} child{node{b}}child{node{b}}}      }}
    ;
    \end{tikzpicture}
\end{column}    
\begin{column}{2cm}
   \begin{tikzpicture}[scale=0.5] 
   \tikzstyle{level 1}=[sibling distance=10mm] 
   \node{f} 
    child{node{a}}
    child{node{f} child{node{b}} child{ node{f }   child{node{a}} child{node{g} child[missing] child{node{a}}}      }}
    ;
   \end{tikzpicture}
 \end{column}
 \end{columns}
\end{frame}

The result is : enter image description here

Now i want to connect these two images by a curve line like this

enter image description here

i don't know how i will do it , any answer will be appreciates

share|improve this question

1 Answer 1

up vote 11 down vote accepted

You can name the nodes and, since the two nodes belong to different tikzpictures, you need to use the remember picture, overlay options to draw a line connecting them:

\documentclass{beamer}
\usepackage{tikz}

\begin{document}

 \begin{frame}

 \begin{columns}[c]
 \begin{column}{2cm}
    \begin{tikzpicture}[remember picture,overlay,scale=0.5] 
    \tikzstyle{level 1}=[sibling distance=10mm] 
    \node{f} 
    child{node{a}}
    child{node{f} child{node{b}} child{[red] node (f1) {f }   child{node{a}} child{node{f} child{node{b}}child{node{b}}}      }}
    ;
    \end{tikzpicture}
\end{column}    
\begin{column}{2cm}
   \begin{tikzpicture}[remember picture,overlay,scale=0.5] 
   \tikzstyle{level 1}=[sibling distance=10mm] 
   \node (f2) {f} 
    child{node{a}}
    child{node{f} child{node{b}} child{ node{f }   child{node{a}} child{node{g} child[missing] child{node{a}}}      }}
    ;
\draw (f1) .. controls (-3,3) .. (f2);
   \end{tikzpicture}
 \end{column}
 \end{columns}
\end{frame}

\end{document}

enter image description here

If both trees are part of the same tikzpicture, there's no need to use remember picture,overlay (but I don't know if using two environments is esential in your actual document).

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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