\documentclass[x11names]{article} \usepackage{tikz} \usetikzlibrary{shapes,arrows,chains} \begin{document} % ------------------------------------------------- % Color definition \definecolor{myblue}{HTML}{008DCB} \definecolor{myred}{HTML}{E1315B} \definecolor{myyellow}{HTML}{FFEC5C} \definecolor{mygreen}{HTML}{3F681C} \definecolor{myblue}{HTML}{375E97} \definecolor{myred}{HTML}{FB6542} \definecolor{myyellow}{HTML}{FFBB00} \definecolor{mygreen}{HTML}{3F681C} \colorlet{lcfree}{Green3} \colorlet{lcnorm}{black} \colorlet{lccong}{Red3} % ------------------------------------------------- % Debugging Layer % top \pgfdeclarelayer{marx} \pgfsetlayers{main,marx} % A macro for marking coordinates (specific to the coordinate naming % scheme used here). Swap the following 2 definitions to deactivate % marks. \providecommand{\cmark}[2][]{\relax} \providecommand{\cmark}[2][]{% \begin{pgfonlayer}{marx} \node [nmark] at (c#2#1) {#2}; \end{pgfonlayer}{marx} } % ------------------------------------------------- % Start the picture \begin{tikzpicture}[% >=triangle 60, % Nice arrows; your taste may be different start chain=going below, % General flow is top-to-bottom node distance=6mm and 60mm, % Global setup of box spacing every join/.style={norm}, % Default linetype for connecting boxes ] % ------------------------------------------------- % Box styles \tikzset{ % base/.style={draw, on chain, on grid, align=center, minimum height=4ex, font=\sffamily, draw=none}, % proc/.style={base, rectangle, text width=10em, fill=myblue}, % test/.style={base, diamond, aspect=3, text width=5em, fill=myyellow}, % startstop/.style={proc, minimum height=6ex, fill=myred}, base/.style={draw, on chain, on grid, align=center, minimum height=4ex, font=\sffamily}, proc/.style={base, rectangle, text width=10em}, test/.style={base, diamond, aspect=3, text width=5em}, startstop/.style={proc, minimum height=6ex}, % Debug styles coord/.style={coordinate, on chain, on grid, node distance=6mm and 25mm}, nmark/.style={draw, cyan, circle, font={\sffamily}}, % Line styles norm/.style={->, draw, lcnorm}, slabel/.style={near start, xshift=1em, font=\sffamily}, welabel/.style={near start, yshift=0.5em, font=\sffamily}, } % ------------------------------------------------- % Nodes \node [startstop] (p0) {Start of Processing}; \node [test, join] (t0) {Terminate?}; %\node [proc] (p1) {Calculate mean free path length}; \node [proc, join] (p1) {Move by MFP\\ $\rightarrow$ Update densities \\ $\rightarrow$ Log to file }; \node [test, join] (t1) {Wallhit?}; \node [proc] (p2) {Do Interaction \\ $\rightarrow$ Update densities \\ $\rightarrow$ Update queue }; \node [test, join] (t2) {Annhilation?}; \node [startstop] (p3) {End}; % ------------------------------------------------- % Coordinate markers \node [coord, right=of t0] (c0) {}; \cmark{0} \node [coord, right=of t1] (c1) {}; \cmark{1} \node [coord, left=of t2] (c2) {}; \cmark{2} % ------------------------------------------------- % Annotations %\node [above=0mm of p4, it] {(Queue was empty)}; %\node [above=0mm of p8, it] {(Queue was not empty)}; % ------------------------------------------------- % North south connectors \path (t0.south) to node [slabel] {no} (p1); \draw [->,lcnorm] (t0.south) -- (p1); \path (t1.south) to node [slabel] {no} (p2); \draw [->,lcnorm] (t1.south) -- (p2); \path (t2.south) to node [slabel] {yes} (p3); \draw [->,lcnorm] (t2.south) -- (p3); % ------------------------------------------------- % Complicated connectors \path (t0.east) -| node [welabel] {yes} (c1); \draw [->,lcnorm] (t0.east) -| (c1); \path (t1.east) to node [welabel] {yes} (c1); \draw [->, lcnorm] (t1.east) -| (c1) |- (p3); \path (t2.west) to node [welabel] {no} (c2); \draw [->, lcnorm] (t2.west) -- (c2) |- (p0); \end{tikzpicture} \end{document}