# Making arrows not touch in TikZ

I'm trying to make a fairly simple diagram using TikZ, along the lines of the following examples:

\begin{tikzpicture}
\draw [->] (0,0) node[anchor=south]{A} -- (1,-2) node[anchor= north]{D};
\draw [->] (1,0) node[anchor=south]{B} -- (1,-2);
\draw [->] (2,0) node[anchor=south]{C} -- (1,-2);
\end{tikzpicture}


and

\begin{tikzpicture}
\draw [->] (1,0) node[anchor=south]{E} -- (0,-2) node[anchor= north]{F};
\draw [->] (1,0) -- (1,-2) node[anchor=north]{G};
\draw [->] (1,0) -- (2,-2) node[anchor=north]{H};
\end{tikzpicture}


What I don't like in the first picture is hopefully clear: I would much prefer that the arrows be spaced out above D, rather than all collapse to a single point.

The second picture doesn't bother me as much, since the clustering here is just of line segments and now arrows, but if there were a way to make the three edges spaced out as well, that would be quite nice. (See the top diagram in the chosen answer to this post for an illustration of something I would like.)

I can of course achieve all these results artificially, just by placing nodes separately, and then mucking about with the coordinates of the ends of the arrows. But it would be great if there were a simpler solution. Many thanks for any insight you may have.

-

I would use a \node to place D, and then draw the lines using the name of the node. This automatically solves the problem. Another option would be to use shorten=<dimension> to shorten the end of the arrows by the given dimension. You can also control the ending points of the arrows explicitly, as my third example suggests.

\documentclass{article}
\usepackage{tikz}

\begin{document}

\begin{tikzpicture}
\node[anchor=north] at (1,-2) (D) {D};
\draw [->] (0,0) node[anchor=south]{A} -- (D);
\draw [->] (1,0) node[anchor=south]{B} -- (D);
\draw [->] (2,0) node[anchor=south]{C} -- (D);
\end{tikzpicture}

\begin{tikzpicture}
\node[anchor=north] at (1,-2) (D) {D};
\draw [->,shorten >=3pt] (0,0) node[anchor=south]{A} -- (D);
\draw [->,shorten >=3pt] (1,0) node[anchor=south]{B} -- (D);
\draw [->,shorten >=3pt] (2,0) node[anchor=south]{C} -- (D);
\end{tikzpicture}

\begin{tikzpicture}
\node[anchor=north] at (1,-2) (D) {D};
\draw [->] (0,0) node[anchor=south]{A} -- (D.120);
\draw [->] (1,0) node[anchor=south]{B} -- (D.90);
\draw [->] (2,0) node[anchor=south]{C} -- (D.60);
\end{tikzpicture}

\end{document}


-
Superb. Thanks a lot! :) –  Skeptic Sep 23 '11 at 19:14
Any reason for having a space between anchor= and south? –  N.N. Sep 23 '11 at 19:22
@N.N. no. I just reused some of the OP's original code, where the space is already present. –  Gonzalo Medina Sep 23 '11 at 19:27
@N.N. I don't mind you editing my answer to suppress the spaces, but I'd prefer edits which are really necessary. –  Gonzalo Medina Sep 23 '11 at 19:35
@GonzaloMedina Sorry, I removed the spaces from your answer and the question because they confused me and I thought others might feel the same. –  N.N. Sep 23 '11 at 19:38

One possibility is to use the shorten >= parameter.

\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\begin{scope}[->,shorten >=9pt]
\draw (0,0) node[anchor= south]{A} -- (1,-2) node[anchor= north]{D};
\draw (1,0) node[anchor= south]{B} -- (1,-2);
\draw (2,0) node[anchor= south]{C} -- (1,-2);
\end{scope}
\begin{scope}[->,shorten <=9pt,xshift=3cm]
\draw (1,0) node[anchor= south]{E} -- (0,-2) node[anchor= north]{F};
\draw (1,0) -- (1,-2) node[anchor= north]{G};
\draw (1,0) -- (2,-2) node[anchor= north]{H};
\end{scope}
\end{tikzpicture}
\end{document}


-
Tip: If you're using scopes you may as well put the arrow tips in the scopes and remove them from \draw, e.g. \begin{scope}[->,shorten >=9pt]. –  N.N. Sep 23 '11 at 19:02
Many thanks, this is a useful trick to know. I'm going with Gonzalo's answer, since that applies more directly, but yours is a great tip. Thanks again. –  Skeptic Sep 23 '11 at 19:14
@N.N. You're right, of course. It crossed my mind, but for some reason I didn't change it ... I'll update the code. –  Torbjørn T. Sep 23 '11 at 19:14