流程图节点未对齐

流程图节点未对齐

我想制作一个流程图,第一行宽度与第二行宽度相同,但略低于第一行。我无法做到这一点,实际上我不知道如何解决这个问题。

如果有人能帮忙,我将不胜感激。以下是 LaTeX 代码:

\documentclass[10pt,a4paper]{article} 

\usepackage[hmargin=1cm,vmargin=1cm]{geometry}
\renewcommand{\rmdefault}{bch} 

\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage{tikz} 
\usetikzlibrary{
arrows,decorations.pathmorphing,
backgrounds,fit,positioning,shapes.symbols,chains}
\usepackage{verbatim}
\usepackage[active,tightpage,floats]{preview}
\setlength\PreviewBorder{5pt}%

\begin{document}

\begin{figure}[h]

\centering
\begin{tikzpicture}
[node distance = 1cm, auto,font=\footnotesize,
every node/.style={node distance=3cm},
comment/.style={
rectangle, 
inner sep= 5pt, 
text width=4cm, 
node distance=0.25cm, 
font=\scriptsize\sffamily},
force/.style={rectangle, 
draw, 
fill=black!10, 
inner sep=5pt, 
text width=4cm,  
text badly centered, 
minimum height=1.2cm,    
font=\bfseries\footnotesize\sffamily},
forcea/.style={rectangle, 
draw, fill=black!10, 
inner sep=5pt, 
text width=15cm, 
text badly centered,    
minimum height=1.2cm, 
font=\bfseries\footnotesize\sffamily},
forceb/.style={rectangle, draw, fill=black!10, inner sep=5pt, text width=10cm, text badly centered, minimum height=1.2cm,  font=\bfseries\footnotesize\sffamily}] 

\node [forcea] (numericalsimulation) {Numerical simulation of turbomachinery};
\node [forceb, below of=numericalsimulation] (multiplerf) {Fluid zones with multiple rotating frames};
\node [force, left=1cm of multiplerf] (singlerf) {rotational periodic in a single fluid zone};
\node [force, below of = singlerf] (steady) {steady approach};
\node [force, right=1cm of steady] (unsteady) {unsteady};
\node [force, below of = steady] (mrf) {MRF/frozen rotor};
\node [force, right=1cm of mrf] (mpl) {Mixing plane};
\node [force, right=1cm of mpl] (smm) {Sliding mesh};
\node [force, left=1cm of mrf] (rrf) {RRF};

\node [comment, below=0.25 of mrf] (comment-mrf){
(-) relative movement between fluid zones \\
(-) improper for rotor-stator interaction (mixed-out approach)};

\node [comment, below=0.25 of mpl] {
(-) relative movement between fluid zones \\
(-) improper for rotor-stator interaction (mixed-out approach)};

\node [comment, below=0.25 of smm] {
(-) unsteady approach \\
(-) for transient rotor-stator interactions};

\node [comment, below=0.25 of rrf]{
(-) Fluid Zones with constant angular speed \\
(-) One impeller channel need be modeled\\
(-) only in absence of stators or volute};

\draw [->] (numericalsimulation) -- (multiplerf);
\draw [->] (numericalsimulation) -- (singlerf);
\draw [->] (multiplerf) -- (steady);
\draw [->] (multiplerf) -- (unsteady);
\draw [->] (steady) -- (mpl);
\draw [->] (steady) -- (mrf);
\draw [->] (unsteady) -- (smm);
\draw [->] (singlerf) -- (rrf);

\end{tikzpicture} 
\end{figure}

\end{document}

答案1

我不确定这是否是您所期望实现的:

\documentclass[10pt,a4paper]{article} 

\usepackage[hmargin=1cm,vmargin=1cm]{geometry}
\renewcommand{\rmdefault}{bch} 

\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage{tikz} 
\usetikzlibrary{
arrows,decorations.pathmorphing,
backgrounds,fit,positioning,shapes.symbols,chains}
\usepackage{verbatim}
\usepackage[active,tightpage,floats]{preview}
\setlength\PreviewBorder{5pt}%

\begin{document}

\begin{figure}
\begin{tikzpicture}
[node distance = 1cm, auto,font=\footnotesize,
every node/.style={node distance=3cm,inner sep=0pt},
comment/.style={
rectangle, 
inner sep= 5pt, 
text width=4cm, 
font=\scriptsize\sffamily},
force/.style={rectangle, 
draw, 
fill=black!10, 
text width=4cm,  
text badly centered, 
minimum height=1.2cm,    
font=\bfseries\footnotesize\sffamily},
forcea/.style={rectangle, 
draw, fill=black!10, 
text width=15cm, 
text badly centered,    
minimum height=1.2cm, 
font=\bfseries\footnotesize\sffamily},
forceb/.style={rectangle, draw, fill=black!10, text width=10cm, text badly centered, minimum height=1.2cm,  font=\bfseries\footnotesize\sffamily}] 

\node [forcea] (numericalsimulation) {Numerical simulation of turbomachinery};
\node [forceb, below of=numericalsimulation,xshift=2.5cm] (multiplerf) {Fluid zones with multiple rotating frames};
\node [force, below of = numericalsimulation,xshift=-5.5cm] (singlerf) {rotational periodic in a single fluid zone};
\node [force, below of = multiplerf,xshift=-3cm] (steady) {steady approach};
\node [force, below of = multiplerf,xshift=3cm] (unsteady) {unsteady};
\node [force, below of = steady,xshift=-2.5cm] (mrf) {MRF/frozen rotor};
\node [force, right=1cm of mrf] (mpl) {Mixing plane};
\node [force, right=1cm of mpl] (smm) {Sliding mesh};
\node [force, left=1cm of mrf] (rrf) {RRF};

\node [comment, below=0.25 of mrf] (comment-mrf){
(-) relative movement between fluid zones \\
(-) improper for rotor-stator interaction (mixed-out approach)};

\node [comment, below=0.25 of mpl] {
(-) relative movement between fluid zones \\
(-) improper for rotor-stator interaction (mixed-out approach)};

\node [comment, below=0.25 of smm] {
(-) unsteady approach \\
(-) for transient rotor-stator interactions};

\node [comment, below=0.25 of rrf]{
(-) Fluid Zones with constant angular speed \\
(-) One impeller channel need be modeled\\
(-) only in absence of stators or volute};

\draw [->] (numericalsimulation) -- (multiplerf);
\draw [->] (numericalsimulation) -- (singlerf);
\draw [->] (multiplerf) -- (steady);
\draw [->] (multiplerf) -- (unsteady);
\draw [->] (steady) -- (mpl);
\draw [->] (steady) -- (mrf);
\draw [->] (unsteady) -- (smm);
\draw [->] (singlerf) -- (rrf);

\end{tikzpicture} 
\end{figure}

\end{document}

在此处输入图片描述

我只是将其设置inner sep为非0pt注释节点,然后用来xshift固定子节点的水平位置。

相关内容