我对以下代码有疑问。h6 和 h7 的线条应该从 h6 和 h7 的正下方开始,而不是从 h6 和 h7 的左侧开始。这在 tree-dvips 中有效,但pstricks
似乎对线条开始的位置有不同的决定。是否可以强制pstricks
从底部而不是左下角开始?
\documentclass{minimal}
\usepackage{pstricks,pst-node}
\psset{nodesep=5pt} %,linewidth=0.8pt,arrowscale=2}
\psset{linewidth=0.5pt}
\begin{document}
\begin{tabular}{@{}ccc@{}}
& \rnode{h0}{h0} & \\[8ex]
\rnode{h1}{h1:every(x, \rnode{h1h3}{h2}, \rnode{h1h2}{h3})} & & \rnode{h5}{h5:some(y, \rnode{h5h7}{h6}, \rnode{h5h6}{h7})}\\[8ex]
\rnode{h3}{h2:dog(x)} & ~~~~~\rnode{h7}{h6:cat(y)} & \\[6ex]
& \rnode{h4}{h4:chase(e, x, y)}\\
\end{tabular}
{\psset{linestyle=dashed}%
\ncline{h0}{h5}%
\ncline{h0}{h1}%
\ncline{h5h6}{h4}%
\ncline{h1h2}{h4}%
}%
\ncline{h1h3}{h3}%
\ncline[angleA=-90]{h5h7}{h7}%
\end{document}
答案1
锚点的默认位置\rnode
是节点的中心。使用符号\rnode[<refpoint>]{<name>}{<stuff>}
(参见pstricks
文档, 部分30 个节点,第 59 页)您可以指定替代方案<refpoint>
,例如[b]
(第24 放置和旋转任意,第 42 页):
我还减少了nodesepA
值(节点与原点节点的分离),以3pt
清楚地表明它指向正确的节点:
\documentclass{minimal}
\usepackage{pstricks,pst-node}% http://ctan.org/pkg/{pstricks,pst-node}
\psset{nodesep=5pt,linewidth=0.5pt}
\begin{document}
\begin{tabular}{@{}ccc@{}}
& \rnode{h0}{h0} & \\[8ex]
\rnode{h1}{h1:every(x, \rnode{h1h3}{h2}, \rnode{h1h2}{h3})} & & \rnode{h5}{h5:some(y, \rnode[b]{h5h7}{h6}, \rnode[b]{h5h6}{h7})} \\[8ex]
\rnode{h3}{h2:dog(x)} & ~~~~~\rnode{h7}{h6:cat(y)} & \\[6ex]
& \rnode{h4}{h4:chase(e, x, y)} \\
\end{tabular}
{\psset{linestyle=dashed}%
\ncline{h0}{h5}%
\ncline{h0}{h1}%
\ncline[nodesepA=3pt]{h5h6}{h4}%
\ncline{h1h2}{h4}%
}%
\ncline{h1h3}{h3}%
\ncline[nodesepA=3pt]{h5h7}{h7}%
\end{document}