5

I'm unable prevent block 6 from overlapping block 3. Why?

\documentclass[x11names, landscape]{article}
%\documentclass[a4paper]{article}
\usepackage{tikz}

\usetikzlibrary{shapes,arrows,chains,calc}

%%%<

\usepackage{verbatim}

\usepackage[active,tightpage]{preview}

\usetikzlibrary{intersections}

\usepackage[utf8]{inputenc} %----permette l' uso dei caratteri accentati

\usepackage[italian]{babel} %-----permette la sillabazione secondo le regole italiane

\PreviewEnvironment{tikzpicture}

\setlength\PreviewBorder{115mm}% %%%>

\begin{document}

\tikzstyle{block1}    = [rectangle, rounded corners,  minimum width=3cm, minimum height=1cm, text centered, draw, fill=blue!20, text width=6cm]

\tikzstyle{block2}    = [rectangle, rounded corners,  minimum width=3cm, minimum height=1cm, text centered, draw, fill=blue!20, text width=3cm]

\tikzstyle{decision}  = [diamond, minimum width=3cm, minimum height=1cm, text centered, draw, fill=blue!20, text width=2cm]

\tikzstyle{line}      = [draw, -latex']

\begin{tikzpicture}[node distance = 2cm, auto]
% Place nodes
\node [block1] (1) {\textbf{\small Presentazione Istanza}};
\node [block2, below of=1] (2) {Avvio procedimento (comunicazione responsabile)};
\node [block2, below of=2] (3) {verifica documentazione};
\node [block1, right of=3, distance=8 cm] (6) {Istruttoria};
\node [block2, below of=3] (4) {irricevibilità con possibilità di integrazione};
\node [decision, below of=4] (5) {Integrazione effettuata};

\node [decision, below of=6] (7) {soggetto a parere della commissione};

% Draw edges

%    \path [line] (1) -| (4);
%   \path [line] (1) -- (3);
%    \path [line] (3.west)  node [, above,color=black] {NO}  |-
(5);
%($(5.east));

%    \path [line] (3.south)  node [right,below,color=black] {SI}  |-
 (9.east);

%   \path [line] (4.east)  node [right,below,color=black] {SI}  -|
 (8.east);
 %($(9.east)+(30mm,0) );

% \path [line] (4.east)  node [right, above,color=black] {SI}  -|  ($(9.east)+(1em,0)$) -- (9.east);

%\path [line] (6.west)  node [left, above,color=black] {NO}  -|  ($(9.west)+(-2em,0)$) -- (9.west);
% \path [line] (4)->  node [left, ,color=black] {NO} (5);
%    \path [line] (5) -> (6);
%    \path [line] (6) --  node [left, ,color=black] {SI} (8);
%\path [line] (7) -- (8);
%    \path [line] (8) -- (9);

% Find the intersection of the two paths.    %\path [name intersections={of=4to12 and 6to14}];
%\coordinate (S)  at (intersection-1);

% Define a circle around this intersection for the arc.
%\path[name path=circle] (S) circle(2mm);

% Find the intersections of second line and circle.
% \path [name intersections={of=circle and 6to14}];
%\coordinate (I1)  at (intersection-1);
%\coordinate (I2)  at (intersection-2);

% Draw normal line segments, except for portion within circle.
%\draw (6) -- (I2);
%\draw[->] (I1)  -| ([xshift=2cm, yshift=0cm]6.east) |- (14);

% Draw arc at intersection
%\draw () arc (180:0:2mm);
\end{tikzpicture}
\end{document}
5

The distance key that you've used when adding the 6 node,

\node [block1, right of=3, distance=8 cm] (6) {Istruttoria};

is for a different purpose. It is for modifying the look of curved to paths, see section 70.3 of the manual for version 3.0.1a of pgf/TikZ. To change the separation of nodes you want node distance:

\node [block1, right of=3, node distance=8 cm] (6) {Istruttoria};

However, the below of= syntax you've used is considered deprecated, I would suggest that you load the positioning library and use below=of instead. See Difference between "right of=" and "right=of" in PGF/TikZ. You can modify the distance of a given node by saying e.g. below=3cm of. The distance is measured between the edges of the nodes, unless the on grid option is active.

In addition, the arrows library is considered deprecated in favor of arrows.meta, and \tikzstyle{foo}=[...] is considered deprecated in favor of \tikzset{foo/.style={...}, ...}, so consider changing.

Complete code with these changes implemented.

\documentclass[x11names, landscape]{article}
\usepackage{tikz}
\usetikzlibrary{
  shapes,
  arrows.meta, % supersedes arrows
  positioning, % for the =of node syntax
  calc,
  intersections
} 
\usepackage[utf8]{inputenc} %----permette l' uso dei caratteri accentati
\usepackage[italian]{babel} %-----permette la sillabazione secondo le regole italiane

\tikzset{
  block1/.style={rectangle, rounded corners,  minimum width=3cm, minimum height=1cm, text centered, draw, fill=blue!20, text width=6cm},
  block2/.style={block1, text width=3cm}, % if the only difference to block1 is the text width, then it makes sense to use block1 here, instead of repeating all the settings
  decision/.style={diamond, minimum width=3cm, minimum height=1cm, text centered, draw, fill=blue!20, text width=2cm},
  line/.style={draw, -Latex} % the Latex arrow tip is from arrows.meta
}
\begin{document}    
\begin{tikzpicture}[auto] % removed the node distance setting
% Place nodes
\node [block1] (1) {\textbf{\small Presentazione Istanza}};
\node [block2, below=of 1] (2) {Avvio procedimento (comunicazione responsabile)};
\node [block2, below=of 2] (3) {verifica documentazione};
\node [block1, right=3cm of 3] (6) {Istruttoria};
\node [block2, below=of 3] (4) {irricevibilità con possibilità di integrazione};
\node [decision, below=of 4] (5) {Integrazione effettuata};
\node [decision, below=of 6] (7) {soggetto a parere della commissione};
\end{tikzpicture} 
\end{document}

output of above code

  • yes! it works and is very useful. Just a question, I' ve removed parameter landscape, addes 2 or 3 block that were not displayd and there is one blanck page at start. – RenatoP Feb 6 '18 at 11:32
  • 2
    @RenatoP, so far you not accept any of received answers on your 17 questions. Is really no one so good that solve your problem? i doubt in this. for accepting one you only need to click on check mark at the top left side of answer. on this way you say "tank you" to member who provide you the answer, which the best solve your problem. other answer you can up vote for the same reason (ny clicking on up-pen at top left side of answer). – Zarko Feb 6 '18 at 11:51
  • @RenatoP Sounds like the diagram is too large for the page, reduce the distance between nodes, or the size of the nodes. – Torbjørn T. Feb 6 '18 at 12:14
3

This is almost the same as Torbjørn T.'s answer. Small differences are in nodes style definitions and way of nodes placement:

\documentclass[italian,landscape]{article}
%\documentclass[a4paper]{article}
\usepackage[utf8]{inputenc} %----permette l' uso dei caratteri accentati
\usepackage{babel} %-----permette la sillabazione secondo le regole italiane

\usepackage{tikz}
\usetikzlibrary{arrows,
                calc, chains,
                intersections,
                positioning,
                quotes,
                shapes}

\usepackage[active,tightpage]{preview}
\PreviewEnvironment{tikzpicture}
\setlength\PreviewBorder{5mm}

\begin{document}
    \begin{tikzpicture}[
  node distance = 6mm and 8 mm,
   block/.style = {rectangle, rounded corners, draw, fill=blue!20,
                   font=\linespread{0.9}\selectfont,
                   text width=#1, minimum height=1cm, align=center},
   block/.default = 3cm,
decision/.style = {diamond, aspect=1.5, draw, fill=blue!20,
                   text width=#1, minimum height=1cm, align=center,
                   inner xsep=0pt},
decision/.default = 3cm,
    line/.style = {draw, -latex'}
                        ]
% Place nodes
\node (1)  [block=6cm]                 {\textbf{Presentazione Istanza}};
\node (2)  [block, below=of 1]         {Avvio procedimento (comunicazione responsabile)};
\node (3)  [block, below=of 2]         {verifica documentazione};
\node (4)  [block=6cm, right=of 3]     {Istruttoria};
\node (5)  [block, below=of 3]         {irricevibilità con possibilità di integrazione};
%
\node (7)  [decision, below=of 4]      {soggetto a parere della commissione};
\node (6)  [decision, below=of 5]      {Integrazione effettuata};
    \end{tikzpicture}
\end{document}

Enter image description here

  • this is what I'm looking for . really very good. – RenatoP Feb 7 '18 at 7:58
  • 1
    @RenatoP, now you have two answers. now is time to select the best one and accept it (as i explained in one of my previous comments). – Zarko Feb 7 '18 at 8:04

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.