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.

Is there a way to decrease the size of roofs in tikz-qtree? I want the roofs not to stick out but match the strings below them.

\documentclass{scrbook}

\usepackage{tikz}
\usepackage{tikz-qtree}

\begin{document}

\begin{tikzpicture}
\tikzset{level 1+/.style={level distance=4\baselineskip}}
\tikzset{frontier/.style={distance from root=16\baselineskip}}
\Tree[.{V[\begin{tabular}[t]{@{}l}
          {\sc comps} { },\\
          {\sc cont} {4}]\\
          \end{tabular}}
          [.{{1} NP{5}} man ]
          [.{V[\begin{tabular}[t]{@{}l}
               {\sc comps} { 1 },\\
               {\sc cont} {4}]\\
               \end{tabular}}
               [.{{2} NP{6}} \edge[roof]; ketābāro ]
               [.{V[\begin{tabular}[t]{@{}l}
                   {\sc comps} { {1}, {2} },\\
                   {\sc cont} {4}]\\
                   \end{tabular}}
                   [.{{3} PP{7}} \edge[roof]; {be Sepide} ]
                   [.{V[\begin{tabular}[t]{@{}l}
                        {\sc comps} { {1} NP{5}, {2} NP{6}, {3} PP{7}},\\
                        {\sc cont} {4} give({5}, {6}, {7})]\\
                        \end{tabular}} dādam ]
               ]
          ]
]
\end{tikzpicture}

\end{document}

share|improve this question
    
Can you include a small tree example with the stick-out(?) roofs case? –  percusse Sep 12 '12 at 9:45
add comment

1 Answer

up vote 2 down vote accepted

Either you define your own roof style by mimicking the tikz-qtree.tex file and shifting the triangle corners with the current node inner sep amount or you specify the roof node options manually for each node.

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

\begin{document}

\begin{tikzpicture}[level 1+/.style={level distance=4\baselineskip},
frontier/.style={distance from root=16\baselineskip},
roof node/.append style={inner sep=0.1pt,text height=2ex,text depth=0.3ex}
]
\Tree[.{V[\begin{tabular}[t]{@{}l}
          {\sc comps} { },\\
          {\sc cont} {4}]\\
          \end{tabular}}
          [.{{1} NP{5}} man ]
          [.{V[\begin{tabular}[t]{@{}l}
               {\sc comps} { 1 },\\
               {\sc cont} {4}]\\
               \end{tabular}}
               [.{{2} NP{6}} \edge[roof]; \node[roof node]{ketābāro}; ]
               [.{V[\begin{tabular}[t]{@{}l}
                   {\sc comps} { {1}, {2} },\\
                   {\sc cont} {4}]\\
                   \end{tabular}}
                   [.{{3} PP{7}} \edge[roof]; \node[roof node]{be Sepide}; ]
                   [.{V[\begin{tabular}[t]{@{}l}
                        {\sc comps} { {1} NP{5}, {2} NP{6}, {3} PP{7}},\\
                        {\sc cont} {4} give({5}, {6}, {7})]\\
                        \end{tabular}} dādam ]
               ]
          ]
]
\end{tikzpicture}


\end{document}

enter image description here

share|improve this answer
    
OK. I looked at the tikz-qtree code, but do not know what to do. I would prefer a manipulation that does allow me to write \edge[my-roof] or maybe even overload the \edge[roof]. –  Stefan Müller Sep 13 '12 at 11:55
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.