Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I read many examples in tikz-qtree, but I didn't find one which illustrates how to add text around/below a node using qtree. Anyone knows how to draw the following tree using tikz-qtree?

how to draw this

share|improve this question

2 Answers 2

up vote 6 down vote accepted

Here's one way to do this:

\documentclass{article}
\usepackage{tikz-qtree}
\tikzset{
every tree node/.style={align=center,anchor=north,draw,circle,inner sep=3pt},
sibling distance=2cm,
edge from parent/.style=
     {draw, edge from parent path={(\tikzparentnode) -- (\tikzchildnode)}},
myleaf/.style={label=below:{\strut#1}}}

\begin{document}
\begin{tikzpicture}
\Tree [.{}  \node[myleaf=A]{}; [.{} \node[myleaf=B]{};  \node[myleaf=C]{}; ]]
\end{tikzpicture}

\end{document}

output of code

share|improve this answer

I know that the OP asked specifically for tikz-qtree but, just in case, here's one possibility showing the approach using the powerful forest package:

\documentclass{article}
\usepackage{forest}

\begin{document}
\begin{forest}
for tree={
  nodes={anchor=north,draw,circle,inner sep=3pt},
  myleaf/.style={label=below:{\strut#1}},
  s sep=2cm
}
[ [,myleaf={a}] [ [,myleaf={b}] [,myleaf={c}] ] ]
\end{forest}

\end{document}

enter image description here

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.