[Xy-pic] inline xymatrix

Ross Moore ross at ics.mq.edu.au
Tue Aug 19 00:08:41 CEST 2008

On 18/08/2008, at 10:12 PM, Chris Heunen wrote:
> Dear xypic users,
> I wish to use xypic inline, that is, in a running text line.
> For example, if instead of
>   ... let $X \stackrel{f}{\to} Y$ be a function ...
> one uses
>   ... let $\xymatrix at 1{ X \ar^-{f}[r] & Y }$ be a function ...
> there is a noticably ugly vertical gap above that line, whereas the
> labels are typeset in the same size as the stackrel.
> How does one prevent this?

There is not only space above, but also some space below.
This is due to the natural size of the diagram, which includes
a little bit of a margin around each object.
See the 1st paragraph in the attached image, where the 2nd line
uses \xymatrix, but other lines use \stackrel .

Try TeX's \smash macro ;  e.g. $\smash{\xymatrix at 1{ X \ar^-{f}[r] &  
Y }}$
as in the 2nd paragraph in the attached image.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: texshop_image.jpeg
Type: image/jpeg
Size: 204669 bytes
Desc: not available
Url : http://tug.org/pipermail/xy-pic/attachments/20080819/bdc070a6/attachment-0001.jpeg 
-------------- next part --------------

However, this results in the top of the $f$ being too close to the
line above. To get back some space above, but not the space below,
use a \strut , but superscripted as in:
   $\smash{\xymatrix at 1{ X \ar^-{f}[r] & Y }}^{\strut}$.
The 3rd paragraph in the image uses this construction.

> Best wishes,
> Chris Heunen

Hope this helps,


Ross Moore                                       ross at maths.mq.edu.au
Mathematics Department                           office: E7A-419
Macquarie University                             tel: +61 (0)2 9850 8955
Sydney, Australia  2109                          fax: +61 (0)2 9850 8114

More information about the xy-pic mailing list