3

Hey Guys i want to build an organization chart like in the following picture but i dont know how to start. I read about the package tikz.... Organization Chart

 \documentclass[border=10pt]{standalone}
 \usepackage{tikz}
 \usetikzlibrary{calc}

 \begin{document}

  \begin{tikzpicture}
    \tikzset{every node/.style=
        {thick, draw=black, align=center, minimum height=30pt, text       
   width=150pt}
     }
   \node(a1) {deterministische \\Prozesse};% start with left second level
   \node[right=10pt] (a2) at (a1.east) {stochastische Prozesse};
    \node[above=10pt] (top) at ($(a1.north)!.5!(a2.north)$)      
    {Maschinenbelegungs-\\planung};
   \node[below=10pt] (b1) at (a1.south) {ein- Maschinen\\Probleme};
  \node[below=10pt] (b2) at (a2.south) {mehrstufige\\Probleme};
   %\node[below=10pt] (c1) at (b1.south) {identische Maschinenfolge für\\alle 
  Auftr\"age \\\texbf{Flow Shop}};
  \node[below=10pt] (c2) at (b2.south) {unterschiedliche\\Maschinenfolge der  
  Auftr\"age \\\textbf{Job Shop}};
    %\node[below=10pt] (c3) at (b2.south) {ungeordnete Maschinenfolge\\ der  
 Auftr\"age \\\textbf{Open Shop}};
 \coordinate (atop) at ($(top.south) + (0,-5pt)$);% midpoint below top
  \coordinate (btop) at ($(a2.south) + (0,-5pt)$);% midoint below a3
  \coordinate (ctop) at ($(b2.south) + (0,-5pt)$);
  \draw[thick] (top.south) -- (atop)
   (a1.north) |- (atop) -| (a2.north)
   (a1.south) -- (b1.north)
   (b1.north) |- (btop) -| (b2.north)
   (b2.south) -- (c2.north);
   % (c2.north) |- (ctop) -| (c3.north);
   \end{tikzpicture}
  \end{document}

this is my code but under mehrstufige Probleme i dont know how to build the last things under it.... and the frame around all the blocks should be the same? Can u guys help me ?

Milo Li
  • 347

2 Answers2

3

You can fix the node's location using something like

\node[below right=10pt] (c3) at (b2.south east) {ungeordnete Maschinenfolge\\ der Auftr\"age \\\textbf{Open Shop}};

However, note that this syntax is deprecated and the positioning library recommended.

More fundamentally, this is not an easy way to draw a tree. I would recommend using a library or package designed for this. Forest is one example.

\documentclass[border=10pt,tikz]{standalone}
\usepackage[edges]{forest}
\usetikzlibrary{fit}

\begin{document}
\begin{forest}
  for tree={
    draw,
    align=center
  },
  forked edges,
  [Maschinenbelegungs-\\planung
    [deterministische\\Prozesse
      [ein- Maschinen\\Probleme
      ]
      [mehrstufige\\Probleme
        [identische Maschinenfolge für\\alle Auftr\"age \\\textbf{Flow Shop}
        ]
        [unterschiedliche\\Maschinenfolge der Auftr\"age \\\textbf{Job Shop}
        ]
        [ungeordnete Maschinenfolge\\ der Auftr\"age \\\textbf{Open Shop}
        ]
      ]
    ]
    [stochastische\\Prozesse
    ]
  ]
  \node [draw, fit=(current bounding box.south east) (current bounding box.north west)] {};
\end{forest}
\end{document}

Forest solution

EDIT

To fit it to a standard article without rotating it, I would recommend making the final nodes 4 lines rather than 3. This makes the chart a bit taller, but significantly narrower. I think it also looks neater.

\documentclass[12pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[edges]{forest}
\usetikzlibrary{fit}

\begin{document}
\begin{figure}
  \centering
  \begin{forest}
    for tree={
      draw,
      align=center
    },
    forked edges,
    [Maschinenbelegungs-\\planung
      [deterministische\\Prozesse
        [ein- Maschinen\\Probleme
        ]
        [mehrstufige\\Probleme
          [identische\\Maschinenfolge\\für alle Auftr\"age\\\textbf{Flow Shop}
          ]
          [unterschiedliche\\Maschinenfolge\\der Auftr\"age\\\textbf{Job Shop}
          ]
          [ungeordnete\\Maschinenfolge\\der Auftr\"age\\\textbf{Open Shop}
          ]
        ]
      ]
      [stochastische\\Prozesse
      ]
    ]
    \node [draw, fit=(current bounding box.south east) (current bounding box.north west)] {};
  \end{forest}
  \caption{Organisation}\label{fig:org}
\end{figure}
\end{document}

4-line terminal nodes

cfr
  • 198,882
  • Hey i just saw the solution on this page so i tried it with that.... normally i wanna build it the same way like the picture but that seems to be very hard with the centering and blocks in the tree. but now "mehrstufige Probleme" is not combined with "ein-Maschinen Probleme"... – Milo Li Dec 06 '16 at 23:05
  • @MiloLi Sorry, but I don't understand what you're asking. (Are you asking something?) – cfr Dec 06 '16 at 23:08
  • how can i put mehrstufige Probleme next to ein-maschinen probleme and then the three other below mehrstufige Probleme. You know what i mean ? – Milo Li Dec 06 '16 at 23:16
  • @MiloLi Please see edit. Is that what you mean? – cfr Dec 06 '16 at 23:20
  • yes!!!!! Thanks, i tried it but then i lost stochatsitsche Prozesse – Milo Li Dec 06 '16 at 23:21
  • now i want to build it in my text but the thing is it is to big the scaling is tooo big... what can i do ? i alrealdy use\documentclass[a4paper, 12pt,fleqn]{article} – Milo Li Dec 06 '16 at 23:27
  • I don't understand what you mean about losing that node. It is not that wide as it is, but what do you want to do? You could rotate the figure. You could use smaller font. You could insert different line breaks in the bottom layer of nodes. – cfr Dec 06 '16 at 23:30
  • the problem is i cant have two documentclasses! i already have for my thesis this: \documentclass[a4paper, 12pt,fleqn]{article}, how can i add your class too? if i run it without \documentclass[border=10pt,tikz]{standalone} it looks to big.... – Milo Li Dec 06 '16 at 23:31
  • @MiloLi The issue is what you want to do to make it smaller. – cfr Dec 06 '16 at 23:47
  • i posted a new question you may see it. the tree is bigger than my page restrictions – Milo Li Dec 06 '16 at 23:53
  • @MiloLi Please see edit above. As I say, there are different ways of dealing with this. But only you know which you want! I would probably use the one I've shown above, but you might obviously make a different choice. – cfr Dec 06 '16 at 23:55
  • sorry,i dont know how to edit an edited text.... can you see my new post: Change Tree size in Document . That really would help me out and sorry for so many dumb questions-.- – Milo Li Dec 06 '16 at 23:56
1

Just as an example of doing an organization chart. I made one in tikz, so I guess it might help others to get ideas on how to get started.

\documentclass[border=10pt,tikz]{standalone}

\definecolor{highlight}{HTML}{A3C87B} \tikzstyle{role} = [rectangle, rounded corners, minimum width=1cm, minimum height=1cm,text centered, draw=black]

\begin{document} \begin{tikzpicture} \node (A) [role, align=center] at (0,0) {Presidente - Conseil \ d'administration}; \node (B) [role] at (0,-2) {Directrice Generale}; \node (C) [role] at (-3.0,-4) {Assistante de direction}; \node (D) [role] at (3.5,-4) {Assistante administratif comptable}; \node (E) [role] at (-2.5,-6) {R'ef'erente handicap}; \node (F) [role, align=center] at (-19,-10) {Responsable d'activit'es \ R'ef'erente qualit'e}; \node (G) [role, align=center] at (-13,-10) {Responsable d'activit'es}; \node (H) [role, align=center] at (-7,-10) {Charg'e de d'eveloppement \ R'ef'erent actions num'eriques}; \node (I) [role, align=center] at (0,-10) {Responsable d'activit'es}; \node (J) [role, align=center] at (7,-10) {Responsable d'activit'es}; \node (K) [role, align=center] at (12,-10) {Directeur CER \ Chef de service}; \node (L) [role, align=center] at (19,-10) {Responsable d'activit'es};

    %%%%%%   F
    \node (F10) [role, align=center] at (-20.5,-12) {Intervenantes \\ exterieurs};
    \node (F11) [align=center] at (-22,-13.5) {PPP};
    \node (F12) [role, align=center] at (-21,-14.5) {CIP};
    \node (F13) [align=center] at (-22,-16) {CBP};
    \node (F14) [role, align=center] at (-20.5,-17) {Formateur \\ FLE};

    \node (F20) [align=center] at (-18,-12) {CBP};
    \node (F21) [role, align=center] at (-16.5,-13) {Formateur};

    \node (F30) [align=center] at (-18,-14) {PPP};
    \node (F31) [role, align=center] at (-17,-15) {CIP};

    \node (F40) [align=center] at (-18,-16) {CLEA};
    \node (F41) [role, align=center] at (-16,-17) {Formateur};
    \node (F42) [role, align=center] at (-16,-18.3) {Formateur};
    \node (F43) [role, align=center] at (-16,-19.6) {Formateur};
    \node (F44) [role, align=center] at (-16,-20.9) {Formateur};
    \node (F45) [role, align=center] at (-16,-22.2) {Formateur};
    \node (F46) [role, align=center] at (-16,-23.5) {Formateur};

    \node (F50) [align=center] at (-18,-24.8) {Parcours s\'ecuris\'e};
    \node (F51) [role, align=center] at (-16,-26.1) {Formateur technique \\ informatique};

    %%%%%%   G
    \node (G10) [align=center] at (-13.88,-11) {EDI 94};
    \node (G11) [role, align=center] at (-12.88,-12) {CIP};
    \node (G12) [role, align=center] at (-12.44,-13.3) {Formateur};

    %%%%%%   H
    \node (H10) [align=center] at (-9.5,-11.5) {TIC TRUCK};
    \node (H11) [role, align=center] at (-8,-12.5) {Coordinateur};

    \node (H20) [align=center] at (-6.5,-11.5) {Actions Informatiques};
    \node (H21) [role,align=center] at (-5,-12.5) {Coordinateur \\ num\'erique};
    \node (H22) [role,align=center] at (-5,-13.8) {Technicien \\ informatique};

    %%%%%%   I
    \node (I10) [align=center, fill=highlight] at (-2,-11.5) {ISAE};
    \node (I11) [role, align=center, fill=highlight] at (-1,-12.5) {CIP};
    \node (I12) [role, align=center, fill=highlight] at (-1,-13.8) {CIP};
    \node (I13) [role, align=center, fill=highlight] at (-0.8,-15.1) {Assistant \\ sociale};
    \node (I14) [role, align=center, fill=highlight] at (-0.8,-16.4) {Assistant \\ sociale};

    \node (I20) [align=center] at (-2,-18) {Chantier de \\ remobilisation};
    \node (I21) [role, align=center] at (-0.8,-19.3) {Encadrant \\ technique};

    \node (I30) [align=center, fill=highlight] at (1.5,-11.5) {PPAIP};
    \node (I31) [role, align=center, fill=highlight] at (3,-12.5) {Psychologue \\ du travail};
    \node (I32) [role, align=center, fill=highlight] at (3,-14) {Psychologue \\ du travail};
    \node (I33) [role, align=center, fill=highlight] at (3,-15.5) {Psychologue \\ du travail};
    \node (I34) [role, align=center, fill=highlight] at (2.5,-16.8) {CIP};
    \node (I35) [role, align=center, fill=highlight] at (2.5,-18.1) {CIP};
    \node (I36) [role, align=center, fill=highlight] at (2.5,-19.4) {CIP};
    \node (I37) [role, align=center, fill=highlight] at (2.5,-20.7) {CIP};
    \node (I38) [role, align=center, fill=highlight] at (2.5,-22) {CIP};

    %%%%%%   J
    \node (J10) [align=center] at (5.5,-11.5) {EDI 92};
    \node (J11) [role, align=center] at (6.7,-12.5) {Assistant \\ sociale};
    \node (J12) [role, align=center] at (6.7,-13.8) {Assistant \\ sociale};
    \node (J13) [role, align=center] at (6.7,-15.1) {Secr\'etaire};

    \node (J20) [align=center] at (8.5,-11.5) {EDIP};
    \node (J21) [role, align=center] at (9.7,-12.5) {Assistant \\ sociale};
    \node (J22) [role, align=center] at (9.7,-13.8) {RSA 93};

    %%%%%%   K
    \node (K10) [role, align=center] at (13.2,-11.3) {Educateur};
    \node (K11) [role, align=center] at (13.2,-12.6) {Educateur};
    \node (K12) [role, align=center] at (13.2,-13.9) {Educateur};
    \node (K13) [role, align=center] at (13.2,-15.2) {Educateur};
    \node (K14) [role, align=center] at (13.2,-16.5) {Educateur};
    \node (K15) [role, align=center] at (13.2,-17.8) {Educateur};
    \node (K16) [role, align=center] at (13.2,-19.1) {CIP};
    \node (K17) [role, align=center] at (13.2,-20.4) {Agent \\ d'entretien};
    \node (K18) [role, align=center] at (13.2,-21.7) {Agent \\ d'entretien};

    %%%%%%   L   
    \node (L10) [align=center] at (16,-11.5) {OFI};
    \node (L11) [role, align=center] at (17.5,-12.8) {Coordinateur};
    \node (L12) [role, align=center] at (17.5,-14.1) {Coordinateur};
    \node (L13) [role, align=center] at (17.5,-15.3) {Formateur};
    \node (L14) [role, align=center] at (17.5,-16.6) {Formateur};
    \node (L15) [role, align=center] at (17.5,-17.9) {Formateur};
    \node (L16) [role, align=center] at (17.5,-19.2) {Formateur};
    \node (L17) [role, align=center] at (17.5,-20.5) {Formateur};
    \node (L18) [role, align=center] at (17.5,-21.8) {Secr\'etaire};

    \node (L20) [align=center] at (20,-11.5) {Pr\'epa apprentissage};
    \node (L21) [role, align=center] at (22,-12.8) {Coordinateur/CIP};
    \node (L22) [role, align=center] at (21.5,-14.1) {Formateur};
    \node (L23) [role, align=center] at (21.5,-15.4) {Formateur};

    \node (L30) [align=center] at (20,-16.7) {ALPHA PRO};
    \node (L31) [role, align=center] at (21.5,-18) {Formateur};

    %%%%%%   Phantoms
    \node (phantom1) at (0,-8.12) {};
    \node (phantom2) at (0.12,-6) {};



    %%%%%%   Edges
    \draw (A) edge (B);
    \draw (C) edge (D);
    \draw (B) edge (phantom1);
    \draw (E) edge (phantom2);
    \draw (-19,-8) edge (19,-8);
    \draw (-19,-8) edge (F);
    \draw (-13,-8) edge (G);
    \draw (-7,-8) edge (H);
    \draw (0,-8) edge (I);
    \draw (7,-8) edge (J);
    \draw (12,-8) edge (K);
    \draw (19,-8) edge (L);

    %%%%%%   F
    \draw (F) |- (-22,-11) edge (F11);
    \draw (F) |- (-18,-11) edge (F20);
    \draw (-22,-12) edge (F10);
    \draw (F11) |- (F12); 
    \draw (F11) edge (F13); 
    \draw (F13) |- (F14); 

    \draw (F20) |- (F21);
    \draw (F20) edge (F30);

    \draw (F30) |- (F31);
    \draw (F30) edge (F40);

    \draw (F40) |- (F41);
    \draw (F40) |- (F42);
    \draw (F40) |- (F43);
    \draw (F40) |- (F44);
    \draw (F40) |- (F45);
    \draw (F40) |- (F46);

    \draw (F40) edge (F50);
    \draw (F50) |- (F51);

    %%%%%%   G
    \draw (G.210) edge (G10);
    \draw (G10) |- (G11);
    \draw (G10) |- (G12);

    %%%%%%   H
    \draw (H) |- (-9.5,-11) edge (H10);
    \draw (H10) |- (H11);

    \draw (H) |- (-6.5,-11) edge (H20);
    \draw (H20) |- (H21);
    \draw (H20) |- (H22);

    %%%%%%   I
    \draw (I) |- (-2,-11) edge (I10);
    \draw (I10) |- (I11);
    \draw (I10) |- (I12);
    \draw (I10) |- (I13);
    \draw (I10) |- (I14);

    \draw (I10) edge (I20);
    \draw (I20) |- (I21);

    \draw (I) |- (1.5,-11) edge (I30);
    \draw (I30) |- (I31);
    \draw (I30) |- (I32);
    \draw (I30) |- (I33);
    \draw (I30) |- (I34);
    \draw (I30) |- (I35);
    \draw (I30) |- (I36);
    \draw (I30) |- (I37);
    \draw (I30) |- (I38);

    %%%%%%   J
    \draw (J) |- (5.5,-11) edge (J10);
    \draw (J10) |- (J11);
    \draw (J10) |- (J12);
    \draw (J10) |- (J13);

    \draw (J) |- (8.5,-11) edge (J20);
    \draw (J20) |- (J21);
    \draw (J20) |- (J22);

    %%%%%%   K
    \draw (K) |- (K10);
    \draw (K) |- (K11);
    \draw (K) |- (K12);
    \draw (K) |- (K13);
    \draw (K) |- (K14);
    \draw (K) |- (K15);
    \draw (K) |- (K16);
    \draw (K) |- (K17);
    \draw (K) |- (K18);

    %%%%%%   L
    \draw (L) |- (16,-11) edge (L10);
    \draw (L10) |- (L11);
    \draw (L10) |- (L12);
    \draw (L10) |- (L13);
    \draw (L10) |- (L14);
    \draw (L10) |- (L15);
    \draw (L10) |- (L16);
    \draw (L10) |- (L17);
    \draw (L10) |- (L18);

    \draw (L) |- (20,-11) edge (L20);
    \draw (L20) |- (L21);
    \draw (L20) |- (L22);
    \draw (L20) |- (L23);

    \draw (L20) edge (L30);
    \draw (L30) |- (L31);

\end{tikzpicture}

\end{document}

Which produces... organization chart