# [Xy-pic] Your tex problem

Ross Moore ross at ics.mq.edu.au
Sat May 10 19:32:57 CEST 2003

> ---------- Forwarded message ----------
> Date: Wed, 7 May 2003 14:52:10 +0000 (GMT)
> From: Michael Abbott <michael at saturn.araneidae.co.uk>
> To: Michael Barr <barr at barrs.org>
> Subject: Re: Your tex problem

> Thank you for the thought.  I *think* my best bet is to get to grips with
> xy-pic itself, but I keep taking glances at your diagrams package.  I
> don't really think I understand the concepts behind it, and I'm also not
> at all sure I can handle trying to understand yet another diagramming
> system!

My thoughts too.
The Xy-pic language allows you to do what you want,
using either \xygraph or the kernel language itself.
It can also do it with \xymatrix, but in a kernel-hacky way.

Also, Michael is correct in that \xymatrix frequently isn't
the best way to tackle complicated CDs.
(So his  diagxy  is a neat way to extend beyond simple layouts,
but you are still forced to fit into what he has provided;
whereas Xy-pic actually gives a lot more freedom.)

> >
>
> For example, how would you modify your diagram to product an arrow into
> AAAA from the left, eg:
>
>                 z                   f
>          ZZZZ ----> AAAA = BBBB -------> CCCC
>                      |                    ~=
>                      |                   DDDD
>                    g |                     |
>                      |                     | h
>                      v          k          v
>                     FFFF <-------------- EEEE
> ?

To do   AAAA = BBBB  with the alignment indicated,
you adjust the location of the base-point:

[]*+!L(.75){AAAA = BBBB}="AA"

(the  ="AA" just sets a name, so that you can use it later
as a target of an arrow).

Similarly you can adjust vertically, once you work out
how to set the mathematics vertically.

Alternatively, you could think of the
CCCC
~=
DDDD
as 3 different objects placed above each other:

\$\$\xygraph{!{0;/r2cm/:}
[]*+!L(.75){AAAA = BBBB}="AA"
[] "AA":[rr]{CCCC}="CC"^(.8)f
[] !{"CC"+D *+!U{\cong},+D *!U+{DDDD}="DD"}:[d]*+{EEEE}^h
}\$\$

with an arrowcoming in from the left and another pointing down.

You can see the result at:

http://www-texdev.ics.mq.edu.au/ABBOTT/xymtest.pdf

>
> >
> > The kern of 12pt was just trial and error.  I don't know a good way of
> > telling a vbox (or a vtop, in this case) to fill out to the width of the
> > remaining hboxes.  Without the vtop, the upper right node will just
> > stick up and you could get it centred with a \vcenter box.
>
> Ouch.  Also not nice at all...

If you are prepare to experiment with different 'factors'
(such as the  (.75), (.8) etc, in the above coding)
then you can get quite simple Xy-pic coding for such diagrams.

>
> > The width of 1300 and height of 600 were just done by eye.  I despair of
> > doing things like that automatically.
>
> Hmm.
>
> So what *is* wrong with xymatrix?  The interface seems to me very easy to
> understand and simple to use, but it does seem to have problems.

The main problem with \xymatrix is that it is rather slow.
It does multiple passes over the code, in order to measure the
size of each of the cells (including empty ones).
Once it knows the size of everything, it can then work out how
to place the arrows.

\xygraph , on the other hand, just sets a sequence of <object>s
in the order that you specify them. There's no need for repetition
or redundancy, unless you specifically want it.

>
> So far I can't figure out whether the problems I'm encoutering are bugs in
> Xy or errors in my use.  Both of the problems I described in my first
> posting today *look* like bugs to me; but then I despair of ever
> understanding xy.  Each time I think I understand it, the next thing I try
> breaks.

Work through examples; e.g. in the Reference Manual,
and in the LaTeX Graphics Companion.

Hope this helps,

Ross Moore

> _______________________________________________
> Xy-pic mailing list
> http://tug.org/mailman/listinfo/xy-pic
>