1

the picture doesn't fit onto an A4 page. So what I would like to change/add is:

  • the node distance
  • the font size
  • a vertical text which groups nodes together
  • a number infront of each node as the "step number"
  • a bigger distance between the "groups"
  • a better way to code maybe as a macro, so when I have to include a node I don't need to change all the numbers

This is how far I got but the distance between the first and second node is different to the rest. I also used in my original document:

\documentclass[12pt, oneside,openright]{mpreport}
\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{textcomp}
\usepackage[scaled=0.9]{helvet}
\usepackage{ngerman}
\usepackage[babel,german=quotes]{csquotes}

but for the picture I had to use \"u for ü and so on...


Here's the code:

\documentclass{article}

\usepackage{tikz}

\usetikzlibrary{positioning,shadows,arrows,backgrounds,fit}

\begin{document}

\begin{figure}

\begin{tikzpicture}
    [schritt/.style=            {draw, fill=gray!10,    text width=22em, minimum width=25em, minimum height=1.5em, drop shadow, rounded corners, font=\small},
     pfeil/.style=              {<-,shorten <=1pt,>=stealth',semithick},
     hintergrund/.style=    {draw, dashed, fill=gray!40,rounded corners}]

    \newcommand{\beschr}[1]{\hfill\textit{#1}};

        %   Bauteil einlegen
        \node   (1)         [schritt]                           {Frg 1\beschr{Freigabe Einfahrt Bauteil}};          
        \node   (2)         [schritt]   [below=1]       {MZ 11 V\beschr{Sauger ein}}
            edge                [pfeil]     (1);                                                                                                                
        \node   (3)         [schritt]   [below=2]       {Frg 2\beschr{Freigabe Ausfahrt Bauteil}}
            edge                [pfeil]     (2);    
        %   Arbeitsstellung
        \node (4)           [schritt]   [below=3]       {MZ 12 V\beschr{Spanner Innenblech vorw\"arts}}
            edge                [pfeil]     (3);
        \node (5)           [schritt]   [below=4]       {M1 \& M2 V\beschr{B\"ugel M1 \& M2 vorw\"arts}}
            edge                [pfeil]     (4);
        \node (6)           [schritt]   [below=5]       {M3 \& M6 V\beschr{B\"ugel M3 \& M6 vorw\"arts}}
            edge                [pfeil]     (5);
        \node (7)           [schritt]   [below=6]       {M4 \& M5 V\beschr{B\"ugel M4 \& M5 vorw\"arts}}
            edge                [pfeil]     (6);
        \node (8)           [schritt]   [below=7]       {MZ 13 V\beschr{Klemmeinheit l\"osen}}
            edge                [pfeil]     (7);
        \node (9)           [schritt]   [below=8]       {MZ 14 V\beschr{Niederhalteraufnahme vorw\"arts}}
            edge                [pfeil]     (8);
        \node (10)      [schritt]   [below=9]       {MZ 15-19 V\beschr{Niederhalteraufnahmen vorw\"arts}}
            edge                [pfeil]     (9);
        \node (11)      [schritt]   [below=10]  {MZ 21-22 V\beschr{Niederhalterzustellungen vorw\"arts}}
            edge                [pfeil]     (10);
        \node (12)      [schritt]   [below=11]  {MZ 23-24 V\beschr{Niederhalterzustellungen vorw\"arts}}
            edge                [pfeil]     (11);
        \node (13)      [schritt]   [below=12]  {MZ 20 V\beschr{Sperrventil vorw\"arts}}
            edge                [pfeil]     (12);

        %   Falzvorgang
        \node (14)      [schritt]   [below=13]  {M7 Pos 1\beschr{Hauptantrieb zur Vorfalzposition}}
            edge                [pfeil]     (13);
        \node (15)      [schritt]   [below=14]  {M7 Pos 4\beschr{Hauptantrieb zur Grundstellung}}
            edge                [pfeil]     (14);
        \node (16)      [schritt]   [below=15]  {MZ 25-30 V\beschr{Vorfalzantriebe vorw\"arts}}
            edge                [pfeil]     (15);
        \node (17)      [schritt]   [below=16]  {M7 Pos 3\beschr{Hauptantrieb zur Falzposition}}
            edge                [pfeil]     (16);

        %   Grundstellung
        \node (18)      [schritt]   [below=17]  {M7 Pos 4\beschr{Hauptantrieb zur Grundstellung}}
            edge                [pfeil]     (17);
        \node (19)      [schritt]   [below=18]  {MZ 25-30 R\beschr{Vorfalzantriebe r\"uckw\"arts}}
            edge                [pfeil]     (18);
        \node (20)      [schritt]   [below=19]  {MZ 23-24 R\beschr{Niederhalterzustellungen r\"uckw\"arts}}
            edge                [pfeil]     (19);
        \node (21)      [schritt]   [below=20]  {MZ 21-22 R\beschr{Niederhalterzustellungen r\"uckw\"arts}}
            edge                [pfeil]     (20);
        \node (22)      [schritt]   [below=21]  {MZ 20 V\beschr{Sperrventil r\"uckw\"arts}}
            edge                [pfeil]     (21);
        \node (23)      [schritt]   [below=22]  {MZ 15-19 V\beschr{Niederhalteraufnahmen r\"uckw\"arts}}
            edge                [pfeil]     (22);
        \node (24)      [schritt]   [below=23]  {MZ 14 V\beschr{Niederhalteraufnahme r\"uckw\"arts}}
            edge                [pfeil]     (23);
        \node (25)      [schritt]   [below=24]  {MZ 13 V\beschr{Klemmeinheit r\"uckw\"arts}}
            edge                [pfeil]     (24);
        \node (26)      [schritt]   [below=25]  {M4 \& M5 V\beschr{B\"ugel M4 \& M5 r\"uckw\"arts}}
            edge                [pfeil]     (25);
        \node (27)      [schritt]   [below=26]  {M3 \& M6 V\beschr{B\"ugel M3 \& M6 r\"uckw\"arts}}
            edge                [pfeil]     (26);
        \node (28)      [schritt]   [below=27]  {M1 \& M2 V\beschr{B\"ugel M1 \& M2 r\"uckw\"arts}}
            edge                [pfeil]     (27);
        \node (29)      [schritt]   [below=28]  {MZ 12 V\beschr{Spanner Innenblech r\"uckw\"arts}}
            edge                [pfeil]     (28);

        %   Bauteilentnahme
        \node   (30)        [schritt]   [below=29]      {Frg 1\beschr{Freigabe Einfahrt Bauteilentnahme}};
            edge                [pfeil]     (29);
        \node   (31)        [schritt]   [below=30]      {MZ 11 V\beschr{Sauger ein}}
            edge                [pfeil]     (30);                                                                                                               
        \node   (32)        [schritt]   [below=31]      {Frg 2\beschr{Freigabe Ausfahrt Bauteilentnahme}};

        %   Hintergrund
        \begin{pgfonlayer}{background}
            \node   [hintergrund, fit=(1)(2)(3), label={[rotate=90,xshift=1.5cm,yshift=0.5cm]left:Bauteil einlegen}] {};
            \node   [hintergrund, fit=(4)(5)(6)(7)(8)(9)(10)(11)(12)(13), label={[rotate=90,xshift=1.5cm,yshift=0.5cm]left:Falze in Arbeitsstellung}] {};
            \node   [hintergrund, fit=(14)(15)(16)(17), label={[rotate=90,xshift=1.5cm,yshift=0.5cm]left:Bauteil einlegen}] {};
            \node   [hintergrund, fit=(18)(19)(20)(21)(22)(23)(24)(25)(26)(27)(28)(29), label={[rotate=90,xshift=1.5cm,yshift=0.5cm]left:Falze in Grundstellung}] {};
            \node   [hintergrund, fit=(30)(31)(32), label={[rotate=90,xshift=1.5cm,yshift=0.5cm]left:Bauteilentnahme}] {};
        \end{pgfonlayer}

\end{tikzpicture}
\caption{Prozessablauf}
\label{abb:Prozessablauf}
\end{figure}


\end{document}
Phil
  • 407
  • for node distance use below=3mm of ... (from positioning library which you already charged). – Ignasi Jun 27 '13 at 17:42
  • for number in front could use \node[label=left:number] ... – Ignasi Jun 27 '13 at 17:44
  • you don't need to fit all nodes, with upper and lower is enough. Instead of fit=(4)(5)...(13) use fit=(4)(13). – Ignasi Jun 27 '13 at 17:46
  • 1
    You could consider to use several matrix of nodes one for group. Then you don't need background nodes because the matrix is already a node with its own border. Not the best example but you can look at this answer – Ignasi Jun 27 '13 at 17:52
  • Thank you! I put the chart into a matrix as you sad. It worked out just fine but I have one more question regarding the nodes. You'll find it with this link. – Phil Jun 28 '13 at 00:22
  • I've added some comments to your new question regarding matrices. Hope they help to simplify your code. – Ignasi Jun 28 '13 at 08:34

1 Answers1

2

This will be a partial answer following suggestions made in comments. I know Phil already followed and improved them (look at Strech the text to the borders of a node by using \hfill) but this way some work for answer the unanswered session could be avoid ;-)

I think node distance, a bigger distance between the "groups", a better way to code can be solved organizing the diagram with several matrix of nodes. Within them row sep will fix node distance, and positioning library will help to place every matrix as far as we want fro maybe as a macro

the node distance the font size a vertical text which groups nodes together a number infront of each node as the "step number"

, so when I have to include a node I don't need to change all the numbers

\documentclass[a4paper]{article}
\usepackage[hmargin={1cm,1cm}]{geometry}
\usepackage{tikz}

\usetikzlibrary{matrix,positioning, shadows,arrows,backgrounds}

\begin{document}

\begin{figure}

\begin{tikzpicture}
    [schritt/.style= {draw, solid, fill=gray!10, text width=22em, minimum width=25em, minimum height=1.5em, drop shadow, rounded corners, font=\small},
     pfeil/.style= {->,shorten <=1pt,>=stealth',semithick},
     hintergrund/.style= {draw, dashed, fill=gray!40,rounded corners},
     every matrix/.style={matrix of nodes, row sep=3mm, outer sep=0pt, hintergrund, nodes={schritt}}]

    \newcommand{\beschr}[1]{\hfill\textit{#1}};

        %   Bauteil einlegen
    \matrix (A) {
        {Frg 1\beschr{Freigabe Einfahrt Bauteil}}\\
        {MZ 11 V\beschr{Sauger ein}}\\            
        {Frg 2\beschr{Freigabe Ausfahrt Bauteil}}\\};

        \foreach \i [remember=\i as \j (initially 1)] in {2, 3}
        \draw[pfeil] (A-\j-1)--(A-\i-1);

        %   Arbeitsstellung
    \matrix (B) [below=5mm of A.south]{
        {MZ 12 V\beschr{Spanner Innenblech vorw\"arts}}\\
        {M1 \& M2 V\beschr{B\"ugel M1 \& M2 vorw\"arts}}\\
        {M3 \& M6 V\beschr{B\"ugel M3 \& M6 vorw\"arts}}\\
        {M4 \& M5 V\beschr{B\"ugel M4 \& M5 vorw\"arts}}\\
        {MZ 13 V\beschr{Klemmeinheit l\"osen}}\\
        {MZ 14 V\beschr{Niederhalteraufnahme vorw\"arts}}\\
        {MZ 15-19 V\beschr{Niederhalteraufnahmen vorw\"arts}}\\
        {MZ 21-22 V\beschr{Niederhalterzustellungen vorw\"arts}}\\
        {MZ 23-24 V\beschr{Niederhalterzustellungen vorw\"arts}}\\
        {MZ 20 V\beschr{Sperrventil vorw\"arts}}\\};

        \foreach \i [remember=\i as \j (initially 1)] in {2, ..., 10}
        \draw[pfeil] (B-\j-1)--(B-\i-1);


%   Falzvorgang
    \matrix (C) [below=5mm of B.south]{
        {M7 Pos 1\beschr{Hauptantrieb zur Vorfalzposition}}\\
        {M7 Pos 4\beschr{Hauptantrieb zur Grundstellung}}\\
        {MZ 25-30 V\beschr{Vorfalzantriebe vorw\"arts}}\\
        {M7 Pos 3\beschr{Hauptantrieb zur Falzposition}}\\};

        \foreach \i [remember=\i as \j (initially 1)] in {2, ..., 4}
        \draw[pfeil] (C-\j-1)--(C-\i-1);

        %   Grundstellung
    \matrix (D) [right=10mm of A.north east, matrix anchor=north west]{
        {M7 Pos 4\beschr{Hauptantrieb zur Grundstellung}}\\
        {MZ 25-30 R\beschr{Vorfalzantriebe r\"uckw\"arts}}\\
        {MZ 23-24 R\beschr{Niederhalterzustellungen r\"uckw\"arts}}\\
        {MZ 21-22 R\beschr{Niederhalterzustellungen r\"uckw\"arts}}\\
        {MZ 20 V\beschr{Sperrventil r\"uckw\"arts}}\\
        {MZ 15-19 V\beschr{Niederhalteraufnahmen r\"uckw\"arts}}\\
        {MZ 14 V\beschr{Niederhalteraufnahme r\"uckw\"arts}}\\
        {MZ 13 V\beschr{Klemmeinheit r\"uckw\"arts}}\\
        {M4 \& M5 V\beschr{B\"ugel M4 \& M5 r\"uckw\"arts}}\\
        {M3 \& M6 V\beschr{B\"ugel M3 \& M6 r\"uckw\"arts}}\\
        {M1 \& M2 V\beschr{B\"ugel M1 \& M2 r\"uckw\"arts}}\\
        {MZ 12 V\beschr{Spanner Innenblech r\"uckw\"arts}}\\};
        \foreach \i [remember=\i as \j (initially 1)] in {2, ..., 12}
        \draw[pfeil] (D-\j-1)--(D-\i-1);


        %   Bauteilentnahme
    \matrix (E) [below=5mm of D.south]{
        {Frg 1\beschr{Freigabe Einfahrt Bauteilentnahme}}\\
        {MZ 11 V\beschr{Sauger ein}}\\
        {Frg 2\beschr{Freigabe Ausfahrt Bauteilentnahme}}\\};
          \foreach \i [remember=\i as \j (initially 1)] in {2, ..., 3}
        \draw[pfeil] (E-\j-1)--(E-\i-1);

\draw[pfeil] (A-3-1)--(B-1-1);
\draw[pfeil] (B-10-1)--(C-1-1);
\draw[pfeil] (C-4-1)--([yshift=-5mm]C.south)-| ([shift={(-5mm,5mm)}]D.north west) -| (D-1-1);
\draw[pfeil] (D-12-1)--(E-1-1);

\end{tikzpicture}
\caption{Prozessablauf}
\label{abb:Prozessablauf}
\end{figure}

\end{document}

enter image description here

David Carlisle
  • 757,742
Ignasi
  • 136,588