I have the following MNWE:
\documentclass[tikz]{standalone}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usetikzlibrary{positioning}
\usetikzlibrary{shapes.geometric, arrows}
\tikzstyle{process} = [rectangle, minimum height=1cm, text centered, draw=black, fill=orange!30]
\tikzstyle{arrow} = [thick,->,>=stealth]
\begin{document}
\begin{tikzpicture}[node distance=1cm]
\node (start) [process] {1};
\node (node2r) [process, below right=of start] {2r};
\node (node3r) [process, below=of node2r] {3r};
\node (node4r) [process, below=of node3r] {4r};
\node (node2l) [process, below left=of start] {2l};
\node (node4l) [process, below=of node2l, left=of node4r] {4l};
\node (end) [process, below left=of node4r] {4};
\draw [arrow] (start) -| (node2r);
\draw [arrow] (start) -| (node2l);
\draw [arrow] (node2l) -- (node4l);
\draw [arrow] (node2r) -- (node3r);
\draw [arrow] (node3r) -- (node4r);
\draw [arrow] (node4r) |- (end);
\draw [arrow] (node4l) |- (end);
\end{tikzpicture}
\end{document}
This generates the following output.
How do I adjust the code so that 4l
aligns with both 2l
(horizontally) and 4r
(vertically)?
Bonus question: How do I ensure that 1
and 5
aligns vertically? (Occurs if the rectangles differ in width)
1
and5
cannot align horizontally since it's one on top of the other, unless you mean vertically?1
and5
horizontally.