2

Given the image

enter image description here

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}

enter image description here

2

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:

enter image description here

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)

5
  • Great Luis :-) I have not found this in the manual....thank you very very very.......much.....
    – Sebastiano
    Nov 26 at 20:54
  • 1
    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 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 :-).
    – Sebastiano
    2 days ago
  • 1
    Yes, I had the same problem with xy, maybe that was the main reason why I moved to tikz-cd 2 days ago
  • I like sometimes the old packages like xy. :-) I think that xy package is very large instead of tikz-cd.
    – Sebastiano
    2 days ago

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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