11

In an xypic or xymatrix diagram, is it possible to specify that an arrow should only cover part of the distance it normally would? In other words, for an arrow \xymatrix{ A \ar[r] & B }, or between two nodes in a more complex diagram \ar@{>=>}"A";"B", I would like to specify that e.g. it should start at 0.3 of the distance from A to B, and end at 0.85 of the distance to B.

(This would be similar to what the \xymatrix{ A \ar[r(0.6)] & B } notation does, except that that only shortens the arrow on the target end, not the source.)

2
  • Well, try tikz-cd instead. It's easier to shorten arrows in tikz.
    – Leo Liu
    Commented Feb 27, 2013 at 15:31
  • @LeoLiu: I like tikz-cd, but I have co-authors who prefer to stick to xymatrix where possible. Commented Feb 27, 2013 at 22:15

1 Answer 1

10

One way to do this is to first typeset an empty arrow \ar@{}[r] and label the required positions. For example ^(0.4){}="a" places an empty label named "a" at 0.4 of the way along the arrow. If you have set up labels "a" and "b" this way, then \ar "a";"b" will draw an arrow between them.

Sample output

\documentclass{article}

\usepackage[all]{xy}

\begin{document}

Normal arrow
\begin{equation}
  \xymatrix{ A \ar[r] & B }
\end{equation}
Shortened arrow
\begin{equation}
  \xymatrix{ A \ar@{}[r]^(.25){}="a"^(.75){}="b" \ar "a";"b"& B }
\end{equation}

\end{document}
4
  • I tried this in LyX and got <pos> "a" not defined" and <pos> "b" not defined. How do I fix it?
    – Exterior
    Commented Dec 6, 2014 at 14:08
  • @Exterior Sounds like a LyX specific problem. You should ask a separate question. Commented Dec 6, 2014 at 21:02
  • latexmk also gives an error: Use of \next@ doesn't match its definition. [}]; Missing } inserted, and others.
    – fosco
    Commented Dec 27, 2016 at 23:37
  • @FoscoLoregian It compiles fine for me on an up-to-date distribution. You should ask a separate question posting more details of the error messages. Commented Dec 29, 2016 at 11:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .