[pstricks] pst-tree label position

Jonne Zutt j.zutt at ewi.tudelft.nl
Wed Sep 29 14:34:27 CEST 2004


Dear pstrickers,

I am using pst-tree to draw a binary tree diagram.
Can someone help me positioning a label correctly?

Each node has several formulas that I put in a shortstack.
Then, there are 0 or 2 children. If there are two, I would like
to label this branch in the center, like this:

       formula_1
       formula_2
           /\
          /  \
         /(10)\
        /      \
       /        \
      /          \
     /            \
   formula_3    formula_4
   etc.         etc.

I provided a (auto-generated) latex example below (I am not happy with
the placement of the (##) labels).

ps > reason why I set the huge page size is that I want to convert the
tree to an image file. Hence, I do not want to have multiple pages.
Another problem I have is to clip the extra whitespace out of the image
(but this might not be the correct place to ask for help on that =)

Thanks in advance,
Jonne.


\documentclass{article}
\usepackage{pst-tree}

\textwidth=100in                % real width of latex text
\textheight=100in               % height of latex text
%\special{papersize=12in,14in}   % small width ensures portrait orientation
\thispagestyle{empty}           % no page numbers

\begin{document}
\thispagestyle{empty}

% Three colors:
% Blue  = regular formulas
% Black = literals ( [~]p_0 )
% Red   = literal that closes tree

\Huge

\newcommand{\of}{$\vee$}
\newcommand{\en}{$\wedge$}
\newcommand{\imp}{$\rightarrow$}
\newcommand{\desda}{$\leftrightarrow$}
\newcommand{\niet}{$\neg$}

\psset{levelsep=*2cm,nodesep=2pt,labelsep=0pt,tpos=.3}

\pstree{\TR{\shortstack[l]{00. a\imp{}b\of{}c\imp{}d\en{}e\\01.
e\of{}f\imp{}g\\02. \niet{}(a\imp{}c\imp{}g)\\03.
a\en{}\niet{}(c\imp{}g)\\04. a\\05. \niet{}(c\imp{}g)\\06.
c\en{}\niet{}g\\07. c\\08. \niet{}g\\09. \niet{}(e\of{}f)\of{}g\\10.
\niet{}a\of{}(b\of{}c\imp{}d\en{}e)}}}{
\pstree{\TR{\shortstack[l]{11. \niet{}(e\of{}f)\\12.
\niet{}e\en{}\niet{}f\\13. \niet{}e\\14. \niet{}f}}_{(9)}}{
\pstree{\TR{\shortstack[l]{15. \niet{}a\\X(4, 15)}}_{(10)}}{
}
\pstree{\TR{\shortstack[l]{16. b\of{}c\imp{}d\en{}e\\17.
\niet{}(b\of{}c)\of{}(d\en{}e)}}}{
\pstree{\TR{\shortstack[l]{18. \niet{}(b\of{}c)\\19.
\niet{}b\en{}\niet{}c\\20. \niet{}b\\21. \niet{}c\\X(7, 21)}}_{(17)}}{
}
\pstree{\TR{\shortstack[l]{22. d\en{}e\\23. d\\24. e\\X(13, 24)}}}{
}
}
}
\pstree{\TR{\shortstack[l]{25. g\\X(8, 25)}}}{
}
}

\end{document}




More information about the PSTricks mailing list