Flow chart and a polylineHow to define the default vertical distance between nodes?How to get the relative node distance from a node to another?Text alignment and form of connectors (edges) in tikz treeScale chevron chart with tikz and insert line break for textDraw path if distance is below thresholdTable with text from side of page to the middleRectanglar cloud shaped node in TikZHow to make a soul driver draw two lines at once (one above and one below text)
Conversion of mass into energy with 100% efficiency
Why is JavaScript not compiled to bytecode before sending over the network?
Would a level 18+ Champion Fighter recover HP outside of combat?
Will iptables rules continue to work if an interface has been deleted and created again?
How might Humans evolve on other planets?
Why is marginal cost not the cost of producing the last unit?
Is using Swiss Francs (CHF) cheaper than Euros (EUR) in Switzerland?
Why is casting a DATE field to VARCHAR datatype non-deterministic and is there a way to make it deterministic?
Sleep for 1000 years
How do I get a stuck gas canister (for hiking/camping) out of a stainless steel mug?
Is there a higher incidence of electoral fraud in states that use all-mail voting?
Monthly budget screen - need to take into account whether it's early/late in the month
How does divination manifest for spells such as Scrying?
Is it safe to drink the water from the fountains found all over the older parts of Rome?
What specifically can swap do that RAM can't
When was Newton "not good enough" for spaceflight; first use and first absolute requirement for relativistic corrections?
What are the ethical implications of lying to get into a course?
What LEGO set do these bags come from
Is the speed of light in all media independent of reference frame?
What is a logic gate?
Smallest Fibonacci Multiples
How to say No to idea given by team member, when I know from my experience that it is going to fail?
Reimbursed more than my travel expenses for interview
DeliciousSoda: A simple parser for robots.txt files
Flow chart and a polyline
How to define the default vertical distance between nodes?How to get the relative node distance from a node to another?Text alignment and form of connectors (edges) in tikz treeScale chevron chart with tikz and insert line break for textDraw path if distance is below thresholdTable with text from side of page to the middleRectanglar cloud shaped node in TikZHow to make a soul driver draw two lines at once (one above and one below text)
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty
margin-bottom:0;
I would like to improve the following code : my problem is explained in the screenshot.
documentclassarticle
usepackage[utf8]inputenc
usepackagetikz
usetikzlibraryshapes,arrows,calc
begindocument
pagestyleempty
% Source: http://www.texample.net/tikz/examples/simple-flow-chart/
% Define block styles
tikzstyledecision = [diamond, draw, fill=green!20,
text width=5.5em, text badly centered, node distance=2.5cm, inner sep=0pt]
tikzstyleblock = [rectangle, draw, fill=blue!20,
text width=5.5em, text centered, node distance=2.5cm, rounded corners, minimum height=2em]
tikzstyleloop = [rectangle, draw, fill=green!20,
text width=5.5em, text centered, node distance=2.5cm, rounded corners, minimum height=2em]
tikzstyleline = [draw, -latex']
tikzstylecloud = [draw, ellipse,fill=red!20, node distance=2.5cm,
text width=6.5em, text centered, minimum height=2em]
begintikzpicture[node distance = 2cm, auto]
% Place nodes
node [cloud] (input) $(n ; x) in N times R$;
node [block, below of=input] (affect1) $u leftarrow x$;
node [loop, below of=affect1] (whileinit) $i leftarrow 1$;
node [decision, below of=whileinit] (whiletest) $i leq n$;
node [block, below of=whiletest] (affect2) $u leftarrow A_1(u)$;
node [loop, left of=affect2] (whilenext) $i leftarrow i + 1$;
node [cloud, below of=affect2] (output) $u$;
path[line] (input) -- (affect1);
path[line] (affect1) -- (whileinit);
path[line] (whileinit) -- (whiletest);
path[line] (whiletest) -- node oui (affect2);
path[line] (affect2) -- (whilenext);
path[line] (whilenext) |- (whiletest);
path[line] (whiletest.east) -| node non ($(whiletest)!.7!(output.east)$) -| (output.north);% (output);
endtikzpicture
enddocument
tikz-pgf formatting
add a comment
|
I would like to improve the following code : my problem is explained in the screenshot.
documentclassarticle
usepackage[utf8]inputenc
usepackagetikz
usetikzlibraryshapes,arrows,calc
begindocument
pagestyleempty
% Source: http://www.texample.net/tikz/examples/simple-flow-chart/
% Define block styles
tikzstyledecision = [diamond, draw, fill=green!20,
text width=5.5em, text badly centered, node distance=2.5cm, inner sep=0pt]
tikzstyleblock = [rectangle, draw, fill=blue!20,
text width=5.5em, text centered, node distance=2.5cm, rounded corners, minimum height=2em]
tikzstyleloop = [rectangle, draw, fill=green!20,
text width=5.5em, text centered, node distance=2.5cm, rounded corners, minimum height=2em]
tikzstyleline = [draw, -latex']
tikzstylecloud = [draw, ellipse,fill=red!20, node distance=2.5cm,
text width=6.5em, text centered, minimum height=2em]
begintikzpicture[node distance = 2cm, auto]
% Place nodes
node [cloud] (input) $(n ; x) in N times R$;
node [block, below of=input] (affect1) $u leftarrow x$;
node [loop, below of=affect1] (whileinit) $i leftarrow 1$;
node [decision, below of=whileinit] (whiletest) $i leq n$;
node [block, below of=whiletest] (affect2) $u leftarrow A_1(u)$;
node [loop, left of=affect2] (whilenext) $i leftarrow i + 1$;
node [cloud, below of=affect2] (output) $u$;
path[line] (input) -- (affect1);
path[line] (affect1) -- (whileinit);
path[line] (whileinit) -- (whiletest);
path[line] (whiletest) -- node oui (affect2);
path[line] (affect2) -- (whilenext);
path[line] (whilenext) |- (whiletest);
path[line] (whiletest.east) -| node non ($(whiletest)!.7!(output.east)$) -| (output.north);% (output);
endtikzpicture
enddocument
tikz-pgf formatting
add a comment
|
I would like to improve the following code : my problem is explained in the screenshot.
documentclassarticle
usepackage[utf8]inputenc
usepackagetikz
usetikzlibraryshapes,arrows,calc
begindocument
pagestyleempty
% Source: http://www.texample.net/tikz/examples/simple-flow-chart/
% Define block styles
tikzstyledecision = [diamond, draw, fill=green!20,
text width=5.5em, text badly centered, node distance=2.5cm, inner sep=0pt]
tikzstyleblock = [rectangle, draw, fill=blue!20,
text width=5.5em, text centered, node distance=2.5cm, rounded corners, minimum height=2em]
tikzstyleloop = [rectangle, draw, fill=green!20,
text width=5.5em, text centered, node distance=2.5cm, rounded corners, minimum height=2em]
tikzstyleline = [draw, -latex']
tikzstylecloud = [draw, ellipse,fill=red!20, node distance=2.5cm,
text width=6.5em, text centered, minimum height=2em]
begintikzpicture[node distance = 2cm, auto]
% Place nodes
node [cloud] (input) $(n ; x) in N times R$;
node [block, below of=input] (affect1) $u leftarrow x$;
node [loop, below of=affect1] (whileinit) $i leftarrow 1$;
node [decision, below of=whileinit] (whiletest) $i leq n$;
node [block, below of=whiletest] (affect2) $u leftarrow A_1(u)$;
node [loop, left of=affect2] (whilenext) $i leftarrow i + 1$;
node [cloud, below of=affect2] (output) $u$;
path[line] (input) -- (affect1);
path[line] (affect1) -- (whileinit);
path[line] (whileinit) -- (whiletest);
path[line] (whiletest) -- node oui (affect2);
path[line] (affect2) -- (whilenext);
path[line] (whilenext) |- (whiletest);
path[line] (whiletest.east) -| node non ($(whiletest)!.7!(output.east)$) -| (output.north);% (output);
endtikzpicture
enddocument
tikz-pgf formatting
I would like to improve the following code : my problem is explained in the screenshot.
documentclassarticle
usepackage[utf8]inputenc
usepackagetikz
usetikzlibraryshapes,arrows,calc
begindocument
pagestyleempty
% Source: http://www.texample.net/tikz/examples/simple-flow-chart/
% Define block styles
tikzstyledecision = [diamond, draw, fill=green!20,
text width=5.5em, text badly centered, node distance=2.5cm, inner sep=0pt]
tikzstyleblock = [rectangle, draw, fill=blue!20,
text width=5.5em, text centered, node distance=2.5cm, rounded corners, minimum height=2em]
tikzstyleloop = [rectangle, draw, fill=green!20,
text width=5.5em, text centered, node distance=2.5cm, rounded corners, minimum height=2em]
tikzstyleline = [draw, -latex']
tikzstylecloud = [draw, ellipse,fill=red!20, node distance=2.5cm,
text width=6.5em, text centered, minimum height=2em]
begintikzpicture[node distance = 2cm, auto]
% Place nodes
node [cloud] (input) $(n ; x) in N times R$;
node [block, below of=input] (affect1) $u leftarrow x$;
node [loop, below of=affect1] (whileinit) $i leftarrow 1$;
node [decision, below of=whileinit] (whiletest) $i leq n$;
node [block, below of=whiletest] (affect2) $u leftarrow A_1(u)$;
node [loop, left of=affect2] (whilenext) $i leftarrow i + 1$;
node [cloud, below of=affect2] (output) $u$;
path[line] (input) -- (affect1);
path[line] (affect1) -- (whileinit);
path[line] (whileinit) -- (whiletest);
path[line] (whiletest) -- node oui (affect2);
path[line] (affect2) -- (whilenext);
path[line] (whilenext) |- (whiletest);
path[line] (whiletest.east) -| node non ($(whiletest)!.7!(output.east)$) -| (output.north);% (output);
endtikzpicture
enddocument
tikz-pgf formatting
tikz-pgf formatting
asked Sep 29 at 23:11
projetmbcprojetmbc
8,63011 gold badges35 silver badges88 bronze badges
8,63011 gold badges35 silver badges88 bronze badges
add a comment
|
add a comment
|
2 Answers
2
active
oldest
votes
Your problems can be solved by
- loading and using the
positioning
library and - changing the
non
path.
The first point means that e.g. below of=
needs to go to below=<distance> of
. The distance can be omitted in which case the node distance
values get used. As for the second point, I used
path[line] (whiletest.east) -- ++ (2cm,0) node[right] non |-
([yshift=-5mm]affect2.south) -- (output.north);
where 2cm
controls the distance, and you may adjust this to your likings. In addition I replaced tikzstyle
by the corresponding tikzset
syntax.
documentclassarticle
usepackage[utf8]inputenc
usepackagetikz
usetikzlibraryshapes,arrows,calc,positioning
begindocument
pagestyleempty
% Source: http://www.texample.net/tikz/examples/simple-flow-chart/
% Define block styles
tikzsetdecision/.style=diamond, draw, fill=green!20,
text width=5.5em, text badly centered, node distance=2.5cm, inner sep=0pt,
block/.style=rectangle, draw, fill=blue!20,
text width=5.5em, text centered, node distance=2.5cm, rounded corners, minimum height=2em,
loop/.style=rectangle, draw, fill=green!20,
text width=5.5em, text centered, node distance=2.5cm, rounded corners, minimum height=2em,
line/.style=draw, -latex',
cloud/.style=draw, ellipse,fill=red!20, node distance=2.5cm,
text width=6.5em, text centered, minimum height=2em
begintikzpicture[node distance = 1cm and 0.8cm, auto]
% Place nodes
node [cloud] (input) $(n ; x) in N times R$;
node [block, below=of input] (affect1) $u leftarrow x$;
node [loop, below=of affect1] (whileinit) $i leftarrow 1$;
node [decision, below=of whileinit] (whiletest) $i leq n$;
node [block, below=of whiletest] (affect2) $u leftarrow A_1(u)$;
node [loop, left=of affect2] (whilenext) $i leftarrow i + 1$;
node [cloud, below=of affect2] (output) $u$;
path[line] (input) -- (affect1);
path[line] (affect1) -- (whileinit);
path[line] (whileinit) -- (whiletest);
path[line] (whiletest) -- node oui (affect2);
path[line] (affect2) -- (whilenext);
path[line] (whilenext) |- (whiletest);
path[line] (whiletest.east) -- ++ (2cm,0) node[right] non |-
([yshift=-5mm]affect2.south) -- (output.north);% (output);
endtikzpicture
enddocument
I should maybe add thattikzstyle
and the positioning mechanisms that do not use thepositioning
library are really really deprecated. They should definitely not be used in any answer in the year 2019.
– Schrödinger's cat
Sep 29 at 23:25
Thanks for the advices. Is there a way to obtain the same flowchart without using old cars ? This is more curiosity than necessity because I have to go to sleep.
– projetmbc
Sep 29 at 23:36
@projetmbc The above does not use "old cars", I think. You may make things a bit more automatic by using e.g.chains
but this won't buy you much here. However, on the long run you will be way better off if you usepositioning
since its syntax is much more powerful.
– Schrödinger's cat
Sep 29 at 23:40
Shame on me... I have read that do usepositioning
... Yesterday it was too late for me. Sorry fo the noise...
– projetmbc
Sep 30 at 7:17
add a comment
|
Here is a way:
documentclassarticle
usepackage[utf8]inputenc
usepackagetikz
usetikzlibraryshapes,arrows,calc
begindocument
pagestyleempty
% Source: http://www.texample.net/tikz/examples/simple-flow-chart/
% Define block styles
tikzstyledecision = [diamond, draw, fill=green!20,
text width=5.5em, text badly centered, node distance=2.5cm, inner sep=0pt]
tikzstyleblock = [rectangle, draw, fill=blue!20,
text width=5.5em, text centered, node distance=2.5cm, rounded corners, minimum height=2em]
tikzstyleloop = [rectangle, draw, fill=green!20,
text width=5.5em, text centered, node distance=2.5cm, rounded corners, minimum height=2em]
tikzstyleline = [draw, -latex']
tikzstylecloud = [draw, ellipse,fill=red!20, node distance=2.5cm,
text width=6.5em, text centered, minimum height=2em]
begintikzpicture[node distance = 2cm, auto]
% Place nodes
node [cloud] (input) $(n ; x) in N times R$;
node [block, below of=input] (affect1) $u leftarrow x$;
node [loop, below of=affect1] (whileinit) $i leftarrow 1$;
node [decision, below of=whileinit] (whiletest) $i leq n$;
node [block, below of=whiletest] (affect2) $u leftarrow A_1(u)$;
node [loop,left] at ($(affect2)+(-3,0)$) (whilenext) $i leftarrow i + 1$;
node [cloud, below of=affect2] (output) $u$;
path[line] (input) -- (affect1);
path[line] (affect1) -- (whileinit);
path[line] (whileinit) -- (whiletest);
path[line] (whiletest) -- node oui (affect2);
path[line] (affect2) -- (whilenext);
path[line] (whilenext) |- (whiletest);
path[line] (whiletest.east) -| node non ($(whiletest)!.7!($(output.east)+(3,0)$)$) -| (output.north);% (output);
endtikzpicture
enddocument
I just used your code and improved the requested things by just adding (-3,0)
or (3,0)
to your given positions. I think this is something easy to learn and can give you much more flexibility than creating the code from scratch -in my way- and instead of introducing just this simple thing to you.
Interesting to see how to play with relative coordinates. Not so natural for me...
– projetmbc
Sep 29 at 23:34
@projetmbc ... You was already using calc library, and I just wanted to add this answer to show you how to use it. Of course you may learn much more things, but with this one you already learn, you can do much things now. (Good choice your accepted answer and you can learn some more stuff there ... )
– koleygr
Sep 29 at 23:37
add a comment
|
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "85"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f510329%2fflow-chart-and-a-polyline%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Your problems can be solved by
- loading and using the
positioning
library and - changing the
non
path.
The first point means that e.g. below of=
needs to go to below=<distance> of
. The distance can be omitted in which case the node distance
values get used. As for the second point, I used
path[line] (whiletest.east) -- ++ (2cm,0) node[right] non |-
([yshift=-5mm]affect2.south) -- (output.north);
where 2cm
controls the distance, and you may adjust this to your likings. In addition I replaced tikzstyle
by the corresponding tikzset
syntax.
documentclassarticle
usepackage[utf8]inputenc
usepackagetikz
usetikzlibraryshapes,arrows,calc,positioning
begindocument
pagestyleempty
% Source: http://www.texample.net/tikz/examples/simple-flow-chart/
% Define block styles
tikzsetdecision/.style=diamond, draw, fill=green!20,
text width=5.5em, text badly centered, node distance=2.5cm, inner sep=0pt,
block/.style=rectangle, draw, fill=blue!20,
text width=5.5em, text centered, node distance=2.5cm, rounded corners, minimum height=2em,
loop/.style=rectangle, draw, fill=green!20,
text width=5.5em, text centered, node distance=2.5cm, rounded corners, minimum height=2em,
line/.style=draw, -latex',
cloud/.style=draw, ellipse,fill=red!20, node distance=2.5cm,
text width=6.5em, text centered, minimum height=2em
begintikzpicture[node distance = 1cm and 0.8cm, auto]
% Place nodes
node [cloud] (input) $(n ; x) in N times R$;
node [block, below=of input] (affect1) $u leftarrow x$;
node [loop, below=of affect1] (whileinit) $i leftarrow 1$;
node [decision, below=of whileinit] (whiletest) $i leq n$;
node [block, below=of whiletest] (affect2) $u leftarrow A_1(u)$;
node [loop, left=of affect2] (whilenext) $i leftarrow i + 1$;
node [cloud, below=of affect2] (output) $u$;
path[line] (input) -- (affect1);
path[line] (affect1) -- (whileinit);
path[line] (whileinit) -- (whiletest);
path[line] (whiletest) -- node oui (affect2);
path[line] (affect2) -- (whilenext);
path[line] (whilenext) |- (whiletest);
path[line] (whiletest.east) -- ++ (2cm,0) node[right] non |-
([yshift=-5mm]affect2.south) -- (output.north);% (output);
endtikzpicture
enddocument
I should maybe add thattikzstyle
and the positioning mechanisms that do not use thepositioning
library are really really deprecated. They should definitely not be used in any answer in the year 2019.
– Schrödinger's cat
Sep 29 at 23:25
Thanks for the advices. Is there a way to obtain the same flowchart without using old cars ? This is more curiosity than necessity because I have to go to sleep.
– projetmbc
Sep 29 at 23:36
@projetmbc The above does not use "old cars", I think. You may make things a bit more automatic by using e.g.chains
but this won't buy you much here. However, on the long run you will be way better off if you usepositioning
since its syntax is much more powerful.
– Schrödinger's cat
Sep 29 at 23:40
Shame on me... I have read that do usepositioning
... Yesterday it was too late for me. Sorry fo the noise...
– projetmbc
Sep 30 at 7:17
add a comment
|
Your problems can be solved by
- loading and using the
positioning
library and - changing the
non
path.
The first point means that e.g. below of=
needs to go to below=<distance> of
. The distance can be omitted in which case the node distance
values get used. As for the second point, I used
path[line] (whiletest.east) -- ++ (2cm,0) node[right] non |-
([yshift=-5mm]affect2.south) -- (output.north);
where 2cm
controls the distance, and you may adjust this to your likings. In addition I replaced tikzstyle
by the corresponding tikzset
syntax.
documentclassarticle
usepackage[utf8]inputenc
usepackagetikz
usetikzlibraryshapes,arrows,calc,positioning
begindocument
pagestyleempty
% Source: http://www.texample.net/tikz/examples/simple-flow-chart/
% Define block styles
tikzsetdecision/.style=diamond, draw, fill=green!20,
text width=5.5em, text badly centered, node distance=2.5cm, inner sep=0pt,
block/.style=rectangle, draw, fill=blue!20,
text width=5.5em, text centered, node distance=2.5cm, rounded corners, minimum height=2em,
loop/.style=rectangle, draw, fill=green!20,
text width=5.5em, text centered, node distance=2.5cm, rounded corners, minimum height=2em,
line/.style=draw, -latex',
cloud/.style=draw, ellipse,fill=red!20, node distance=2.5cm,
text width=6.5em, text centered, minimum height=2em
begintikzpicture[node distance = 1cm and 0.8cm, auto]
% Place nodes
node [cloud] (input) $(n ; x) in N times R$;
node [block, below=of input] (affect1) $u leftarrow x$;
node [loop, below=of affect1] (whileinit) $i leftarrow 1$;
node [decision, below=of whileinit] (whiletest) $i leq n$;
node [block, below=of whiletest] (affect2) $u leftarrow A_1(u)$;
node [loop, left=of affect2] (whilenext) $i leftarrow i + 1$;
node [cloud, below=of affect2] (output) $u$;
path[line] (input) -- (affect1);
path[line] (affect1) -- (whileinit);
path[line] (whileinit) -- (whiletest);
path[line] (whiletest) -- node oui (affect2);
path[line] (affect2) -- (whilenext);
path[line] (whilenext) |- (whiletest);
path[line] (whiletest.east) -- ++ (2cm,0) node[right] non |-
([yshift=-5mm]affect2.south) -- (output.north);% (output);
endtikzpicture
enddocument
I should maybe add thattikzstyle
and the positioning mechanisms that do not use thepositioning
library are really really deprecated. They should definitely not be used in any answer in the year 2019.
– Schrödinger's cat
Sep 29 at 23:25
Thanks for the advices. Is there a way to obtain the same flowchart without using old cars ? This is more curiosity than necessity because I have to go to sleep.
– projetmbc
Sep 29 at 23:36
@projetmbc The above does not use "old cars", I think. You may make things a bit more automatic by using e.g.chains
but this won't buy you much here. However, on the long run you will be way better off if you usepositioning
since its syntax is much more powerful.
– Schrödinger's cat
Sep 29 at 23:40
Shame on me... I have read that do usepositioning
... Yesterday it was too late for me. Sorry fo the noise...
– projetmbc
Sep 30 at 7:17
add a comment
|
Your problems can be solved by
- loading and using the
positioning
library and - changing the
non
path.
The first point means that e.g. below of=
needs to go to below=<distance> of
. The distance can be omitted in which case the node distance
values get used. As for the second point, I used
path[line] (whiletest.east) -- ++ (2cm,0) node[right] non |-
([yshift=-5mm]affect2.south) -- (output.north);
where 2cm
controls the distance, and you may adjust this to your likings. In addition I replaced tikzstyle
by the corresponding tikzset
syntax.
documentclassarticle
usepackage[utf8]inputenc
usepackagetikz
usetikzlibraryshapes,arrows,calc,positioning
begindocument
pagestyleempty
% Source: http://www.texample.net/tikz/examples/simple-flow-chart/
% Define block styles
tikzsetdecision/.style=diamond, draw, fill=green!20,
text width=5.5em, text badly centered, node distance=2.5cm, inner sep=0pt,
block/.style=rectangle, draw, fill=blue!20,
text width=5.5em, text centered, node distance=2.5cm, rounded corners, minimum height=2em,
loop/.style=rectangle, draw, fill=green!20,
text width=5.5em, text centered, node distance=2.5cm, rounded corners, minimum height=2em,
line/.style=draw, -latex',
cloud/.style=draw, ellipse,fill=red!20, node distance=2.5cm,
text width=6.5em, text centered, minimum height=2em
begintikzpicture[node distance = 1cm and 0.8cm, auto]
% Place nodes
node [cloud] (input) $(n ; x) in N times R$;
node [block, below=of input] (affect1) $u leftarrow x$;
node [loop, below=of affect1] (whileinit) $i leftarrow 1$;
node [decision, below=of whileinit] (whiletest) $i leq n$;
node [block, below=of whiletest] (affect2) $u leftarrow A_1(u)$;
node [loop, left=of affect2] (whilenext) $i leftarrow i + 1$;
node [cloud, below=of affect2] (output) $u$;
path[line] (input) -- (affect1);
path[line] (affect1) -- (whileinit);
path[line] (whileinit) -- (whiletest);
path[line] (whiletest) -- node oui (affect2);
path[line] (affect2) -- (whilenext);
path[line] (whilenext) |- (whiletest);
path[line] (whiletest.east) -- ++ (2cm,0) node[right] non |-
([yshift=-5mm]affect2.south) -- (output.north);% (output);
endtikzpicture
enddocument
Your problems can be solved by
- loading and using the
positioning
library and - changing the
non
path.
The first point means that e.g. below of=
needs to go to below=<distance> of
. The distance can be omitted in which case the node distance
values get used. As for the second point, I used
path[line] (whiletest.east) -- ++ (2cm,0) node[right] non |-
([yshift=-5mm]affect2.south) -- (output.north);
where 2cm
controls the distance, and you may adjust this to your likings. In addition I replaced tikzstyle
by the corresponding tikzset
syntax.
documentclassarticle
usepackage[utf8]inputenc
usepackagetikz
usetikzlibraryshapes,arrows,calc,positioning
begindocument
pagestyleempty
% Source: http://www.texample.net/tikz/examples/simple-flow-chart/
% Define block styles
tikzsetdecision/.style=diamond, draw, fill=green!20,
text width=5.5em, text badly centered, node distance=2.5cm, inner sep=0pt,
block/.style=rectangle, draw, fill=blue!20,
text width=5.5em, text centered, node distance=2.5cm, rounded corners, minimum height=2em,
loop/.style=rectangle, draw, fill=green!20,
text width=5.5em, text centered, node distance=2.5cm, rounded corners, minimum height=2em,
line/.style=draw, -latex',
cloud/.style=draw, ellipse,fill=red!20, node distance=2.5cm,
text width=6.5em, text centered, minimum height=2em
begintikzpicture[node distance = 1cm and 0.8cm, auto]
% Place nodes
node [cloud] (input) $(n ; x) in N times R$;
node [block, below=of input] (affect1) $u leftarrow x$;
node [loop, below=of affect1] (whileinit) $i leftarrow 1$;
node [decision, below=of whileinit] (whiletest) $i leq n$;
node [block, below=of whiletest] (affect2) $u leftarrow A_1(u)$;
node [loop, left=of affect2] (whilenext) $i leftarrow i + 1$;
node [cloud, below=of affect2] (output) $u$;
path[line] (input) -- (affect1);
path[line] (affect1) -- (whileinit);
path[line] (whileinit) -- (whiletest);
path[line] (whiletest) -- node oui (affect2);
path[line] (affect2) -- (whilenext);
path[line] (whilenext) |- (whiletest);
path[line] (whiletest.east) -- ++ (2cm,0) node[right] non |-
([yshift=-5mm]affect2.south) -- (output.north);% (output);
endtikzpicture
enddocument
answered Sep 29 at 23:19
Schrödinger's catSchrödinger's cat
30.7k2 gold badges44 silver badges71 bronze badges
30.7k2 gold badges44 silver badges71 bronze badges
I should maybe add thattikzstyle
and the positioning mechanisms that do not use thepositioning
library are really really deprecated. They should definitely not be used in any answer in the year 2019.
– Schrödinger's cat
Sep 29 at 23:25
Thanks for the advices. Is there a way to obtain the same flowchart without using old cars ? This is more curiosity than necessity because I have to go to sleep.
– projetmbc
Sep 29 at 23:36
@projetmbc The above does not use "old cars", I think. You may make things a bit more automatic by using e.g.chains
but this won't buy you much here. However, on the long run you will be way better off if you usepositioning
since its syntax is much more powerful.
– Schrödinger's cat
Sep 29 at 23:40
Shame on me... I have read that do usepositioning
... Yesterday it was too late for me. Sorry fo the noise...
– projetmbc
Sep 30 at 7:17
add a comment
|
I should maybe add thattikzstyle
and the positioning mechanisms that do not use thepositioning
library are really really deprecated. They should definitely not be used in any answer in the year 2019.
– Schrödinger's cat
Sep 29 at 23:25
Thanks for the advices. Is there a way to obtain the same flowchart without using old cars ? This is more curiosity than necessity because I have to go to sleep.
– projetmbc
Sep 29 at 23:36
@projetmbc The above does not use "old cars", I think. You may make things a bit more automatic by using e.g.chains
but this won't buy you much here. However, on the long run you will be way better off if you usepositioning
since its syntax is much more powerful.
– Schrödinger's cat
Sep 29 at 23:40
Shame on me... I have read that do usepositioning
... Yesterday it was too late for me. Sorry fo the noise...
– projetmbc
Sep 30 at 7:17
I should maybe add that
tikzstyle
and the positioning mechanisms that do not use the positioning
library are really really deprecated. They should definitely not be used in any answer in the year 2019.– Schrödinger's cat
Sep 29 at 23:25
I should maybe add that
tikzstyle
and the positioning mechanisms that do not use the positioning
library are really really deprecated. They should definitely not be used in any answer in the year 2019.– Schrödinger's cat
Sep 29 at 23:25
Thanks for the advices. Is there a way to obtain the same flowchart without using old cars ? This is more curiosity than necessity because I have to go to sleep.
– projetmbc
Sep 29 at 23:36
Thanks for the advices. Is there a way to obtain the same flowchart without using old cars ? This is more curiosity than necessity because I have to go to sleep.
– projetmbc
Sep 29 at 23:36
@projetmbc The above does not use "old cars", I think. You may make things a bit more automatic by using e.g.
chains
but this won't buy you much here. However, on the long run you will be way better off if you use positioning
since its syntax is much more powerful.– Schrödinger's cat
Sep 29 at 23:40
@projetmbc The above does not use "old cars", I think. You may make things a bit more automatic by using e.g.
chains
but this won't buy you much here. However, on the long run you will be way better off if you use positioning
since its syntax is much more powerful.– Schrödinger's cat
Sep 29 at 23:40
Shame on me... I have read that do use
positioning
... Yesterday it was too late for me. Sorry fo the noise...– projetmbc
Sep 30 at 7:17
Shame on me... I have read that do use
positioning
... Yesterday it was too late for me. Sorry fo the noise...– projetmbc
Sep 30 at 7:17
add a comment
|
Here is a way:
documentclassarticle
usepackage[utf8]inputenc
usepackagetikz
usetikzlibraryshapes,arrows,calc
begindocument
pagestyleempty
% Source: http://www.texample.net/tikz/examples/simple-flow-chart/
% Define block styles
tikzstyledecision = [diamond, draw, fill=green!20,
text width=5.5em, text badly centered, node distance=2.5cm, inner sep=0pt]
tikzstyleblock = [rectangle, draw, fill=blue!20,
text width=5.5em, text centered, node distance=2.5cm, rounded corners, minimum height=2em]
tikzstyleloop = [rectangle, draw, fill=green!20,
text width=5.5em, text centered, node distance=2.5cm, rounded corners, minimum height=2em]
tikzstyleline = [draw, -latex']
tikzstylecloud = [draw, ellipse,fill=red!20, node distance=2.5cm,
text width=6.5em, text centered, minimum height=2em]
begintikzpicture[node distance = 2cm, auto]
% Place nodes
node [cloud] (input) $(n ; x) in N times R$;
node [block, below of=input] (affect1) $u leftarrow x$;
node [loop, below of=affect1] (whileinit) $i leftarrow 1$;
node [decision, below of=whileinit] (whiletest) $i leq n$;
node [block, below of=whiletest] (affect2) $u leftarrow A_1(u)$;
node [loop,left] at ($(affect2)+(-3,0)$) (whilenext) $i leftarrow i + 1$;
node [cloud, below of=affect2] (output) $u$;
path[line] (input) -- (affect1);
path[line] (affect1) -- (whileinit);
path[line] (whileinit) -- (whiletest);
path[line] (whiletest) -- node oui (affect2);
path[line] (affect2) -- (whilenext);
path[line] (whilenext) |- (whiletest);
path[line] (whiletest.east) -| node non ($(whiletest)!.7!($(output.east)+(3,0)$)$) -| (output.north);% (output);
endtikzpicture
enddocument
I just used your code and improved the requested things by just adding (-3,0)
or (3,0)
to your given positions. I think this is something easy to learn and can give you much more flexibility than creating the code from scratch -in my way- and instead of introducing just this simple thing to you.
Interesting to see how to play with relative coordinates. Not so natural for me...
– projetmbc
Sep 29 at 23:34
@projetmbc ... You was already using calc library, and I just wanted to add this answer to show you how to use it. Of course you may learn much more things, but with this one you already learn, you can do much things now. (Good choice your accepted answer and you can learn some more stuff there ... )
– koleygr
Sep 29 at 23:37
add a comment
|
Here is a way:
documentclassarticle
usepackage[utf8]inputenc
usepackagetikz
usetikzlibraryshapes,arrows,calc
begindocument
pagestyleempty
% Source: http://www.texample.net/tikz/examples/simple-flow-chart/
% Define block styles
tikzstyledecision = [diamond, draw, fill=green!20,
text width=5.5em, text badly centered, node distance=2.5cm, inner sep=0pt]
tikzstyleblock = [rectangle, draw, fill=blue!20,
text width=5.5em, text centered, node distance=2.5cm, rounded corners, minimum height=2em]
tikzstyleloop = [rectangle, draw, fill=green!20,
text width=5.5em, text centered, node distance=2.5cm, rounded corners, minimum height=2em]
tikzstyleline = [draw, -latex']
tikzstylecloud = [draw, ellipse,fill=red!20, node distance=2.5cm,
text width=6.5em, text centered, minimum height=2em]
begintikzpicture[node distance = 2cm, auto]
% Place nodes
node [cloud] (input) $(n ; x) in N times R$;
node [block, below of=input] (affect1) $u leftarrow x$;
node [loop, below of=affect1] (whileinit) $i leftarrow 1$;
node [decision, below of=whileinit] (whiletest) $i leq n$;
node [block, below of=whiletest] (affect2) $u leftarrow A_1(u)$;
node [loop,left] at ($(affect2)+(-3,0)$) (whilenext) $i leftarrow i + 1$;
node [cloud, below of=affect2] (output) $u$;
path[line] (input) -- (affect1);
path[line] (affect1) -- (whileinit);
path[line] (whileinit) -- (whiletest);
path[line] (whiletest) -- node oui (affect2);
path[line] (affect2) -- (whilenext);
path[line] (whilenext) |- (whiletest);
path[line] (whiletest.east) -| node non ($(whiletest)!.7!($(output.east)+(3,0)$)$) -| (output.north);% (output);
endtikzpicture
enddocument
I just used your code and improved the requested things by just adding (-3,0)
or (3,0)
to your given positions. I think this is something easy to learn and can give you much more flexibility than creating the code from scratch -in my way- and instead of introducing just this simple thing to you.
Interesting to see how to play with relative coordinates. Not so natural for me...
– projetmbc
Sep 29 at 23:34
@projetmbc ... You was already using calc library, and I just wanted to add this answer to show you how to use it. Of course you may learn much more things, but with this one you already learn, you can do much things now. (Good choice your accepted answer and you can learn some more stuff there ... )
– koleygr
Sep 29 at 23:37
add a comment
|
Here is a way:
documentclassarticle
usepackage[utf8]inputenc
usepackagetikz
usetikzlibraryshapes,arrows,calc
begindocument
pagestyleempty
% Source: http://www.texample.net/tikz/examples/simple-flow-chart/
% Define block styles
tikzstyledecision = [diamond, draw, fill=green!20,
text width=5.5em, text badly centered, node distance=2.5cm, inner sep=0pt]
tikzstyleblock = [rectangle, draw, fill=blue!20,
text width=5.5em, text centered, node distance=2.5cm, rounded corners, minimum height=2em]
tikzstyleloop = [rectangle, draw, fill=green!20,
text width=5.5em, text centered, node distance=2.5cm, rounded corners, minimum height=2em]
tikzstyleline = [draw, -latex']
tikzstylecloud = [draw, ellipse,fill=red!20, node distance=2.5cm,
text width=6.5em, text centered, minimum height=2em]
begintikzpicture[node distance = 2cm, auto]
% Place nodes
node [cloud] (input) $(n ; x) in N times R$;
node [block, below of=input] (affect1) $u leftarrow x$;
node [loop, below of=affect1] (whileinit) $i leftarrow 1$;
node [decision, below of=whileinit] (whiletest) $i leq n$;
node [block, below of=whiletest] (affect2) $u leftarrow A_1(u)$;
node [loop,left] at ($(affect2)+(-3,0)$) (whilenext) $i leftarrow i + 1$;
node [cloud, below of=affect2] (output) $u$;
path[line] (input) -- (affect1);
path[line] (affect1) -- (whileinit);
path[line] (whileinit) -- (whiletest);
path[line] (whiletest) -- node oui (affect2);
path[line] (affect2) -- (whilenext);
path[line] (whilenext) |- (whiletest);
path[line] (whiletest.east) -| node non ($(whiletest)!.7!($(output.east)+(3,0)$)$) -| (output.north);% (output);
endtikzpicture
enddocument
I just used your code and improved the requested things by just adding (-3,0)
or (3,0)
to your given positions. I think this is something easy to learn and can give you much more flexibility than creating the code from scratch -in my way- and instead of introducing just this simple thing to you.
Here is a way:
documentclassarticle
usepackage[utf8]inputenc
usepackagetikz
usetikzlibraryshapes,arrows,calc
begindocument
pagestyleempty
% Source: http://www.texample.net/tikz/examples/simple-flow-chart/
% Define block styles
tikzstyledecision = [diamond, draw, fill=green!20,
text width=5.5em, text badly centered, node distance=2.5cm, inner sep=0pt]
tikzstyleblock = [rectangle, draw, fill=blue!20,
text width=5.5em, text centered, node distance=2.5cm, rounded corners, minimum height=2em]
tikzstyleloop = [rectangle, draw, fill=green!20,
text width=5.5em, text centered, node distance=2.5cm, rounded corners, minimum height=2em]
tikzstyleline = [draw, -latex']
tikzstylecloud = [draw, ellipse,fill=red!20, node distance=2.5cm,
text width=6.5em, text centered, minimum height=2em]
begintikzpicture[node distance = 2cm, auto]
% Place nodes
node [cloud] (input) $(n ; x) in N times R$;
node [block, below of=input] (affect1) $u leftarrow x$;
node [loop, below of=affect1] (whileinit) $i leftarrow 1$;
node [decision, below of=whileinit] (whiletest) $i leq n$;
node [block, below of=whiletest] (affect2) $u leftarrow A_1(u)$;
node [loop,left] at ($(affect2)+(-3,0)$) (whilenext) $i leftarrow i + 1$;
node [cloud, below of=affect2] (output) $u$;
path[line] (input) -- (affect1);
path[line] (affect1) -- (whileinit);
path[line] (whileinit) -- (whiletest);
path[line] (whiletest) -- node oui (affect2);
path[line] (affect2) -- (whilenext);
path[line] (whilenext) |- (whiletest);
path[line] (whiletest.east) -| node non ($(whiletest)!.7!($(output.east)+(3,0)$)$) -| (output.north);% (output);
endtikzpicture
enddocument
I just used your code and improved the requested things by just adding (-3,0)
or (3,0)
to your given positions. I think this is something easy to learn and can give you much more flexibility than creating the code from scratch -in my way- and instead of introducing just this simple thing to you.
answered Sep 29 at 23:20
koleygrkoleygr
16.3k1 gold badge12 silver badges44 bronze badges
16.3k1 gold badge12 silver badges44 bronze badges
Interesting to see how to play with relative coordinates. Not so natural for me...
– projetmbc
Sep 29 at 23:34
@projetmbc ... You was already using calc library, and I just wanted to add this answer to show you how to use it. Of course you may learn much more things, but with this one you already learn, you can do much things now. (Good choice your accepted answer and you can learn some more stuff there ... )
– koleygr
Sep 29 at 23:37
add a comment
|
Interesting to see how to play with relative coordinates. Not so natural for me...
– projetmbc
Sep 29 at 23:34
@projetmbc ... You was already using calc library, and I just wanted to add this answer to show you how to use it. Of course you may learn much more things, but with this one you already learn, you can do much things now. (Good choice your accepted answer and you can learn some more stuff there ... )
– koleygr
Sep 29 at 23:37
Interesting to see how to play with relative coordinates. Not so natural for me...
– projetmbc
Sep 29 at 23:34
Interesting to see how to play with relative coordinates. Not so natural for me...
– projetmbc
Sep 29 at 23:34
@projetmbc ... You was already using calc library, and I just wanted to add this answer to show you how to use it. Of course you may learn much more things, but with this one you already learn, you can do much things now. (Good choice your accepted answer and you can learn some more stuff there ... )
– koleygr
Sep 29 at 23:37
@projetmbc ... You was already using calc library, and I just wanted to add this answer to show you how to use it. Of course you may learn much more things, but with this one you already learn, you can do much things now. (Good choice your accepted answer and you can learn some more stuff there ... )
– koleygr
Sep 29 at 23:37
add a comment
|
Thanks for contributing an answer to TeX - LaTeX Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f510329%2fflow-chart-and-a-polyline%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown