设置图表中矩形的最大宽度

设置图表中矩形的最大宽度

我正在尝试绘制如下图所示的图表:

所需图表

我的主要问题是我不知道如何设置矩形的最大宽度,也不知道如何复制 \Delta t 周围的“重做”符号。

我的代码是:

\documentclass[t]{beamer}

\usepackage{tikz}
\usetikzlibrary{shapes.geometric, arrows}
\tikzstyle{block} = [rectangle, draw, minimum height = 1cm]
\tikzstyle{line} = [draw, -latex']

\begin{document}
\begin{frame}{Model}
    \centering
    \begin{tikzpicture}
    \node [block] (load) {Load macro-particles};
    \node [block, below of=load] (step1) {Integration of equations of motion, moving particles};
    \node [below of=step1] (evol) {$\Delta t$};
    \node [block, right of=evol] (step2) {Weighting};
    \node [block, below of=evol] (step3) {Integration of field equations on grid};
    \node [block, left of=evol] (step4) {Weighting};
    \path[line] (load) -- (step1);
    \draw (step1) |- (step2);
    \draw (step2) |- (step3);
    \draw (step3) |- (step4);
    \end{tikzpicture}
\end{frame}
\end{document}

我的图表看起来像这样,我猜它会被适当的宽度所固定:

我的

答案1

这是一种方法。没有,maximum width但您可以选择text width以获得有效的最大宽度。我还切换到使用positioning进行节点定位,arrows.meta而不是arrows,去掉了\tikzstyle命令,并添加了缺失的线和弧。

\documentclass[t]{beamer}

\usepackage{tikz}
\usetikzlibrary{arrows.meta,bending,positioning,shapes.geometric}

\begin{document}
\begin{frame}{Model}
\centering
\begin{tikzpicture}[block/.style={rectangle, draw, minimum height = 1cm,
        text width=4.2cm,align=center},
        line/.style={draw, -Latex},node distance=2em]
    \node [block] (load) {Load macro-particles};
    \node [block, below=1em of load] (step1) {Integration of equations of motion, moving particles};
    \node [below=of step1] (evol) {$\Delta t$};
    \node [block, right=of evol] (step2) {Weighting};
    \node [block, below=of evol] (step3) {Integration of field equations on grid};
    \node [block, left=of evol] (step4) {Weighting};
    \path[line] (load) -- (step1);
    \draw (step1) -| (step2) |- (step3) -| (step4) |- (step1);
    \draw[thick,-{Stealth[bend]}] 
    (evol.center) ++ (45:1.5em) arc[start angle=45,end angle=-225,radius=1.5em];
\end{tikzpicture}
\end{frame}
\end{document}

在此处输入图片描述

相关内容