Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I have already drawn two ellipses l1 and l2, l2 is on the left below l1:

\begin{tikzpicture}
  \node (l1) [ellipse, draw=black, fill=white!20, text=black, scale=0.8, text centered]{
    $l_1$};
  \node (l2) [ellipse, draw=black, fill=white!20, text=black, scale=0.8, text centered, below left=1cm of l1]{
    $l_2$};
\end{tikzpicture}

I would like to draw an arc from the south of l1 to the north of l2 with a ->. The aim of drawing arc instead of a line is to make it prettier, so just a little radian will be fine, no need to be very accurate.

Does anyone know how to do it?

Also I would like to label the arc in its middle. The label, which is actually a word, will be ideally displayed horizontally.

share|improve this question
    
Your code does not compile for me. What TiKZ libraries are you using? –  Niel de Beaudrap Sep 2 '11 at 1:05
    
@Niel de Beaudrap: \usetikzlibrary{positioning,shapes,shadows,arrows,shapes.multipart} –  SoftTimur Sep 2 '11 at 1:11
    
Thanks. Generally, you should post a complete working document in such cases, to avoid such confusion. (Especially where TiKZ is involved, which has more accessories than the proverbial Malibu Stacy doll.) –  Niel de Beaudrap Sep 2 '11 at 1:14
    
By the way: fill=white!20 doesn't make much sense: You're mixing 20% white with 80% white, ending up with white. What would make sense would be fill=white!20!blue, which mixes 20% white with 80% blue, or fill=blue!20, which mixes 20% blue with 80% white. If you want to get a semi-transparent background, specify fill=white, opacity=0.2 –  Jake Sep 2 '11 at 3:19
add comment

1 Answer

up vote 6 down vote accepted

You can draw the the arc with an arrow tip by using \draw [bend right,->] (l1) to (l2);. The curvature can be specified using bend right=<angle>.

To add a label, you can add a node halfway along the path by inserting node [auto] {<text>} after to. The auto keyword makes sure that the text doesn't overlap the line. If you want the text on the other side of the line, you can add the keyword swap after auto. The distance along the path can be controlled using at start, very near start, near start (or the equivalent expressions with end), or by specifying a fraction using at=<pos>.

Note that you don't need to set text centered explicitly, as this is the default behaviour.

\documentclass[a4paper]{article}

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

\begin{document}

\begin{tikzpicture}
  \node (l1) [ellipse, draw=black, fill=white!20, text=black, scale=0.8]{
    $l_1$};
  \node (l2) [ellipse, draw=black, fill=white!20, text=black, scale=0.8, below left=1cm of l1]{
    $l_2$};
\draw[bend left,->]  (l1) to node [auto] {Link} (l2);
\end{tikzpicture}

\end{document}
share|improve this answer
    
I just posted antoher related question: draw a special arc from 1 node to another in tikz, could you please take a look if you want? –  SoftTimur Sep 2 '11 at 2:36
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.