如何在 LaTeX 中绘制流程图

如何在 LaTeX 中绘制流程图

我需要在 LaTeX 中制作此流程图。我使用了 TikZ 包,但我不知道如何绘制此括号和此表格。我也不知道为什么没有绘制最后两个节点之间的箭头。

在此处输入图片描述

    \documentclass{article}
    
     \usepackage[utf8]{inputenc}
    
    \usepackage[francais]{babel}
    
    \usepackage[latin1]{inputenc}
    
    \usepackage[left=1.27cm,right=1.27cm,top=1.3cm,bottom=1.3cm]{geometry}
    % Required packages
    \usepackage{tikz}
    \usetikzlibrary{shapes,positioning}
    \definecolor{blue1}{RGB}{84,141,212}
    \definecolor{blue2}{RGB}{142,180,227}
    \definecolor{yellow1}{RGB}{255,229,153}
    \definecolor{orange1}{RGB}{255,153,0}
    \definecolor{gray1}{RGB}{127,127,127}
    
    \definecolor{gray2}{RGB}{217,217,217}
    
    \begin{document}
     
    \begin{tikzpicture}[font=\small,thick]
     
         
    
    % Start block
    \node[draw, text width=6cm ,text centered,
        minimum width=5cm,fill=blue1,rounded corners,
        minimum height=1cm] (block1) {ETAPES};
      
        \node[draw,
            right =of block1,
        minimum width=4cm,fill=yellow1,rounded corners,
        minimum height=1cm] (block2) {DOCUMENTS};
        \node[draw,
        left =of block1,rounded corners,
        minimum width=4cm,fill=gray1,
        minimum height=1cm] (block3) {ACTEURS};
    %ETAPE 2
    \node[draw,
        below=of block1,
         text width=6cm ,text centered,
        minimum width=5cm,fill=orange1,rounded corners,
        minimum height=1cm
    ] (block4) { Remarque / Déficience };
     
     \node[draw,
        below  =of block3,
        minimum width=3cm,fill=gray2,
        minimum height=1cm
    ] (block5) {  Client };
    %ETAPE 3
    \node[draw,
        below=of block4,
        minimum width=5cm,fill=blue2,rounded corners,
         text width=6cm ,text centered,
        minimum height=1cm
    ] (block6) { Enregistrement de la remarque };
     
     \node[draw,
        below  = 2 cm of block5,
        minimum width=3cm,fill=gray2,
        minimum height=1cm
    ] (block7) {Responsable qualité  };
     \node[draw,
        below  =of block2,
        minimum width=3cm,fill=yellow1,
        minimum height=1cm
    ] (block8) { BDD\_RETOUR\_INFOS\_CLIENTS };
    %ETAPE start
    \node[draw,
        below=of block6,
         text width=6cm ,text centered,
        minimum width=5cm,fill=blue2,rounded corners,
        minimum height=1cm
    ] (block9) { Accusé-Réception de la remarque par mail  };
    
    \node[draw,
        below=of block9,
         text width=6cm ,text centered,
        minimum width=5cm,fill=blue2,rounded corners,
        minimum height=2cm
    ] (block10) { Définition d’un plan d’action si nécessaire : ouverture de CAPA };
    
    \node[draw,
        below=of block10,
         text width=6cm ,text centered,
        minimum width=5cm,fill=blue2,rounded corners,
        minimum height=1.5cm
    ] (block11) { Communication des résultats d’analyse au client  };
    
    \node[draw,
        below=of block11,
        minimum width=5cm,text centered,fill=blue2,rounded corners,
        minimum height=1cm
    ] (block12) {  Mise en œuvre et suivi du plan d’action };
     \node[draw,
        below=of block12,
        text width=6cm ,text centered,
        maximum  width=5cm,fill=blue2,rounded corners,
        minimum height=2cm
    ] (block19) { Communication (au client) des résultats des actions entreprises et prise en compte de ses remarques };
     %ETAPE acteur 
    \node[draw,
        left =of block10,
        minimum width=3cm,fill=gray2,
        minimum height=1cm
    ] (block13) { Equipe + Responsable qualité  };
     \node[draw,
        below=3.5cm of block13,fill=gray2,
        minimum width=3cm,
        minimum height=1cm
    ] (block14) { Responsable qualité  };
    %ETAPE DOCUMENTS
    \node[draw,
       right=of block10,
        minimum width=3cm,fill=yellow1,
        minimum height=1cm
    ] (block15) { INS\_PLAN\_ACTION };
    \node[draw,
        right=of block12,
        minimum width=3cm,fill=yellow1,
        minimum height=1cm
    ] (block16) { INS\_PLAN\_ACTION  };
    \node[coordinate,left=1.35cm of block14] (block20) {};
     \node[coordinate,left=1.35cm of block7] (block21) {};
     % Arrows
      
    \draw[-latex] (block1) edge (block4)
        (block4) edge (block6)
        (block6) edge (block9);
        \draw[-latex] 
           (block9) edge (block10);
           \draw[-latex] 
           (block10) edge (block11);
