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 want to use xypic to make diagrams using vertical cofibration arrows, i.e. ones that look like $\rightarrowtail$. Naively using


gives an arrow whose tail overlaps with the source object. There is an exercise in the xyguide that fixes this:

\newdir{ >}{{}*!/-5pt/@{>}}.

But using this for vertical arrows gives tails that are horizontally shifted and do not attach to the shaft. How can I fix this or is there a nicer way to do such arrows in xypic anyway? This is the best I have seen so far but the results are not exceptional.

Here's a MWE

\newdir{ >}{{}*!/-5pt/@{>}}

 S_{P} \ar@{=}[r] \ar@{ >->}[d] & S_{P} \ar@{->>}[r] \ar@{ >->}[d] & 0 \ar@{ >->}[d] \\
 R' \ar@{ >->}[r] \ar@{->>}[d] & R \ar@{->>}[r] \ar@{->>}[d] & M \ar@{=}[d] \\ 
 P' \ar@{ >->}[r] & P \ar@{->>}[r] & M

enter image description here

share|improve this question
Can you add what you have up to now? – egreg Jul 31 '13 at 13:48
I'm no sure what you mean. The \newdir given above is what I have. It works for horizontal arrows but not vertical ones. Do you want an example of its use? – Tom Harris Jul 31 '13 at 14:29
I meant showing the code for a diagram of the kind you want, even if the arrow is wrong. – egreg Jul 31 '13 at 14:52
Sure. The vertical arrows here typeset incorrectly: [ \xymatrix{ S_{P} \ar@{=}[r] \ar@{ >->}[d] & S_{P} \ar@{->>}[r] \ar@{ >->}[d] & 0 \ar@{ >->}[d] \R' \ar@{ >->}[r] \ar@{->>}[d] & R \ar@{->>}[r] \ar@{->>}[d] & M \ar@{=}[d] \P' \ar@{ >->}[r] & P \ar@{->>}[r] & M } ] – Tom Harris Jul 31 '13 at 15:00
the arrowheads used here are very "deep". the arrowheads that match those on the computer modern arrows are much shallower. if you simply change your \usepackage line to \usepackage[all,cmtip]{xy} there will be a more reasonable gap between the arrow tails and what the arrows point from. (not sure why cmtip isn't included in the all option; it's possible that not everyone prefers the cm style, and it's harder to disable an option that's been set than to add one more.) – barbara beeton Jul 31 '13 at 16:59
up vote 7 down vote accepted

a one-line change in your existing example, adding cmtip to


gives this result:

output of original example with code change as indicated

share|improve this answer

As you told, from the user guide, we have \newdir{ >}{{}*!/-7pt/\dir{>}}.

Note the empty space before the first use of >.

(Edited: I changed the value to -7pt. Choose what is better to you.)

Then you use it as \ar@{ >->}.

See the result:

enter image description here

share|improve this answer
Thanks. It seems I was missing the \dir{>} in the definition of the \newdir. – Tom Harris Jul 31 '13 at 15:37
@TomHarris, there must have been a change in Xy at some point. I have a version of the user guide from 1999 which does not include the \dir. – Mike Shulman Jun 6 '14 at 21:07
Hmm, okay, maybe that's not it; I just downloaded the up-to-date user guide and it also uses @{>} rather than \dir{>}. Do you by chance have a \makeatletter before your \newdir? I did, and removing it fixed the problem for me. – Mike Shulman Jun 6 '14 at 21:15
@Sigur: What would be the analogous code to make \ar@{^{(}->} not overlap so much? – jdc Feb 18 '15 at 0:58
@jdc, sorry, I'm not sure I'm following. – Sigur Feb 18 '15 at 13:20

If you are willing to switch to tikz-cd, here's the same diagram:



S_{P} \arrow[equal]{r} \arrow[tail]{d} &
 S_{P} \arrow[two heads]{r} \arrow[tail]{d} &
 0 \arrow[tail]{d} \\
R' \arrow[tail]{r} \arrow[two heads]{d} &
 R \arrow[two heads]{r} \arrow[two heads]{d} &
 M \arrow[equal]{d} \\
P' \arrow[tail]{r} & P \arrow[two heads]{r} & M


enter image description here

share|improve this answer
I tried using your code and the equals arrows displayed as normal arrows. Any idea why? – Tom Harris Jul 31 '13 at 16:38
It works here on TeXlive 2011 and Lubuntu 11.10. – Sigur Jul 31 '13 at 16:44
I'm using whatever distribution comes with Kile on Ubuntu 13.04. – Tom Harris Jul 31 '13 at 16:53

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.