3

I have a sentence with two possible meanings - so, two possible syntactic trees.

I read the documentation of tikz-qtree and learned how to do upside-down trees. but I can't find a way to combine the two trees in one; both leading to the same sentence.

This is my code at the moment:

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[portuguese]{babel}
\usepackage{tikz}
\usepackage{tikz-qtree}
\usepackage{tikz-qtree-compat}
\usepackage{tikz-dependency}

\begin{document}

\begin{tikzpicture}[frontier/.style={distance from root=5cm}]
\Tree [.S [.SN [.Det o ] [.N menino ] ] [.SV [.Vtd viu ] [.SN [.Det a ] [.N menina ] ] [.SP [.P com ] [.SN [.Det o ] [.N telescópio ] ] ] ] ] 
\end{tikzpicture}
\par 
\begin{tikzpicture}[frontier/.style={distance from root=5cm}, grow'=up ]
\Tree [.S [.SN [.Det o ] [.N menino ] ] [.SV [.SV [.Vtd viu ] [.SN [.Det a ] [.N menina ] ] ] [.SP [.P com ] [.SN [.Det o ] [.N telescópio ] ] ] ] ]
\end{tikzpicture}

\end{document}

And the result:

enter image description here

What can I do to have only one tree (or better saying: two trees leading to only one sentence) with this structure?

1 Answers1

3

A quick solution is to make the words of the second sentence zero-height but original-width (with \hphantom, i.e., horizontal phantom) and then manually adjust the space between the trees to make them appear combined.

Note that manual spacing can lead to issues where the upper tree ends up behind the bars of the lower tree (and similarly the subject may end up behind bars when looking at girls through telescopes I guess).

MWE:

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[portuguese]{babel}
\usepackage{tikz}
\usepackage{tikz-qtree}
\usepackage{tikz-qtree-compat}
\usepackage{tikz-dependency}
\begin{document}

\begin{tikzpicture}[frontier/.style={distance from root=5cm}]
\Tree [.S [.SN [.Det o ] [.N menino ] ] [.SV [.Vtd viu ] [.SN [.Det a ] [.N menina ] ] [.SP [.P com ] [.SN [.Det o ] [.N telescópio ] ] ] ] ] 
\end{tikzpicture}
\par\vspace{-2.5mm}
\begin{tikzpicture}[frontier/.style={distance from root=5cm}, grow'=up ]
\Tree [.S [.SN [.Det \hphantom{o} ] [.N \hphantom{menino} ] ] [.SV [.SV [.Vtd \hphantom{viu} ] [.SN [.Det \hphantom{a} ] [.N \hphantom{menina} ] ] ] [.SP [.P \hphantom{com} ] [.SN [.Det \hphantom{o} ] [.N \hphantom{telescópio} ] ] ] ] ]
\end{tikzpicture}

\end{document}

Result:

enter image description here

Marijn
  • 37,699