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 often want to add what I call "callout arrows" to draw attention to some part of a technical graphic, such as the two curved paths with arrows below:

enter image description here

Although I have used TikZ only a few times, my question is not "will someone do this for me?" but rather, "could you outline to me the philosophy or approach you take?" to adding a curved path with an arrow to a technical graphic, which may be placed in a variety of positions and/or take on a variety of lengths depending on the particular task at hand.

Right now, I am playing around with using in and out commands, and doing this by placing a path through particular coordinates, and manually adjusting the angles in and out, but the downside is that it seems every new callout I want is a brand new problem. So I am mainly wondering what approaches others would use for this.

share|improve this question
    
Make a to path, with measuring the path angle with relative in,out angles. And without a simple MWE with your manual arrows, this is still a do-it-for-me question. –  percusse Nov 4 '13 at 15:01
1  
Your comment is ridiculous. How is it a "do it for me" question when I very specifically (in bold font no less) said, "tell me how you think about the question" and NOT "tell me how to do it". In fact, I don't care at all about how to do the particular graphic I pasted. It was merely a categorical example. –  JohnD Nov 4 '13 at 16:08
    
So you say you have an example and you won't paste it because it is a categorical question. And we should give you a text based answer for that or what? Where is the benefit of it? I already give you the answer without the code in the comment then. That's what is ridiculous. –  percusse Nov 4 '13 at 16:20
add comment

1 Answer

Edit: my first answer works with the latest CVS version of TikZ. I provide a degraded version below (compatible TikZ 2.10).

1st version (latest CVS version of TikZ)

Here is an attempt to respond to your very vague question:

enter image description here

The code (poi = Point of Interest):

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{calc}
\tikzset{
  zigzag/.style={
    to path={
      coordinate (m) at ($(\tikztostart)!.5!(\tikztotarget)$)
      coordinate (m1) at ($(m)!1mm!90:(\tikztostart)$)
      coordinate (m2) at ($(m)!1mm!90:(\tikztotarget)$)
      plot[smooth] coordinates{ (\tikztostart) (m1) (m2) (\tikztotarget)}
    }
  },
}

\begin{document}
\begin{tikzpicture}
  \node[draw,circle,fill=gray] (poi) {POI};

  \node[blue] (c1) at (0,2) {$y = f(x)$};
  \draw[blue,-latex] (c1.south) to[zigzag] (poi.north);

  \node[red] (c2) at (2,0) {$y = g(x)$};
  \draw[red,-latex] (c2.west) to[zigzag] (poi.east);
\end{tikzpicture}
\end{document}

2nd version (compatible with TikZ 2.10)

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{calc}
\tikzset{
  zigzag/.style={
    to path={
      coordinate (m) at ($(\tikztostart)!.5!(\tikztotarget)$)
      coordinate (m1) at ($(m)!1mm!110:(\tikztostart)$)
      coordinate (m2) at ($(m)!1mm!110:(\tikztotarget)$)
      plot[rounded corners=1mm] coordinates{ (\tikztostart) (m1) (m2) (\tikztotarget)}
    }
  },
}

\begin{document}
\begin{tikzpicture}
  \node[draw,circle,fill=gray] (poi) {POI};

  \node[blue] (c1) at (0,2) {$y = f(x)$};
  \draw[blue,-latex] (c1.south) to[zigzag] (poi.north);

  \node[red] (c2) at (2,0) {$y = g(x)$};
  \draw[red,-latex] (c2.west) to[zigzag] (poi.east);
\end{tikzpicture}
\end{document}

enter image description here

share|improve this answer
    
So "try using to[zigzag] rather than trying to manually recreate that behavior yourself each time". –  JohnD Nov 4 '13 at 16:15
    
@JohnD ... or define your own zigzag operation and use it. –  Paul Gaborit Nov 4 '13 at 16:26
    
I tried the above code but didn't quite get the same image. In my case each arrow tip is pointing due north rather than at the nodes. I've tried the stable 2.10 and the latest pgf from sourceforge. –  rhody Dec 1 '13 at 0:17
    
@rhody Exact! I added a new version compatible with TikZ 2.10. –  Paul Gaborit Dec 1 '13 at 8:59
    
That works! Many thanks. –  rhody Dec 3 '13 at 18:11
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.