# Tikz: Applying arrows to all drawn lines

I have to draw a lot of separate lines, and don't want to put \draw[->] in front of every single one of them. I have done this before so I'm not sure why it's not working. It always just puts the arrow on the last line.

Some shortened and simplified code (still the same problem though):

\documentclass[11pt]{article}
\usepackage{fp}
\usepackage{tikz}
\usetikzlibrary{arrows,calc}

\begin{document}

\newcommand{\inputNode}[3]{\node[shape=rectangle,draw=black,fill=green!25,thin,inner sep=0,minimum size=8mm,label=above:$#3$](In#2)at(#1){In$_#2$};}
\newcommand{\junctionNode}[5]
{
\node[shape=rectangle,draw=black,fill=blue!10,thin,inner sep=0,minimum height=1cm,minimum width=#3cm](Box#2)at(#1){$#5$};
\FPeval\inputs {clip(#3-1)}
\foreach \int in {0,1,...,\inputs}
{   \path let
\p1=(Box#2.north west), \p2=(Box#2.north east), \n1={(\x2-\x1-20)/\inputs}
in
node(Box#2-in\int) at (\x1+10+\n1*\int,\y1){}
;}}
\begin{tikzpicture}
\inputNode{1,8}{1}{Input1}
\inputNode{3.5,8}{2}{Input2}
\inputNode{6,8}{3}{Input3}
\inputNode{8.5,8}{4}{Input4}
\junctionNode{3,4}{1}{4}{2}{Junction1}

\draw [->,>=stealth]
(In1) to [out=270,in=90] (Box1-in0.center)
(In2) to [out=270,in=90] (Box1-in1.center)
(In3) to [out=270,in=90] (Box1-in2.center)
(In4) to [out=270,in=90] (Box1-in3.center);
\end{tikzpicture}
\end{document}


The edge operation instead of the to operator solves the issue:

\documentclass[11pt]{article}
\usepackage{fp}
\usepackage{tikz}
\usetikzlibrary{arrows,calc}

\begin{document}

\newcommand{\inputNode}[3]{%
\node[
shape=rectangle,
draw=black,
fill=green!25,
thin,
inner sep=0,
minimum size=8mm,
label=above:{#3},
] (In#2) at (#1) {In$_#2$};%
}
\newcommand{\junctionNode}[5]{
\node[
shape=rectangle,
draw=black,
fill=blue!10,
thin,
inner sep=0,
minimum height=1cm,
minimum width=#3cm,
] (Box#2) at (#1) {#5};%
\FPeval\inputs {clip(#3-1)}
\foreach \int in {0,1,...,\inputs} {
\path let
\p1=(Box#2.north west),
\p2=(Box#2.north east),
\n1={(\x2-\x1-20)/\inputs}
in
node(Box#2-in\int) at (\x1+10+\n1*\int,\y1){}
;%
}%
}
% Spacer %
\begin{tikzpicture}
\inputNode{1,8}{1}{Input1}
\inputNode{3.5,8}{2}{Input2}
\inputNode{6,8}{3}{Input3}
\inputNode{8.5,8}{4}{Input4}
\junctionNode{3,4}{1}{4}{2}{Junction1}

\path [->,>=stealth]
(In1) edge [out=270,in=90] (Box1-in0.center)
(In2) edge [out=270,in=90] (Box1-in1.center)
(In3) edge [out=270,in=90] (Box1-in2.center)
(In4) edge [out=270,in=90] (Box1-in3.center);
\end{tikzpicture}
\end{document}


Also I have moved the text out of math mode. A word like "Input" is not set as word in math mode, but it is set as product of the variables I, n, p, u, and t. If the font should be italics, then \textit{...} or $\mathit{...}$ can be used. In combination with digits, \textit{Input1} also uses the italics font for digits.

• Thank you very much, I'll do some research on what 'Edge' actually does, but It works, and that is what matters right now. But I also have another line that I didn't show, and it does not apply to this method that you showed me. Here: '(In4.east |- 0,2.2) -- ++(7.65,0);' Still doesn't have an arrow. – Areuz Sep 26 '15 at 22:17
• @Areuz edge can also be used with your other line, it replaces --. – Heiko Oberdiek Sep 26 '15 at 22:36
• Just one last thing, I'm going to leave you be after this one, thank you so much for the help though! I noticed that node and edge acts weird when put together: (In3.south) edge ++(0,-3.5) node[midway,above,sloped] – Areuz Sep 26 '15 at 22:59
• @Areuz (In3.south) edge node[midway,above,sloped] {foo} ++(0, -3.5) – Heiko Oberdiek Sep 26 '15 at 23:08
• Why not simply \foreach \Value [count=\xi from 0] in {1,...,4} \draw [->,>=stealth] (In\Value) edge [out=270,in=90] (Box1-in\xi.center); ? – Gonzalo Medina Sep 27 '15 at 2:13