# TikZ Figure with text, arrows, dashed line, and brackets

I am trying to produce the following figure: So far, this is my code:

\documentclass{article}
\usepackage{amsmath}
\usepackage{arydshln}

\begin{document}
\pagestyle{empty}
\centering

$\begin{array}{ccccc} \text{First Factor} & \xrightarrow{\hspace*{2cm}} & \text{Second Factor} & \xrightarrow{\hspace*{2cm}} & \text{Multiple Factors} \\ \text{(Parenthetical)} & & & & \text{(M = 100)} \\ \end{array}$

$\begin{array}{ccccc} &&& \left\downarrow\rule{0cm}{1cm}\right.\phantom{(\varphi^n)^*}\\ \end{array}$

Long text explaining what is the output in this row  \\ $Y_{ipt}$ = f(factor1, factor2, factor3, factor4, factor5, factor6, factor7, factor8)

$\begin{array}{ccccc} &&& \left\downarrow\rule{0cm}{1cm}\right.\phantom{(\varphi^n)^*}\\ \end{array}$

Another Long text explaining what is the output in this row
$\hat{Y}_{pt}$ explaining the predicted values considering factor1, factor2, factor3, factor4, factor5, factor6, factor7,  and factor8

$\begin{array}{ccccc} &&& \left\downarrow\rule{0cm}{1cm}\right.\phantom{(\varphi^n)^*}\\ \end{array}$

One more long text explaining the output \\\hdashline[10.5pt/7pt]

New stage begins calculating the mean ($\mu$) and the variance ($\omega$) with some other parameters to understand our results

$\begin{array}{ccccc} &&& \left\downarrow\rule{0cm}{1cm}\right.\phantom{(\varphi^n)^*}\\ \end{array}$

$\mu_{pt} =$ f(factor1, factor2, factor3, factor4, factor5, factor6, factor7, factor8, factor1*factor2, factor2*factor3, factor4*factor5)
$\omega_{pt}$=f(factor9, factor10, factor11, factor12, factor13, factor14, factor15, factor16, factor17, factor18, factor19, factor20)

\end{document}


As you can see, I am far from it as what I am producing is neither efficient nor really a figure. I am sure there is a better way to do it using a package such as TikZ for example, but I can't code it successfully.

• Yes this is quite easy to do with tikz. I'm not at a computer so cannot help right now. Start by learning to do the text nodes and arrows between them. There are many examples on this site, also Google "tikz examples" – daleif Apr 8 at 17:46

With TikZ, as suggested @daleif in his comment:

\documentclass{article}
\usepackage{geometry}
\usepackage{amsmath}
\usepackage{tikz}
\usetikzlibrary{arrows.meta,
chains,
decorations.pathmorphing,
calligraphy,
positioning}
\makeatletter
\tikzset{suspend join/.code={\def\tikz@after@path{}}}
\makeatother

\begin{document}
\pagestyle{empty}
\centering

\begin{tikzpicture}[
node distance = 12mm and 0mm,
start chain = A going below,
every node/.append style = {align=flush center},
box/.style = {minimum height=9mm, text width=124mm,
font=\itshape\sffamily\small, on chain=A, join=by arr},
arr/.style = {-{Triangle[angle=60:2 3]}, thick},
BC/.style = {decorate,  % Brace, calligraphy
decoration={calligraphic brace, amplitude=4pt,
pre =moveto, pre  length=1pt,
post=moveto, post length=1pt,
raise=4pt,
mirror}, % for mirroring of brace
very thick,
pen colour=black
},
]
\node[box] {};
\node (A-1C) at (A-1) {Second Factor};
\node (A-1L) [right=of A-1.west] {First Factor\\(Parenthetical)};
\node (A-1R) [ left=of A-1.east] {Multipole Factor\\($M=100$)};
\draw[arr]  (A-1L) -- (A-1C);
\draw[arr]  (A-1C) -- (A-1R);
\draw   (A-1.north west) -- (A-1.north east);

\node[box]  {Long text explaining what is the output in this row
$Y_{ipt}=f$ factor1, factor2, factor3, factor4,
factor5, factor6, factor7,  and factor8};
\node[box]  {Another Long text explaining what is the output in this row
$\hat{Y}_{pt}$ explaining the predicted values considering factor1, factor2, factor3, factor4,\\
factor5, factor6, factor7,  and factor8};
\node[box]  {One more long text explaining the output};

\draw[dashed]   (A-4.south west) -- (A-4.south east);

\node[box, suspend join,
below=0pt of A-4]
{New stage begins calculating the mean ($\mu$) and the variance ($\omega$) with some other parameters to understand our results};
\node[box]  {New stage begins calculating the mean ($\mu$) and the variance ($\omega$) with some other parameters to understand our results};

\node[box]  {$\mu_{pt} =$ f(factor1, factor2, factor3, factor4, factor5, factor6, factor7, factor8,\\
factor1*factor2, factor2*factor3, factor4*factor5)\\
$\omega_{pt}=f$(factor9, factor10, factor11, factor12, factor13, factor14, factor15, factor16,\\
factor17, factor18, factor19, factor20)};
\draw   (A-7.south west) -- (A-7.south east);
%%%%
\draw[BC] (A-1.north west) --
node[left=8pt] {\textbf{1\textsuperscript{st}}\\ \textbf{stage}} (A-4.south west);
\draw[BC] (A-5.north west) --
node[left=8pt] {\textbf{2\textsuperscript{st}}\\ \textbf{stage}} (A-7.south west);

\end{tikzpicture}
\end{document} • @daleif, thank you very much. \textbf is now corrected. – Zarko Apr 9 at 6:15