I would like to achieve the following goal:
I have two different kind of trees that I would like to merge :
\documentclass{article}
\usepackage{color,graphicx}
\usepackage{tikz}
\usepackage{tikz-dependency}
\usetikzlibrary{%
shapes,%
arrows,%
positioning,%
calc,%
automata%
}
\definecolor{pf7}{RGB}{166, 118, 29}
\begin{document}
\begin{tikzpicture}[
level/.style={sibling distance=2cm,
level distance = 1cm}
]
\tikzset{level 1/.style={sibling distance=4cm}}
\node {S}
child{
node (np) {\textcolor{red}{\textbf{NP}}}
child {
node {D} child{node {The}}
}
child[red] {
node {\textcolor{red}{\textbf{N}}} child[black]{node {cat}}
}
}
child{
node (vp) {\textcolor{blue}{\textbf{VP}}}
child[blue] {
node {\textcolor{blue}{\textbf{V}}} child[black]{node {sat}}
}
child[blue] {
node {\textcolor{blue}{\textbf{PP}}}
child {
node {\textcolor{blue}{\textbf{P}}} child[black]{node {on}}
}
child[black] {
node {NP}
child {
node {D} child{node {the}}
}
child {
node {N} child{node {mat}}
}
}
}
}
;
\end{tikzpicture}
\end{document}
and a dependency tree :
\documentclass{article}
\usepackage{color,graphicx}
\usepackage{tikz}
\usepackage{tikz-dependency}
\usetikzlibrary{%
shapes,%
arrows,%
positioning,%
calc,%
automata%
}
\definecolor{pf7}{RGB}{166, 118, 29}
\begin{document}
\begin{dependency}
\begin{deptext}[column sep=3em]
\textbf{The} \& \textbf{cat} \& \textbf{sat} \& \textbf{on} \& \textbf{the} \& \textbf{mat} \\
\textbf{1} \& \textbf{2} \& \textbf{3} \& \textbf{4} \& \textbf{5} \& \textbf{6} \\
\end{deptext}
\depedge[edge below]{3}{2}{\bf\textcolor{pf7}{nsubj}}
\depedge[edge below]{4}{6}{\bf\textcolor{pf7}{pobj}}
\depedge[edge below]{3}{4}{\bf\textcolor{pf7}{prep}}
\depedge[edge below]{2}{1}{\bf\textcolor{pf7}{det}}
\depedge[edge below]{6}{5}{\bf\textcolor{pf7}{det}}
\end{dependency}
\end{document}
So far I managed to get this, bu the tikz upper tree is not well-aligned (as it was) and I don't know how to achieve this.
\begin{dependency}
\begin{deptext}[column sep=3em]
\textbf{The} \& \textbf{cat} \& \textbf{sat} \& \textbf{on} \& \textbf{the} \& \textbf{mat} \\
\textbf{1} \& \textbf{2} \& \textbf{3} \& \textbf{4} \& \textbf{5} \& \textbf{6} \\
\end{deptext}
\node[yshift=7cm] {S}
child{
node (np) {\textcolor{red}{\textbf{NP}}}
child {
node {D} child{node at ($(\wordref{1}{1})$) {}}
}
child[red] {
node {\textcolor{red}{\textbf{N}}}
child[black]{node at($(\wordref{1}{2})$) {}}
}
}
child{
node (vp) {\textcolor{blue}{\textbf{VP}}}
child[blue] {
node {\textcolor{blue}{\textbf{V}}}
child[black]{node at($(\wordref{1}{3})$) {}}
}
child[blue] {
node {\textcolor{blue}{\textbf{PP}}}
child {
node {\textcolor{blue}{\textbf{P}}}
child[black]{node at($(\wordref{1}{4})$) {}}
}
child[black] {
node {NP}
child {
node {D} child{node at($(\wordref{1}{5})$) {}}
}
child {
node {N} child{node at($(\wordref{1}{6})$) {}}
}
}
}
}
;
\depedge[edge below]{3}{2}{\bf\textcolor{pf7}{nsubj}}
\depedge[edge below]{4}{6}{\bf\textcolor{pf7}{pobj}}
\depedge[edge below]{3}{4}{\bf\textcolor{pf7}{prep}}
\depedge[edge below]{2}{1}{\bf\textcolor{pf7}{det}}
\depedge[edge below]{6}{5}{\bf\textcolor{pf7}{det}}
\end{dependency}
If somebody can help me, it would be very nice,
Have a nice day.