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'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?

share|improve this question
1  
Welcome to TeX.sx! –  Kurt Apr 1 '13 at 2:42
add comment

1 Answer

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}

enter image description here

share|improve this answer
    
Yes it is, thank you! –  Sjiveru Apr 1 '13 at 2:36
    
@Sjiveru You're welcome! –  Gonzalo Medina Apr 1 '13 at 2:38
add comment

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.