# Problem with drawing thick line

With the solution posted here, I only changed a little (at line 17, I added [thick, ->] after \draw):

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

\begin{document}

\begin{tikzpicture}
[   cnode/.style={draw=black,fill=#1,minimum width=3mm,circle},
]
\node[cnode=red,label=0:$\Sigma$] (s) at (6,-3) {};
\node at (0,-4) {$\vdots$};
\node at (3,-4) {$\vdots$};
\foreach \x in {1,...,4}
{   \pgfmathparse{\x<4 ? \x : "n"}
\node[cnode=blue,label=180:$x_{\pgfmathresult}$] (x-\x) at (0,{-\x-div(\x,4)}) {};
\node[cnode=gray,label=90:$\varphi_{\pgfmathresult}$] (p-\x) at (3,{-\x-div(\x,4)}) {};

%%%%%%%%Changed this line
\draw[thick, ->] (p-\x) -- node[above,sloped,pos=0.3] {$\omega_{\pgfmathresult}$} (s);
}
\foreach \x in {1,...,4}
{   \foreach \y in {1,...,4}
{   \draw (x-\x) -- (p-\y);
}
}
\end{tikzpicture}

\end{document}


Here is the output:

Note that the texts with \omega have been changed to 0.8. Why is this happening and how to fix that?

-
If you add the thick option at the end of the path, i.e. \draw[->] … node {\pgfmathresult} … [thick];, the \pgfmathresult macro won’t get overwritten. But it is better to have a dedicated macro anyway. Here you can also use \foreach \x[evaluate={\mytemp=\x<4?int(\x):"n"}] in {1,...,4}. By the way, you can also use \pgfmathprint{\x<4?int(\x):"n"} directly in the node (but that evaluates \x<4 three times, of course). –  Qrrbrbirlbel Oct 26 '13 at 18:25
@Qrrbrbirlbel \pgfmathprint{\x<4?int(\x):"n"} worked fine. But can you give a MWE for \foreach \x[evaluate={\mytemp=\x<4?int(\x):"n"}] ? –  pushpen.paul Oct 26 '13 at 20:21

Think of \pgfmathresult as the \temp macro that everytime a math operation is done it gets overwritten. thick makes the line width 0.8pt and it is used somewhere in the bowels as a math operation. So, \pgfmathresult gets overwritten. Instead if you make it a fixed macro to hold the value it works as expected

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

\begin{document}

\begin{tikzpicture}
[   cnode/.style={draw=black,fill=#1,minimum width=3mm,circle},
]
\node[cnode=red,label=0:$\Sigma$] (s) at (6,-3) {};
\node at (0,-4) {$\vdots$};
\node at (3,-4) {$\vdots$};
\foreach \x in {1,...,4}
{   \pgfmathsetmacro\mytemp{\x<4 ? int(\x) : "n"}
\node[cnode=blue,label=180:$x_{\mytemp}$] (x-\x) at (0,{-\x-div(\x,4)}) {};
\node[cnode=gray,label=90:$\varphi_{\mytemp}$] (p-\x) at (3,{-\x-div(\x,4)}) {};
\draw[thick, ->] (p-\x) -- node[above,sloped,pos=0.3] {$\omega_{\mytemp}$} (s);
}
\foreach \x in {1,...,4}
{   \foreach \y in {1,...,4}
{   \draw (x-\x) -- (p-\y);
}
}
\end{tikzpicture}

\end{document}

-
But, now I'm getting error: Missing number, treated as zero }. After searching, I found this! –  pushpen.paul Oct 26 '13 at 18:50
@pushpen.paul Ah yes this is fixed in the CVS version. Sorry I forgot that I'm using the beta version of the new release –  percusse Oct 26 '13 at 18:54
@pushpen.paul I usually just define \newcommand*\pgfMathsetmacro[2]{\pgfmathparse{#2}\let#1\pgfmathresult} that works like \pgfmathsetmacro but can work with every output in \pgfmathresult. –  Qrrbrbirlbel Oct 26 '13 at 20:25