[Xy-pic] Vertical alignment in xymatrix

Ross Moore ross at ics.mq.edu.au
Thu Mar 6 08:53:56 CET 2003

Hello Michael, and other Xy-pic users,

> On Mon, 3 Mar 2003, Michael Abbott wrote:
> > I've got a couple of problems with controlling vertical alignment with
> > xymatrix, and I'd like to know if there are any solutions.
> Does the silence on this question mean that the people who can answer this
> question are away or busy, or does it mean that there is no solution?

Silence from whom ?
Your question has generated some discussion, which indicates the
right kind of approach to adopt.

> (Forgive me Florian, but your answers, although amusing, don't count as
> solutions!)

Adjusting \entrymodifiers is often the right thing to do, to get
improved alignment when some cell entries have descenders (e.g. subscripts)
but others do not.

In your case, however, because of the unusual shape created by
 $-_X$ and  $-^X$  where the sup/subscripts are larger than the main atom
itself, then it is necessary to adjust some of the cells' actual
contents rather than the way the cells are positioned.

This is actually what  \xymatrix @1   and  \xymatrix @2 attempt to do
 --- but they may not be able to cope as well as you would like.

So set the \everyentry directly:
  \xymatrix....{....  }

Now the invisible strut constructed by the \vphantom will be
placed into *every* cell of your matrix-like diagram, as part
of the <object> being built within that cell.
When the strut is larger than the visible contents, then it will
be determining the vertical size of the cell. 
For two adjacent cells, each with height determined in this way,
the TeX base-lines should appear to line-up.

The draw-back is that arrows pointing to the cell may terminate at
a greater distance than you might prefer, upon meeting the boundary
of a larger rectangle.

If that is really a problem, then you will have to adjust the contents
of cells individually, rather than collectively. Of course this
makes it difficult to read the mathematics in your LaTeX source, as
cells will then become a mixture of content and positioning constructions
(like the first reply, using \vphantom within the sup/subscripts).

Try using \everyentry first, to see if that gives you adequate satisfaction.


	Ross Moore

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

More information about the Xy-pic mailing list