# Nodes within leaf text in tikz-qtree?

I'm trying to draw a box around only part of the text in a tikz-qtree tree, but the closest I can do is this:

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

\begin{tikzpicture} \tikzset{every tree node/.style={align=center, anchor=north}}
\Tree
[.parent
[.child \node[draw]{boxed}; unboxed ]
]
\end{tikzpicture}
\end{document}


Unfortunately, this generates 'boxed' and 'unboxed' as child nodes of 'child', when I'd much prefer them to be part of the text in 'child'. I've been doing lineless labels on nodes like this -

[.{child \\ label} ]


and so I'd like to be able to do something like this -

[.{child \\ \node[draw]{boxed};unboxed} ]


giving '[boxed]unboxed' on a line under 'child'. The problem is that placing a node inside a [.{} ] element gives an undefined control sequence error. Is there any way around this issue, or am I just going to have to put the whole thing inside a boxed node?

-
Welcome to TeX.sx! –  Kurt Apr 1 '13 at 2:42

Perhaps I am misunderstanding the question, Is something like this what you want?

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

\begin{tikzpicture} \tikzset{every tree node/.style={align=center, anchor=north}}
\Tree
[.parent
[.\node (a) {child \\ \fbox{boxed} unboxed}; ]
]
\end{tikzpicture}
\end{document}


-
Yes it is, thank you! –  Sjiveru Apr 1 '13 at 2:36
@Sjiveru You're welcome! –  Gonzalo Medina Apr 1 '13 at 2:38