Ich möchte mit Tikz ein Flussdiagramm erstellen, das so aussieht:
-------------------------------
| wide node |
-------------------------------
|
-------------------------------
| wide node |
-------------------------------
|
-------------------------
| | |
------ ------ ------
|sub1| |sub2| |sub3|
------ ------ ------
| | |
-----------------------
|
-------------------------------
| wide node |
-------------------------------
Sieht aus wie ein ziemlich einfaches Flussdiagramm. Ich habe viel probiert, um die Pfeile zu verbinden und die Unterknoten so breit wie die anderen Knoten zu machen, aber ich habe es nicht hinbekommen. Mein aktueller Code sieht so aus:
\documentclass{minimal}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows,arrows,decorations.pathmorphing,backgrounds,fit,positioning,
shapes.symbols,chains}
\begin{document}
\tikzstyle{block} = [rectangle, draw=black, thick, fill=white, text width=8em,
text centered, minimum height=4em]
\tikzstyle{dummyblock} = [rectangle]
\tikzstyle{line} = [draw, -latex']
\begin{center}
\begin{tikzpicture}[node distance=3.5cm]
\node [block] (A) {A};
\node [block,below of= A] (B) {B};
\node [dummyblock,below of=B] (BB) {};
\node [block, below of = BB] (D) {D};
\node [block, left of=D] (C) {C};
\node [block, right of=D] (E) {E};
\node [block, below of=D] (F) {F};
\path [line] (A.south) -| (B.north);
\path [line] (B.south) -| (BB.north);
\path [line] (BB.south) -| (C);
\path [line] (BB.south) -| (D);
\path [line] (BB.south) -| (E);
\path [line] (C.south) -| (F.north);
\path [line] (D.south) -| (F.north);
\path [line] (E.south) -| (F.north);
\end{tikzpicture}\end{center}
\end{document}
Hat jemand eine Ahnung, wie man das behebt? Jede Hilfe ist sehr willkommen!
Antwort1
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows,arrows,decorations.pathmorphing,backgrounds,
fit,positioning,shapes.symbols,chains}
\tikzstyle{block} = [rectangle, draw=black, thick, fill=white, text width=8em,
text centered, minimum height=4em]
\tikzstyle{dummyblock} = [rectangle]
\tikzstyle{line} = [draw, -latex']
\begin{document}
\begin{tikzpicture}[node distance=3.5cm]
\node [block] (A) {A};
\node [block,below =of A] (B) {B};
\coordinate [below = of B] (BB) {};
\node [block, below = of BB] (D) {D};
\node [block, left = of D] (C) {C};
\node [block, right = of D] (E) {E};
\coordinate[below = of D] (fn);
\node [block, below = of fn] (F) {F};
\path [line] (A) -- (B);
\draw (B) -- (BB);
\path [line] (BB) -| (C);
\path [line] (BB) -- (D);
\path [line] (BB) -| (E);
\draw (C) |- (fn);
\draw (D) |- (fn);
\draw (E) |- (fn);
\path[line] (fn) -- (F);
\end{tikzpicture}
\end{document}
Antwort2
Percusse, vielen Dank für all deine Hilfe! Ich habe alles oben genannte in der endgültigen Lösung kombiniert:
\documentclass{minimal}
\usepackage{tikz}
\usetikzlibrary{arrows,positioning,fit}
\tikzstyle{block} = [rectangle, draw=black, thick, fill=white, text width=8em,
text centered, minimum height=4em]
\tikzstyle{line} = [draw, -latex']
\begin{document}
\begin{tikzpicture}[node distance=0.5cm]
\node [block] (D) {D};
\node [block, left = of D] (C) {C};
\node [block, right = of D] (E) {E};
\coordinate[below = of D] (FF);
\node [ block, fit={(C) (D) (E)},label=center:F, below = of FF] (F) {};
\coordinate [above = of D] (BB) {};
\node [ block, fit={(C) (D) (E)},label=center:B, above = of BB] (B) {};
\node [ block, fit={(C) (D) (E)},label=center:A, above = of B] (A) {};
\path [line] (A) -- (B);
\draw (B) -- (BB);
\path [line] (BB) -| (C);
\path [line] (BB) -- (D);
\path [line] (BB) -| (E);
\draw (C) |- (FF);
\draw (D) |- (FF);
\draw (E) |- (FF);
\path[line] (FF) -- (F);
\end{tikzpicture}
\end{document}
Übrigens gibt meine Linux-Texlive-Latex-Distribution aus irgendeinem Grund folgende Fehler aus (meine Windows-Miktex-Distribution gibt keinen Fehler aus):
\node [ block, fit={(C) (D) (E)},label=center:A, above = of B] (A) {};
Dies kann behoben werden, indem diese Zeile durch ersetzt wird
\node [ block, fit={(C) (D) (E)}, above = of B] (A) {A};
Antwort3
Es funktioniert fast, wenn man alle oben genannten Vorschläge kombiniert:
\documentclass{minimal}
\usepackage{tikz}
\usetikzlibrary{positioning,fit,arrows}
\tikzstyle{line} = [draw, -latex']
\begin{document}
\begin{tikzpicture}[node distance=0.2cm,mynode/.style={outer sep=0pt, draw}]
\node[mynode] (foo) {foo};
\node[mynode] (bar) [right=of foo] {bar};
\node[mynode] (bar2) [right=of bar] {bar2};
\coordinate[below = of bar] (cbar);
\node [ mynode,
inner sep=0pt,
yshift=-1cm,
fit={(foo) (bar) (bar2)},label=center:foobar
] (foobar) {};
\draw (foo.south) |- (cbar);
\draw (bar.south) |- (cbar);
\draw (bar2.south) |- (cbar);
\path[line] (cbar) -- (foobar.north);
\end{tikzpicture}
\end{document}
Nur werden aus irgendeinem Grund die Pfeile nicht gerade von der Koordinate unter drei Knoten zum breiteren Knoten gezeichnet ... weiß jemand, wie man das behebt?