2

I'd like to make a diagram representing a sum of arrows.

I'm not really familiar with tikz, so I was wondering if this was something doable. The first idea I had is something like this:

\documentclass{article}
\usepackage[utf8]{inputenc}
\begin{document}
\begin{tikzpicture}[]
\draw[->,thick] (0,0) -- (0:1cm) node[inner sep=0pt, outer sep=0pt] (a) {};
\draw[->,thick] (a.50) -- (50:1cm) node[inner sep=0pt, outer sep=0pt] (c) {};
\draw[->,thick] (c.90) -- (90:1cm) node[inner sep=0pt, outer sep=0pt] (d) {};
\draw[->,thick] (d.130) -- (130:1cm) node[inner sep=0pt, outer sep=0pt] (e) {};
\draw[->,thick] (e.160) -- (160:1cm) node[inner sep=0pt, outer sep=0pt] (f) {};
\end{tikzpicture}
\end{document}

I have two problems :

First, the arrows are not coming out with the (same) right length.

Second, I will eventually have to draw a large number of arrows with arbitrary angles. I was wondering if there was a way to write a loop that would automatically draw the arrows given a set of angles.

3
  • 3
    Welcome to TeX.SX. Unfortunately the link to the picture is not working ... Commented Apr 2, 2016 at 20:17
  • 2
    the link leads to HTTP403. best you upload the image here
    – naphaneal
    Commented Apr 2, 2016 at 20:18
  • Check out the various answers to my question of drawing a chain of links. You would just have to change the links to arrows for your purpose. tex.stackexchange.com/questions/292743/…
    – AJN
    Commented Apr 3, 2016 at 9:50

1 Answer 1

2

See, if this is what you looking for:

enter image description here

Pictures are drawn with the following code:

\documentclass[border=3mm,
               tikz,
               preview]{standalone}

\begin{document}
% improved original code
\begin{tikzpicture}[->,thick]
\draw   (0,0)   -- (0:1cm)      coordinate (a);
\draw   (a)     -- (50:1cm)     coordinate (c);
\draw   (c)     -- (90:1cm)     coordinate (d);
\draw   (d)     -- (130:1cm)    coordinate (e);
\draw   (e)     -- (160:1cm)    coordinate (f);
\end{tikzpicture}

% use of loop
\begin{tikzpicture}[red,->,thick]
    \coordinate (a0) at (0,0);
\foreach \angle [count=\i from 0, count=\j from 1] in {0, 50, 90, 130, 160}
\draw   (a\i)   -- (\angle:1cm)      coordinate (a\j);
\end{tikzpicture}
\end{document}

Above code differ from yours in:

  • Instead of nodes the coordinates are used. By this the gaps between ends of previous arrow and star arrow disappear, code is far shorter, the anchors of nodes, where to start new arrow is surplus (coordinate has only one anchor: itself)

  • In solutions with a loop has in curly braces in the loop macro collected angles of coordinates, which lie on a circle with radius 1cm, where arrows ends. Added counters serves for indicating names of previous and new coordinates name.

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