Local-scoped coordinate names in tikz?
Clash Royale CLAN TAG#URR8PPP
up vote
7
down vote
favorite
I think I just discovered (!) that coordinates names are global in tikz
:
documentclassarticle
usepackage[T1]fontenc
usepackage[utf8]inputenc
usepackagetikz
begindocument
begintikzpicture[black]
draw(0,0) coordinate(alfa) -- (3,0) coordinate(beta);
endtikzpicture
begintikzpicture[blue]
draw (alfa) -- (beta);
endtikzpicture
begintikzpicture[red]
beginscope
draw(1,0) coordinate(alfa) -- (2,0) coordinate(beta);
endscope
endtikzpicture
begintikzpicture[green]
draw (alfa) -- (beta);
endtikzpicture
enddocument
...and I really expected
- an error in the second
tikzpicture
(I am not usingremember picture
!), and - a
(0,0)--(3,0)
green line...
So,
am I correct that coordinate names are global to all
tikzpicture
s?As a bonus question, is it possible to create local coordinate names?
tikz-pgf
add a comment |
up vote
7
down vote
favorite
I think I just discovered (!) that coordinates names are global in tikz
:
documentclassarticle
usepackage[T1]fontenc
usepackage[utf8]inputenc
usepackagetikz
begindocument
begintikzpicture[black]
draw(0,0) coordinate(alfa) -- (3,0) coordinate(beta);
endtikzpicture
begintikzpicture[blue]
draw (alfa) -- (beta);
endtikzpicture
begintikzpicture[red]
beginscope
draw(1,0) coordinate(alfa) -- (2,0) coordinate(beta);
endscope
endtikzpicture
begintikzpicture[green]
draw (alfa) -- (beta);
endtikzpicture
enddocument
...and I really expected
- an error in the second
tikzpicture
(I am not usingremember picture
!), and - a
(0,0)--(3,0)
green line...
So,
am I correct that coordinate names are global to all
tikzpicture
s?As a bonus question, is it possible to create local coordinate names?
tikz-pgf
1
+1 I didn't know that either. On page983
we find this, and I quote:pgfgetlastxymacro for xmacro for y Since (x,y) coordinates are usually assigned globally, it is safe to use this command after path operations
– AndréC
7 hours ago
add a comment |
up vote
7
down vote
favorite
up vote
7
down vote
favorite
I think I just discovered (!) that coordinates names are global in tikz
:
documentclassarticle
usepackage[T1]fontenc
usepackage[utf8]inputenc
usepackagetikz
begindocument
begintikzpicture[black]
draw(0,0) coordinate(alfa) -- (3,0) coordinate(beta);
endtikzpicture
begintikzpicture[blue]
draw (alfa) -- (beta);
endtikzpicture
begintikzpicture[red]
beginscope
draw(1,0) coordinate(alfa) -- (2,0) coordinate(beta);
endscope
endtikzpicture
begintikzpicture[green]
draw (alfa) -- (beta);
endtikzpicture
enddocument
...and I really expected
- an error in the second
tikzpicture
(I am not usingremember picture
!), and - a
(0,0)--(3,0)
green line...
So,
am I correct that coordinate names are global to all
tikzpicture
s?As a bonus question, is it possible to create local coordinate names?
tikz-pgf
I think I just discovered (!) that coordinates names are global in tikz
:
documentclassarticle
usepackage[T1]fontenc
usepackage[utf8]inputenc
usepackagetikz
begindocument
begintikzpicture[black]
draw(0,0) coordinate(alfa) -- (3,0) coordinate(beta);
endtikzpicture
begintikzpicture[blue]
draw (alfa) -- (beta);
endtikzpicture
begintikzpicture[red]
beginscope
draw(1,0) coordinate(alfa) -- (2,0) coordinate(beta);
endscope
endtikzpicture
begintikzpicture[green]
draw (alfa) -- (beta);
endtikzpicture
enddocument
...and I really expected
- an error in the second
tikzpicture
(I am not usingremember picture
!), and - a
(0,0)--(3,0)
green line...
So,
am I correct that coordinate names are global to all
tikzpicture
s?As a bonus question, is it possible to create local coordinate names?
tikz-pgf
tikz-pgf
edited 8 hours ago
asked 8 hours ago
Rmano
7,21221647
7,21221647
1
+1 I didn't know that either. On page983
we find this, and I quote:pgfgetlastxymacro for xmacro for y Since (x,y) coordinates are usually assigned globally, it is safe to use this command after path operations
– AndréC
7 hours ago
add a comment |
1
+1 I didn't know that either. On page983
we find this, and I quote:pgfgetlastxymacro for xmacro for y Since (x,y) coordinates are usually assigned globally, it is safe to use this command after path operations
– AndréC
7 hours ago
1
1
+1 I didn't know that either. On page
983
we find this, and I quote: pgfgetlastxymacro for xmacro for y Since (x,y) coordinates are usually assigned globally, it is safe to use this command after path operations
– AndréC
7 hours ago
+1 I didn't know that either. On page
983
we find this, and I quote: pgfgetlastxymacro for xmacro for y Since (x,y) coordinates are usually assigned globally, it is safe to use this command after path operations
– AndréC
7 hours ago
add a comment |
1 Answer
1
active
oldest
votes
up vote
5
down vote
accepted
Yes, I've observed that before. And I think your interpretation is correct, and you can make coordinates "local" by using name prefix
.
documentclassarticle
usepackage[T1]fontenc
usepackage[utf8]inputenc
usepackagetikz
begindocument
begintikzpicture[black]
draw(0,0) coordinate(alfa) -- (3,0) coordinate(beta);
endtikzpicture
begintikzpicture[blue]
draw (alfa) -- (beta);
endtikzpicture
begintikzpicture[red,name prefix=Rmano]
beginscope
draw(1,0) coordinate(alfa) -- (2,0) coordinate(beta);
endscope
endtikzpicture
begintikzpicture[green]
draw (alfa) -- (beta);
endtikzpicture
enddocument
Ah,name prefix
is a nice trick. Thanks!
– Rmano
7 hours ago
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
5
down vote
accepted
Yes, I've observed that before. And I think your interpretation is correct, and you can make coordinates "local" by using name prefix
.
documentclassarticle
usepackage[T1]fontenc
usepackage[utf8]inputenc
usepackagetikz
begindocument
begintikzpicture[black]
draw(0,0) coordinate(alfa) -- (3,0) coordinate(beta);
endtikzpicture
begintikzpicture[blue]
draw (alfa) -- (beta);
endtikzpicture
begintikzpicture[red,name prefix=Rmano]
beginscope
draw(1,0) coordinate(alfa) -- (2,0) coordinate(beta);
endscope
endtikzpicture
begintikzpicture[green]
draw (alfa) -- (beta);
endtikzpicture
enddocument
Ah,name prefix
is a nice trick. Thanks!
– Rmano
7 hours ago
add a comment |
up vote
5
down vote
accepted
Yes, I've observed that before. And I think your interpretation is correct, and you can make coordinates "local" by using name prefix
.
documentclassarticle
usepackage[T1]fontenc
usepackage[utf8]inputenc
usepackagetikz
begindocument
begintikzpicture[black]
draw(0,0) coordinate(alfa) -- (3,0) coordinate(beta);
endtikzpicture
begintikzpicture[blue]
draw (alfa) -- (beta);
endtikzpicture
begintikzpicture[red,name prefix=Rmano]
beginscope
draw(1,0) coordinate(alfa) -- (2,0) coordinate(beta);
endscope
endtikzpicture
begintikzpicture[green]
draw (alfa) -- (beta);
endtikzpicture
enddocument
Ah,name prefix
is a nice trick. Thanks!
– Rmano
7 hours ago
add a comment |
up vote
5
down vote
accepted
up vote
5
down vote
accepted
Yes, I've observed that before. And I think your interpretation is correct, and you can make coordinates "local" by using name prefix
.
documentclassarticle
usepackage[T1]fontenc
usepackage[utf8]inputenc
usepackagetikz
begindocument
begintikzpicture[black]
draw(0,0) coordinate(alfa) -- (3,0) coordinate(beta);
endtikzpicture
begintikzpicture[blue]
draw (alfa) -- (beta);
endtikzpicture
begintikzpicture[red,name prefix=Rmano]
beginscope
draw(1,0) coordinate(alfa) -- (2,0) coordinate(beta);
endscope
endtikzpicture
begintikzpicture[green]
draw (alfa) -- (beta);
endtikzpicture
enddocument
Yes, I've observed that before. And I think your interpretation is correct, and you can make coordinates "local" by using name prefix
.
documentclassarticle
usepackage[T1]fontenc
usepackage[utf8]inputenc
usepackagetikz
begindocument
begintikzpicture[black]
draw(0,0) coordinate(alfa) -- (3,0) coordinate(beta);
endtikzpicture
begintikzpicture[blue]
draw (alfa) -- (beta);
endtikzpicture
begintikzpicture[red,name prefix=Rmano]
beginscope
draw(1,0) coordinate(alfa) -- (2,0) coordinate(beta);
endscope
endtikzpicture
begintikzpicture[green]
draw (alfa) -- (beta);
endtikzpicture
enddocument
answered 7 hours ago
marmot
73.9k480155
73.9k480155
Ah,name prefix
is a nice trick. Thanks!
– Rmano
7 hours ago
add a comment |
Ah,name prefix
is a nice trick. Thanks!
– Rmano
7 hours ago
Ah,
name prefix
is a nice trick. Thanks!– Rmano
7 hours ago
Ah,
name prefix
is a nice trick. Thanks!– Rmano
7 hours ago
add a comment |
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
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f459492%2flocal-scoped-coordinate-names-in-tikz%23new-answer', 'question_page');
);
Post as a guest
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
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
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
1
+1 I didn't know that either. On page
983
we find this, and I quote:pgfgetlastxymacro for xmacro for y Since (x,y) coordinates are usually assigned globally, it is safe to use this command after path operations
– AndréC
7 hours ago