1

i got a problem with tikz. I wanted to nest the nodes Auftraggeber, Lierferanten and Benutzer into the node Lenkung, but the nested nodes never get left aligned.

\documentclass[11pt,a4paper]{article}
\usepackage{tikz}
\usepackage{float}
\usepackage{caption}
\usetikzlibrary{chains, positioning, shapes, arrows}
\begin{document}
\begin{figure}[H]
    \begin{tikzpicture}[remember picture, node distance = 0.4cm, thick, 
    every node/.style = {rectangle, font = \sffamily, white,
        top color = red!90!black, bottom color = white!60!black,
        text width = 4.4cm, align = center, minimum width = 4cm, 
 minimum height = 1cm},
    UP/.style = {anchor=north west, text width = 8cm, minimum width=16cm},
    Team/.style = {minimum width = 16cm},
    Lenkung/.style = {align=left, minimum height = 2cm, minimum width=16cm}
    ]
    \node [UP](UP) [anchor=west]{Unternehmens- oder Programmmanagement};
    \coordinate [below = 0.9cm of UP] (Mitte);
    \node[Lenkung,draw=blue, below = of UP] (Lenkung) {
        Lenkungsausschuss
        \begin{tikzpicture}[align=left]
            \node (Auftraggeber) [draw=black]  {Auftraggeber\\
            Frau Grenz (AZ AG)};
            \node (Lieferanten) [draw=black,right = of Auftraggeber] {Lieferantenvertreter\\
                \begin{enumerate}
                    \item Herr Bob (RZ Bau AG)
                    \item Frau Haunersdorfer (Telekom)
                    \item Herr Meierhofer (RZB GmbH)
                    \item Herr Brünig
                \end{enumerate}};
            \node (Benutzer) [draw=black, left = of Auftraggeber]  {Benutzervertreter\\
                \begin{enumerate}
                    \item Herr Kunz
                    \item Herr Knecht
                    \item Frau Huber
                    \item Herr Knurr
                \end{enumerate}};
        \end{tikzpicture}
    };
    \node (PM)   [below  = 1cm of Lenkung] {Projektmanager\\ Herr Prinz (PMC GmbH)};
    \node (Aenderung) [right = 1cm of PM] {Änderungsausschuss};
    \node (Sicherung) [left = 1cm of PM] {Sicherungsausschuss};
    \node (BO) [below = 1cm of Aenderung] {Back office\\
    Frau Munker};
    \node (TM) [below = 2cm of PM] {Teamanager\\
    Herr Bauer (AZ AG)};
    \node [Team](Team) [below = 1cm of TM] {Teammitglieder};
    \draw [green!60!black,thick];
    \end{tikzpicture}
    \captionof{figure}{Organigramm Projektorganisation}
\end{figure}
\end{document}

enter image description here Any Clue?

Thanks in advance

  • Welcome to TeX.SX! If that are real names you may want to anonymize them. – TeXnician Oct 10 '17 at 11:05
  • Thank you. No this is just an exercise with fictitious names – user1414157 Oct 10 '17 at 11:09
0

Nesting tikzpictures should in general be avoided I think, you can't always be sure that it works as expected. A different method is to draw the three nested nodes first, and place the Lenkung node afterwards, in the background. Below I did this with the help of the fit and backgrounds library.

Some other things to note:

  • The \\ before \begin{enumerate} is not necessary.
  • You're inside a figure environment, so \captionof{figure} isn't needed, \caption{figure} is enough.
  • The arrows library (which you're not actually using here) is considered deprecated in favor of arrows.meta, see the manual.
  • Your diagram is much wider than the text block in a standard article, so you get an overfull hbox. I have not done anything to fix that.

output of code

\documentclass[11pt,a4paper]{article}
\usepackage{tikz}
\usepackage{float}
\usepackage{caption}
\usetikzlibrary{positioning, fit,backgrounds}
\begin{document}
\begin{figure}[H]
\begin{tikzpicture}[
    remember picture, node distance = 0.4cm, thick, 
    every node/.style = {rectangle, font = \sffamily, white,
        top color = red!90!black, bottom color = white!60!black,
        text width = 4.4cm, align = center, minimum width = 4cm, 
 minimum height = 1cm},
    UP/.style = {anchor=north west, text width = 8cm, minimum width=16cm},
    Team/.style = {minimum width = 16cm},
    Lenkung/.style = {align=left, minimum height = 2cm, minimum width=16cm}
    ]
    \node [UP](UP) [anchor=west]{Unternehmens- oder Programmmanagement};


    \node (Auftraggeber) [below=3cm of UP,draw=black]  {Auftraggeber\\
            Frau Grenz (AZ AG)};
    \node (Lieferanten) [draw=black,right = of Auftraggeber] {Lieferantenvertreter
                \begin{enumerate}
                    \item Herr Bob (RZ Bau AG)
                    \item Frau Haunersdorfer (Telekom)
                    \item Herr Meierhofer (RZB GmbH)
                    \item Herr Brünig
                \end{enumerate}};
    \node (Benutzer) [draw=black, left = of Auftraggeber]  {Benutzervertreter
                \begin{enumerate}
                    \item Herr Kunz
                    \item Herr Knecht
                    \item Frau Huber
                    \item Herr Knurr
                \end{enumerate}};

    \begin{scope}[on background layer]
    \node[Lenkung,
          fit=(Lieferanten)(Auftraggeber)(Benutzer),
          label={[anchor=north,shade=none]above:Lenkungsauschuss},
          inner ysep=2.5ex,yshift=1.7ex,
          draw=blue] (Lenkung) {};
    \end{scope}
    \node (PM)   [below  = 1cm of Lenkung] {Projektmanager\\ Herr Prinz (PMC GmbH)};
    \node (Aenderung) [right = 1cm of PM] {Änderungsausschuss};
    \node (Sicherung) [left = 1cm of PM] {Sicherungsausschuss};
    \node (BO) [below = 1cm of Aenderung] {Back office\\
    Frau Munker};
    \node (TM) [below = 2cm of PM] {Teamanager\\
    Herr Bauer (AZ AG)};
    \node [Team](Team) [below = 1cm of TM] {Teammitglieder};
    \draw [green!60!black,thick];
    \end{tikzpicture}
    \caption{Organigramm Projektorganisation}
\end{figure}
\end{document}
| improve this answer | |
  • Thank you very much for solving this and also for your advanced tips. – user1414157 Oct 10 '17 at 13:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.