[Xy-pic] problem with [@] in labels

Ross Moore ross at ics.mq.edu.au
Sun Sep 14 15:23:23 CEST 2003


Hello Richard,

On Fri, 5 Sep 2003, Richard Lewis wrote:

> Consider the following two matrices. (See also the thread starting
> with Message-ID: <3f554cde at shknews01> on comp.text.tex)
>
> \usepackage[dvips,all]{xy}
>
> \xymatrix{ A & B \ar[dl]|*[@]{\labelstyle{foo}} \\ C & D}
>
> \xymatrix{ A & B  \\ C\ar@{<-}[ur]|*[@]{\labelstyle{foo}} & D}
>
> [@] is aligns the label with the direction of the arrow, which it does
> correctly, but in the first case the `foo' is printed on top of the
> arrow (the second case is correct, in that the arrow is broken to make
> space for the `foo').  Is this a bug?

Yes; this is a bug.
There is a line missing from  xyrotate.doc,
and the derived file  xyrotate.tex :

In the definition of  \xyrotateSizeMod@ , viz.

\xydef@\xyrotateSizeMod@ @@{%
 \L at p=\L at c \R at p=\R at c \U at p=\U at c \D at p=\D at c
 \ifdim\cosDirection\p@>\z@
 \R at c=\cosDirection\R at p \L at c=\cosDirection\L at p
 \U at c=\cosDirection\U at p \D at c=\cosDirection\D at p
 \else
 \R at c=\cosDirection\L at p \L at c=\cosDirection\R at p
 \U at c=\cosDirection\D at p \D at c=\cosDirection\U at p
 \R at c=-\R at c \L at c=-\L at c \U at c=-\U at c \D at c=-\D at c
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -- needs this !
 \fi
 \advance\L at c \if-\sinDirection\D at p\else\sinDirection\U at p\fi
 \advance\R at c \if-\sinDirection\U at p\else\sinDirection\D at p\fi


This affects rotations through obtuse angles
(that is, > 90 degrees anti/clockwise, or
more correctly, angles $\theta$ for which $\cos\theta < 0$).

The macro \xyrotateSizeMod@ is calculating the size of the
minimal rectangle (with sides aligned with the axes) that
encloses the rotated <object>.
Without the missing line, this calculation will produce a
rectangle that is too small, and possibly even with negative
extents (i.e. distance to the edges).
The example you gave above has such negative extents,
so the arrow is drawn across the text of the label, to the
right-hand edge (which is supposedly left of centre
due to the incorrect negative extent).
Similarly the arrow starts again at the left-edge, which
is supposedly to the right of centre, due to the negative
extent.

By inserting the line indicated above, the negative amounts
are made positive again, and a sensible rectangle results.


> This happens in \xygraph too:
>
>   \xygraph{!{0;<2cm,0pc>:<0pc,2cm>::0}%
>     %%
>     B [dl] C
>     "B":|*[@][F.]{\labelstyle{foo}} "C"
>     %%
>     "B"[dd]
>     %%
>     b [dl] c
>     %%
>     "c":@{<-}|*[@][F.]{\labelstyle{foo}} "b"
>   }

Sure. The use of \xymatrix or \xygraph has no bearing
on the way the rotation code behaves.


Thanks for the report,

	Ross Moore

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


More information about the xy-pic mailing list