Why does a perfectly-identical repetition of a drawing command given within an earlier loop 𝘯𝘰𝘵...
Compactness of finite sets
What was the idiom for something that we take without a doubt?
How to execute this code on startup?
A steel cutting sword?
keyval - function for keyB should act dependent on value of keyA - how to do this?
What are the real benefits of using Salesforce DX?
How to know if a folder is a symbolic link?
Why did David Cameron offer a referendum on the European Union?
Why are C64 games inconsistent with which joystick port they use?
Is the Starlink array really visible from Earth?
Why colon to denote that a value belongs to a type?
Why do airplanes use an axial flow jet engine instead of a more compact centrifugal jet engine?
Who will lead the country until there is a new Tory leader?
What is the largest (size) solid object ever dropped from an airplane to impact the ground in freefall?
Count Even Digits In Number
If a person had control of every single cell of their body, would they be able to transform into another creature?
How to use Palladio font in text body but Computer Modern for Equations?
Text at the right of icon
What to do when you've set the wrong ISO for your film?
Can I install both XCode & Android Studio on MacBook Air with only 8 GB of Ram
Did people go back to where they were?
Is real public IP Address hidden when using a system wide proxy in Windows 10?
Line of lights moving in a straight line , with a few following
Where have Brexit voters gone?
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)?
begin{tikzpicture}
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}{
pgfmathsetmacroauxone{Mod(n,5)};
pgfmathsetmacroauxtwo{Mod(add(n,1),5)};
pgfmathsetmacroauxthree{Mod(add(n,2),5)};
draw[opacity=0.5] (vauxtwo)--(vauxone);
draw[opacity=0.5] (vauxthree)--(vauxone);
}
draw[opacity=0.5] (v0)--(v1);
end{tikzpicture}
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)?
begin{tikzpicture}
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}{
pgfmathsetmacroauxone{Mod(n,5)};
pgfmathsetmacroauxtwo{Mod(add(n,1),5)};
pgfmathsetmacroauxthree{Mod(add(n,2),5)};
draw[opacity=0.5] (vauxtwo)--(vauxone);
draw[opacity=0.5] (vauxthree)--(vauxone);
}
draw[opacity=0.5] (v0)--(v1);
end{tikzpicture}
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)?
begin{tikzpicture}
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}{
pgfmathsetmacroauxone{Mod(n,5)};
pgfmathsetmacroauxtwo{Mod(add(n,1),5)};
pgfmathsetmacroauxthree{Mod(add(n,2),5)};
draw[opacity=0.5] (vauxtwo)--(vauxone);
draw[opacity=0.5] (vauxthree)--(vauxone);
}
draw[opacity=0.5] (v0)--(v1);
end{tikzpicture}
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)?
begin{tikzpicture}
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}{
pgfmathsetmacroauxone{Mod(n,5)};
pgfmathsetmacroauxtwo{Mod(add(n,1),5)};
pgfmathsetmacroauxthree{Mod(add(n,2),5)};
draw[opacity=0.5] (vauxtwo)--(vauxone);
draw[opacity=0.5] (vauxthree)--(vauxone);
}
draw[opacity=0.5] (v0)--(v1);
end{tikzpicture}
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}
begin{document}
begin{tikzpicture}
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}{
pgfmathtruncatemacroauxone{Mod(n,5)};
pgfmathtruncatemacroauxtwo{Mod(add(n,1),5)};
pgfmathtruncatemacroauxthree{Mod(add(n,2),5)};
draw[opacity=0.5] (vauxtwo)--(vauxone);
draw[opacity=0.5] (vauxthree)--(vauxone);
}
draw[opacity=0.5] (v0)--(v1);
end{tikzpicture}
end{document}
If you want to close the gaps, you may want to use coordinate
s instead of node
s.
documentclass[tikz,border=3.14mm]{standalone}
begin{document}
begin{tikzpicture}
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}{
pgfmathtruncatemacroauxone{Mod(n,5)};
pgfmathtruncatemacroauxtwo{Mod(add(n,1),5)};
pgfmathtruncatemacroauxthree{Mod(add(n,2),5)};
draw[opacity=0.5] (vauxtwo)--(vauxone);
draw[opacity=0.5] (vauxthree)--(vauxone);
}
draw[opacity=0.5] (v0)--(v1);
end{tikzpicture}
end{document}
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}
begin{document}
begin{tikzpicture}
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}{
pgfmathtruncatemacroauxone{Mod(n,5)};
pgfmathtruncatemacroauxtwo{Mod(add(n,1),5)};
pgfmathtruncatemacroauxthree{Mod(add(n,2),5)};
draw[opacity=0.5] (vauxtwo)--(vauxone);
draw[opacity=0.5] (vauxthree)--(vauxone);
}
draw[opacity=0.5] (v0)--(v1);
end{tikzpicture}
end{document}
If you want to close the gaps, you may want to use coordinate
s instead of node
s.
documentclass[tikz,border=3.14mm]{standalone}
begin{document}
begin{tikzpicture}
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}{
pgfmathtruncatemacroauxone{Mod(n,5)};
pgfmathtruncatemacroauxtwo{Mod(add(n,1),5)};
pgfmathtruncatemacroauxthree{Mod(add(n,2),5)};
draw[opacity=0.5] (vauxtwo)--(vauxone);
draw[opacity=0.5] (vauxthree)--(vauxone);
}
draw[opacity=0.5] (v0)--(v1);
end{tikzpicture}
end{document}
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}
begin{document}
begin{tikzpicture}
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}{
pgfmathtruncatemacroauxone{Mod(n,5)};
pgfmathtruncatemacroauxtwo{Mod(add(n,1),5)};
pgfmathtruncatemacroauxthree{Mod(add(n,2),5)};
draw[opacity=0.5] (vauxtwo)--(vauxone);
draw[opacity=0.5] (vauxthree)--(vauxone);
}
draw[opacity=0.5] (v0)--(v1);
end{tikzpicture}
end{document}
If you want to close the gaps, you may want to use coordinate
s instead of node
s.
documentclass[tikz,border=3.14mm]{standalone}
begin{document}
begin{tikzpicture}
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}{
pgfmathtruncatemacroauxone{Mod(n,5)};
pgfmathtruncatemacroauxtwo{Mod(add(n,1),5)};
pgfmathtruncatemacroauxthree{Mod(add(n,2),5)};
draw[opacity=0.5] (vauxtwo)--(vauxone);
draw[opacity=0.5] (vauxthree)--(vauxone);
}
draw[opacity=0.5] (v0)--(v1);
end{tikzpicture}
end{document}
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}
begin{document}
begin{tikzpicture}
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}{
pgfmathtruncatemacroauxone{Mod(n,5)};
pgfmathtruncatemacroauxtwo{Mod(add(n,1),5)};
pgfmathtruncatemacroauxthree{Mod(add(n,2),5)};
draw[opacity=0.5] (vauxtwo)--(vauxone);
draw[opacity=0.5] (vauxthree)--(vauxone);
}
draw[opacity=0.5] (v0)--(v1);
end{tikzpicture}
end{document}
If you want to close the gaps, you may want to use coordinate
s instead of node
s.
documentclass[tikz,border=3.14mm]{standalone}
begin{document}
begin{tikzpicture}
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}{
pgfmathtruncatemacroauxone{Mod(n,5)};
pgfmathtruncatemacroauxtwo{Mod(add(n,1),5)};
pgfmathtruncatemacroauxthree{Mod(add(n,2),5)};
draw[opacity=0.5] (vauxtwo)--(vauxone);
draw[opacity=0.5] (vauxthree)--(vauxone);
}
draw[opacity=0.5] (v0)--(v1);
end{tikzpicture}
end{document}
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}
begin{document}
begin{tikzpicture}
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}{
pgfmathtruncatemacroauxone{Mod(n,5)};
pgfmathtruncatemacroauxtwo{Mod(add(n,1),5)};
pgfmathtruncatemacroauxthree{Mod(add(n,2),5)};
draw[opacity=0.5] (vauxtwo)--(vauxone);
draw[opacity=0.5] (vauxthree)--(vauxone);
}
draw[opacity=0.5] (v0)--(v1);
end{tikzpicture}
end{document}
If you want to close the gaps, you may want to use coordinate
s instead of node
s.
documentclass[tikz,border=3.14mm]{standalone}
begin{document}
begin{tikzpicture}
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}{
pgfmathtruncatemacroauxone{Mod(n,5)};
pgfmathtruncatemacroauxtwo{Mod(add(n,1),5)};
pgfmathtruncatemacroauxthree{Mod(add(n,2),5)};
draw[opacity=0.5] (vauxtwo)--(vauxone);
draw[opacity=0.5] (vauxthree)--(vauxone);
}
draw[opacity=0.5] (v0)--(v1);
end{tikzpicture}
end{document}
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