Q: PSTricks - balanced pstrees

Denis Girou Denis.Girou at idris.fr
Fri Sep 18 21:24:35 CEST 1998


-----------------------------------------------------------------------------
This is the PSTricks mailing list, devoted to discussions about computational
graphics in (La)TeX using the PSTricks package from Timothy van Zandt.
For help using this mailing list, see instructions at the end of message.
-----------------------------------------------------------------------------

The following message is a courtesy copy of an article
that has been posted to comp.text.tex as well.

>>>>> "Glen.Newton" == Glen Newton <gnewton at wapiti.cisti.nrc.ca> writes:

    Glen.Newton> I am using PSTricks to make trees, using pstree. However, when i do
    Glen.Newton> the following, i end up with nodes which are at the same level being
    Glen.Newton> offset vertically:

    Glen.Newton> \pstree[labelsep=2pt]{\TR{level 0}}
    Glen.Newton> 	{
    Glen.Newton> 	  \TR{level 1 a} 
    Glen.Newton> 	  \TR{
    Glen.Newton> 		\begin{tabular}{c}
    Glen.Newton> 		  level 1 b \\
    Glen.Newton> 		  more\\
    Glen.Newton> 		  stuff\\
    Glen.Newton> 		  here 
    Glen.Newton> 		\end{tabular}}
    Glen.Newton> 	}

    Glen.Newton> i.e. the vertex between "level 0" and "level 1 b" is shorter and this
    Glen.Newton> causes things to look "funny". I'd like all nodes at the same level
    Glen.Newton> in the tree to be top aligned. If you can tell me how to do this, i
    Glen.Newton> would appreciate it. 

  This is normal, as default vertical positioning of a tabular environment is
"center". You must use the top "[t]" optional parameter in your case (see
for instance Lamport, page 204).

  P.S. Take care also to spurious blanks!

\documentclass{article}

\usepackage{pst-tree}

\pagestyle{empty}

\begin{document}

\pstree[labelsep=2pt]{\TR{level 0}}
	{%
	  \TR{level 1 a}
	  \TR{%
		\begin{tabular}[t]{c}
		  level 1 b\\
		  more\\
		  stuff\\
		  here
		\end{tabular}}
	}
\hfill
% Original one
\pstree[labelsep=2pt]{\TR{level 0}}
	{
	  \TR{level 1 a}
	  \TR{
		\begin{tabular}{c}
		  level 1 b \\
		  more\\
		  stuff\\
		  here
		\end{tabular}}
	}

\end{document}

Denis Girou
--
---------------------------------------------------------------------------
Institut du De'veloppement et des Ressources en Informatique Scientifique |
Centre National de la Recherche Scientifique                              |
Ba^timent 506 - B.P. 167 - 91403 Orsay Cedex - France                     |
---------------------------------------------------------------------------

-----------------------------------------------------------------------------
The list interface (subscription, information, access to the archives) is on:
http://www.tug.org/cgi-bin/lwgate/pstricks
Otherway to unsubscribe, send mail to pstricks-request at mail.tug.org
with a blank subject and in body the line unsubscribe <email-address>
-----------------------------------------------------------------------------



More information about the PSTricks mailing list