我如何确保箭头从$t_2$
“的”下方的曲线出来?我如何使用它\qroof{some company}.DP
,但仍然让箭头指向它?
\documentclass[12pt,a4paper]{article}
\usepackage{tikz-qtree}
\usepackage{tikz-qtree-compat}
\usepackage{ulem}
\begin{document}
\begin{tikzpicture}
\Tree
[.S
[.DP [.D Every ]
[.NP [.DP$_1$ \node (ne) {PRO}; ]
[.NP $\lambda_1$
[.NP \node (ue) {some company};
[.S
[.$\lambda_1$ ]
[.NP [.\node [circle,draw] (me) {t$_{1}$} ; ]
[.N$’$ [.N representative ] [.PP [.P of ]
[. \node [circle,draw] (le) {t$_{2}$} ; ]
]
]
]
]
]
]
]
]
[.VP [.V saw ] [. \qroof{a sample}.DP ]]
]
\draw[semithick, dashed, ->] (le)..controls +(south west:6) and +(south:6) .. (ue);
\draw[semithick, dashed, ->] (me)..controls +(south west:3) and +(south:3) .. (ne);
\end{tikzpicture}
\begin{tikzpicture}
\Tree [.VP John [.V$’$ [.V loves ] \qroof{the man}.DP ]]
\end{tikzpicture}
\end{document}
答案1
发生碰撞是因为的节点位于2节点和您指定的控制点south west:6
。(请参阅我对您问题的回答绘制节点箭头了解有关这些控制点如何工作的更多信息。
您需要移动第一个控制点,以便的节点不妨碍此路径。通过将 更改为 ,可以很容易地做到这一点south west
,south
但我还建议缩短距离以获得更好看的箭头。正如我在绘制节点箭头,如果使用 xy 坐标系而不是罗盘点系统,您可以更好地控制控制点的位置。
要标记屋顶节点以便可以引用它(例如,作为箭头的端点),请使用以下语法:[.DP \edge[roof]; \node (ue) {some company}; ]
。(见Alan Munn 的回答到在 tikz-qtree 中绘制到屋顶的移动箭头的更有效方法。)这实际上意味着(ue)
是屋顶下的节点。也可以tikz
在屋顶的句法标签 (DP) 上添加标签(参见Alan Munn 的回答到在 tikz-qtree 中向 qroof 添加节点),但大多数情况下,用这种方法很难让箭头看起来美观。
\documentclass[12pt,a4paper]{article}
\usepackage{tikz-qtree}
\usepackage{tikz-qtree-compat}
\usepackage{ulem}
\usetikzlibrary{decorations.pathreplacing,shapes.misc}
\tikzset{
show control points/.style={
decoration={show path construction, curveto code={
\draw [blue, dashed]
(\tikzinputsegmentfirst) -- (\tikzinputsegmentsupporta)
node [at end, cross out, draw, solid, red, inner sep=2pt]{};
\draw [blue, dashed]
(\tikzinputsegmentsupportb) -- (\tikzinputsegmentlast)
node [at start, cross out, draw, solid, red, inner sep=2pt]{};
}
},
postaction=decorate
},
}
\begin{document}
\begin{tikzpicture}
\Tree
[.S
[.DP [.D Every ]
[.NP [.DP_1 \node (ne) {PRO}; ]
[.NP $\lambda_1$
[.NP
[.DP \edge[roof]; \node (ue) {some company}; ]
[.S
[.$\lambda_1$ ]
[.NP [.\node [circle,draw] (me) {t$_{1}$} ; ]
[.N$’$ [.N representative ] [.PP [.P of ]
[. \node [circle,draw] (le) {t$_{2}$} ; ]
]
]
]
]
]
]
]
]
[.VP [.V saw ] [. \qroof{a sample}.DP ]]
]
\draw[semithick, dashed, ->, show control points] (le)..controls +(-0,-3) and +(0,-4) .. (ue); % equivalent to +(south:3) and +(south:4)
\draw[semithick, dashed, ->] (me)..controls +(south west:3) and +(south:3) .. (ne);
\end{tikzpicture}
\end{document}
答案2
通过改变箭头的来源锚点,可以对从 到 的碰撞箭头进行分类。从$t_2$
到。如果需要,可以在此处使用更大的数字。\node (ue) {some company};
+(south west:6)
+(south:3)
这个答案表示\qroof
此处不合适,\edge[roof];
可以使用。我不太确定你想要的屋顶是什么样子,但这就是我想出的。
\documentclass[12pt,a4paper]{article}
\usepackage{tikz-qtree}
\usepackage{tikz-qtree-compat}
\usepackage{ulem}
\begin{document}
\begin{tikzpicture}
\Tree
[.S
[.DP [.D Every ]
[.NP [.DP_1 \node (ne) {PRO}; ]
[.NP $\lambda_1$
[.NP [\edge[roof]; \node (ue) {some company};]
[.S
[.$\lambda_1$ ]
[.NP [.\node [circle,draw] (me) {t$_{1}$} ; ]
[.N$’$ [.N representative ] [.PP [.P of ]
[. \node [circle,draw] (le) {t$_{2}$} ; ]
]
]
]
]
]
]
]
]
[.VP [.V saw ] [. \qroof{a sample}.DP ]]
]
\draw[semithick, dashed, ->] (le)..controls +(south:5) and +(south:6) .. (ue);
\draw[semithick, dashed, ->] (me)..controls +(south west:3) and +(south:3) .. (ne);
\end{tikzpicture}
\begin{tikzpicture}
\Tree [.VP John [.V$’$ [.V loves ] \qroof{the man}.DP ]]
\end{tikzpicture}
\pagebreak
\begin{tikzpicture}
\Tree [ .TP I [ .T\1 T\\{[past]} [ .\node(vp){vP}; { } [ .v\1 v\\saw
[ .VP { } [ .V\1 V\\(saw) [.\node(nP){nP}; \edge[roof]; {a man} ] ] ] ] ] ] ]
\end{tikzpicture}
\end{document}
这使,