为什么块 6 与块 3 重叠?

为什么块 6 与块 3 重叠?

我无法阻止块 6 与块 3 重叠。为什么?

\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}

答案1

distance添加节点时使用的密钥6

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

用于不同的目的。它用于修改曲线to路径的外观,请参阅 /TikZ 3.0.1a 版手册第 70.3 节pgf。要更改您想要的节点分离node distance

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

但是,below of=您使用的语法已被弃用,我建议您加载positioning库并使用below=of。请参阅PGF/TikZ 中“right of=”和“right=of”之间的区别。您可以修改给定节点的距离,例如。除非该选项处于活动状态,below=3cm of否则距离是在节点边缘之间测量的。on grid

此外,该arrows库被视为已弃用并支持arrows.meta,并且\tikzstyle{foo}=[...]被视为已弃用并支持\tikzset{foo/.style={...}, ...},因此请考虑更改。

实施这些更改后的完整代码。

\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}

上述代码的输出

答案2

这几乎与Torbjørn T.的答案。节点样式定义和节点放置方式略有不同:

\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}

在此处输入图片描述

相关内容