3

I want to have one arrow point to another arrowhead. How do I roughly make a node surrounding an arrowhead?

\documentclass{memoir}

\usepackage{pgfcore}
\usepackage{pgfplots}
\usetikzlibrary{arrows}

\begin{document}

\begin{tikzpicture}
  \path (0, 0) edge [-stealth'] (1, 0);
  \path (1, 1) edge [-stealth'] (0.94, 0.1);
\end{tikzpicture}
\end{document}

1 Answer 1

4

Ideally, one could place a node at the (1,0)-(.5\pgfarrowsleftextend,0), i.e. the end point of the arrow minus half of the total width of the stealth' arrow tip. But I don't know how to access the length stored in \pgfarrowleftextend, so the following solution involves some manual fiddling.

  • Use inner sep=<dim> to control the radius of the circle
  • Use ($(1,0)-(<dim>,0)$) to adjust the center of the circle

Code

\documentclass{memoir}

% \usepackage{pgfcore}
\usepackage{pgfplots}
\usetikzlibrary{arrows,calc}

\begin{document}

\begin{tikzpicture}
  \path (0, 0) edge [-stealth'] (1,0);
  \node(n)[draw,circle,inner sep=3pt]at($(1,0)-(2pt,0)$){};
  \path (1, 1) edge [-stealth'] (n);
\end{tikzpicture}
\end{document}

Output

enter image description here


Update

The above approach can be generalized to work with curves, where the node positioning option pos=<frac> works (e.g. the line-to and curve-to operations). The idea is similar: put a node at a position close to the end of the path, at a length approximately equal to half of the arrow tip's width. Unfortunately, some manual adjustment of the pos=<frac> is needed (<frac> here is usually a number slightly smaller than 1).

Code

\documentclass{memoir}
\usepackage{pgfplots}
\usetikzlibrary{arrows}

\begin{document}
\begin{tikzpicture}
  \draw[-stealth'](0,0)..controls(.5,1)..(1,0) node(n)[pos=.98,draw,circle,inner sep=3pt]{};
  \draw[-stealth'](1,1)--(n);
\end{tikzpicture}
\end{document}

Output

enter image description here

3
  • Nice, thank you! I wonder if there's a way to automate this if the arrow is not horizontal.
    – Neil G
    Dec 17, 2013 at 20:47
  • @NeilG: I've updated my answer. It still requires some manual adjustment, however.
    – Herr K.
    Dec 17, 2013 at 21:42
  • Nice, thanks!! That's exactly what I was looking for.
    – Neil G
    Dec 17, 2013 at 22:06

You must log in to answer this question.

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