2

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

sduplooy
  • 483

2 Answers2

4

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

Alan Munn
  • 218,180
1
\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

Alain Matthes
  • 95,075