# Changing length of an arrows from a vertex to itself

I'm working with LyX.

I would like to change the length of an arrow from a vertex to itself. I would like to make the arrow stretch longer up before returning down to the encircled vertex. The code I have been using so far, inside the \xymatrix in the LyX Math-box, is:

*+[o][F-]{e}\ar@(ul,ur)

How should this code be modified in LyX in order to lengthen the arrow?

-

As canaaerus says the control points option is the way to go. To reproduce the ul direction use a point of the form (-x,x) and for the ur direction (x,x). The standard size is produced with x roughly 10. Now with the correct syntax you can write

\documentclass{article}
\usepackage[arrow, matrix, curve]{xy}

\begin{document}
$$\begin{xy}\xymatrix{ e\ar @{(-10,10),(10,10)} }\end{xy} \qquad \begin{xy}\xymatrix{ e\ar @{(-20,20),(20,20)} }\end{xy}$$

\end{document}

and get

To make this narrower, reduce the size of the x-coordinates of the control points

$$\begin{xy}\xymatrix{ e\ar @{(-10,20),(10,20)} } \end{xy}$$

Note that if you wish to place such arrows at a different node of your \xymatrix then you should be careful about absolute vs. relative coordinates, one way to deal with this is to package the node into an \xybox. Here is an example, including the node formatting in your original question:

\documentclass{article}
\usepackage[all]{xy}

\begin{document}

$$\begin{xy}\xymatrix{ \xybox{ *=+[o][F]{e}\ar @{(-10,10),(10,10)} } & \xybox{ *=+[o][F]{e}\ar @{(-20,20),(20,20)} } }\end{xy}$$

\end{document}

and here is a further example demonstrating that xypic treats these nodes correctly in that arrows point to the circled node:

\documentclass{article}
\usepackage[all]{xy}

\begin{document}

\begin{displaymath}
\begin{xy}
\xymatrix{
\xybox{ *=+<12pt>[o][F]{e}\ar @{(-10,10),(10,10)} }
\ar[r]^\pi
\ar@{.>}[rd]_q &
\xybox{ *=+<12pt>[o][F]{g}\ar @{(-20,20),(20,20)} } \ar[d]^p \\
& \xybox{ *=+<12pt>[o][F]{f}\ar @{(-10,-20),(10,-20)}|a }
}
\end{xy}
\end{displaymath}

\end{document}

Notice that I have used +<12pt> to get larger circles around the nodes.

-
Andrew, thanks a lot for your answer! It's very helpful! :) –  Shlomi A Aug 24 '12 at 9:36
This is fantastic, and it can be made even better. :) To use relative coordinates, you can just write "\ar@`{p+(-10,10),p+(10,10)}", because "p" is parsed as the coordinates of the source of the arrow (see paragraph 24q of the XY-pic reference manual). –  Vectornaut Aug 18 at 3:08
@Vectornaut That is a very useful way of specifying these relative coordinates without packing up in a box. –  Andrew Swann Aug 18 at 9:11
I'm glad you like it! –  Vectornaut Aug 19 at 5:18

First of all e\ar@(ul,ur) seems to have the same effect for me as your example. To make it into a complete MWE:

\documentclass{article}
\usepackage[arrow, matrix, curve]{xy}

\begin{document}

$\begin{xy}\xymatrix{ e\ar@(ul,ur) }\end{xy}$

\end{document}

Now I think the problem can be solved by putting explicit curve control points. Compare 24q in the XY-pic Reference Manual. Then the syntax should look like e\ar@'{a,b} where a and b are control points which are to the upper left and upper right, but sufficiently far away.

Unfortunately I'm not familiar enough with this function yet.

-