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

Saul Lubkin lubkin@math.rochester.edu
Sat, 13 Jul 2002 17:12:24 -0400 (EDT)

Dear Kristoffer and Ross,

Dear Ross,

Thanks for responding so promptly o my prompt.  Some thoughts that might
conceivably useful below.

Thanks much, again.

:)

On Wed, 10 Jul 2002, Ross Moore wrote:

>Hello Saul,
>
>> Dear Ross,
>>
>....
>
>> I am using a postscript back-end, dvips, that works very well; and I'm
>> trying --so far unsuccessfully --to program one of the special effects,
>> that works so well in the reference manual (pg. 31, "special
>> effect: aligned text"), that lives over one (complicated) directional.
>>
>> 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.
>> ....

>Here is a way to do it, using \xygraph for the grid-like layout
>(instead of \xymatrix) and kernel-escapes for the harder bits:
>
>	http://www-texdev.ics.mq.edu.au/LUBKIN/aligntest.pdf
> ....

>Hope this helps,
>
>	Ross
>

Dear Kristoffer and Ross,

This should work; however, the programming involved in each diagram may be too
elaborate to be used.

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

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.

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