我正在尝试删除 V 头下方的线条(将 V 连接到“likes”)。我尝试了一种解决方案:添加以下行
\tikzset{every tree node/.style={align=center, anchor=north}}
这让我可以替换一些较低的线条,\\
但我不能普遍做到这一点。任何帮助都值得感激。
\documentclass{article}
\usepackage{tikz, tikz-qtree}
\tikzset{every tree node/.style={align=center, anchor=north}}
\begin{tikzpicture}
\Tree
[.TP
[.DP \edge[roof]; \node (J) {John}; ]
[.T$'$
[.T ]
[.\emph{v}P
[.DP \edge[roof]; \node (Jtrace) {$<$John$>$}; ]
[.\emph{v}$'$
[.\emph{v}
[.V \node(V1){likes}; ]
[.\emph{v} ]
]
[.VP
[.V \node(V2){$<$likes$>$}; ]
[.DP \edge[roof]; {Mary} ]
]
]
]
]
]
\draw[->] (Jtrace) [in=-90,out=-90,looseness=1.5] to (J);
\draw[->] (V2) [in=-90,out=-90] to (V1);
\end{tikzpicture}
\end{document}
答案1
您不能使用[.V\\\node(V1){likes};]
我认为您想要的构造。正如 Jason 在评论中指出的那样,您可以改用可以[.\node(V1){V\\likes};]
实现您想要的功能的构造。
\documentclass{article}
\usepackage{tikz, tikz-qtree}
\tikzset{every tree node/.style={align=center, anchor=north}}
\begin{document}
\begin{tikzpicture}
\Tree
[.TP
[.DP \edge[roof]; \node (J) {John}; ]
[.T$'$
[.T ]
[.\emph{v}P
[.DP \edge[roof]; \node (Jtrace) {$<$John$>$}; ]
[.\emph{v}$'$
[.\emph{v}
[.\node(V1){V\\likes}; ]
[.\emph{v} ]
]
[.VP
[.\node(V2){V\\$<$likes$>$}; ]
[.DP \edge[roof]; {Mary} ]
]
]
]
]
]
\draw[->] (Jtrace) [in=-90,out=-90,looseness=1.5] to (J);
\draw[->] (V2) [in=-90,out=-90] to (V1);
\end{tikzpicture}
\end{document}