# xy diagram problem: too wide, some arrows too short

I'm trying to write the diagrams of the isomorphism theorems, and I'm having problems. Some objects are too wide, and some arrows too short. Currently I have

$$\xymatrix{A\ar[r]^\pi\ar[d]_\rho & A/C\ar[d]_\tau\ar@{-->}[dl]_\sigma\\ A/B\ar@{-->}[r]^\theta & (A/C)/(B/C)\\}\hspace{-4mm}$$
$$\xymatrix{A\ar[r]^\rho\ar[d]_\iota\ar[dr]_\varphi & A/(A\cap N)\ar@{-->}[d]_\theta\\ A\,N\ar[r]^\pi & A\,N/N\\}$$


which produces

.

Notice that the problem is the position of (A/C)/(B/C) and A/(A\cap N): both should be positioned more to the right (left justified), so that all arrows were more or less equally long.

How can I specify the length of arrows and position/justification of objects? I'm using \usepackage[all]{xy}.

-
thanks for the points which enabled me to post the pics. – Leon Apr 23 '11 at 20:54

You can use the \mathrlap feature of mathtools:

\documentclass[a4paper]{article}
\usepackage[all,pdf,cmtip]{xy}
\usepackage{mathtools}
\begin{document}
$\xymatrix{A\ar[r]^\pi\ar[d]_\rho & A/C\ar[d]_\tau\ar@{-->}[dl]_\sigma\\ A/B\ar@{-->}[r]^\theta & (A/C)\mathrlap{/(B/C)}}$
$\xymatrix{A\ar[r]^\rho\ar[d]_\iota\ar[dr]^\varphi & A/(A\mathrlap{{}\cap N)}\ar@{-->}[d]_\theta\\ AN\ar[r]^\pi & AN/N}$
\end{document}


You are lucky that the big objects are in the final column.

-
Yes, this works! Thank you :). Is there also a way to lengthen the vertical arrows, so that the diagram would have a more suare-like and less rectangle-like shape? – Leon Apr 24 '11 at 12:05
With \xymatrix@R+12pt{...} you add 12pt to the length of the vertical arrows. In order to get alignment of the entries, add \mathstrut to each one; if no entry is too big, this effectively gives them the same height. – egreg Apr 24 '11 at 13:20
great, thank you very much – Leon Apr 24 '11 at 14:15

You can shift a node to the right be preceding it by *+[r] and then enclosing the node in braces. Here's how your examples would look:

\documentclass{article}
\usepackage[all,cmtip]{xy}
\begin{document}

\begin{displaymath}
\xymatrix{
A\ar[r]^\pi\ar[d]_\rho
& A/C\ar[d]_\tau\ar@{-->}[dl]_\sigma\\
A/B\ar@{-->}[r]^\theta
& *+[r]{(A/C)/(B/C)}
}%\hspace{-4mm}
\end{displaymath}
\begin{displaymath}
\xymatrix{
A\ar[r]^\rho\ar[d]_\iota\ar[dr]_\varphi
& *+[r]{A/(A\cap N)} \ar@{-->}[d]_\theta\\
A\,N\ar[r]^\pi
& A\,N/N}
\end{displaymath}

\end{document}


That produces:

-
is there a way to make the top A/C and bottom A/C in (A/C)/(B/C) aligned? Also, is there a way to lengthen the vertical arrows, so that the diagram would have a more suare-like and less rectangle-like shape? – Leon Apr 24 '11 at 9:59
@Leon Lampret, for the alignement try : *+[r]{A/C} – Matsaya Apr 24 '11 at 14:12
@Leon Lampret: For the alignment, as @Matsaya suggests, make that node *+[r]{A/C}. To lengthen the vertical arrows, set the row spacing to whatever you like with @R=length before the opening brace of the xymatrix, as in \xymatrix@R=8ex{ {A} \ar[r]^{\pi}.... (You can also set the column spacing with @C=length in between the \xymatrix and the opening brace.) – Phil Hirschhorn Apr 24 '11 at 15:31
thanks, good advice – Leon Apr 24 '11 at 22:38