[Xy-pic] Help with trees?!
Ross Moore
ross at ics.mq.edu.au
Tue Mar 11 21:06:04 CET 2003
> Hallo all!
>
> >From time to time I use the Xy-pic package. I think it's great stuff!
>
> Among its goodies I found something to layout trees (e.g. for
> directories) in a nice way (see [1] for details, and "tree.sty", taken
> from [1], in the attachment of this mail).
> Normally this tree thing works great.
> But for trees with long lines, I mean, long entries for nodes, those
> horizontal lines get too long.
>
> This is a sketch of what I tried:
>
> Study Package
> |
> +-----WP 1000 ---> blablabla | <- right margin
> | |
> +-----WP 2000 ---> blablablabla |
> | | |
> | `------------------- ST 2100 blubbblubbblubb
> : |
> : /\
> `-- How can I reduce the length of this line?
>
> So, the branch from "WP 2000" to "ST 2100" gets too long, and the leaf
> is printed over the right margin.
> The problem seems to be that the point where the line starts is the
> middle of the whole inner node.
Yes, and the place where the next level of labelling starts is at the
right-hand end of the previous label.
viz.
% Interpretation action for (: move back and down!
\def\openaction{\POS @+c +R+/r1em/ +/d\baselineskip/ }
^^___ move to Right end (then down a bit)
> So, I'm looking for a way to shorten the branch line. Sometimes, it
> seems reasonable to define a constant length for this.
> Or, alternatively, to define a starting point for this line.
You could define alternative values for \openaction:
\let\openactioni \openaction % store the default method
\def\openactionii{\POS @+c +R+/l2cm/+/r1em/ +/d\baselineskip/ }
\def\openactioniii{\POS @+c +R+....... }
then find a way to include re-bindings of \openaction
within your diagram source:
.... do some nodes ....
\let\openaction\openactionii
.... do some more nodes ....
\let\openaction\openactioni
.... and some more, back in the normal way ....
> I tried my best and looked up the Xy-pic user guide and ref man, but I'm
> lost. I assume I have to change the definition of the macro \branch or
> maybe the macro \openaction (both in "tree.tex")... well, somehow...
Yes, I think \openaction is the method that needs to be adjusted to
fit your situation.
There could be a similar solution adjusting \branch ,
as this is where the centering is specified:
> \def\branch{\ar @{-} `l/\jot s0+DC="s0" "s0" }
^^^
this could be replaced by +DL+/r<shift>/="s0"
where <shift> is a constant length.
> Any clues?
Hope this helps,
Ross Moore
>
> Many thanks in advance!
>
> Regards,
> Wolfgang
>
> References:
> [1] http://tug.org/applications/Xy-pic/soft/xypapers/tug97rose.ps
More information about the Xy-pic
mailing list