# How to control the direction of a hook arrow in diagxy?

I'm converting some diagrams from tikz-cd to diagxy and am having problems with hook arrow for inclusion maps.

With tikz-cd the hook gets reversed on a right-to-left arrow, but I can restore it by adding an apostrophe.

With xy that's not an option, and changing the left parenthesis from a subscript to a superscript doesn't work.

Any suggestions?

\documentclass{article}
\usepackage[barr,pdf]{xy}
\usepackage{tikz-cd}

\begin{document}
With tikzcd

$\begin{tikzcd} A \ar[r, hook, "right~hook"'] & B \\ A & B \ar[l, hook', swap, "left~hook"'] \end{tikzcd}$

With xy

$\bfig \node a1(0,800)[A] \node b1(1000,800)[B] \node a2(0,700)[A] \node b2(1000,700)[B] \node a3(0,600)[A] \node b3(1000,600)[B] \node a4(0,500)[A] \node b4(1000,500)[B] \node a5(0,400)[A] \node b5(1000,400)[B] \node a6(0,300)[A] \node b6(1000,300)[B] \node a7(0,200)[A] \node b7(1000,200)[B] \node a8(0,100)[A] \node b8(1000,100)[B] \arrow |b|/_{ (}->/[a1b1;right~sub~(] \arrow |b|/^{ (}->/[a3b3;right~sup~(] \arrow |b|/_{ (}->/[b5a5;left~sub~(] \arrow |b|/^{ (}->/[b7a7;left~sup~(] \efig$

\end{document}


• I've finally found the bug, see my updated answer. – gernot Mar 21 '17 at 0:40

Add the following line after \usepackage[barr,pdf]{xy}.

\newdir_{ (}{{ }*!/-.5em/@_{(}}


\documentclass{article}
\usepackage[barr,pdf]{xy}
\newdir_{ (}{{ }*!/-.5em/@_{(}}
\begin{document}
Without space:
$\bfig \node a1(0,800)[A] \node b1(1000,800)[B] \node a2(0,700)[A] \node b2(1000,700)[B] \node a3(0,600)[A] \node b3(1000,600)[B] \node a4(0,500)[A] \node b4(1000,500)[B] \node a5(0,400)[A] \node b5(1000,400)[B] \node a6(0,300)[A] \node b6(1000,300)[B] \node a7(0,200)[A] \node b7(1000,200)[B] \node a8(0,100)[A] \node b8(1000,100)[B] \arrow |b|/_{(}->/[a1b1;right~sub~(] \arrow |b|/^{(}->/[a3b3;right~sup~(] \arrow |b|/_{(}->/[b5a5;left~sub~(] \arrow |b|/^{(}->/[b7a7;left~sup~(] \efig$

With extra space:
$\bfig \node a1(0,800)[A] \node b1(1000,800)[B] \node a2(0,700)[A] \node b2(1000,700)[B] \node a3(0,600)[A] \node b3(1000,600)[B] \node a4(0,500)[A] \node b4(1000,500)[B] \node a5(0,400)[A] \node b5(1000,400)[B] \node a6(0,300)[A] \node b6(1000,300)[B] \node a7(0,200)[A] \node b7(1000,200)[B] \node a8(0,100)[A] \node b8(1000,100)[B] \arrow |b|/_{ (}->/[a1b1;right~sub~(] \arrow |b|/^{ (}->/[a3b3;right~sup~(] \arrow |b|/_{ (}->/[b5a5;left~sub~(] \arrow |b|/^{ (}->/[b7a7;left~sup~(] \efig$
\end{document}


Edit: I have contacted Michael Barr, the maintainer of xybarr. According to him it is not a bug, but a deliberate omission, and he is not planning to add it.

• I need to add a space to avoid run-in. I'll try / _^(->/ and see what happens. – shmuel Mar 20 '17 at 20:22