I would like to apply yshift
effect to nodes defined with foreach loop. In below example,the output line not shift as expected:
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows,positioning,decorations.pathreplacing}
\begin{document}
\begin{tikzpicture}[
box/.style={circle,draw,inner sep=1}
]
\def\arr{
A/0,
B/22mm,
C/16mm
}
\def\dy{4mm}
\foreach \name/\offset [count=\i from 0,evaluate=\i as \j using {int(\i-1)}] in \arr {
\ifnum\i=0
\node[box] (P\i) {\name};
\else
\node[box,right=\offset of P\j] (P\i) {\name};
\fi
}
\draw[-angle 90] ([yshift=\dy]P0) -- ([yshift=\dy]P2) node[pos=.5,sloped,above] {direction};
\end{tikzpicture}
\end{document}