3

I would like to adjust the height and width of certain roofs in my syntax trees.

I'm particularly interested in getting a roof with a long phrase/sentence to look better. In the image below, the "um cocar de índio" roof should not be so wide, but higher and less "flat", if I can explain myself clearly. Here's what it looks like right now:

enter image description here

I've looked at the solution here, but it doesn't work for me because the "triangle" (roof) goes upside down, like in the image below (and the width of the roof still looks the same to me):

enter image description here

Here's a minimal example:

\documentclass[12pt,a4paper]{article}
\usepackage{tipa, tikz-qtree}
\usepackage{tikz-qtree-compat}
\usepackage{linguex}

\begin{document}
\ex. \parbox{\textwidth}{\begin{tikzpicture}[sibling distance=5pt, level distance=10pt]\tikzset{every tree node/.style={align=center,anchor=north}} 
\Tree 
[ [ \edge[roof]; \node(v2) {[o rei]\textsubscript{F}} ; ]
[ [. \node(ct) {CT-$\lambda$\textsubscript{1}}; ]
[ [. \node(v1) {$t_1$} ; ]
[ [.me ]
[ [. deu ]
[ \edge[roof]; {um cocar de índio} ] ] ] ] ] ]
\draw[semithick, dashed, ->] (v1) to [bend left=45] (v2); 
\end{tikzpicture}}

\end{document}

1 Answer 1

2

Here's a solution. It requires the text of the roof node to be in an explicit \node with style [roof node]. I've only shown the code for the downwards pointing roofs; for the other directions you can check the source code for tikz-qtree. I didn't change the width of the roof, which looks fine to me, but this could be done by adjusting the x coordinate in the coordinate addition.

\documentclass[12pt,a4paper]{article}
\usepackage{tipa, tikz-qtree}
\usetikzlibrary{calc}
\usepackage{calc}
\newlength{\roofht}
\setlength{\roofht}{.5cm}
\usepackage{tikz-qtree-compat}
\usepackage{linguex}
\tikzset{roof node/.style=
    {text height=\roofht+.5\baselineskip}}
\makeatletter
\def\roof@edge@down#1#2{(#1.south) -- ($(#2.north west)+(0pt,-\roofht)$) -- ($(#2.north east)+(0pt,-\roofht)$) -- cycle}
\makeatother
\begin{document}
\ex. \parbox{\textwidth}{\begin{tikzpicture}[sibling distance=5pt, level distance=10pt]\tikzset{every tree node/.style={align=center,anchor=north},roof/.append={level distance=3em}} 
\Tree 
[ [ \edge[roof]; \node[roof node](v2) {[o rei]\textsubscript{F}} ; ]
[ [. \node(ct) {CT-$\lambda$\textsubscript{1}}; ]
[ [. \node(v1) {$t_1$} ; ]
[ [.me ]
[ [. deu ]
[ \edge[roof,]; \node[roof node]{um cocar de índio}; ] ] ] ] ] ]
\draw[semithick, dashed, ->] (v1) to [bend left=45] (v2); 
\end{tikzpicture}}

\end{document}

output of code

1
  • This worked great, thank you! Commented Nov 11, 2019 at 8:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .