[Tex/LaTex] How to style all edges in a tikz-qtree as arrows

tikz-arrowstikz-qtree

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.

Best Answer

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

Related Question