# Inside arrow in xy package: steps

Given the image

taken from this question here How do I deal with these scaling and positioning issues in Tikzcd,

how is it possible to obtain an arrow inside a segment using only xy package?

\documentclass[a4paper,12pt]{article}
\usepackage{amsmath,amssymb}
\usepackage[all,cmtip]{xy}
\begin{document}

$\xymatrix{ \ar@{->}[r]^{a} & f & }$
\end{document}


In xy-pic there is an arrow modifier \dir. Using this modifier you can draw the arrow with the tip in the middle as follows:

\documentclass[a4paper,12pt]{article}
\usepackage{amsmath,amssymb}
\usepackage[all,cmtip]{xy}
\begin{document}
$\xymatrix{ \ar@{-}[r]|*\dir{>} & f & }$
\end{document}


Here is the output:

The command \dir doesn't appear in the xy-pic user manual. It is the xy-pic reference manual in which this command is documented. (I don't know why there are many manuals for xy-pic with different contents)

• Great Luis :-) I have not found this in the manual....thank you very very very.......much..... Nov 26 '21 at 20:54
• It is nice to know that it is useful to you. You have not found that command in the manual because it is not there. I edited the answer with the corresponding "manual" in which you can see this and many other commands for xy. Nov 27 '21 at 2:27
• Excellent Luis. I have the documentation of xy but often when there is not an example I not understand well the code :-). Nov 27 '21 at 20:50
• Yes, I had the same problem with xy, maybe that was the main reason why I moved to tikz-cd Nov 27 '21 at 23:46
• I like sometimes the old packages like xy. :-) I think that xy package is very large instead of tikz-cd. Nov 28 '21 at 12:42