TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

enter image description here

instead of

enter image description here.

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}.

share|improve this question
thanks for the points which enabled me to post the pics. – Leon Apr 23 '11 at 20:54
up vote 5 down vote accepted

You can use the \mathrlap feature of mathtools:

\xymatrix{A\ar[r]^\pi\ar[d]_\rho & 
          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}

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

share|improve this answer
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:


    & A/C\ar[d]_\tau\ar@{-->}[dl]_\sigma\\
    & *+[r]{(A/C)/(B/C)}
    & *+[r]{A/(A\cap N)} \ar@{-->}[d]_\theta\\
    & A\,N/N}


That produces:enter image description here

share|improve this answer
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

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.