5

Even though I just learned how to draw an arc, I have difficulties in drawing the arcs in the figure. Especially the arc from the second circle to the first one. If I do: \draw[bend left,->] (l2.south) to node [auto] (l1.north) (where l1 is the circle above, and l2 is the circle below), the line will cross the circles and make the picture not pretty.

So does anyone know how to draw the arc from l2 to l1? Another thing is I would like this arc goes from the south of l2, and points to the north-west of l1 (instead of north of l1)

Could anyone help? Thank you very much!

enter image description here

1 Answer 1

5

You'll need to define a support point for this. You can use the syntax +(<x>,<y>), which specifies a point relative to the starting point. In order to smooth the curve, you'll have to make sure that the in value of the path segment going into the support point, and the out value of the segment leaving the support point add up to 0. To adjust the path of the curve, you can play with looseness, in looseness and out looseness, which specify how "curvy" the path is.

By specifying an out and in angle for the first and last segment of the path, you can determine at what location the path leaves or enters a node. Alternatively, you could specify (<node name>.north west) to make the path start or end at the top left of a node, or use (<node name>.<angle>) to specify at what angle on the shape outline the path will start or end, with 0 pointing due east, 90 due north, etc.

\documentclass[a4paper]{article}

\usepackage{tikz}
\usetikzlibrary{shapes.geometric,positioning}

\begin{document}

\begin{tikzpicture}[every node/.style={draw,ellipse}]
  \node (A) {A};
  \node [below left=2cm and 0.5cm of A] (B) {B};
\draw[out=-90,in=90,->]  (A) to  (B);
\draw [->] (B)  to [out=-90,in=-90,in looseness=2.5] +(-1cm,1cm) to [out=90,in=135,out looseness=1.5](A);
\end{tikzpicture}

\end{document}

If you're not set on the path leaving node B from the south, but instead make it leave from south west, you can instead just write

\draw [->] (B)  to [out=-135,in=135,in looseness=1.5] (A);

3
  • Thanks for your reply, but your code does not compile, it gives an error Package tikz Error: ( expected....
    – SoftTimur
    Sep 2, 2011 at 14:28
  • @SoftTimur: This works fine for me. Perhaps you are using an older version of the libraries. Sep 2, 2011 at 23:53
  • That's weird, it compiles fine for me if I copy the whole code block into a new document. Are you using an old (pre 2.1) version of TikZ? You can check that by putting \listfiles in your preamble and checking the list near the end of the .log file.
    – Jake
    Sep 3, 2011 at 0:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .