9

I'd like the edges in my tikz-qtree to be painted as arrows (pointing to the child node).

How can this be done? I found a lot of questions here about how to add addtional edges, lines or arcs, but none about how to draw the edges in a tikz-qtree as arrows instead of plain lines.

1 Answer 1

9

You can use the edge from parent style. A compete example:

\documentclass{article}
\usepackage{tikz-qtree}

\tikzset{edge from parent/.append style={->}}

\begin{document}

\begin{tikzpicture}
\Tree
[.A
  [.B ]
  [.C ]
]
\end{tikzpicture}

\end{document}

The result:

enter image description here

Changing to latex arrow tips and adding red color:

\documentclass{article}
\usepackage{tikz-qtree}

\tikzset{edge from parent/.append style={->,>=latex,red}}

\begin{document}

\begin{tikzpicture}
\Tree
[.A
  [.B ]
  [.C ]
]
\end{tikzpicture}

\end{document}

enter image description here

2
  • Wow, so simple and yet I managed to look around for an hour without finding it. Thanks for the speedy reply!
    – mort
    Commented Jun 18, 2015 at 17:24
  • 2
    Can this be extended to work for specified nodes only? Commented Jan 1, 2017 at 11:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .