3

I need to connect (dec1) to (pro6) nicely. When I compile the code, I get this error "Package PGF Math Error: You asked me to calculate `1/0.0', but I cannot divide any number by zero. \path [line] (dec1) -| (pro6)"

Can anyone help to solve this problem. Thanks.

\documentclass[journal]{IEEEtran}
\IEEEoverridecommandlockouts                             
\newcounter{ct}
\usepackage{multirow}
\usepackage{epstopdf}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric, arrows}  
\usepackage{pgfplots}
\pgfplotsset{compat=1.12}
\usepackage{fp}

\begin{document}
\tikzstyle{startstop} = [rectangle, rounded corners, minimum width=3cm,   minimum height=1cm,text centered, draw=black, fill=red!30]
\tikzstyle{io} = [trapezium, trapezium left angle=70, trapezium right angle=110, text width=4cm, minimum height=1cm, text centered, draw=black, fill=blue!10]
\tikzstyle{process} = [rectangle, minimum width=3cm, minimum height=1cm,text width=6cm, text centered, draw=black, fill=blue!10]
\tikzstyle{decision} = [diamond, minimum width=2cm, minimum height=1.5cm,text width=3cm, text centered, draw=black, fill=blue!10,aspect=3]
\tikzstyle{arrow} = [thick,->,>=stealth]
\tikzstyle{line} = [draw, -latex']

\begin{center}

%\begin{frame}
\begin{tikzpicture}[node distance=1.5cm]

\node (in1) [io] {Load historical data available};
\node (pro1) [process, below of=in1] {Calculate };
\draw [arrow] (in1) -- (pro1);
\node (pro2) [process, below of=pro1] {Plug };
\draw [arrow] (pro1) -- (pro2);
\node (pro3) [process, below of=pro2] {Set   };
\draw [arrow] (pro2) -- (pro3);
\node (pro4) [process, below of=pro3] {Apply  };
\draw [arrow] (pro3) -- (pro4);
\node (pro5) [process, below of=pro4] {If  };
\draw [arrow] (pro4) -- (pro5);
\node (pro6) [process, below of=pro5] {Calculate };
\draw [arrow] (pro5) -- (pro6);
\node (pro7) [process, below of=pro6,yshift=-1em] {Plug  };
\draw [arrow] (pro6) -- (pro7);
\node (pro8) [process, below of=pro7,yshift=-1em] {gg};
\draw [arrow] (pro7) -- (pro8);
\node (dec1) [decision, below of=pro8,yshift=-1.1cm] {};
\draw [arrow] (pro8) -- (dec1);
\node (out1) [io, below of=dec1,yshift=-2em] {Release};
\draw [arrow] (dec1) -- node[anchor=east] {yes} (out1);
%\draw [-latex]  (dec1) -| (pro6) ;
%\path (dec1)   --++  (-3,0) node [near start] {no} |- (pro6);
\path [line] (dec1) -|  (pro6);
\end{tikzpicture}
%\end{frame}
\end{center}



\end{document}
1

The problem is that you are telling TikZ to draw a line from one node to the other by starting straight and making a 90° turn in between. This makes no mathematical sense and the error is quite clear about that. It seems as if you have forced PGF to divide some variable by 0. I have proposed some solution for your approach below. I hope, I understood you correctly.

% arara: pdflatex

\documentclass{IEEEtran}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric, arrows} 
\tikzset{%
    ,io/.style={%
        ,trapezium
        ,trapezium left angle=70,trapezium right angle=110
        ,text width=4cm
        ,minimum height=1cm
        ,text centered
        ,draw
        ,fill=blue!10
        }
    ,process/.style={%
        ,rectangle
        ,minimum width=3cm,minimum height=1cm
        ,text width=6cm
        ,text centered
        ,draw
        ,fill=blue!10
        }
    ,decision/.style={%
        ,diamond
        ,minimum width=2cm,minimum height=1.5cm
        ,text width=3cm
        ,text centered
        ,draw
        ,fill=blue!10
        ,aspect=3
        }
    ,arrow/.style={%
        ,thick
        ,->
        ,>=stealth
        }
    ,line/.style={%
        ,draw
        ,-latex'
        }
    }

\begin{document}
    \begin{tikzpicture}[node distance=1.5cm]        
        \node (in1) [io] {Load historical data available};
        \node (pro1) [process, below of=in1] {Calculate };
        \draw [arrow] (in1) -- (pro1);
        \node (pro2) [process, below of=pro1] {Plug };
        \draw [arrow] (pro1) -- (pro2);
        \node (pro3) [process, below of=pro2] {Set   };
        \draw [arrow] (pro2) -- (pro3);
        \node (pro4) [process, below of=pro3] {Apply  };
        \draw [arrow] (pro3) -- (pro4);
        \node (pro5) [process, below of=pro4] {If  };
        \draw [arrow] (pro4) -- (pro5);
        \node (pro6) [process, below of=pro5] {Calculate };
        \draw [arrow] (pro5) -- (pro6);
        \node (pro7) [process, below of=pro6,yshift=-1em] {Plug  };
        \draw [arrow] (pro6) -- (pro7);
        \node (pro8) [process, below of=pro7,yshift=-1em] {gg};
        \draw [arrow] (pro7) -- (pro8);
        \node (dec1) [decision, below of=pro8,yshift=-1.1cm] {};
        \draw [arrow] (pro8) -- (dec1);
        \node (out1) [io, below of=dec1,yshift=-2em] {Release};
        \draw [arrow] (dec1) -- node[anchor=east] {yes} (out1);
        \path [line] (dec1) -- ++(-4,0) |- (pro6);
    \end{tikzpicture}
\end{document}
0

The problem is that the centers of (dec1) and (pro6) are vertically aligned, so \path [line] (dec1) -| (pro6) does not make sense. By specifying that the arrow should end in the right part of (pro6) the line can take a 90 degree turn, as in

\draw [line] (dec1) -| (pro6.east);

But this is not what you want either since it approaches the box from straight below. So aiming first at a point 2cm to the right of it gives

\draw [line] (dec1) -| ($(pro6.east)+(2cm,0)$) -- (pro6);

which I think is more what you are looking for. To use the calculation you must also add the tikzlibrary calc.

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.