As you can see in the pic the lines from the top balls do not start as expected from the south, but from the east. Below the arrows from the XOR perfectly fit to my expectation. What do I have to change?
Thanks in advance
\documentclass[border=5pt]{standalone}
\usepackage{tikz}
\usepackage{amsmath}
\usetikzlibrary{shapes}
\usetikzlibrary{decorations.pathreplacing}
\usetikzlibrary{shadows}
\begin{document}
\begin{tikzpicture}[%
bit/.style={circle,shading=ball,minimum width=1cm,ball color=white,path fading=fade inside},
bit2/.style={circle,shading=ball,minimum width=1cm,ball color=blue,path fading=fade inside},
]
\tikzfading[name=fade inside,inner color=transparent!80,outer color=transparent!30]
\foreach \n in {0,...,4,20,21,22,23,24}{%
% x
\pgfmathparse{mod(\n,5)}
\edef\myx{\pgfmathresult}
% y
\pgfmathparse{int(\n/5)}
\pgfmathparse{int(5-\pgfmathresult)}
\edef\myy{\pgfmathresult}
\node [bit] (\n) at (\myx,\myy) {};
}
\foreach \n in {20,21,22,23,24}{%
\pgfmathparse{\n-20}
\edef\myk{\pgfmathresult}
\node [above of=\n, inner sep=0] (plus\n) {$\bigoplus$};
\draw [-stealth] (plus\n) -- (\n);
\draw [-stealth] (\myk) -- (plus\n);
}
\end{tikzpicture}
\end{document}
\pgfmathparse
creates a float, so you get e.g.1.0
, and the.0
is seen as an anchor. Use\pgfmathtruncatemacro{\myk}{\n-20}
, or\pgfmathparse{int(\n-20)}
, which gives you an integer.\pgfmathparse{\n-20}\edef\myk{\pgfmathresult}
to\pgfmathtruncatemacro{\myk}{\n-20}
, it works as expected. And the anchor is never reported in an error like that, if you use\draw (sdiof.north);
the error says "no shape sdiof known".