Why does a perfectly-identical repetition of a drawing command given within an earlier loop 𝘯𝘰𝘵 produce exactly the same line?Does TikZ use the same internal mechanism as PSTricks to produce vector based pdf outputs?Reuse of soft path in fading declaration? Transformation of fadings?Why does cleveref's crefname command have no effect when it appears within a foreach?Why does this pgfmathparse not work outside the foreach loop?tikz draws line in wrong place (2 pages above its definition)Why does “fill opacity” affect nodes in the same path?Tikz: Is it possible to change line style within same draw command?`latex` and `pdflatex` produce different colors given the same TikZ pictureWhy is prooftrees putting everything on the same line?Omit the same coordinate parameters in drawing line in tikz
Is the Indo-European language family made up?
At what point in European history could a government build a printing press given a basic description?
What was the idiom for something that we take without a doubt?
Why did David Cameron offer a referendum on the European Union?
Why are C64 games inconsistent with which joystick port they use?
What are the real benefits of using Salesforce DX?
I unknowingly submitted plagarised work
What to do when you've set the wrong ISO for your film?
Compactness of finite sets
In general, would I need to season a meat when making a sauce?
How to know if a folder is a symbolic link?
What is quasi-aromaticity?
When and what was the first 3D acceleration device ever released?
How to use Palladio font in text body but Computer Modern for Equations?
What is the environment variable XDG_VTNR?
What does this symbol on the box of power supply mean?
Crossing US border with music files I'm legally allowed to possess
Installed Electric Tankless Water Heater - Internet loss when active
Why colon to denote that a value belongs to a type?
Use backslash or single-quotes for field separation
Why do Ryanair allow me to book connecting itineraries through a third party, but not through their own website?
Why does Mjolnir fall down in Age of Ultron but not in Endgame?
Construct a word ladder
Should one buy new hardware after a system compromise?
Why does a perfectly-identical repetition of a drawing command given within an earlier loop 𝘯𝘰𝘵 produce exactly the same line?
Does TikZ use the same internal mechanism as PSTricks to produce vector based pdf outputs?Reuse of soft path in fading declaration? Transformation of fadings?Why does cleveref's crefname command have no effect when it appears within a foreach?Why does this pgfmathparse not work outside the foreach loop?tikz draws line in wrong place (2 pages above its definition)Why does “fill opacity” affect nodes in the same path?Tikz: Is it possible to change line style within same draw command?`latex` and `pdflatex` produce different colors given the same TikZ pictureWhy is prooftrees putting everything on the same line?Omit the same coordinate parameters in drawing line in tikz
Question. Why does the following code produce a line from vertex 0 to vertex 1 which does not perfectly coincide with the analogous line drawn earlier (by way of the foreach-loop)?
begintikzpicture
foreach n/a/r in 0/0/100,1/72/100,2/144/100,3/216/100,4/288/100
node (vn) at (a:r pt) [];
foreach n in 0,1,2,3,4
pgfmathsetmacroauxoneMod(n,5);
pgfmathsetmacroauxtwoMod(add(n,1),5);
pgfmathsetmacroauxthreeMod(add(n,2),5);
draw[opacity=0.5] (vauxtwo)--(vauxone);
draw[opacity=0.5] (vauxthree)--(vauxone);
draw[opacity=0.5] (v0)--(v1);
endtikzpicture
The offending output is the following:
Remarks.
My wish is to have the second line from 0 to 1 coincide perfect with the previously drawn one (and hence create a darker hue, because of the superposition of two opacity-0.5-lines).
I fail to see any reason for the non-congruence of the two lines. (If one mentally substitues the variables auxone and auxtwo, then the two drawing-commands in question seem perfectly identical to me, hence can be expected to have exactly the same effect.)
I tried to exchange the line
draw[opacity=0.5] (v0)--(v1);
with the line
draw[opacity=0.5] (v0.center)--(v1.center);
producing a slighly different, yet still unexplained and undesirable, result, which I permit myself to also reproduce (in the hope that this might help someone understand the problem):
tikz-pgf foreach technical-drawing tikz-graphdrawing
add a comment |
Question. Why does the following code produce a line from vertex 0 to vertex 1 which does not perfectly coincide with the analogous line drawn earlier (by way of the foreach-loop)?
begintikzpicture
foreach n/a/r in 0/0/100,1/72/100,2/144/100,3/216/100,4/288/100
node (vn) at (a:r pt) [];
foreach n in 0,1,2,3,4
pgfmathsetmacroauxoneMod(n,5);
pgfmathsetmacroauxtwoMod(add(n,1),5);
pgfmathsetmacroauxthreeMod(add(n,2),5);
draw[opacity=0.5] (vauxtwo)--(vauxone);
draw[opacity=0.5] (vauxthree)--(vauxone);
draw[opacity=0.5] (v0)--(v1);
endtikzpicture
The offending output is the following:
Remarks.
My wish is to have the second line from 0 to 1 coincide perfect with the previously drawn one (and hence create a darker hue, because of the superposition of two opacity-0.5-lines).
I fail to see any reason for the non-congruence of the two lines. (If one mentally substitues the variables auxone and auxtwo, then the two drawing-commands in question seem perfectly identical to me, hence can be expected to have exactly the same effect.)
I tried to exchange the line
draw[opacity=0.5] (v0)--(v1);
with the line
draw[opacity=0.5] (v0.center)--(v1.center);
producing a slighly different, yet still unexplained and undesirable, result, which I permit myself to also reproduce (in the hope that this might help someone understand the problem):
tikz-pgf foreach technical-drawing tikz-graphdrawing
add a comment |
Question. Why does the following code produce a line from vertex 0 to vertex 1 which does not perfectly coincide with the analogous line drawn earlier (by way of the foreach-loop)?
begintikzpicture
foreach n/a/r in 0/0/100,1/72/100,2/144/100,3/216/100,4/288/100
node (vn) at (a:r pt) [];
foreach n in 0,1,2,3,4
pgfmathsetmacroauxoneMod(n,5);
pgfmathsetmacroauxtwoMod(add(n,1),5);
pgfmathsetmacroauxthreeMod(add(n,2),5);
draw[opacity=0.5] (vauxtwo)--(vauxone);
draw[opacity=0.5] (vauxthree)--(vauxone);
draw[opacity=0.5] (v0)--(v1);
endtikzpicture
The offending output is the following:
Remarks.
My wish is to have the second line from 0 to 1 coincide perfect with the previously drawn one (and hence create a darker hue, because of the superposition of two opacity-0.5-lines).
I fail to see any reason for the non-congruence of the two lines. (If one mentally substitues the variables auxone and auxtwo, then the two drawing-commands in question seem perfectly identical to me, hence can be expected to have exactly the same effect.)
I tried to exchange the line
draw[opacity=0.5] (v0)--(v1);
with the line
draw[opacity=0.5] (v0.center)--(v1.center);
producing a slighly different, yet still unexplained and undesirable, result, which I permit myself to also reproduce (in the hope that this might help someone understand the problem):
tikz-pgf foreach technical-drawing tikz-graphdrawing
Question. Why does the following code produce a line from vertex 0 to vertex 1 which does not perfectly coincide with the analogous line drawn earlier (by way of the foreach-loop)?
begintikzpicture
foreach n/a/r in 0/0/100,1/72/100,2/144/100,3/216/100,4/288/100
node (vn) at (a:r pt) [];
foreach n in 0,1,2,3,4
pgfmathsetmacroauxoneMod(n,5);
pgfmathsetmacroauxtwoMod(add(n,1),5);
pgfmathsetmacroauxthreeMod(add(n,2),5);
draw[opacity=0.5] (vauxtwo)--(vauxone);
draw[opacity=0.5] (vauxthree)--(vauxone);
draw[opacity=0.5] (v0)--(v1);
endtikzpicture
The offending output is the following:
Remarks.
My wish is to have the second line from 0 to 1 coincide perfect with the previously drawn one (and hence create a darker hue, because of the superposition of two opacity-0.5-lines).
I fail to see any reason for the non-congruence of the two lines. (If one mentally substitues the variables auxone and auxtwo, then the two drawing-commands in question seem perfectly identical to me, hence can be expected to have exactly the same effect.)
I tried to exchange the line
draw[opacity=0.5] (v0)--(v1);
with the line
draw[opacity=0.5] (v0.center)--(v1.center);
producing a slighly different, yet still unexplained and undesirable, result, which I permit myself to also reproduce (in the hope that this might help someone understand the problem):
tikz-pgf foreach technical-drawing tikz-graphdrawing
tikz-pgf foreach technical-drawing tikz-graphdrawing
asked 8 hours ago


