6

How can I display an arrow between two tikzpictures (of the same size) so that the arrow is alligned with the centre of the pictures?

\documentclass{article}
\usepackage{tikz}
\begin{document}


\begin{tikzpicture}[
  tlabel/.style={pos=0.4,right=-1pt},
]
\node{$\Rightarrow$}
child {node {$\wedge$}
child {node {$p$}}
child {node {$q$}}}
child {node {$r$}}
;
\end{tikzpicture}

 $\rightarrow$ % the arrow between the pictures

\begin{tikzpicture}[
  tlabel/.style={pos=0.4,right=-1pt},
]
\node{$\Rightarrow$}
child {node {$\wedge$}
child {node {$p$}}
child {node {$q$}}}
child {node {$r$}}
;
\end{tikzpicture}

\end{document}
2

Do you want something like this?

arrow between

This uses the baseline key with the value (current bounding box.center) to align the centres of the pictures with the current baseline.

\documentclass{article}
\usepackage{tikz}
\begin{document}
  \begin{tikzpicture}[
    tlabel/.style={pos=0.4,right=-1pt},
    baseline=(current bounding box.center)
    ]
    \node{$\Rightarrow$}
    child {node {$\wedge$}
      child {node {$p$}}
      child {node {$q$}}}
    child {node {$r$}}
    ;
  \end{tikzpicture}
  $\rightarrow$ % the arrow between the pictures
  \begin{tikzpicture}[
    tlabel/.style={pos=0.4,right=-1pt},
    baseline=(current bounding box.center)
    ]
    \node{$\Rightarrow$}
    child {node {$\wedge$}
      child {node {$p$}}
      child {node {$q$}}}
    child {node {$r$}}
    ;
  \end{tikzpicture}
\end{document}

If you are drawing trees, you should consider one of the specialised libraries or packages as they offer greater power and flexibility and, in many cases, a syntax which allows you to specify a tree much more concisely.

Packages include forest (based on TikZ), tikz-qtree (obviously TikZ-based), qtree (non-TikZ) and the TikZ library trees (much less powerful and does not support specialised syntax).

  • That's exactly what I want, thanks! I tried some tree packages but they didn't display the trees how I want. I only need to draw a few simple trees and tikz seems fine for that. – mmgro27 Aug 9 '15 at 22:03
  • @notnek Certainly if it works for you, there is no need to fix it ;). – cfr Aug 9 '15 at 22:39

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.