This is a pretty minor gripe with what is a great library.
\documentclass[border=3em]{standalone}
\usepackage{tikz}
\usetikzlibrary{trees}
\begin{document}
\begin{tikzpicture}[grow=right]
\node {a}
child {
node {b}
}
child{
node {c}
};
\end{tikzpicture}
\end{document}
This MWE produces the following output:
Note that despite the b
node being written before the c
node, it is the c
node that is on top. This is unintuitive. I'd have expected the b
node to be on top, since it's defined first.
I understand why it works that way because without the grow=right
option, things are typeset in the obvious order. What I want to know is:
Is there an easy way to have right-growing trees set their nodes in the order you'd expect from reading the source?
Edit
Matthew's suggestion in the comments works well for basic trees. Unfortunately, it breaks the sloped
option:
\documentclass[border=3em]{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\begin{tikzpicture}[grow=right,yscale=-1,sloped]
\node {a}
child {
node {b}
edge from parent
node[above] {Foo}
}
child{
node {c}
};
\end{tikzpicture}
\end{tikzpicture}
\end{document}
\node[yscale=-1]
?tikzpicture
environment that works. Not as an option on the node