I have this
\documentclass{article}
\usepackage{tikz}
\usepackage{forest}
\usetikzlibrary{positioning}
\usetikzlibrary{automata}
\begin{document}
\begin{tikzpicture}[%
node distance=0.8cm,
->,
font=\small,
baseline=(current bounding box.north)
]
\node[state] (s1) {$s_1$};
\node[state] (s2) [above left=of s1] {$s_2$};
\node[state] (s3) [right=of s1] {$s_8$};
\node[state] (s4) [left=of s2] {$s_3$};
\node[state] (s5) [left=of s1] {$s_5$};
\node[state] (s6) [right=of s2] {$s_9$};
\node[state] (s7) [below left=of s3] {$s_{11}$};
\node[state] (s8) [left=of s5] {$s_4$};
\node[state] (s9) [right=of s6] {$s_{10}$};
\node[state] (s10) [left=of s7] {$s_6$};
\node[state] (s11) [left=of s10] {$s_7$};
\path (s1) edge (s2);
\path (s1) edge (s3);
\path (s2) edge (s4);
\path (s2) edge (s5);
\path (s3) edge (s6);
\path (s3) edge (s7);
\path (s4) edge (s8);
\path (s6) edge (s9);
\path (s5) edge (s10);
\path (s5) edge (s11);
\end{tikzpicture}
\qquad
\begin{forest}
for tree={%
math content,
state,
edge={->},
l sep=0.1cm,
s sep=0.1cm,
font=\small
}
[s_1
[s_2
[s_3
[s_4]
[,phantom]
]
[s_5
[s_6]
[s_7]
]
]
[s_8
[s_9
[,phantom]
[s_{10}]
]
[s_{11}]
]
]
\end{forest}
\end{document}
which produces
I want these two graphs/trees to be equal in height (or at least top-aligned).
I have tried with baseline=(current bounding box.north), but it did not work as expected.
How do I make an arrow between these with some small text above the arrow? Should I put each graph in a node and use \draw (graph1) -- node[above] {text above} (graph2)?
Edit 1
Using baseline=(current bounding box.south), I get
so they are still not aligned vertically.
Seems to be the same as omitting baseline option completely.
Edit 2
The problem is that I cannot fit the two graphs side by side on my page if the tikzpicture has node distance=2cm. So either the forest should be smaller or I should give up on making them the same height, and instead just align them vertically.
Also, it seems placing an tikzpicture side by side with a forest makes a left margin:
My code is
Some text
\begin{center}
\begin{tikzpicture}[%
node distance=0.9cm,
->,
font=\small,
framed
]
\node[state] (s1) {$s_1$};
\node[state] (s2) [above left=of s1] {$s_2$};
\node[state] (s3) [right=of s1] {$s_8$};
\node[state] (s4) [left=of s2] {$s_3$};
\node[state] (s5) [left=of s1] {$s_5$};
\node[state] (s6) [right=of s2] {$s_9$};
\node[state] (s7) [below left=of s3] {$s_{11}$};
\node[state] (s8) [left=of s5] {$s_4$};
\node[state] (s9) [right=of s6] {$s_{10}$};
\node[state] (s10) [left=of s7] {$s_6$};
\node[state] (s11) [left=of s10] {$s_7$};
\path (s1) edge (s2);
\path (s1) edge (s3);
\path (s2) edge (s4);
\path (s2) edge (s5);
\path (s3) edge (s6);
\path (s3) edge (s7);
\path (s4) edge (s8);
\path (s6) edge (s9);
\path (s5) edge (s10);
\path (s5) edge (s11);
\end{tikzpicture}
\hfill
\begin{forest}
for tree={%
math content,
state,
edge={->},
l sep=0.1cm,
s sep=0.1cm,
font=\small,
}
[s_1
[s_2
[s_3
[s_4]
[,phantom]
]
[s_5
[s_6]
[s_7]
]
]
[s_8
[s_9
[,phantom]
[s_{10}]
]
[s_{11}]
]
]
\end{forest}
\end{center}
If I remove the forest and does not center it, it it left aligned with Some text just above it.





forestis on the bottom line. So you need to change that baseline too... – Rmano Dec 28 '16 at 09:27\qquador something back in. To get space before the arrow you can do something like\draw [-latex] (current bounding box.east) ++(2mm,0) --node[above]{text} +(1cm,0);, and change2mmto what you like. Note however that the diagrams are already much wider than the textblock, which may or may not be a problem. – Torbjørn T. Dec 28 '16 at 09:31baseline=(current bounding box.south)in bothforestandtikzpicture– Jamgreen Dec 28 '16 at 10:15