2

I want to connect the NP[...], NP[...] text in the left daughter of the following tree with the NP[...], NP[...] in the right daughter.

\documentclass{article}

\usepackage{xspace}

\usepackage{tikz-qtree}
\tikzset{every roof node/.append style={inner sep=0.1pt,text height=2ex,text depth=0.3ex}}

\newcommand{\feattab}[1]{[\begin{tabular}[t]{@{}l@{}}#1 ]\end{tabular}}
\newcommand{\vform}{{\sc vform}\xspace}

\newcommand{\type}[1]{{\it #1}}
\newcommand{\sliste}[1]{%
\mbox{%
$\left\langle\mbox{\sc #1}\right\rangle$}%
}


\begin{document}


\begin{tikzpicture}
\tikzset{level 1+/.style={level distance=4\baselineskip}}
\tikzset{frontier/.style={distance from root=8\baselineskip}}
\Tree[.V\feattab{
              \vform \type{fin},\\
              \sliste{ NP[\type{nom}], NP[\type{acc}] } } 
        [.V\feattab{
              \vform \type{bse},\\
              \sliste{ NP[\type{nom}], NP[\type{acc}] } } lesen ]
        [.V\feattab{
              \vform \type{fin},\\
              \sliste{ NP[\type{nom}], NP[\type{acc}], V } } wird ]
]
\end{tikzpicture}

\end{document}

I tried to achieve this with \node and \draw, but somehow this does not work:

\documentclass{article}

\usepackage{xspace}

\usepackage{tikz-qtree}
\tikzset{every roof node/.append style={inner sep=0.1pt,text height=2ex,text depth=0.3ex}}

\newcommand{\feattab}[1]{[\begin{tabular}[t]{@{}l@{}}#1 ]\end{tabular}}
\newcommand{\vform}{{\sc vform}\xspace}

\newcommand{\type}[1]{{\it #1}}
\newcommand{\sliste}[1]{%
\mbox{%
$\left\langle\mbox{\sc #1}\right\rangle$}%
}


\begin{document}


\begin{tikzpicture}
\tikzset{level 1+/.style={level distance=4\baselineskip}}
\tikzset{frontier/.style={distance from root=8\baselineskip}}
\Tree[.V\feattab{
              \vform \type{fin},\\
              \sliste{ NP[\type{nom}], NP[\type{acc}] } } 
        [.V\feattab{
              \vform \type{bse},\\
              \sliste{ \node(lesen){NP[\type{nom}], NP[\type{acc}]}; } } lesen ]
        [.V\feattab{
              \vform \type{fin},\\
              \sliste{ \node(wird){NP[\type{nom}], NP[\type{acc}]};, V } } wird ]
]
\draw[semithick,->] (lesen)..controls +(south east:5) and +(south west:5)..(wird);
\end{tikzpicture}

\end{document}

Is there a way to do this?

I would also like to highlight the NP[...], NP[...] part by turning the background into gray.

4

TiKZ-qtree manual says

Inside a \Tree , in place of a node label, you can use a TikZ \node command.

and you are trying to use a node inside a node label not instead of. If you include all your node label inside a node, it works.

\documentclass{article}

\usepackage{xspace}

\usepackage{tikz-qtree}
\tikzset{every roof node/.append style={inner sep=0.1pt,text height=2ex,text depth=0.3ex}}

\newcommand{\feattab}[1]{[\begin{tabular}[t]{@{}l@{}}#1 ]\end{tabular}}
\newcommand{\vform}{{\sc vform}\xspace}

\newcommand{\type}[1]{{\it #1}}
\newcommand{\sliste}[1]{%
\mbox{%
$\left\langle\mbox{\sc #1}\right\rangle$}%
}


\begin{document}


\begin{tikzpicture}
\tikzset{level 1+/.style={level distance=4\baselineskip}}
\tikzset{frontier/.style={distance from root=8\baselineskip}}
\Tree[.V\feattab{
              \vform \type{fin},\\
              \sliste{ NP[\type{nom}], NP[\type{acc}] } } 
        [.\node (lesen) {V\feattab{
              \vform \type{bse},\\
              \sliste{ NP[\type{nom}], NP[\type{acc}] } } }; ]
        [.\node (wird) {V\feattab{
              \vform \type{fin},\\
              \sliste{ NP[\type{nom}], NP[\type{acc}], V } }}; ]
]
\draw[semithick,->] (lesen)..controls +(south east:5) and +(south west:5)..(wird);
\end{tikzpicture}

\end{document}

enter image description here

2
  • Thanks! I think this works for the example at hand. But is there a general way to achieve what I described? The point is that the nodes in the trees are big and one may want to connect a specific item inside of a node to another item in another node. – Stefan Müller Nov 13 '13 at 12:07
  • 1
    @StefanMüller: You could try using tikzmark inside nodes, but my test was not successful. Another one, you can also shift your anchors: draw ([shift={(...,...)lesen.south}... and try to find the position where you want point. – Ignasi Nov 13 '13 at 16:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.