3

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?

8

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

| improve this answer | |
  • @LaRiFaRi, doesn't the opening of the loop in the second and third image, seem a bit too big? Presumably because of the _{\alpha} – daleif Mar 23 '15 at 9:18
  • 1
    @daleif hu, your vote is hard to get :-) I smashed the alpha in the first two examples. Looks better, right. The wide opening of the loop was the desired result of the OP, if I understood that correctly. Smashing the alpha in the xy approach would need further tweaking on column or row seps as the arrow heads would touch. – LaRiFaRi Mar 23 '15 at 9:49
  • 1
    I like the first one best. BTW: the the projection on the on the first component (pr_1) should of course also be upright ;-) (just to be consistent) – daleif Mar 23 '15 at 10:02
  • 2
    Here's another approach, rather than declare it with \DeclareMathOperator, that might give better spacing depending on the situation. – Manuel Mar 23 '15 at 11:18
  • @LaRiFaRi thanks. It appears I was just looking in the wrong part of the documentation :). What if I want to widen the loop, i.e. extend it further in the "up" direction? Is it possible without tikz-cd? I wouldn't want to change, if possible. Otherwise I will consider :). – MickG Mar 23 '15 at 17:01

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.