[Tex/LaTex] How to use the node distance to offset the start and/or end of an arrow with TikZ

nodestikz-arrowstikz-pgf

I want to draw an arrow where one of the end points is not actually attached to another node, and I want the length of the arrow to take into account the node distance of the node to which the arrow is attached. So I would like to be able to write something like

\draw [->] ([left of] the-node) -- (the-node);

See the MWE below:

\documentclass{standalone}

\usepackage{tikz}
\usetikzlibrary{positioning}

\begin{document}
\begin{tikzpicture}[
    node/.style={
      node distance=5mm,
    },
  ]
  \node [node] (n) {n};

  % This is what I would like to write (or something like it)
  %\draw [->] ([left of] n) -- (n);

  % Here are my options so far, none of which I like

  % 1:
  \draw [->] ([yshift=5mm] n.north) -- (n);
  % CON: requires explicit use of the node distance

  % 2:
  \coordinate (coord1) at ([xshift=5mm] n.east);
  \draw [->] (coord1) -- (n);
  % CON: requires explicit use of the node distance AND an extra coordinate

  % 3:
  \coordinate [below=of n] (coord2);
  \draw [->] (coord2) -- (n);
  % CON: requires an extra coordinate, and it doesn't seem to use the node
  % distance of 'n' anyway
\end{tikzpicture}
\end{document}

Here's the result of the MWE:

enter image description here

Any ideas of how I could achieve this?

Best Answer

You can use relative coordinates on the left side. (On the right side you have to use calc.)

\documentclass{standalone}
\usepackage{tikz}

\begin{document}
\begin{tikzpicture}
  \node (n) {n};
  \draw [->] (n.north)+(0,5mm) -- (n);
  \draw [->] (n.east)+(5mm,0) -- (n);
  \draw [->] (n.south)+(0,-5mm) -- (n);
\end{tikzpicture}
\end{document}

An even simpler solution:

\documentclass{standalone}
\usepackage{tikz}

\begin{document}
\begin{tikzpicture}
  \node (n) {n};
  \draw [<-] (n.north) -- +(0,5mm);
  \draw [<-] (n.east) -- +(5mm,0);
  \draw [<-] (n.south) -- +(0,-5mm);
\end{tikzpicture}
\end{document}