[pstricks] trees: putting objects on tree branches

Herbert Voss LaTeX at ZEDAT.FU-Berlin.DE
Sun Sep 14 08:09:59 CEST 2008


MA V schrieb:
>
> I'm currently using PStricks for drawing tree diagrams but there are two
> things that I haven't figured out how to do yet.
>
> Just for explanation purposes, suppose I have the tree:
> http://tug.org/PSTricks/pst-tree/tree7.tex
> What I would like to do is the following:
> 1) Between nodes 0 and 10, 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 right side of that triangle.

Icannot see the nodes 0 and 10 ..

> 2) Draw a cross on top  of the connection between nodes 1 and 4.


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

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

\begin{document}

\pstree{\MyNode{0}}
       {\pstree{\MyNode[name=1]{1}}
               {\MyNode{2}
                \MyNode{3}}
        \MyNode[name=4]{4}}
\ncline[linecolor=red]{1}{4}\ncput{\Large$\times$}

\end{document}



Herbert




More information about the PSTricks mailing list