0

Please see MWE. No idea why its not working, error says

'Sorry, your compile took too long to run and timed out. This may be due to a large number of high-res images, or complicated diagrams.'

However its not a very big flow diagram so any advice/explanation why this happens.

Thanks

Sam

\documentclass{article} \usepackage[utf8]{inputenc} \usepackage{tikz} \usetikzlibrary{shapes.geometric, arrows} \begin{document} \begin{center} \begin{tikzpicture}[node distance=2cm] \node (start) [startstop] {Start}; \node (in1) [io, right of=start, xshift=4cm] {Input}; \node (dec1) [decision, below of=start] {Is $t< \epsilon$}; \node (pro1) [process, below of=dec1] {Predict Price Data}; \node (pro2) [process, below of=pro1] {Solve Optimisation Problem}; \node (out1) [io, below of=pro2] {Output $A_i$}; \node (out2) [io, right of =out1] {Output `ERROR'}; \node (dec2) [decision, right of =dec1, xshift=4cm] {Is $t= \epsilon$}; \node (stop) [startstop, below of=out1] {Stop}; \draw [arrow] (start) -- (dec1); \draw [arrow] (in1) -- (dec1); \draw [arrow] (dec1) -- node[anchor=east] {No} (dec2); \draw [arrow] (dec1) -- node[anchor=south] {Yes} (pro1); \draw [arrow] (dec2) -- node[anchor=east] {No} (out2); \draw [arrow] (dec2) -- node[anchor=south] {Yes} (stop); \draw [arrow] (pro1) -- (pro2) \draw [arrow] (pro2) -- (out1) \draw [arrow] (out1) -- (dec1) \end{tikzpicture} \end{center} \end{document} 
2
  • 2
    please, add to mwe definitions for your node styles ... as it is, it is not compilable :-( Commented Jun 22, 2018 at 19:32
  • 5
    You forgot some ; at the end of the \draws Commented Jun 22, 2018 at 19:32

2 Answers 2

1

Apart from the things mentioned by @Zarko and @CarLateX you may benefit from loading the positioning library and placing the Yes/No nodes differently, and from disclosing the source of your styles.

\documentclass{article} \usepackage[utf8]{inputenc} \usepackage{tikz} \usetikzlibrary{shapes.geometric, arrows,positioning} \begin{document} \tikzset{startstop/.style={rectangle, text width=3cm, minimum height=1cm,text centered, draw=black, fill=red!30}, io/.style={trapezium, trapezium left angle=70, trapezium right angle=110, text width=3cm, minimum height=1cm, text centered, draw=black, fill=blue!30}, process/.style={rectangle, text width=3cm, minimum height=1cm, text centered, draw=black, fill=orange!30}, decision/.style={diamond, text width=3cm, minimum height=1cm, text centered, draw=black, fill=green!30}, arrow/.style={thick,-stealth}} \begin{center} \begin{tikzpicture}[node distance=2cm] \node (start) [startstop] {Start}; \node (in1) [io, right=3cm of start] {Input}; \node (dec1) [decision, below=of start] {Is $t< \epsilon$}; \node (pro1) [process, below=of dec1] {Predict Price Data}; \node (pro2) [process, below=of pro1] {Solve Optimisation Problem}; \node (out1) [io, below=of pro2] {Output $A_i$}; \node (out2) [io, right=of out1] {Output `ERROR'}; \node (dec2) [decision, right of =dec1, xshift=4cm] {Is $t= \epsilon$}; \node (stop) [startstop, below right=2cm and 2cm of out1] {Stop}; \draw [arrow] (start) -- (dec1); \draw [arrow] (in1) -- (dec1); \draw [arrow] (dec1) --(dec2) node[midway,above] {No} ; \draw [arrow] (dec1) -- (pro1) node[midway,left] {Yes}; \draw [arrow] (dec2) -- (out2) node[midway,right] {No}; \draw [arrow] (dec2) -- (stop) node[midway,left] {Yes}; \draw [arrow] (pro1) -- (pro2); \draw [arrow] (pro2) -- (out1); \draw [arrow] (out1.west) -- ++(-1cm,0) |- (dec1); \end{tikzpicture} \end{center} 

enter image description here

1

mostly off-topic (problem is solved by comment and marmot answer) ... since i never see such a flow chart, let me propose, how i would draw it:

enter image description here

(code is based on my answers on similar questions)

\documentclass{article} \usepackage[utf8]{inputenc} \usepackage{tikz} \usetikzlibrary{arrows.meta, chains, positioning, quotes, shapes.geometric} \tikzset{FlowChart/.style={ base/.style = {draw, minimum height=1cm, minimum width=3cm, text width =\pgfkeysvalueof{/pgf/minimum width}-2*\pgfkeysvalueof{/pgf/inner xsep}, align=center, outer sep=0pt, on chain, join=by arrow}, startstop/.style = {base, fill=red!30}, process/.style = {base, rounded corners, fill=orange!30}, decision/.style = {diamond, aspect=1.3, draw, minimum height=1cm, minimum width=2cm, align=center, on chain, join=by arrow, fill=green!30}, io/.style = {base, trapezium, trapezium stretches body, trapezium left angle=70, trapezium right angle=110, fill=blue!30}, arrow/.style = {semithick, -Triangle} } } \makeatletter \tikzset{suspend join/.code={\def\tikz@after@path{}}} \makeatother \usepackage[active,tightpage]{preview} \PreviewEnvironment{tikzpicture} \setlength\PreviewBorder{1em} \begin{document} \begin{center} \begin{tikzpicture}[FlowChart, node distance = 5mm and 12mm, start chain = going below ] \node (start) [startstop] {Start}; \node (in1) [io] {Input}; \node (dec1) [decision] {Is\\ $t< \epsilon$}; \node (pro1) [process] {Predict Price Data}; \node (pro2) [process] {Solve Optimisation Problem}; \node (out1) [io] {Output $A_i$}; \node (dec2) [decision, suspend join, right=of dec1 -| start.east] {Is\\ $t= \epsilon$}; \node (out2) [io, below=of pro2.south -| dec2] {Output `ERROR'}; \node (stop) [startstop, suspend join, right=of out2] {Stop}; \path (dec1) to ["No"] (pro1); \path (dec2) to ["No"] (out2); \draw [arrow] (dec1) to ["Yes"] (dec2); \draw [arrow] (dec2) to ["Yes"] (dec2 -| stop) -- (stop); % \draw [arrow] (out1.west) -- ++ (-1,0) |- (dec1); % it is illogical ... \end{tikzpicture} \end{center} \end{document} 

compilation report: Errors: 0 Warnings: 0 Bad Boxes: 0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.