[Xy-pic] Problem with Xy-pic graph next to eps file via subfigure package

Ross Moore ross at ics.mq.edu.au
Fri May 16 10:08:58 CEST 2003

On Thu, 15 May 2003, Richard Dybowski wrote:

> I would like to place a graph produced by Xy-pic next to a figure obtained
> from an EPS file. I have attempted this using the subfigure package but,
> instead of the two figures appearing side-by-side, the figure from Xy-pic
> appears much lower than that from the EPS file. How do I overcome this
> problem?

It sounds like you are placing two boxes side-by-side, in horizontal mode.
where those boxes have different heights and depths.
TeX will align them so that the baselines match.

By default, Xy-pic produces boxes in which the baseline is midway down
the diagram; i.e. equal height and depth.

But you can easily change this, using \xybox .

e.g.  \begin{xy} *!D\xybox{.....}\end{xy}

places the contents (Xy-pic constructed sub-diagram)
as a single <object> within the outer {xy}-environment.
The !D moifier means that the current reference point is at the
bottom (Down) edge, hence all of the diagram is above this.
That is, the resulting box has all height, no depth.

In your case, you may want:

 \begin{xy} *!D\xybox{\xymatrix{....}}\end{xy}

Using different modifiers, (e.g. factors after the direction
specifier) you can shift the diagram vertically, as much as you like;
e.g., try the effect of:

 \begin{xy} *!U(.5)\xybox{\xymatrix{....}}\end{xy}
 \begin{xy} *!D(1.2)\xybox{\xymatrix{....}}\end{xy}

Hope this helps.

	Ross Moore

> The complete LaTeX code is as follows:
> %--------------------------------------------------
> \documentclass{article}
> \usepackage{graphicx,subfigure}
> \usepackage[all,frame,curve,rotate]{xy}
> \newcommand{\agraph}{
> $$\xymatrix{
>   & X_1 \ar[dl]\ar[dr] & \\
>   X_2 \ar[dr] & & X_3 \ar[dl] \\
>   & X_4 &
> }$$}

Why do you have $$...$$ here?
They are not needed.

> \begin{document}
> \begin{figure}[htb]
> \centering \mbox{
>   \subfigure[]{\agraph}
>   \subfigure[]{\includegraphics[width=0.4\textwidth]{afigure.eps}} }
>   \caption{A caption} \label{fig:1}
> \end{figure}
> \end{document}
> %--------------------------------------------------
> Thanking you in advance,
> Richard
> -------------------------------
> Dr Richard Dybowski
> 143 Village Way
> Pinner HA5 5AA, UK
> Tel: 07976 250092
> _______________________________________________
> Xy-pic mailing list
> http://tug.org/mailman/listinfo/xy-pic

More information about the Xy-pic mailing list