52

I've been testing out TikZ lately, but I'm still quite new to it. What I want to do is to create a line to indicate that a parameter belongs to a part of the drawing. For example "This surface that I'm pointing at has temperature T". What I've seen used sometimes is to have a line or arrow with a small S-bend on the middle. I think this is a good idea as it's easy to see that the line doesn't have anything to do with the body you're drawing. Unfortunatley I had some problems finding a picutre explaining what I'm thinking of. The arrow specifying Pθ on this picture was the best I could find allthough it's not completly the same.

Is there any easy way to do something like this in TikZ? I have no idea what it would be called...

1
  • 1
    How about this? or this? in general is the to[out=90,in=180] keyword you are looking for, I think. Dec 1, 2010 at 16:20

1 Answer 1

67

There are a number of ways you can do this in TikZ. Here are three examples:

\begin{tikzpicture}
  \node[anchor=east] at (0,0) (text) {This is some text.};
  \node[anchor=west] at (3,1) (description) {Here is the description.};
  \draw (description) edge[out=180,in=0,->] (text);
\end{tikzpicture}

\begin{tikzpicture}
  \node[anchor=east] at (0,0) (text) {This is some text.};
  \node[anchor=west] at (3,1) (description) {Here is the description.};
  \draw[->] (description) -| (text);
\end{tikzpicture}

\begin{tikzpicture}
  \node[anchor=east] at (0,0) (text) {This is some text.};
  \node[anchor=west] at (3,1) (description) {Here is the description.};
  \draw[->] (description) .. controls ([xshift=-4cm] description) and ([xshift=4cm] text) .. (text);
\end{tikzpicture}

which produces

Screenshot of the three TikZ pictures.

6
  • Brilliant! That actually don't look too difficult :)
    – Paul
    Dec 1, 2010 at 16:42
  • 8
    The last one can be done much more easily using the line \draw[->] (description) to [out = 180, in = 0, looseness = 2] (text);. The looseness parameter sets the controls automatically and is more intuitive.
    – Ryan Reich
    Dec 5, 2010 at 10:24
  • 1
    @RyanReich: True. My motivation for including that last example was to demonstrate TikZ's lower level Bézier curve drawing capabilities.
    – ESultanik
    Sep 7, 2012 at 13:27
  • Which package of Tikz are you using?
    – Daniel
    Nov 18, 2013 at 0:27
  • @Daniel I don't recall what version I used when I posted this answer, but these commands are all supported in the core TikZ/PGF engine and have been for years (if not all along). A vanilla install of any modern LaTeX distro should be able to compile this example directly out of the box, and I can confirm that that is the case for both TexLive and MacTeX.
    – ESultanik
    Nov 18, 2013 at 13:35

You must log in to answer this question.

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