3

I'm trying to draw two arrows that should indicate that a neural network cycles between two states. Following the tutorial for the Petri net, I used pgfonlayer, fit and a scope to align two networks side by side. I cannot, however, get the arrow to appear, for some reason. Here is the code

\begin{tikzpicture}[auto]
\node[excited] (middle)                  {-2.5};
\node[inhibited]   (west)  [left=of middle]   {0.5}
    edge node {-1} (middle);
\node[inhibited]   (east)  [right=of middle]  {0.5}
    edge node {-1} (middle);
\node[excited] (north) [above=of middle]  {0.5}
    edge node       {1}  (east)
    edge node[swap] {1}  (west)
    edge node       {-1} (middle);
\node[excited]   (south) [below=of middle]  {0.5}
    edge node        {-1} (middle)
    edge node        {1}  (west)
    edge node [swap] {1}  (east);
\begin{scope}[xshift=6cm]
\node[excited] (middle1)                  {-2.5};
\node[excited]   (west1)  [left=of middle1]   {0.5}
    edge node {-1} (middle1);
\node[excited]   (east1)  [right=of middle1]  {0.5}
    edge node {-1} (middle1);
\node[inhibited] (north1) [above=of middle1]  {0.5}
    edge node       {1}  (east1)
    edge node[swap] {1}  (west1)
    edge node       {-1} (middle1);
\node[inhibited]   (south1) [below=of middle1]  {0.5}
    edge node        {-1} (middle1)
    edge node        {1}  (west1)
    edge node [swap] {1}  (east1);
\end{scope}
\begin{pgfonlayer}{background}
    \node (n1) [fit=(west) (middle) (east) (south) (north)] {};
    \node (n2) [fit=(west1) (middle1) (east1) (south1) (north1)] {};
    \draw [shorten >=5mm,shorten <=5mm,bend left=45,<-]
        (north) to (north1);
    \draw [shorten >=5mm,shorten <=5mm,bend right=45,->]
        (south) to (south1);
\end{pgfonlayer}
\end{tikzpicture}

And the result, regardless of me having <- and -> in the \draw command. result

Does anyone have an idea why this is happening?

Thanks for the help.

  • 3
    It would be better a you created a complete, compilable example, including the necessary libraries and style definitions. I get the arrow tips with a recently updated TeX Live 2013. – Torbjørn T. Mar 30 '14 at 17:24
  • (Bloody typo. That should of course be '... if you created ...'. ) – Torbjørn T. Mar 30 '14 at 17:34
  • If the linked question is offtopic... This is offtopic too. Also according to the evince bug here: bugzilla.gnome.org/show_bug.cgi?id=787927 the bug is possibly fixed with poppler 0.52. – koleygr Sep 20 '17 at 13:00
4

Would this be what you seek? You code is incompleted where this solution added some in order to get the output you posted.

enter image description here

Code

\documentclass[border=10pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{positioning,intersections,calc,fit}

\tikzset{
 excited/.style={circle,thick,draw=black,fill=blue!50,minimum size=6mm},
 inhibited/.style={circle,thick,draw,fill=none,minimum size=6mm},
 every fit/.append style=text badly centered   % to get rid of underfull bad box
 }

\begin{document}

\pgfdeclarelayer{background}
\pgfdeclarelayer{foreground}
\pgfsetlayers{background,main,foreground}

\begin{tikzpicture}[auto]
\node[excited] (middle)                  {-2.5};
\node[inhibited]   (west)  [left=of middle]   {0.5}
    edge node {-1} (middle);
\node[inhibited]   (east)  [right=of middle]  {0.5}
    edge node {-1} (middle);
\node[excited] (north) [above=of middle]  {0.5}
    edge node       {1}  (east)
    edge node[swap] {1}  (west)
    edge node       {-1} (middle);
\node[excited]   (south) [below=of middle]  {0.5}
    edge node        {-1} (middle)
    edge node        {1}  (west)
    edge node [swap] {1}  (east);
\begin{scope}[xshift=6cm]
\node[excited] (middle1)                  {-2.5};
\node[excited]   (west1)  [left=of middle1]   {0.5}
    edge node {-1} (middle1);
\node[excited]   (east1)  [right=of middle1]  {0.5}
    edge node {-1} (middle1);
\node[inhibited] (north1) [above=of middle1]  {0.5}
    edge node       {1}  (east1)
    edge node[swap] {1}  (west1)
    edge node       {-1} (middle1);
\node[inhibited]   (south1) [below=of middle1]  {0.5}
    edge node        {-1} (middle1)
    edge node        {1}  (west1)
    edge node [swap] {1}  (east1);
\end{scope}
\begin{pgfonlayer}{background}
    \node (n1) [fit=(west) (middle) (east) (south) (north)] {};
    \node (n2) [fit=(west1) (middle1) (east1) (south1) (north1)] {};
    \draw [shorten >=5mm,shorten <=5mm,bend left=45,<-]
        (north) to (north1);
    \draw [shorten >=5mm,shorten <=5mm,bend right=45,->]
        (south) to (south1);
\end{pgfonlayer}
\end{tikzpicture}

\end{document}
  • Thank you very much for your answer and sorry for the late reply. It seems there was never a problem to begin with -- I noticed that when my final PDF document was viewed in chrome, the arrowheads appeared. Upon closer inspection, zooming into ca. 250% in evince showed them as well. I am not sure why this happens in evince. – identity Apr 3 '14 at 19:07
1

I decided to put this as an answer seeing as someone else might run into the same if they are using the same PDF viewer(evince) as I was.

I noticed that when my PDF was viewed in chrome, the arrowheads appeared. In evince at 100% zoom, there were none. If I zoomed in to roughly 250%, they would appear. I am not sure why this happens, but if anyone else runs into this problem, well; it isn't really a problem.

  • I've also run into this problem. See this bug report. – Roly Feb 24 '15 at 13:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.