# [Xy-pic] Deficiencies in xymatrix package?

Michael Abbott michael at araneidae.co.uk
Tue May 20 07:29:28 CEST 2003

On Mon, 12 May 2003, Alexander Perlis wrote:
> Regarding \xymatrix, Michael Barr wrote:
> >> The most serious is that if one node of a horizontal arrow has a
> >> superscript and the other a subscript, they will quite obviously
> >> appear on different levels.
>
> Michael Abbott replied:
> > I quite agree, and I have to say that this "feature" is really
> > annoying. I would be very happy if an option to xymatrix could
> > be implemented to make centre-line alignment the default option.
>
>   As you probably know, it isn't too difficult to solve this problem:
> just put \entrymodifiers={+!!<0pt,\fontdimen22\textfont2>} near the
> top of your document.

Aha!

This is such an obvious and easy fix that it ought to be more widely
known.  I didn't actually spot how simple a solution this is until I read

So, to repeat for clarity, the answer to xymatrix vertical alignment is to

\entrymodifiers={+!!<0pt,\fontdimen22\textfont2>}

to the preamble of the document.  Then, unless we perform an explicit *{}
drop, xymatrix alignment will come out right.

(This does beg the question as to why we have to do this.  hrm.  A
"feature" in the design of xymatrix.  grumble grumble...)

> Vadim Radionov first posted the above solution on 27Jun2001 and
> suggested it should be the default behavior. I independently looked into
> this around Aug2002 and arrived at the same solution, and wrote the
> following TUGboat submission explaining the alignment issues and how the
> solution above works:
>
>
> More importantly to the present discussion, near the end of this
> article, I propose specific syntax for giving the user easy access to
> this solution, on a per-document or per-diagram basis, both for
> \xymatrix and \xygraph. Could you take a look and let me know whether
> the proposed syntax would meet your needs?

As far as I can see, the only significant change request is for a new
offset letter A as a shorthand for <0pt,\fontdimen22\objectfont2> where
\objectfont is \textfont, \scriptfont or whatever, depending on the value
of \objectstyle.  I cannot imagine that this is especially hard to do
(modulo the fact that programming *anything* in TeX is actually
intrinsically absurdly hard).

In your article you suggest that !A should be a shorthand for !!<the above
vector>; I'd guess that this is less compatible with the existing system,
and that there's no harm in making users write !!A.

So without the A shorthand, when we do an explicit drop we have to write,
for example

*+[F.]!!<0pt,\fontdimen22\textfont2>{blah}

which it would be nice to abbreviate to

*+[F.]!!A{blah}

Your other suggestions are:

2. An @A option on \xymatrix as a shorthand for \entrymodifiers={+!!A}.
Well, maybe; but as putting this once in the preamble is good enough, it
hardly seems necessary.  The same applies to your point 4.

3. Changing the definition of @1.  Well, breaking backwards compatibility
is generally a bad thing, even if it *is* broken.  Not really bothered

4. See 2.

5. Yes.  I think there s a bit of a problem with xygraph, as I'm not aware
of any way of setting a global action on every xygraph in the document
preamble.  Something to help here would be nice to have.

So in summary, I'd suggest revising the definition of !A to just make it
an offset and forget about the other changes.  This sounds to me like an
*easy* change to the core xy language.