[pstricks] Re: pst-tree: Moving trees using relative coordinates?
Denis Girou
Denis.Girou at idris.fr
Tue Feb 26 20:36:25 CET 2002
The following message is a courtesy copy of an article
that has been posted to comp.text.tex as well.
>>>>> "Till.Doerges" == Till Doerges <nospamplease at doerges.net> writes:
Till.Doerges> Hi folks,
Till.Doerges> I'm trying to use the package pst-tree to draw some (simple) binary
Till.Doerges> trees. The output produced is fine all by itself.
Till.Doerges> However, LaTeX sets my trees to low on the page.
Till.Doerges> If I understood things correctly this is due to pstricks telling LaTeX
Till.Doerges> to take a point somewhere near to top of the box to center the whole
Till.Doerges> tree instead of taking some point in the middle.
Till.Doerges> I would very much like to know how to change that, because even after
Till.Doerges> digging through the documentation and the newsgroups for quite some time
Till.Doerges> I didn't find anything appropriate for my needs.
Till.Doerges> What I've tried so far, is the use of \psset{coord={}}, and \rput. The
Till.Doerges> \psset will only move some parts of my tree and the \rput will move the
Till.Doerges> tree, but it'll also put a 0x0-box around it, so LaTeX will basically
Till.Doerges> ignore it, when placing the surrounding items.
Till.Doerges> I've also heard about something w/ \pspicture and then being able to
Till.Doerges> define a box all by myself. The reason, why I don't like a solution
Till.Doerges> leading into this direction is, that I don't want to fiddle around w/
Till.Doerges> the proper bounding-box-dimensions (after all, that's why I'm using
Till.Doerges> LaTeX...) because there are quite a few of them.
Till.Doerges> The trees are generated automatically, so I'm looking for a single
Till.Doerges> option/switch/command to move the tree a little upwards (w/o zeroing its
Till.Doerges> dimensions).
Till.Doerges> Here's a small - yet not properly working - example of what I want:
Till.Doerges> --- snip ---
Till.Doerges> [...]
Till.Doerges> % X{n+1} := S S X{n}
Till.Doerges> % rput doesn't work...
Till.Doerges> Es wird vermutet, daß sie im wesentlichen durch Muster wie ${\sf
Till.Doerges> X_{n+1}} := \rput[t](0,8pt){\pstree [treesep=6pt, levelsep=*3pt,
Till.Doerges> treefit=loose] {\Tn} {\pstree {\Tdot*} { \pstree {\Tdot*} {
Till.Doerges> {\TR{{\bf S}}} {\TR{{\bf S}}} } {\TR{\sf X_{n}}}}}}$
Till.Doerges> beschreibbar sind.
Till.Doerges> [...]
Till.Doerges> --- snap ---
A PSTricks tree is a box, so you can simply use (La)TeX commands to change
the position of it. In LaTeX, an easy solution is to use \raisebox (of course,
the following code must be compiled twice, due to the usage of the
"levelsep=*xxx" parameter).
\documentclass[a4paper]{article}
\usepackage[latin1]{inputenc}
\usepackage{pst-tree}
\pagestyle{empty}
\begin{document}
\LARGE
% X{n+1} := S S X{n}
Es wird vermutet, daß sie im wesentlichen durch Muster wie ${\sf
X_{n+1}} := \pstree [treesep=6pt, levelsep=*3pt,
treefit=loose] {\Tn} {\pstree {\Tdot*} { \pstree {\Tdot*} {
{\TR{{\bf S}}} {\TR{{\bf S}}} } {\TR{\sf X_{n}}}}}$
beschreibbar sind.
\vspace{1cm}
% X{n+1} := S S X{n}
% using \raisebox
Es wird vermutet, daß sie im wesentlichen durch Muster wie
$\mathsf{X_{n+1}}$ :=
\raisebox{7mm}{%
\pstree[treesep=6pt,levelsep=*3pt,treefit=loose]
{\Tn}
{\pstree{\Tdot*}
{\pstree{\Tdot*}
{\TR{$\mathbf{S}$}
\TR{$\mathbf{S}$}}
\TR{$\mathsf{X_{n}}$}}}}
beschreibbar sind.
\end{document}
P.S. Take care to spurious blanks! See the manual page 3 (last paragraph).
You will introduce small gaps, which can have a bad visual effect in some
circumstances. Better suppress the unnecessary blanks and never finish a line
by "{" but rather by "{%".
Till.Doerges> (BTW, does there exist an online version of the pst-docs which is in
Till.Doerges> *one* document instead of six and easily searchable?)
Searching on the Web, you can found that some people have done it.
For instance you can found pstricks.pdf and pst-beta.pdf on:
http://www.phys.uni.torun.pl/~norbert/LaTeX/LaTeX-Doc/
Denis Girou
--
--------------------------------------------------------------------------
Institut du Développement et des Ressources en Informatique Scientifique |
Centre National de la Recherche Scientifique |
Bâtiment 506 - B.P. 167 - 91403 Orsay Cedex - France |
--------------------------------------------------------------------------
More information about the PSTricks
mailing list