[pstricks] trees: putting objects on tree branches

Herbert Voss Herbert.Voss at FU-Berlin.DE
Sun Sep 14 22:44:29 CEST 2008

MA V schrieb:

> A couple of questions:
>
> 1) As for the triangle, suppose that, instead of the cross, we would like to add a triangle (on top of the line connecting the two nodes; i.e. the line would be interrupted by the triangle) and write something on the bottom of that triangle. How can I achieve that?
>
> 2) Suppose we want to add a cross to the line connecting nodes 0 and
> 4. How can I achieve that?

\documentclass[a4paper]{article}
\usepackage{pst-tree}

\newcommand{\MyNode}[2][]{\Tcircle[#1]{\makebox[1em]{#2}}}
\pagestyle{empty}

\begin{document}

\pstree{\MyNode[name=0]{0}}
{\pstree{\MyNode[name=1]{1}}
{\MyNode{2}
\MyNode{3}}
\MyNode[name=4]{4}}
\ncline[linecolor=red]{1}{4}\naput{\pspolygon(-0.3,0)(0,0.5)(0.3,0)}
\ncline[linestyle=none]{0}{4}\ncput*{$\times$}

\end{document}

Herbert



More information about the PSTricks mailing list