3

I created a flow chart with boxes all lined up vertically. Now I want to draw an arrow from the last box to the first box. How can I do this, so that the arrow leaves the last box horizontally on the west side and arrives at the first box horizontally on the west side?

right now I get only errors or an arrow leaving horizontally but arriving vertically...

1
  • Please help us to help you and add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. Apr 8 '14 at 13:14
7

The way i use to solve problems like this is by adding an additional control point to guide the line on. The following code shows how to do this by your given vertical example:

\documentclass{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\node (n1) at (0,0) [draw]  {Node 1};
\node (n2) [draw, below of=n1] {Node 2};
\node (n3) [draw, below of=n2] {Node 3};

% Connectors
\draw [->] (n1) -- (n2);
\draw [->] (n2) -- (n3);
\draw [->] (n3.west) -| ++(-0.5,0) |- (n1.west);

\end{tikzpicture}
\end{document}

The value ++(-0.5,0) sets the relative control point coordinates the backarrow has to go through. Edit them to your needs or add some more.

The code results in:

result of example code

Hope this helps.

1
  • perfect, this was what I was looking for. thanks! Apr 8 '14 at 13:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.