2

I would be appreciated if someone set the arrows correctly. many thanks in advance.

 \documentclass{article}
\usepackage{tikz, ulem}
\usetikzlibrary{shapes,shadows,arrows,positioning}
\begin{document}

\tikzstyle{decision} = [diamond, draw, fill = white, font = \footnotesize, minimum height = 2mm, text centered,
 minimum width= 5cm, text width = 5cm , node distance = 15em]

\tikzstyle{line} = [draw, -stealth', thick, font = \footnotesize]

\tikzstyle{elli} = [draw, ellipse, fill = white, text centered,
 minimum height = 7mm, text width = 10em,  minimum width=1.5cm, font=\footnotesize ,node distance = 17em]

\tikzstyle{box}=[draw, rectangle, fill = white, font = \footnotesize, minimum width=1.5cm, text centered,
text width = 12em, minimum height = 8mm , node distance = 17em]


\begin{figure}
\centering

\footnotesize

\resizebox{0.85\textwidth}{!}{%
    
\begin{tikzpicture}[
thick,scale = 0.5, every node /.style ={scale=0.5}%,
]%

\node[elli](step1){ \textbf{\uline{Si}} \\ };
\node[box, right of= step1](step2){ \textbf {\uline{Hai una problema?}} \\ };
\node[elli, right of= step2](step3){\textbf  {\uline{No}} \\ };
\node[box, below of= step1]%, yshift = +9em]
                           (step11){{\centering\textbf{} \par}
                                                                        Puoi fare qualcosa?}; 
                                                         
\node[decision, below of= step3, yshift = -20em] %, yshift = +7em]
                           (step31){{\centering\textbf{} \par}
                                                                      Non ti preoccupare. 
};

\node[elli, below of= step11, xshift = -16em ] % , yshift = +5em]
                           (step21){{\centering\textbf{Si} \par} };
                           
\node[elli, below of= step11, xshift = +16em ] % , yshift = +5em]
(step22){{\centering\textbf{No} \par} };       
                    
\draw [->, very thick] (step2) to [out=150,in=30] (step1);
\draw [->, very thick] (step2) to [out=30,in=150] (step3);
\path[line](step1)--(step11);
\path[line](step11)--(step21);
\path[line](step11)--(step22);
\path[line](step3)--(step31);
%\path[line](step21)--(step31);
%\path[line](step22)--(step31);

\draw [->, very thick] (step21) to [out=270,in=180] (step31);
\draw [->, very thick] (step22) to [out=270,in=200] (step31);

%\draw[->] (step21) -| (step31); 

%\end{scope}
\end{tikzpicture}
}%
\caption{Non ti preoccupi }
\label{fig:theworkflow}

%\end{center}
\end{figure}
\end{document}
2
  • 1
    You may need to define "correctly". Do you just mean to change the second to last arrow from \draw [->, very thick] (step21) to [out=270,in=180] (step31); to \draw [->, very thick] (step21) to [out=270,in=230] (step31);, or did you have more in mind? (Parts of your code is also a bit outdated, but that is another matter.) Commented Oct 23, 2021 at 18:22
  • thanks but the coordinates doesn't look right. I wanted to do something like starecat.com/… Commented Oct 23, 2021 at 18:28

1 Answer 1

5

Does this look alright?

enter image description here

You already know how to add manual shifts with xshift/yshift, so you could have done more of that to move things around, but I rewrote things a bit to simplify and modernize. A summary:

  • \tikzstyle is considered deprecated, I used multiple stylename/.style={...} inside a \tikzset instead.
  • Instead of below of=, I used below=of. The former syntax is considered deprecated, and the latter is defined by the positioning library, which you already have loaded.
  • I removed all the \\, \centering, \par etc. from the nodes, I don't really think they're needed?
  • I defined the "do you have a problem" node first, and placed the yes/no nodes relative to that, rather than defining the yes-node first.
  • I removed all the node distance=... and fill=white from the node styles.
  • The yes/no nodes are placed with below left=of ... and below right=of ....
  • The general node distance is set to 1cm and 0cm. This means 1cm in the vertical direction and 0cm in the horizontal direction. below left will also set anchor=north east.
  • The final node is pushed a bit more down, by saying below=2cm of ..., instead of just below=of ....
  • I also removed all the additional scaling by scale and resizebox. I don't really see that there is any point to them. \resizebox should in general be a last resort for scaling diagrams like this, I think.

\documentclass{article}
\usepackage{tikz, ulem}
\usetikzlibrary{shapes,shadows,arrows.meta,positioning}

\tikzset{
    decision/.style={diamond, draw, font = \footnotesize, minimum height = 2mm, text centered,},
    line/.style={-Stealth, thick},
    elli/.style={draw, ellipse, -Stealth, text centered,
 minimum height = 7mm, text width = 5em,  minimum width=1.5cm, font=\footnotesize},
    box/.style={draw, rectangle, font = \footnotesize, minimum width=1.5cm, text centered,
text width = 12em, minimum height = 8mm}
}
\begin{document}
\begin{figure}
\centering
\begin{tikzpicture}[node distance=1cm and 0cm]
\node[box](step2){ \textbf {\uline{Hai una problema?}}};

\node[elli, below left=of step2] (step1) {\textbf{\uline{Si}}};
\node[elli, below right=of step2] (step3) {\textbf{\uline{No}}};
\node[box, below=of step1]  (step11) {Puoi fare qualcosa?}; 
                                                         
\node[decision, below=2cm of step3] (step31) {Non ti preoccupare.};

\node[elli, below left=1cm and 0mm of step11, anchor=north] (step21){\textbf{Si}};
                           
\node[elli, below right=1cm and 0mm of step11, anchor=north] (step22) {\textbf{No}};
                    
\draw [line] (step2) -- (step1);
\draw [line] (step2) -- (step3);
\draw [line] (step1) -- (step11);
\draw [line] (step11) -- (step21);
\draw [line] (step11) -- (step22);
\draw [line] (step3) -- (step31);

\draw [line] (step21) to [out=270,in=230] (step31);
\draw [line] (step22) to [out=270,in=200] (step31);

\end{tikzpicture}
\caption{Non ti preoccupi }
\label{fig:theworkflow}
\end{figure}
\end{document}
3
  • yeah thank you very much <3 Commented Oct 23, 2021 at 19:10
  • 4
    Very kind Torbjørn T. in your code you have "Hai una problema?" Here there is a fix typo. It must be "Hai un problema?".
    – Sebastiano
    Commented Oct 23, 2021 at 21:24
  • ahh irregular, thanks <3 Commented Oct 24, 2021 at 9:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .