1

I am trying to draw multiple nodes inside nodes and connect the outer ones to create a flowchart. Since Im new to Tikz I used examples and tried to manipulate them for my issue. If there is a way to align the parts in a proper way (not harcoded) I would also be happy for those improvements. The main question is, how to connect the outer frame to the same picture below.

\documentclass[ngerman]{scrbook}

\usepackage{selinput}
\SelectInputMappings{adieresis={ä},germandbls={ß}}
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}
\usepackage{isodate}
\usepackage{mathtools}
\usepackage{sansmath}
\usepackage{enumitem}
\usepackage{xcolor}
\usepackage{tikz}
\usepackage{verbatim} %comment Befehl

\usetikzlibrary{calc,trees,positioning,arrows,chains,shapes.geometric,%
decorations.pathreplacing,decorations.pathmorphing,shapes,%
matrix,shapes.symbols,fit,backgrounds,shadows,intersections,through,shapes.multipart}

\tikzstyle{noframe} = [minimum width=2cm, minimum height=1cm,text centered, draw=white, opacity=0, text opacity=1]    
\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, minimum width=3cm, minimum height=1cm, text centered, draw=black, fill=blue!30]
\tikzstyle{process} = [rectangle, minimum width=3cm, minimum height=1cm, text centered, text width=3cm, draw=black, fill=orange!30]
\tikzstyle{decision} = [diamond, minimum width=3cm, minimum height=1cm, text centered, draw=black, fill=green!30]
\tikzstyle{arrow} = [thick,->,>=stealth]
\tikzstyle{ell} = [ellipse, minimum width=3cm, minimum height=1cm, text centered, draw=black, fill=green!30]

\begin{document}
\begin{figure}
\centering
\begin{tikzpicture}[nodes=draw, inner frame sep=.5cm]
\node[noframe] (leer) {};
\node[ell, fill=green!30, left of=leer, xshift=-1cm] (variation) {Variation der Geometrie};
\node[fill=red!30, above of=leer, xshift=-4cm, yshift=1cm] (head) {\textbf{Geometrie}};
\node[noframe, right of=leer, align=center, xshift=3cm] (nsim) {$n_{sim}$\\ Durchläufe};
\begin{scope}[on background layer]
\node[fit=(leer), minimum width=.75\textwidth, minimum height=4cm] {};
\end{scope}
\draw [arrow, dashed, thick, bend angle=45, bend right]  (nsim) to (variation);
\draw [arrow, dashed, bend angle=45, bend right]  (variation) to (nsim);
\end{tikzpicture}
\end{figure}

\begin{figure}
\centering
\begin{tikzpicture}[nodes=draw, inner frame sep=.5cm]
\node[noframe] (leer) {};
\node[ell, fill=green!30, left of=leer, xshift=-1cm] (variation) {Variation der Geometrie};
\node[fill=red!30, above of=leer, xshift=-4cm, yshift=1cm] (head) {\textbf{Geometrie}};
\node[noframe, right of=leer, align=center, xshift=3cm] (nsim) {$n_{sim}$\\ Durchläufe};
\begin{scope}[on background layer]
\node[fit=(leer), minimum width=.75\textwidth, minimum height=4cm] {};
\end{scope}
\draw [arrow, dashed, thick, bend angle=45, bend right]  (nsim) to (variation);
\draw [arrow, dashed, bend angle=45, bend right]  (variation) to (nsim);
\end{tikzpicture}
\end{figure}
\end{document} 

(Edit) I added the second picture. Those two should be connected with an arrow.

Sure it can be coded in one tikzpicture, but Im not capable.

regards

2
  • Welcome to TeX.SE. It doesn't seem clear what you want to achieve, to connect what thing with ... what?. You must add a picture where you explain clearly this.
    – skpblack
    Aug 30, 2014 at 15:10
  • It isn't good idea to connect two figures in different figure environments (maybe it is possible with [remember picture]) but the results are unexpected (if the second figure pass to the next page?).
    – skpblack
    Aug 30, 2014 at 15:30

1 Answer 1

2

Try to reference the nodes (name) and to make your picture only in a tikzpicture environment.

In this case i copied the second figure in a scope environment (because it is the same, your case really should be different) and named the outer nodes with (node1) and (node2). Then it is easy join them.

\documentclass[ngerman]{scrbook}

\usepackage{selinput}
\SelectInputMappings{adieresis={ä},germandbls={ß}}
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}
\usepackage{isodate}
\usepackage{mathtools}
\usepackage{sansmath}
\usepackage{enumitem}
\usepackage{xcolor}
\usepackage{tikz}
\usepackage{verbatim} %comment Befehl

\usetikzlibrary{calc,trees,positioning,arrows,chains,shapes.geometric,%
decorations.pathreplacing,decorations.pathmorphing,shapes,%
matrix,shapes.symbols,fit,backgrounds,shadows,intersections,through,shapes.multipart}

\tikzstyle{noframe} = [minimum width=2cm, minimum height=1cm,text centered, draw=white, opacity=0, text opacity=1]    
\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, minimum width=3cm, minimum height=1cm, text centered, draw=black, fill=blue!30]
\tikzstyle{process} = [rectangle, minimum width=3cm, minimum height=1cm, text centered, text width=3cm, draw=black, fill=orange!30]
\tikzstyle{decision} = [diamond, minimum width=3cm, minimum height=1cm, text centered, draw=black, fill=green!30]
\tikzstyle{arrow} = [thick,->,>=stealth]
\tikzstyle{ell} = [ellipse, minimum width=3cm, minimum height=1cm, text centered, draw=black, fill=green!30]

\begin{document}
\begin{figure}
\centering
\begin{tikzpicture}[nodes=draw, inner frame sep=.5cm]
\node[noframe] (leer) {};
\node[ell, fill=green!30, left of=leer, xshift=-1cm] (variation) {Variation der Geometrie};
\node[fill=red!30, above of=leer, xshift=-4cm, yshift=1cm] (head) {\textbf{Geometrie}};
\node[noframe, right of=leer, align=center, xshift=3cm] (nsim) {$n_{sim}$\\ Durchläufe};
\begin{scope}[on background layer]
\node[fit=(leer), minimum width=.75\textwidth, minimum height=4cm] (node1) {};
\end{scope}
\draw [arrow, dashed, thick, bend angle=45, bend right]  (nsim) to (variation);
\draw [arrow, dashed, bend angle=45, bend right]  (variation) to (nsim);

\begin{scope}[yshift=-6cm]
\node[noframe] (leer) {};
\node[ell, fill=green!30, left of=leer, xshift=-1cm] (variation) {Variation der Geometrie};
\node[fill=red!30, above of=leer, xshift=-4cm, yshift=1cm] (head) {\textbf{Geometrie}};
\node[noframe, right of=leer, align=center, xshift=3cm] (nsim) {$n_{sim}$\\ Durchläufe};
\begin{scope}[on background layer]
\node[fit=(leer), minimum width=.75\textwidth, minimum height=4cm] (node2) {};
\end{scope}
\draw [arrow, dashed, thick, bend angle=45, bend right]  (nsim) to (variation);
\draw [arrow, dashed, bend angle=45, bend right]  (variation) to (nsim);
\end{scope}

\draw[blue,thick,->] (node1) -- (node2);
\end{tikzpicture}
\end{figure}
\end{document} 

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .