5

I made some changes to Zarko's code from here to make my own flowchart.

\documentclass[a4paper,11pt,twoside]{book}
\usepackage[a4paper,left=2.5cm,right=2.5cm,top=2.5cm,bottom=2.5cm]{geometry}
\usepackage{amsmath, amsthm, amssymb, amsfonts}

\usepackage[english,greek]{babel}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
% shapes
\usetikzlibrary{shapes}
%arrows
\usetikzlibrary{arrows,arrows.meta}
%decorations
\usetikzlibrary{decorations.text,decorations.pathreplacing,patterns,shadows.blur,fadings}
% miscellaneous
\usetikzlibrary{calc,quotes,positioning,fpu,angles,fit,spy,chains}

\begin{document}

    \begin{tikzpicture}[
  node distance = 8mm and 16mm,
  start chain = A going below,
  base/.style = {draw, minimum width=32mm, minimum height=8mm,
    align=center, on chain=A},
  startstop/.style = {ultra thick,double,base, rectangle, rounded corners, fill=white},
  process/.style = {ultra thick,base, rectangle, fill=white},
  io/.style = {ultra thick,base, trapezium, 
    trapezium left angle=70, trapezium right angle=110,
    fill=white},
  decision/.style = {ultra thick,base, diamond, fill=white},
  every edge quotes/.style = {auto=right}]
  ]
  \node [startstop]       {Έναρξη};     % <-- A-1
  \node [io]              {Εισαγωγή}; %A-2
  \node [decision]        {Ερώτηση}; %Α-3
  \node [io]              {Απάντηση}; %A-4
  \node [startstop]       {Τέλος};      % <-- A-5
  \node [process, right=of A-3]    {Κάτι};     % <-- A-6

  \draw [arrows=-Stealth] 
  (A-1) edge          (A-2)
  (A-2) edge   (A-3)
  (A-3) edge  ["όχι"]     (A-4)
    (A-3) edge  ["ναι"]     (A-6)
  (A-4) edge    (A-5)
  (A-6) |- ($(A-1.south east)!0.5!(A-2.north east)$)
  -| ([xshift=7mm] A-2.north)
  ;
  \end{tikzpicture}
\end{document}

This is how it looks like.

enter image description here

The problem is that I don't know how to draw the arrow from A-3 (diamond "Ερώτηση") to A-2 (parallelogram "Εισαγωγή") without the A-6 (rectangle "Κάτι"). I want something like this:

enter image description here

How can I do it?

2 Answers2

5

You only need to remove node "A-6" and draw arrow from A-3 to A-2. I also took opportunity in rearrange loading tikz libraries and a little bit simplified/ shortened code for image:

\documentclass[a4paper,11pt,twoside]{book}
\usepackage[a4paper,
            margin=2.5cm]{geometry}
\usepackage{amsmath, amsthm, amssymb}

\usepackage{fontspec}
\usepackage{polyglossia}
\setmainlanguage{greek}
\setromanfont{Minion Pro} %% Select your favorite font
\setotherlanguage{english}

\usepackage{tikz}
\usetikzlibrary{angles, arrows, arrows.meta,
                calc, chains,
                decorations.text, decorations.pathreplacing,
                fadings, fit, 
                patterns, positioning,
                quotes,
                shapes, shadows.blur,
                spy}

\begin{document}
\centering
    \begin{tikzpicture}[
node distance = 8mm and 4mm,
  start chain = A going below,
  base/.style = {draw, minimum width=32mm, minimum height=8mm,
                  align=center, on chain=A, join=by -Stealth},
startstop/.style = {ultra thick,double,base, rectangle, rounded corners, fill=white},
  process/.style = {ultra thick,base, rectangle, fill=white},
    io/.style = {trapezium, trapezium stretches,
                 trapezium left angle=70, trapezium right angle=110,       
                 base, ultra thick, fill=white},
  decision/.style = {ultra thick,base, diamond, fill=white},
every edge quotes/.style = {auto=right}
                        ]
  \node [startstop]       {Έναρξη};     % <-- A-1
  \node [io]              {Εισαγωγή};  
  \node [decision]        {Ερώτηση};  
  \node [io]              {Απάντηση};  
  \node [startstop]       {Τέλος};      % <-- A-5

\coordinate[above left=of A-2.east] (aux);
\draw [arrows=-Stealth]
        (A-3.east)  to  ["ναι"] ++ (1,0) |- (aux) -- (aux |- A-2.north);
\path   (A-3)       to  ["όχι"]     (A-4);
    \end{tikzpicture}
\end{document}

enter image description here

Edit 1: compiled by XeLaTeX engine.

Edit 2: from all libraries in your MWE are actually used only the following:

\usetikzlibrary{arrows.meta,
                chains,
                positioning,
                quotes,
                shapes
                }
Zarko
  • 296,517
  • thank's for your answer! It was too difficult to choose between AndréC's and your code. So I try some changes at these codes. The 1st problem I had with your code was "όχι" witch printed on the parallelogram (https://pastebin.com/y9wxeMaZ). The 2nd problem was with the position of the loop's arrow (https://pastebin.com/74RDfuN5). Maybe the problem was pdflatex that I used. For these reasons I preferred AndréC's code (even I didn't like 3mm and 20 mm), that I can change it more easily (for my latex's knowledge). Thank's again for the starting idea and for your answers! – Kώστας Κούδας Aug 04 '19 at 22:38
  • 1
    @KώσταςΚούδας, it is up to you what you like to have. I do not need any explanation why you decides as you. Al other, if is problem, please ask new question. I'm very convinced, that my code is better than selected by you. – Zarko Aug 04 '19 at 22:42
  • obviously your code is better than selected by me. I give my explanation for your time that you spend for my question. Thank's again! – Kώστας Κούδας Aug 04 '19 at 22:52
3

I modified as little as possible your code by doing:

  1. I added the every join/.style=-Stealth option that automatically draws the arrows without having to rebuild the chain.
  2. I placed the node A-6 at the top right of the node A-2 without joining it to the chain, without tracing it and transforming it into a coordinate.

    \node [on chain,coordinate, above right=3mm and 20 mm of A-2]{}; % <-- A-6

  3. Thus, I build an arrow for the loop because (A-6) is not joined to the chain. \draw [arrows=-Stealth] (A-3) -| node[pos=.25,below]{Κάτι}(A-6)-| (A-2.30);
  4. I only place the label without drawing anything more since the arrows have already been built by the chain. \path (A-3) --node[left]{όχι} (A-4);

screenshot

\documentclass[a4paper,11pt,twoside]{book}
\usepackage[a4paper,left=2.5cm,right=2.5cm,top=2.5cm,bottom=2.5cm]{geometry}
\usepackage{amsmath, amsthm, amssymb, amsfonts}
\usepackage[utf8]{inputenc}
%\usepackage[greek]{babel}

% babel dont work for me, i took these 5 lines from the answer of Zarko
\usepackage{fontspec}
\usepackage{polyglossia}
\setmainlanguage{greek}
\setromanfont{Minion Pro} %% Select your favourite font
\setotherlanguage{english}

\usepackage{tikz}
% shapes
\usetikzlibrary{shapes}
%arrows
\usetikzlibrary{arrows,arrows.meta}
%decorations
\usetikzlibrary{decorations.text,decorations.pathreplacing,patterns,shadows.blur,fadings}
% miscellaneous
\usetikzlibrary{calc,quotes,positioning,fpu,angles,fit,spy,chains}

\begin{document}

    \begin{tikzpicture}[
  node distance = 8mm and 16mm,
  start chain = A going below,
  base/.style = {draw, minimum width=32mm, minimum height=8mm,
    align=center, on chain=A,join},
  startstop/.style = {ultra thick,double,base, rectangle, rounded corners, fill=white},
  process/.style = {ultra thick,base, rectangle, fill=white},
  io/.style = {ultra thick,base, trapezium, 
    trapezium left angle=70, trapezium right angle=110,
    fill=white},
  decision/.style = {ultra thick,base, diamond, fill=white},
  every edge quotes/.style = {auto=right},
  every join/.style=-Stealth]
  ]
  \node [startstop]       {Έναρξη};     % <-- A-1
  \node [io]              {Εισαγωγή}; %A-2
  \node [decision]        {Ερώτηση}; %Α-3
  \node [io]              {Απάντηση}; %A-4
  \node [startstop]       {Τέλος};      % <-- A-5
  \node [on chain,coordinate, above right=3mm and 20 mm of A-2]{};     % <-- A-6

  \draw [arrows=-Stealth] 
  (A-3) -| node[pos=.25,below]{Κάτι}(A-6)-| (A-2.30);
  \draw  (A-3) --node[left]{όχι} (A-4);
  \end{tikzpicture}
\end{document}
AndréC
  • 24,137
  • thank's a lot! Problem solved. I have only one more question. Is it possible to change 3mm and 20 mm? If I change the size of the book or of the font, maybe this causes a problem. Or not? Is it possible to put it automatically at the middle of A-1 and A-2? Thank's! – Kώστας Κούδας Aug 04 '19 at 22:42
  • 1
    What do you mean by the middle of (A-1) and (A-3)? Do you want the arrow (A-2) to (A-3) and the end of the loop to merge? – AndréC Aug 05 '19 at 05:13
  • I wanted exactly what you write, but with other coding at the part of this that I highlight (https://ibb.co/RcrpmNP). I wanted this line automatically at the middle of A-1 scheme and A-2 scheme (without 3mm and 20 mm) so, if I change something to the book, the result will be the same. But never mind. It's nor really important. – Kώστας Κούδας Aug 05 '19 at 06:38
  • 1
    The point where the arrow ends is the one defined by (A-2.30). If you write (A-2), the two arrows merge: \draw [arrows=-Stealth] (A-3) -| node[pos=.25,below]{Κάτι}(A-6.center)-| (A-2); – AndréC Aug 05 '19 at 06:57
  • I understand. Thanks for your answers! – Kώστας Κούδας Aug 05 '19 at 07:00