![从 tikz-qtree 中的句法树中删除行](https://linux22.com/image/343649/%E4%BB%8E%20tikz-qtree%20%E4%B8%AD%E7%9A%84%E5%8F%A5%E6%B3%95%E6%A0%91%E4%B8%AD%E5%88%A0%E9%99%A4%E8%A1%8C.png)
我正在尝试删除 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}