(block11) edge (block12);
(block12) edge (block19);
    
    % Arrows
    
    
     
      
    \end{tikzpicture}
     
    \end{document}

答案1

编辑(1):

  • 现在 MWE 重现您在答案中显示的图像。
  • 既然您的答案指出它包含最终代码,我想知道您是否还对其他答案感兴趣?
  • 无论如何,在下面的 MWE 中与您的代码相比,做了以下更改:
    • 节点形状具有通用的样式定义
    • 主分支中的节点按链式组织(通过使用chains库并使用join=by ...宏作为节点之间的箭头

编辑(2): 现在我发现我只显示了所需的图像,但没有显示 MWE,因此无法显示。现在已更正。完整的 MWE(对那些感兴趣的人而言)是:

\documentclass{article}
\usepackage[hmargin=1.27cm,top=1.3cm,bottom=1.3cm]{geometry}

\usepackage[francais]{babel}

% Required packages
\usepackage{tikz}
\usetikzlibrary{arrows.meta,
                calc, chains,
                decorations.pathreplacing,%
                    calligraphy,% had to be after decorations.pathreplacing
                positioning,
                shapes}
\definecolor{blue1}{RGB}{84,141,212}
\definecolor{blue2}{RGB}{142,180,227}
\definecolor{yellow1}{RGB}{255,229,153}
\definecolor{orange1}{RGB}{255,153,0}
\definecolor{gray1}{RGB}{127,127,127}

\definecolor{gray2}{RGB}{217,217,217}

\begin{document}
    \begin{tikzpicture}[
node distance = 8mm and 12mm,
  start chain = A going below,
   arr/.style = {-{Triangle[length=3mm, width=6mm]}, line width= 2mm,
                 draw=blue2, shorten > = 1mm, shorten <=1mm},
  base/.style = {draw, semithick, minimum height=12mm, text width=44mm,
                 align=flush center},
BC/.style args = {#1/#2/#3}{
        decorate,
        decoration={calligraphic brace, amplitude=6pt,
        pre =moveto, pre  length=1pt,
        post=moveto, post length=1pt,
        raise=#1,
              #2},% for mirroring of brace
        very thick,
        pen colour={#3} },
     M/.style = {base, fill=#1,
                 tape, 
                 tape bend top=none, tape bend height=2mm, tape bend bottom=in and out},
     N/.style = {base, rounded corners, fill=#1}
                        ]
% main branch
    \begin{scope}[nodes={on chain=A, join=by arr},
                  N/.default=blue2]
\node [N=blue1]     {ETAPES};                   % A-1
\node [N=orange1]   {Remarque / Déficience};    % A-2
\node [N]   {Enregistrement de la remarque};
\node [N]   {Accusé-Réception de la remarque par mail};
\node [N]   {Définition d’un plan d’action si nécessaire: ouverture de CAPA};
\node [N]   {Communication des résultats d’analyse au client};
\node [N]   {Mise en œuvre et suivi du plan d’action};
\node [N]   {Communication (au client) des résultats des actions entreprises et prise en compte de ses remarques};
\node [N]   {Réponse aux questions complémentaires par mail et téléphone};
    \end{scope}
% nodes on the left side of the main branch
\node [N=gray1,
       left=of A-1]     (B-1)   {ACTEURS};
\coordinate (aux1) at ($(A-3.south west)!0.5!(A-4.north west)$);
\node [N=gray2,
      left=of aux1]     (B-2)   {Client};
\node [N=gray1,
       left=of A-5]     (B-2)   {Responsable qualité};
\draw[BC=4mm/mirror/gray]   (A-3.west) -- (A-4.west);

\coordinate (aux2) at ($(A-6.west)!0.5!(A-9.west)$);
\node [N=gray1,
      left=of aux2]     (B-3)   {Client};
\draw[BC=4mm/mirror/gray]   (A-6.west) -- (A-9.west);
% nodes on the right side of thr main branch
    \begin{scope}[M/.default=yellow1]
\node[N=yellow1, 
         right=of A-1]      (C-1)   {DOCUMENTS};
\node[M, text width=55mm,
         at={(C-1 |- A-3)}] (C-2)   {BDD\_RETOUR\_INFOS\_CLIENTS};
\node[M, right=of A-5]      (C-3)   {INS\_PLAN\_ACTION};
\node[M, right=of A-7]      (C-4)   {INS\_PLAN\_ACTION};
    \end{scope}
    \end{tikzpicture}
\end{document}

在此处输入图片描述

答案2

this is the final code 


   \documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[francais]{babel}
\usepackage[left=1.27cm,right=1.27cm,top=1.3cm,bottom=1.3cm]{geometry}
% Required packages
\usepackage{tikz}
\usetikzlibrary{arrows.meta}
\usetikzlibrary{shapes,arrows,positioning}
\usetikzlibrary{decorations.pathreplacing,calligraphy}
\definecolor{blue1}{RGB}{84,141,212}
\definecolor{blue2}{RGB}{142,180,227}
\definecolor{blue3}{RGB}{0,176,240}
\definecolor{yellow1}{RGB}{255,229,153}
\definecolor{orange1}{RGB}{255,153,0}
\definecolor{gray1}{RGB}{127,127,127}
\definecolor{gray2}{RGB}{217,217,217}
\begin{document}
    
    \begin{tikzpicture}[font=\small,thick]
        
        % Start block
        %ETAPE start
        
        \node[draw, text width=6cm ,text centered,
        minimum width=5cm,fill=blue1,rounded corners,
        minimum height=1cm] (block1) {\textbf{ETAPES}};
        \node[draw,
        below=0.5cm of block1,
        text width=6cm ,text centered,
        minimum width=5cm,fill=orange1,rounded corners,
        minimum height=1cm
        ] (block4) { Remarque / Déficience };
        \node[draw,
        below=of block4,
        minimum width=5cm,fill=blue2,rounded corners,
        text width=6cm ,text centered,
        minimum height=1cm
        ] (block6) { Enregistrement de la remarque };
        
        \node[draw,
        below=of block6,
        text width=6cm ,text centered,
        minimum width=5cm,fill=blue2,rounded corners,
        minimum height=1cm
        ] (block9) { Accusé-Réception de la remarque par mail  };
        
        \node[draw,
        below=of block9,
        text width=6cm ,text centered,
        minimum width=5cm,fill=blue2,rounded corners,
        minimum height=2cm
        ] (block10) { Définition d’un plan d’action si nécessaire : ouverture de CAPA };
        
        \node[draw,
        below=of block10,
        text width=6cm ,text centered,
        minimum width=5cm,fill=blue2,rounded corners,
        minimum height=1.5cm
        ] (block11) { Communication des résultats d’analyse au client  };
        
        \node[draw,
        below=of block11,
        minimum width=5cm,text centered,fill=blue2,rounded corners,
        minimum height=1cm
        ] (block12) {  Mise en œuvre et suivi du plan d’action };
        \node[draw,
        below=of block12,
        text width=6cm ,text centered,
        minimum  width=5cm,fill=blue2,rounded corners,
        minimum height=2cm] (block19) { Communication (au client) des résultats des actions entreprises et prise en compte de ses remarques };
        \node[draw,
        below=of block19,
        text width=6cm ,text centered,
        minimum  width=5cm,fill=blue2,rounded corners,
        minimum height=2cm] (blockf) { Réponse aux questions complémentaires par mail et téléphone   };
        %ETAPE acteur 
        
        \node[draw,
        left =of block1,rounded corners,
        minimum width=4cm,fill=gray1,
        minimum height=1cm] (block3) {\textbf{ACTEURS}};
        
        \node[draw,
        below  =0.5of block3,
        minimum width=3cm,fill=gray2,
        minimum height=1cm
        ] (block5) {  Client };
        \node[draw,
        below  = 2 cm of block5,
        minimum width=3cm,fill=gray2,
        minimum height=1cm
        ] (block7) {Responsable qualité  };
        
        \node[draw,
        left =of block10,
        minimum width=3cm,fill=gray2,
        minimum height=1cm
        ] (block13) { Equipe + Responsable qualité  };
        \node[draw,
        below  = 5.7cm of block13,fill=gray2,
        minimum width=3cm,
        minimum height=1cm
        ] (block14) { Responsable qualité  };
        %ETAPE DOCUMENTS
        \node[draw,
        right =2cm of block1,
        minimum width=4cm,fill=yellow1,rounded corners,
        minimum height=1cm] (block2) {\textbf{DOCUMENTS}};
        
        \node[draw,
        right=1.5cm of block6,
        minimum width=3cm,fill=yellow1,tape, tape bend top=none,tape bend height=2mm,   tape bend bottom=in and out,
        minimum height=2cm
        ] (block8) { BDD\_RETOUR\_INFOS\_CLIENTS };
        \node[draw,
        right=2cm of block10,text width=4cm ,text centered,
        minimum width=3cm,fill=yellow1,tape, tape bend top=none,tape bend height=2mm,   tape bend bottom=in and out,
        minimum height=2cm
        ] (block15) { INS\_PLAN\_ACTION };
        \node[draw,
        right=2.2cm of block12, text width=4cm ,text centered,
        minimum width=3cm,fill=yellow1,tape, tape bend top=none,tape bend height=2mm,   tape bend bottom=in and out,
        minimum height=2cm
        ] (block16) { INS\_PLAN\_ACTION  };
        
        
        % Arrows
        
        \draw[blue3 ,-Triangle ,line width=5pt] 
        (block4) edge (block6)
        (block6) edge (block9);
        \draw[blue3 ,-Triangle ,line width=5pt]
        (block9) edge (block10);
        \draw[blue3 ,-Triangle ,line width=5pt] 
        (block10) edge (block11)
        (block11) edge (block12)
        (block12) edge (block19)
        (block19) edge (blockf);
        
        %% brace décoration
        \draw[decorate,gray1,decoration={brace,amplitude=18pt,mirror,raise=4pt},xshift=-4em] (block6.west)--(block9.west)node[midway,left,xshift=-4em]{};
        \draw[decorate,gray1,decoration={brace,amplitude=22pt,mirror,raise=4pt},xshift=-4em] (block11.west)--(blockf.west)node[midway,left,xshift=-4em]{};
        
        
    \end{tikzpicture}
    
\end{document}

相关内容