
Ich habe einige Änderungen an Zarkos Code vorgenommen vonHierum mein eigenes Flussdiagramm zu erstellen.
\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}
So sieht es aus.
Das Problem ist, dass ich nicht weiß, wie ich den Pfeil von A-3
(Diamant "Ερώτηση") nach A-2
(Parallelogramm "Εισαγωγή") zeichnen soll, ohne dieA-6
(Rechteck „Κάτι“) zeichnen soll.Ich möchte so etwas:
Wie kann ich es tun?
Antwort1
Ich habe Ihren Code so wenig wie möglich geändert, indem ich Folgendes getan habe:
- Ich habe die
every join/.style=-Stealth
Option hinzugefügt, die Pfeile automatisch zu zeichnen, ohne die Kette neu aufbauen zu müssen. Den Knoten A-6 habe ich oben rechts neben den Knoten A-2 gesetzt, ohne ihn in die Kette einzubinden, ohne ihn nachzuzeichnen und in eine Koordinate umzuwandeln.
\node [on chain,coordinate, above right=3mm and 20 mm of A-2]{}; % <-- A-6
- Daher baue ich einen Pfeil für die Schleife, da (A-6) nicht mit der Kette verbunden ist.
\draw [arrows=-Stealth] (A-3) -| node[pos=.25,below]{Κάτι}(A-6)-| (A-2.30);
- Ich platziere lediglich die Beschriftung ohne etwas weiter zu zeichnen, da die Pfeile bereits durch die Kette gebildet wurden.
\path (A-3) --node[left]{όχι} (A-4);
\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}
Antwort2
Sie müssen nur den Knoten „A-6“ entfernen und einen Pfeil von A-3
nach zeichnen A-2
. Ich habe auch die Gelegenheit genutzt, tikz
die Ladebibliotheken neu anzuordnen und den Code für das Bild ein wenig vereinfacht/verkürzt:
\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}
Bearbeitung 1:kompiliert von der XeLaTeX-Engine.
Bearbeitung 2:von allen Bibliotheken in Ihrem MWE werden tatsächlich nur die folgenden verwendet:
\usetikzlibrary{arrows.meta,
chains,
positioning,
quotes,
shapes
}