Posts

Showing posts from January 29, 2019

Tikz picture using two “foreach” loops

Image
up vote 4 down vote favorite I am making a picture using foreach . MWE is appended below documentclass{article} usepackage[svgnames]{xcolor} usepackage{tikz} begin{document} begin{tikzpicture} foreach x in {0,...,5} draw [DodgerBlue](x,-1) circle (0.25); foreach x in {0,...,5} draw [-latex,red](x,-1) -- (x,-1.5); foreach x in {0,...,5} draw [-latex,DarkGreen](x,-1) -- (x,-0.5); draw [ultra thin] (5,-0.5) -- (0,-1); end{tikzpicture} end{document} The resulting picture is attached below Now what I want is that the green arrows on the top should be limited by the black line diagonal line. That is for the first circle there should be no green arrow, and its length should increase until it becomes equal to the red arrow in the last circle. How can this be done using foreach using the variable ...