2
% flowchart drawing
\documentclass[a4paper, 12pt]{report}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{float}



\usepackage{tikz}
\usetikzlibrary{shapes.geometric, arrows}
\tikzstyle{rect} = [rectangle, rounded corners, minimum width=3cm, minimum height=1cm,text centered, draw=black, fill=white]
\tikzstyle{arrow} = [thick,->,>=stealth]
\usetikzlibrary{shapes.multipart}

\begin{document}
\begin{figure}[H]
    \centering
    \begin{tikzpicture}[node distance=2cm]
        \node (one) [rect] {Input excitation $p_{i+1}$ };
        \node (two) [rect, below of=one] {Calculate displacement response: $x_{i+1} = x_{i} + \Delta t \mathit{x1}_{i} +  \frac{\Delta t^2}{2} \mathit{x2}_{i}$ };
        \node(three)[rect, below of=two]{Impose $x_{i+1}$ on test structure};
        \node(four)[rect, below of=three]{Measure restoring forces from $\mathit{fs}_{i+1}$ from the test  structure}; 
        \node(five)[rect, below of=four]{Calculate: $\mathit{x2}_{i+1} = \left[m + \frac{\mathit{\Delta t}}{2} c\right]^{-1} \left[p_{i+1} - \mathit{fs}_{i+1} - c \mathit{x1}_{i} - \frac{\mathit{\Delta t}}{2} c \mathit{x2}_{i}\right]  \mathit{x1}_{i+1} = \mathit{x1}_{i} + \frac{\mathit{\Delta t}}{2}\left(\mathit{x2}_{i} + \mathit{x2}_{i+1}\right) $};
        \node(six)[rect, below of=five]{set $i = i+1$};
        \draw [arrow] (one) -- (two);
        \draw [arrow] (two) -- (three);
        \draw [arrow] (three) -- (four);
        \draw [arrow] (four) -- (five);
        \draw [arrow] (five) -- (six);
        \draw [arrow] (six.east) -- ++(5, 0) --  ++ (0, 10) -- (one) ;
    \end{tikzpicture}
    \caption{Newmark Explicit Scheme flowchart}
    \label{flowchart}
\end{figure}


\end{document}
  • What is your question? Please add a short but clear description of your problem. In this case it is probably also helpful to add a picture of the rendered output of your code. – schtandard Jun 07 '19 at 11:34
  • 1
    Also, don't use [H]. That's like giving someone a car so they can get where they need to be but taking of all the wheels first. In LaTeX terms, don't use a floating environment (like figure), if you don't want it to float around. – schtandard Jun 07 '19 at 11:37
  • Does this help https://tex.stackexchange.com/questions/123671/manual-automatic-line-breaks-and-text-alignment-in-tikz-nodes – jak123 Jun 07 '19 at 12:01

1 Answers1

3

Like this?

enter image description here

For above flowchart I made the following changes in your MWE (Minimal Working Example):

  • Define text width for node style rect. For its size I select 66 mm. It forse nodes contents, which is wider than text width, is breaken into more lines (with this is solved your main problem)
  • Since \tikzstyle is obsolete syntax, instead it I use\tikzset`
  • For placement I use TikZ library positioning and chains
  • For arrows between nodes is used macro join=by ...
% flowchart drawing
\documentclass[a4paper, 12pt]{report}
\usepackage{caption}

\usepackage{tikz}
\usetikzlibrary{arrows.meta,
                chains, 
                positioning,
                shapes.geometric,
                shapes.multipart 
                }
\tikzset{rect/.style = {rectangle, draw, rounded corners, 
\tikzset{rect/.style = {rectangle, draw, rounded corners, 
                        minimum width=#1, minimum height=9mm,
                        text width =\pgfkeysvalueof{/pgf/minimum width}-
                                    2*\pgfkeysvalueof{/pgf/inner xsep},
                        align=center,
                        on chain=A, join=by arrow},
       rect/.default = 66mm,
        arrow/.style = {thick,-Stealth}
        }

\begin{document}
\begin{figure}[htb]
    \centering
    \begin{tikzpicture}[
    node distance=7mm and 1mm,
      start chain= A going below
                        ]
\node [rect] {Input excitation $p_{i+1}$ };
\node [rect] {Calculate displacement response:\\[1ex] 
              $x_{i+1} = x_{i} + \Delta t \mathit{x1}_{i} + \frac{\Delta t^2}{2} \mathit{x2}_{i}$ };
\node [rect] {Impose $x_{i+1}$ on test structure};
\node [rect] {Measure restoring forces from $\mathit{fs}_{i+1}$ 
              from the test  structure};
\node [rect] {Calculate:\\ 
              $
              \mathit{x2}_{i+1} =
              \Bigl[m + \frac{\mathit{\Delta t}}{2} c\Bigr]^{-1}
              \Bigl[p_{i+1} - \mathit{fs}_{i+1} - c \mathit{x1}_{i} - %\\
               \frac{\mathit{\Delta t}}{2} c \mathit{x2}_{i}\Bigr]  \mathit{x1}_{i+1}%\\
              = \mathit{x1}_{i} + \frac{\mathit{\Delta t}}{2}\Bigl(\mathit{x2}_{i} + \mathit{x2}_{i+1}\Bigr)
              $
              };
\node [rect] {set $i = i+1$};
        \draw [arrow] (A-6.east) -- ++(1, 0) |- (A-1) ;
    \end{tikzpicture}
    \caption{Newmark Explicit Scheme flowchart}
    \label{flowchart}
\end{figure}
\end{document}
Zarko
  • 296,517