# Bending arrows in xy-pic

This question almost duplicates Bending snakes with xy-pic, but I need something slightly different from the solutions presented there. I spent some time trying to figure out how arrow bending works in XY-pic, but I don't seem to understand the syntax.

So I have the following diagram:

$\xymatrix@M=1em{ & \ker d^\prime\ar@{>->}[d]\ar[r] & \ker d\ar@{>->}[d]\ar[r] & \ker d^{\prime\prime}\ar@{>->}[d]\ar[dddll] \\ & M^\prime\ar[r]\ar[d] & M\ar@{->>}[r]\ar[d] & M^{\prime\prime}\ar[r]\ar[d] & 0 \\ 0\ar[r] & N^\prime\ar@{>->}[r]\ar@{->>}[d] & N\ar[r]\ar@{->>}[d] & N^{\prime\prime}\ar@{->>}[d] \\ & \coker d^\prime\ar[r] & \coker d\ar[r] & \coker d^{\prime\prime}}$ I want to bend the diagonal arrow so that it looks like the red arrow I painted above: goes down, crosses the arrow M'' -> 0, then crosses the three vertical arrows, and finally the arrow 0 -> N'. I want it to consist of straight segments, with slightly rounded corners. I am pretty sure the "bending" feature of XY-pic should do that, but I could not produce the desired result following some examples.

I found another question: How do you draw the "snake" arrow for the connecting homomorphism in the snake lemma?, with the accepted solution that looks almost as what I want, but I don't want to use TikZ. I hope someone here can show me how XY-pic bending is done in this case.

Thank you!

• Just curious : any reasons not to use tikz ? Jun 25 '16 at 9:49
• The answer tex.stackexchange.com/a/16516/15925 to the linked question is XY-pic not tkz. Jun 29 '16 at 6:29
• @Andrew Swann I just wanted a diagram exactly like the one I tried to depict above (it looks like that in Bourbaki's "Algèbre homologique"), and the closest solution from tex.stackexchange.com/questions/3892 does use TikZ...
– user45435
Jul 1 '16 at 15:04

A handy (and short) document is the XY-pic User's Guide by Kristoffer H. Rose, available as "User Guide" at https://www.ctan.org/pkg/xypic?lang=en. Curving the arrows is section 2.8, and the best you'd get is something like:

\documentclass{article}
\usepackage[arrow,matrix]{xy}
\newcommand{\coker}{\mathrm{coker}~}
\begin{document}
$\xymatrix@M=1em{ & \ker d'\ar@{>->}[d]\ar[r] & \ker d\ar@{>->}[d]\ar[r] & \ker d''\ar@{>->}[d] \arr[dr][dlll][dddlll][dddll][dddll] %\ar[dddll] \\ & M'\ar[r]\ar[d] & M\ar@{->>}[r]\ar[d] & M''\ar[r]\ar[d] & 0 \\ 0\ar[r] & N'\ar@{>->}[r]\ar@{->>}[d] & N\ar[r]\ar@{->>}[d] & N''\ar@{->>}[d] \\ & \coker d'\ar[r] & \coker d\ar[r] & \coker d''}$
\end{document}


(I've replace \primeskip with ') which becomes: Let's breakdown the command of interest:

\ar       % an arrow
r       % which starts by going to the right before curving to go toward
[dr]     % the entry one down and one to the right
% before bending to go toward
[dlll]   % the entry one down and three to the left
        % before bending to go toward
[dddlll] % the entry three down and three to the left
% before bending to go toward
[dddll]  % the entry three down and two to the left
[dddll]  % where the arrow ends


To get something closer to what you're looking for, we can take a trick from section 2.7 and define some phantom targets. We'll put in extra columns and rows where the arrow would need to curve. To make the spacing come out right, we'll also put in extra columns and rows everywhere else. So instead of 5 columns and 4 rows, we'll have 9 columns and 7 rows (but every other column / row won't have an entry; a few of them are just targets for the arrow to curve at). That spaces things out too much, so we tighten up the sizing (a lot of guess and check to match the original sizing). Finally, instead of [ddddddlllll] as a target, we'll use the relative [6,-5] (see section 2.5). That leaves us with:

\documentclass{article}
\usepackage[arrow,matrix]{xy}
\newcommand{\coker}{\mathrm{coker}~}
\begin{document}
$\xymatrix@C=.3em@R=.7ex@M=1em{ && \ker d'\ar@{>->}[dd]\ar[rr] && \ker d\ar@{>->}[dd]\ar[rr] && \ker d''\ar@{>->}[dd] \arr[3,1][3,-5][6,-5][6,-4][6,-4] && \\\\ && M'\ar[rr]\ar[dd] && M\ar@{->>}[rr]\ar[dd] && M''\ar[rr]\ar[dd] && 0 \\ &&&&&&&& \\ % needs enough columns to have the target we want 0\ar[rr] && N'\ar@{>->}[rr]\ar@{->>}[dd] && N\ar[rr]\ar@{->>}[dd] && N''\ar@{->>}[dd] \\\\ && \coker d'\ar[rr] && \coker d\ar[rr] && \coker d''}$
\end{document}


and • That's exactly what I was looking for, thank you very much for the solution and explanation.
– user45435
Jul 1 '16 at 14:56