Peter HeinigPeter Heinig
38318
38318
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
Because you were using pgfmathsetmacro
, which adds .0
at the end of the numbers, which get interpreted as anchors (.0
is equivalent to .east
in this case). If you use pgfmathtruncatemacro
instead the lines match perfectly, as they should.
documentclass[tikz,border=3.14mm]standalone
begindocument
begintikzpicture
foreach n/a/r in 0/0/100,1/72/100,2/144/100,3/216/100,4/288/100
node (vn) at (a:r pt) [];
foreach n in 0,1,2,3,4
pgfmathtruncatemacroauxoneMod(n,5);
pgfmathtruncatemacroauxtwoMod(add(n,1),5);
pgfmathtruncatemacroauxthreeMod(add(n,2),5);
draw[opacity=0.5] (vauxtwo)--(vauxone);
draw[opacity=0.5] (vauxthree)--(vauxone);
draw[opacity=0.5] (v0)--(v1);
endtikzpicture
enddocument
If you want to close the gaps, you may want to use coordinate
s instead of node
s.
documentclass[tikz,border=3.14mm]standalone
begindocument
begintikzpicture
foreach n/a/r in 0/0/100,1/72/100,2/144/100,3/216/100,4/288/100
coordinate (vn) at (a:r pt);
foreach n in 0,1,2,3,4
pgfmathtruncatemacroauxoneMod(n,5);
pgfmathtruncatemacroauxtwoMod(add(n,1),5);
pgfmathtruncatemacroauxthreeMod(add(n,2),5);
draw[opacity=0.5] (vauxtwo)--(vauxone);
draw[opacity=0.5] (vauxthree)--(vauxone);
draw[opacity=0.5] (v0)--(v1);
endtikzpicture
enddocument
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/3.0/"u003ecc by-sa 3.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%2f492625%2fwhy-does-a-perfectly-identical-repetition-of-a-drawing-command-given-within-an-e%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Because you were using pgfmathsetmacro
, which adds .0
at the end of the numbers, which get interpreted as anchors (.0
is equivalent to .east
in this case). If you use pgfmathtruncatemacro
instead the lines match perfectly, as they should.
documentclass[tikz,border=3.14mm]standalone
begindocument
begintikzpicture
foreach n/a/r in 0/0/100,1/72/100,2/144/100,3/216/100,4/288/100
node (vn) at (a:r pt) [];
foreach n in 0,1,2,3,4
pgfmathtruncatemacroauxoneMod(n,5);
pgfmathtruncatemacroauxtwoMod(add(n,1),5);
pgfmathtruncatemacroauxthreeMod(add(n,2),5);
draw[opacity=0.5] (vauxtwo)--(vauxone);
draw[opacity=0.5] (vauxthree)--(vauxone);
draw[opacity=0.5] (v0)--(v1);
endtikzpicture
enddocument
If you want to close the gaps, you may want to use coordinate
s instead of node
s.
documentclass[tikz,border=3.14mm]standalone
begindocument
begintikzpicture
foreach n/a/r in 0/0/100,1/72/100,2/144/100,3/216/100,4/288/100
coordinate (vn) at (a:r pt);
foreach n in 0,1,2,3,4
pgfmathtruncatemacroauxoneMod(n,5);
pgfmathtruncatemacroauxtwoMod(add(n,1),5);
pgfmathtruncatemacroauxthreeMod(add(n,2),5);
draw[opacity=0.5] (vauxtwo)--(vauxone);
draw[opacity=0.5] (vauxthree)--(vauxone);
draw[opacity=0.5] (v0)--(v1);
endtikzpicture
enddocument
add a comment |
Because you were using pgfmathsetmacro
, which adds .0
at the end of the numbers, which get interpreted as anchors (.0
is equivalent to .east
in this case). If you use pgfmathtruncatemacro
instead the lines match perfectly, as they should.
documentclass[tikz,border=3.14mm]standalone
begindocument
begintikzpicture
foreach n/a/r in 0/0/100,1/72/100,2/144/100,3/216/100,4/288/100
node (vn) at (a:r pt) [];
foreach n in 0,1,2,3,4
pgfmathtruncatemacroauxoneMod(n,5);
pgfmathtruncatemacroauxtwoMod(add(n,1),5);
pgfmathtruncatemacroauxthreeMod(add(n,2),5);
draw[opacity=0.5] (vauxtwo)--(vauxone);
draw[opacity=0.5] (vauxthree)--(vauxone);
draw[opacity=0.5] (v0)--(v1);
endtikzpicture
enddocument
If you want to close the gaps, you may want to use coordinate
s instead of node
s.
documentclass[tikz,border=3.14mm]standalone
begindocument
begintikzpicture
foreach n/a/r in 0/0/100,1/72/100,2/144/100,3/216/100,4/288/100
coordinate (vn) at (a:r pt);
foreach n in 0,1,2,3,4
pgfmathtruncatemacroauxoneMod(n,5);
pgfmathtruncatemacroauxtwoMod(add(n,1),5);
pgfmathtruncatemacroauxthreeMod(add(n,2),5);
draw[opacity=0.5] (vauxtwo)--(vauxone);
draw[opacity=0.5] (vauxthree)--(vauxone);
draw[opacity=0.5] (v0)--(v1);
endtikzpicture
enddocument
add a comment |
Because you were using pgfmathsetmacro
, which adds .0
at the end of the numbers, which get interpreted as anchors (.0
is equivalent to .east
in this case). If you use pgfmathtruncatemacro
instead the lines match perfectly, as they should.
documentclass[tikz,border=3.14mm]standalone
begindocument
begintikzpicture
foreach n/a/r in 0/0/100,1/72/100,2/144/100,3/216/100,4/288/100
node (vn) at (a:r pt) [];
foreach n in 0,1,2,3,4
pgfmathtruncatemacroauxoneMod(n,5);
pgfmathtruncatemacroauxtwoMod(add(n,1),5);
pgfmathtruncatemacroauxthreeMod(add(n,2),5);
draw[opacity=0.5] (vauxtwo)--(vauxone);
draw[opacity=0.5] (vauxthree)--(vauxone);
draw[opacity=0.5] (v0)--(v1);
endtikzpicture
enddocument
If you want to close the gaps, you may want to use coordinate
s instead of node
s.
documentclass[tikz,border=3.14mm]standalone
begindocument
begintikzpicture
foreach n/a/r in 0/0/100,1/72/100,2/144/100,3/216/100,4/288/100
coordinate (vn) at (a:r pt);
foreach n in 0,1,2,3,4
pgfmathtruncatemacroauxoneMod(n,5);
pgfmathtruncatemacroauxtwoMod(add(n,1),5);
pgfmathtruncatemacroauxthreeMod(add(n,2),5);
draw[opacity=0.5] (vauxtwo)--(vauxone);
draw[opacity=0.5] (vauxthree)--(vauxone);
draw[opacity=0.5] (v0)--(v1);
endtikzpicture
enddocument
Because you were using pgfmathsetmacro
, which adds .0
at the end of the numbers, which get interpreted as anchors (.0
is equivalent to .east
in this case). If you use pgfmathtruncatemacro
instead the lines match perfectly, as they should.
documentclass[tikz,border=3.14mm]standalone
begindocument
begintikzpicture
foreach n/a/r in 0/0/100,1/72/100,2/144/100,3/216/100,4/288/100
node (vn) at (a:r pt) [];
foreach n in 0,1,2,3,4
pgfmathtruncatemacroauxoneMod(n,5);
pgfmathtruncatemacroauxtwoMod(add(n,1),5);
pgfmathtruncatemacroauxthreeMod(add(n,2),5);
draw[opacity=0.5] (vauxtwo)--(vauxone);
draw[opacity=0.5] (vauxthree)--(vauxone);
draw[opacity=0.5] (v0)--(v1);
endtikzpicture
enddocument
If you want to close the gaps, you may want to use coordinate
s instead of node
s.
documentclass[tikz,border=3.14mm]standalone
begindocument
begintikzpicture
foreach n/a/r in 0/0/100,1/72/100,2/144/100,3/216/100,4/288/100
coordinate (vn) at (a:r pt);
foreach n in 0,1,2,3,4
pgfmathtruncatemacroauxoneMod(n,5);
pgfmathtruncatemacroauxtwoMod(add(n,1),5);
pgfmathtruncatemacroauxthreeMod(add(n,2),5);
draw[opacity=0.5] (vauxtwo)--(vauxone);
draw[opacity=0.5] (vauxthree)--(vauxone);
draw[opacity=0.5] (v0)--(v1);
endtikzpicture
enddocument
answered 8 hours ago


marmotmarmot
130k6164312
130k6164312
add a comment |
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%2f492625%2fwhy-does-a-perfectly-identical-repetition-of-a-drawing-command-given-within-an-e%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