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.

Using the QTree package, is it possible to add a shape to a node? For example, a square or a circle?

share|improve this question

2 Answers 2

up vote 1 down vote accepted
\documentclass{scrartcl}

\usepackage{tikz,qtree}
\usetikzlibrary{shapes} 

\begin{document}

\def\adddiam#1{\tikz\node[draw,shape=diamond]{#1};}
\def\addsquare#1{\tikz\node[draw]{#1};} 

\Tree [.CP \addsquare{Spec(CP)} [ C^0 [.IP I^0 \adddiam{Comp(IP)} ] ] ]    
\end{document}  

enter image description here

share|improve this answer
    
@sduplooy In qtree you can use \qtreeshowframes but I think it's only to get a simple frame (rectangle) –  Alain Matthes Apr 2 '11 at 8:30

Although Altermundus' solution works fine, there is a version of qtree designed to work seamlessly with tikz: tikz-qtree, and so it would make more sense to use it for this task. This allows you to easily connect nodes, change node edges and more. Here's an example:

\documentclass[11pt]{article}
\usepackage{tikz-qtree,tikz-qtree-compat}
\begin{document}
\begin{tikzpicture}
\Tree [.CP [.DP \node(wh){who}; ] 
    [.C\1 [.C \node(c){did}; ]  
        [.\node[draw]{TP}; [.DP Bill ] [.T\1  [.T \node(T){t}; ] 
            [.\node[draw,circle]{VP}; [.V see ] 
                [.DP \node(tr){t};  ]]]]]]
\draw[semithick,->] (tr)..controls +(south west:3) and +(south:3) .. (wh);
\draw[semithick,->] (T)..controls +(south west:2) and +(south:2) .. (c);
\end{tikzpicture}
\end{document}

tree image

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.