[Xy-pic] Re: aligned text over arrows in xypic

Ross Moore ross@ics.mq.edu.au
Mon, 15 Jul 2002 03:32:44 +1000 (EST)

> Dear Kristoffer and Ross,
> Dear Ross,
> Thanks for responding so promptly o my prompt.  Some thoughts that might
> conceivably useful below.

> >> I would like to write a macro -- say, called, "\aligned", that would
> >> require the postscript back-end, and would work, roughly, as follows:
> >>
> >> In an xypic command:
> >>
> >> \ar[rru]^{\aligned{\txt{resriction of $\iota$}}}
> >
> >This is non-trivial, since you have to switch off the parser,
> >then start it up again.
> >Presuming that you are within \xymatrix, which delays expansion
> >of arrows until the size of cells is known, then you'll have
> >problems getting things right.
> >
> >> would put the phrase, "resriction of \iota" over the arrow -- but aligned
> >> in the direction of the arrow, rather than horizontal.
> >> ....
> Dear Kristoffer and Ross,
> This should work; however, the programming involved in each diagram may be too
> elaborate to be used.

Can you send an example diagram please.
> I do understand the problem:
> In an \xymatrix, the directions of arrows aren't known until compilation time --
> so there's no way that, e.g., a superscript on a diagonal arrow, can know it's
> "current direction" -- which is needed to typeset the material to be
> superscript.
> I have another idea -- that may conceivably be feasible?  (it would require a
> little development -- and may or may not be practical; my level of knowledge
> of the mechanics behind the excellent xypic program, is unforunately
> inadequate).
> Here's the idea.  The xymatrix would at first be compiled, ignoring the
> superscript command altogether.  Then, it would be recompiled -- reading in,
> also, the data in the copiled file.  The data in the compiled file, would show
> a definite direction for the arrow (with the missing superscript).  In the
> recompilation, the new superscript would NOT be ignored -- it would use the
> direction for the arrow from the compiled data, taken as
> a hard-coded direction specification for the superscript.

In fact \xymatrix does work this way already; the label should already be delayed
until the matrix-layout has been established and all cell-contents have had their
sizes measured.
When preparing the example that I sent earlier, I was very surprised to find that
with \ar the current direction was not along the arrow, for purposes of aligning 
the label.
Either I hadn't found the correct syntax, or there is only a minor bug that needs
to be fixed, so as to restore this feature.

Some more investigation is needed.
Thanks for making us aware of the difficulty.

All the best,


> To me, it seems that this should work.  Possible shortcomings:  The newly
> compiled matrix, because of the new superscript on the arrow, might be slightly
> off in the direction of the superscript (which would actually be suitable for a
> diagram lacking any space for text over the arrow).
> Possible solutions:
> (1) Ignore the problem.  Superscripts should only be slightly off.
> (2) Do a third recompilation, which would now use the new direction for the
> arrow in the matrix.  The third compilatioon of the matrix should be closer to
> perfect.
> To a certain extent, the procedure that I'm suggesting resembles LaTeX's (and
> also LamsTeX's) way of getting references to \label's right -- the location
> data is saved in an .aux or other file; and, on recompilation, this file is
> read, and used to improve \ref's to \label's.  If necessary, yet a third
> recompilation is possible, for further improvement of \ref's.
> It would add a powerful new tool, for creating such aligned text label's, in
> commutative diagrams,and other applications.
> What do you think?  Might this be feasible?
> Sincerely yours,
> Saul
> _______________________________________________
> Xy-pic mailing list
> http://tug.org/mailman/listinfo/xy-pic