[Tex/LaTex] Loop arrow in xypic

diagramsxy-pic

I am trying to get a loop arrow in an xypic diagram, and I just can't. For now, I have the following:

\[\xymatrix{
p^{-1}(U_{\alpha})\ar[rr]^-{\tau_{\alpha}} & & U_{\alpha}\times\mathbb R^k\ar[dl]^{pr_1} \\
 & U_{\alpha}\ar[ul]^-{s|_{U_{\alpha}}} \ar`ul/20pt[ur]`/10pt[0,0]`/10pt[l]^{id}`/10pt[ul]
}.\]

enter image description here

As you can see, the final portion of the arrow does not point towards its start. My aim is to have the tip of the arrow very close to the tip of the \ar[dl]^{pr_1} arrow. My problem is I can't refer to the starting point as a target, because [0,0] would be a curving centre and "2,2" does not get interpreted. I have looked at the documentation of the package and found nothing. How do I do this?

Best Answer

If you are willing to switch to this becomes easy.

% arara: pdflatex

\documentclass{article}
\usepackage{mathtools}
\usepackage{amsfonts}
\DeclareMathOperator\id{id}
\DeclareMathOperator\pr{pr} 
\usepackage{tikz-cd}

\begin{document}
\[
\begin{tikzcd}
    p^{-1}(U_{\alpha})\ar{rr}{\tau_{\alpha}} && U_{\alpha}\times\mathbb{R}^k\ar{dl}{\pr_1}\\
    & U_{\mathrlap\alpha}\ar{ul}{s|_{U_{\alpha}}}\ar[loop above]{}{\id} & 
\end{tikzcd}
\]
\end{document}

enter image description here

In order to manipulate the target of the arrow, you may want to play around with the options in the arrow below.

\begin{tikzcd}
    p^{-1}(U_{\alpha})\ar{rr}{\tau_{\alpha}} && U_{\alpha}\times\mathbb{R}^k\ar{dl}{\pr_1}\\
    & U_{\mathrlap\alpha}\ar{ul}{s|_{U_{\alpha}}}\ar[%
    ,loop % tells tikz-cd to do a loop
    ,out=123 % start at angle 123°
    ,in=57 % stop at angle 57°
    ,distance=2.5em % biggest distance of arrow to node. You can use pt or cm as well.
    ]{}{\id} & 
\end{tikzcd}

enter image description here


I just checked the syntax for xy and the default result looks quite good, too. Would this be close enough to the right arrow?

% arara: pdflatex

\documentclass{article}
\usepackage{mathtools}
\usepackage{amsfonts}
\DeclareMathOperator\id{id}
\DeclareMathOperator\pr{pr}
\usepackage[all,cmtip]{xy}

\begin{document}
\[
\xymatrix{%
    p^{-1}(U_{\alpha})\ar[rr]^-{\tau_{\alpha}} & & U_{\alpha}\times\mathbb{R}^k\ar[dl]^{\pr_1} \\
    & U_{\alpha}\ar[ul]^-{s|_{U_{\alpha}}} \ar@(ul,ur)^{\id} % smashing the alpha here would result in touching arrow heads. That's why I didn't do that here
}. % supposing, this dot was set here by purpose...
\]
\end{document}

enter image description here

Related Question