расстояния в TikZ

расстояния в TikZ

Я не знаю, какие числа нужно установить, чтобы этот код выглядел красиво.

\documentclass{article}
\usepackage{times}
\usepackage[latin1]{inputenc}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows}
\begin{document}
\pagestyle{empty}


% Define block styles
\tikzstyle{decision} = [diamond, draw, fill=white!20, 
text width=4.5em, text badly centered, node distance=3cm, inner sep=0pt]
    \tikzstyle{block} = [rectangle, draw, fill=white!20, 
text width=5em, text centered, rounded corners, minimum height=4em]
    \tikzstyle{line} = [draw, -latex']
    \tikzstyle{cloud} = [draw, ellipse,fill=white!20, node distance=3cm,
minimum height=2em]

    \begin{tikzpicture}[node distance = 2cm, auto]
% Place nodes
    \node [block] (seg) {seg};
    \node [cloud, left of=seg] (ct1) {ct};
%\node [cloud, right of=init] (system) {system};
    \node [block, below of=seg] (smoo) {smoo};
    \node [block, below of=seg] (vol) {vol};
%\node [block, left of=evaluate, node distance=5cm] (update) {update model};
    \node [block, below of=vol] (drr) {drr};
    \node [block, below of=drr] (acqu) {acqu};
    \node [cloud, left of=acqu] (target1) {target};    
    \node [block, below of=acqu] (comp) {comp}; 
    \node [block, below of=comp] (trans) {trans};
    \node [decision, below of=trans] (3d) {3d}; 
    \node [block, below of=3d, node distance=3cm] (cloud) {cloud};     
    \node [block, below of=cloud] (estab) {estab};   
    \node [block, below of=estab] (meas) {meas};
    \node [block, left of=meas] (meas2) {meas}; 
    \node [cloud, below of=meas] (ct2) {ct set};                        
    \node [cloud, below of=meas2] (target2) {target};      
%\node [block, below of=decide, node distance=3cm] (stop) {stop};
% Draw edges
\path [line] (ct1) -- (seg);
\path [line] (seg) -- (smoo);
\path [line] (smoo) -- (vol);
\path [line] (vol) -- (drr);
\path [line] (drr) -- (acqu);
\path [line] (acqu) -- (comp);
\path [line] (comp) -- (trans);
\path [line] (trans) -- (3d);
\path [line] (cloud) -- (3d);
\path [line] (estab) -- (cloud);
\path [line] (meas) -- (estab);
\path [line] (ct2) -- (meas);
\path [line] (target2) -- (meas2);
\path [line] (meas2) |- (cloud);
\path [line] (target2) -- (meas2);
\path [line] (target1) -- (acqu);


\end{tikzpicture}


\end{document}

решение1

Это одно из возможных решений, при котором предложение разбивает одну длинную нисходящую блок-схему, превышающую длину страницы, на 4 сегмента, распространяющихся горизонтально.

Основная хитрость заключается в том, чтобы перейти below of = xxв right = xx cm of yyточку, которую вы хотите разорвать, а затем использовать, например, draw[line] (acqu.east) -- ++(1cm,0) |- (comp.west); что означает рисование от акв.востока на 1 см вправо, затем вертикально вверх и повороты горизонтально на св.запад.

введите описание изображения здесь

Код

\documentclass{article}
\usepackage[margin=1in]{geometry}
\usepackage{times}
\usepackage[latin1]{inputenc}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows,positioning}
\begin{document}
\pagestyle{empty}


% Define block styles
\tikzstyle{decision} = [diamond, draw, fill=white!20, 
text width=4.5em, text badly centered, node distance=2cm, inner sep=0pt]
    \tikzstyle{block} = [rectangle, draw, fill=white!20, 
text width=5em, text centered, rounded corners, minimum height=4em]
    \tikzstyle{line} = [draw, -latex']
    \tikzstyle{cloud} = [draw, ellipse,fill=white!20, node distance=2cm,
minimum height=2em]

    \begin{tikzpicture}[node distance = 2cm, auto]
% Place nodes
    \node [block] (seg) {seg};
    \node [cloud, left of=seg] (ct1) {ct};
%\node [cloud, right of=init] (system) {system};
    \node [block, below of=seg] (smoo) {smoo};
    \node [block, below of=smoo] (vol) {vol};
%\node [block, left of=evaluate, node distance=5cm] (update) {update model};
    \node [block, below of=vol] (drr) {drr};
    \node [block, below of=drr] (acqu) {acqu};
    \node [cloud, left of=acqu] (target1) {target};    
    \node [block, right =2cm of seg] (comp) {comp}; 
    \node [block, below of=comp] (trans) {trans};
    \node [decision, below of=trans] (3d) {3d}; 
    \node [block, right = 2cm of comp] (cloud) {cloud};     
    \node [block, below of=cloud] (estab) {estab};   
    \node [block, below of=estab] (meas) {meas};
    \node [block, right = 1cm of meas] (meas2) {meas}; 
    \node [cloud, below of=meas] (ct2) {ct set};                        
    \node [cloud, below of=meas2] (target2) {target};      
%\node [block, below of=decide, node distance=3cm] (stop) {stop};
% Draw edges
\path [line] (ct1) -- (seg);
\path [line] (seg) -- (smoo);
\path [line] (smoo) -- (vol);
\path [line] (vol) -- (drr);
\path [line] (drr) -- (acqu);
\path [line] (acqu.east) -- ++(1cm,0) |- (comp.west);
\path [line] (comp) -- (trans);
\path [line] (trans) -- (3d);
\path [line] (cloud.west) -- ++ (-1cm,0) |- (3d.east);
\path [line] (estab) -- (cloud);
\path [line] (meas) -- (estab);
\path [line] (ct2) -- (meas);
\path [line] (target2) -- (meas2);
\path [line] (meas2) |- (cloud);
\path [line] (target2) -- (meas2);
\path [line] (target1) -- (acqu);
\end{tikzpicture}
\end{document}

Связанный контент