Soit l'organigramme ci-dessous (trouvé je ne sais plus où et réalisé avec TikZ).

Comment obtenir un alignement vertical de nœuds à gauche (Pôle adm. et finance ; Air Algérie Catering) ou à droite (les trois cases « Division ») selon le cas ?

Car le problème est que les coordonnées (x,y) se basent sur le centre du nœud (ce qui facilite bien les choses, avouons-le).

Ouvrir dans l'éditeur Overleaf
\documentclass{minimal}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\begin{scope}[xscale=2,yscale=1.5]
% description et nommage des noeuds 
\node (AA) at (0,6) [rectangle,draw] {\begin{tabular}{c}Air Algérie\\SPA\end{tabular} };
\node (PAF) at (-1,5) [rectangle,draw] {\begin{tabular}{c}P\^ole \\Administration\\et Finance\end{tabular}};
\node (PO) at (1,5) [rectangle,draw] {\begin{tabular}{c}P\^ole \\Op\'eration\end{tabular}};
\node (DC) at (2,4) [rectangle,draw] {\begin{tabular}{c}Division \\Commerciale\end{tabular}};
\node (DP) at (2,3) [rectangle,draw] {\begin{tabular}{c}Division \\Production\end{tabular}};
\node (DCE) at (2,2) [rectangle,draw] {\begin{tabular}{c}Division \\Commandement\\d'exploitation\end{tabular}};
\node (AAC) at (-1.5,0.5) [rectangle,draw,dashed] {\begin{tabular}{c}Air Algérie\\Catering\end{tabular} };
\node (AAH) at (0,0.5) [rectangle,draw,dashed] {\begin{tabular}{c}Air Algérie\\Handing\end{tabular} };
\node (AAM) at (1.5,0.5) [rectangle,draw,dashed] {\begin{tabular}{c}Air Algérie\\Maintenance\end{tabular} };
% description des arêtes
% -- arête rectiligne entre les noeuds nommés
\draw (AA) -- (AAH);
\draw (PAF) -- (PO);
% |- départ vertical arrivée horizontale
\draw (PO) |- (DC);
\draw (PO) |- (DP);
\draw (PO) |- (DCE);
% -| départ horizontal (du noeud de coordonnée (0,1)) arrivée verticale
\draw (0,1) -| (AAC);
\draw (0,1) -| (AAM);
\end{scope}
\end{tikzpicture}
\end{document}

Posée 26 Mai '20, 09:54

fred02840's gravatar image

fred02840
4.2k17154187
Taux d'acceptation : 16%

Modifiée 26 Mai '20, 18:18

Pathe's gravatar image

Pathe ♦♦
7.4k28196245

1

Jettes un coup d'oeil à \usetikzlibrary{positioning}

(26 Mai '20, 10:53) samcarter samcarter's gravatar image
1

Pour les nœuds a droite: \node (DC) at (1.5,4) [rectangle,draw,anchor=west] {\begin{tabular}{c}Division \\Commerciale\end{tabular}}; \node (DP) at (1.5,3) [rectangle,draw,anchor=west] {\begin{tabular}{c}Division \\Production\end{tabular}}; \node (DCE) at (1.5,2) [rectangle,draw,anchor=west] {\begin{tabular}{c}Division \\Commandement\\d'exploitation\end{tabular}};

(26 Mai '20, 10:54) samcarter samcarter's gravatar image
1

Les tableaux sont très encombrants. On lieu on peut utiliser \node (DCE) at (1.5,2) [rectangle,draw,anchor=west,text width=3cm,align=center] {Division \\Commandement\\d'exploitation};

(26 Mai '20, 10:56) samcarter samcarter's gravatar image

Voici une solution :

Ouvrir dans l'éditeur Overleaf
\documentclass{minimal}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\begin{scope}[xscale=2,yscale=1.5]
% description et nommage des noeuds 
\node (AA) at (0,6) [rectangle,draw] {\begin{tabular}{c}Air Algérie\\SPA\end{tabular} };
\node (PAF) at (-1,5) [rectangle,draw,anchor=east] {\begin{tabular}{c}P\^ole \\Administration\\et Finance\end{tabular}};
\node (PO) at (1,5) [rectangle,draw] {\begin{tabular}{c}P\^ole \\Op\'eration\end{tabular}};
\node (DC) at (2,4) [rectangle,draw,anchor=west] {\begin{tabular}{c}Division \\Commerciale\end{tabular}};
\node (DP) at (2,3) [rectangle,draw,anchor=west] {\begin{tabular}{c}Division \\Production\end{tabular}};
\node (DCE) at (2,2) [rectangle,draw,anchor=west] {\begin{tabular}{c}Division \\Commandement\\d'exploitation\end{tabular}};
\node (AAC) at (-1.5,0.5) [rectangle,draw,dashed,anchor=center] {\begin{tabular}{c}Air Algérie\\Catering\end{tabular} };
\node (AAH) at (0,0.5) [rectangle,draw,dashed] {\begin{tabular}{c}Air Algérie\\Handing\end{tabular} };
\node (AAM) at (1.5,0.5) [rectangle,draw,dashed] {\begin{tabular}{c}Air Algérie\\Maintenance\end{tabular} };
% description des arêtes
% -- arête rectiligne entre les noeuds nommés
\draw (AA) -- (AAH);
\draw (PAF) -- (PO);
% |- départ vertical arrivée horizontale
\draw (PO) |- (DC);
\draw (PO) |- (DP);
\draw (PO) |- (DCE);
% -| départ horizontal (du noeud de coordonnée (0,1)) arrivée verticale
\draw (0,1) -| (AAC);
\draw (0,1) -| (AAM);
\end{scope}
\end{tikzpicture}
\end{document}

... dont le rendu est :

Lien permanent

Publiée 26 Mai '20, 11:45

Hugues's gravatar image

Hugues
772916
Taux d'acceptation : 25%

Modifiée 26 Mai '20, 18:34

Pathe's gravatar image

Pathe ♦♦
7.4k28196245

@samcarter et @hugues. Le point d'ancrage : j'aurais dû y penser… Je l'avais retrouvé dans TikZ pour l'impatient et le manuel de Till Tantau, mais je m'étais figuré qu'on ne l'utilisait que pour fixer les liens entre deux nœuds.

(26 Mai '20, 16:56) fred02840 fred02840's gravatar image

Voici une solution avec \usetikzlibrary{positioning} :

Ouvrir dans l'éditeur Overleaf
\documentclass[border=5mm]{standalone}
\usepackage{tikz}

\usetikzlibrary{positioning}

\begin{document}
\begin{tikzpicture}[
  mynode/.style={ 
    rectangle,
    draw,
    text width=2.5cm,
    align=center,
    anchor=center
  }
]
\begin{scope}[xscale=2]
% description et nommage des noeuds 
\node[mynode] (AA) {Air Algérie\\SPA};
\node[below=of AA] (dummy) {};
\node[mynode,left=of dummy] (PAF)  {P\^ole \\Administration\\et Finance};
\node[mynode,right=of dummy] (PO) {P\^ole \\Op\'eration};
\node[mynode,below right=of PO.center] (DC) {Division \\Commerciale};
\node[mynode,below=0.2cm of DC] (DP) {Division \\Production};
\node[mynode,below=0.2cm of DP] (DCE)  {Division \\Commandement\\d'exploitation};
\node[mynode,dashed, below=7cm of AA] (AAH) {Air Algérie\\Handing};
\node[mynode,dashed, left=of AAH] (AAC) {Air Algérie\\Catering};
\node[mynode,dashed, right=of AAH] (AAM) {Air Algérie\\Maintenance};
%% description des arêtes
%% -- arête rectiligne entre les noeuds nommés
\draw (AA) -- (AAH);
\draw (PAF) -- (PO);
%% |- départ vertical arrivée horizontale
\draw (PO) |- (DC);
\draw (PO) |- (DP);
\draw (PO) |- (DCE);
%% -| départ horizontal (du noeud de coordonnée (0,1)) arrivée verticale
\draw (AAC.north) -- ++(0,0.5) -| (AAM.north);
\end{scope}
\end{tikzpicture}
\end{document}
Lien permanent

Publiée 26 Mai '20, 17:53

samcarter's gravatar image

samcarter
8.2k2817
Taux d'acceptation : 57%

Modifiée 26 Mai '20, 18:35

Pathe's gravatar image

Pathe ♦♦
7.4k28196245

@samcarter. Je n'avais pas vu cette deuxième solution : parfait !

(04 Jui '20, 20:08) fred02840 fred02840's gravatar image
Votre réponse
(dés)activer l'aperçu

Suivre cette question

Par courriel :

Une fois que vous serez enregistré, vous pourrez souscrire à n'importe quelle mise à jour ici

Par flux RSS :

Réponses

Réponses et commentaires

Bases de Markdown

  • *italique* ou _italique_
  • **gras** ou __gras__
  • Lien ::[texte](http://url.com/ "Titre ")
  • Image : ?![alt texte](/path/img.jpg "Titre ")
  • Liste numérotée : 1. Foo 2. Bar
  • Pour ajouter un passage à la ligne, ajoutez deux espaces à l'endroit où vous souhaitez que la ligne commence.
  • Les balises HTML de base sont également prises en charge.