Different dimensions with shift and xshift
Clash Royale CLAN TAG#URR8PPP
I discovered that there is a different default dimension in shift and xshift.
Consider the following mwe
documentclassarticle
usepackagetikz
begindocument
begintikzpicture
node (a) at (0,3) a;
node (b) at (0,2) b;
node (c) at (0,1) c;
node (d) at (0,0) d;
node[xshift=5cm] at (a) aa;
node[shift=(5cm,0)] at (b) bb;
node[xshift=5] at (c) cc;
node[shift=(5,0)] at (d) dd;
draw[help lines] (0,0) grid (5,3) ;
endtikzpicture
enddocument
It gives the following result:
For the two first lines given with 'cm' (a and b), the behavior of shift and xshift is the same.
But without dimensions (c and d) , it seems that shift uses default tikz dimensions, while xshift seems to use point?
I noticed that in the manual xshift is always given with cm, but this behavior is not explained.
Am I doing something incorrect? Is it a bug or a feature?
tikz-pgf
add a comment |
I discovered that there is a different default dimension in shift and xshift.
Consider the following mwe
documentclassarticle
usepackagetikz
begindocument
begintikzpicture
node (a) at (0,3) a;
node (b) at (0,2) b;
node (c) at (0,1) c;
node (d) at (0,0) d;
node[xshift=5cm] at (a) aa;
node[shift=(5cm,0)] at (b) bb;
node[xshift=5] at (c) cc;
node[shift=(5,0)] at (d) dd;
draw[help lines] (0,0) grid (5,3) ;
endtikzpicture
enddocument
It gives the following result:
For the two first lines given with 'cm' (a and b), the behavior of shift and xshift is the same.
But without dimensions (c and d) , it seems that shift uses default tikz dimensions, while xshift seems to use point?
I noticed that in the manual xshift is always given with cm, but this behavior is not explained.
Am I doing something incorrect? Is it a bug or a feature?
tikz-pgf
2
You're not doing anything incorrect, and this has been noticed before. Another situation in which the default unit is cm is a cricle, sodraw (0,0) circle(1);
gives you a circle of radius 1cm, similarly for arcs. As you have noticed, this is also true for coordinates, soat (1,0)
andat (1cm,0)
are equivalent. That's why theshift=(5,0)
andshift=(5cm,0)
can be used interchangedly. But for "most" other situations the default unit ispt
.
– marmot
Jan 13 at 1:05
I can understand that commands doing completely different actions have different default dimensions. But shift and xshift seem very close, at least in terms of functionality. And this difference in behavior is really confusing...
– Alain Merigot
Jan 13 at 1:14
I agree it is confusing. But in my list of confusing things this is below the confusion which library one has to load to make an example from the pgfmanual run through. (And I would like to draw your attention to this source of confusion, which confuses me, too. ;-)
– marmot
Jan 13 at 1:17
add a comment |
I discovered that there is a different default dimension in shift and xshift.
Consider the following mwe
documentclassarticle
usepackagetikz
begindocument
begintikzpicture
node (a) at (0,3) a;
node (b) at (0,2) b;
node (c) at (0,1) c;
node (d) at (0,0) d;
node[xshift=5cm] at (a) aa;
node[shift=(5cm,0)] at (b) bb;
node[xshift=5] at (c) cc;
node[shift=(5,0)] at (d) dd;
draw[help lines] (0,0) grid (5,3) ;
endtikzpicture
enddocument
It gives the following result:
For the two first lines given with 'cm' (a and b), the behavior of shift and xshift is the same.
But without dimensions (c and d) , it seems that shift uses default tikz dimensions, while xshift seems to use point?
I noticed that in the manual xshift is always given with cm, but this behavior is not explained.
Am I doing something incorrect? Is it a bug or a feature?
tikz-pgf
I discovered that there is a different default dimension in shift and xshift.
Consider the following mwe
documentclassarticle
usepackagetikz
begindocument
begintikzpicture
node (a) at (0,3) a;
node (b) at (0,2) b;
node (c) at (0,1) c;
node (d) at (0,0) d;
node[xshift=5cm] at (a) aa;
node[shift=(5cm,0)] at (b) bb;
node[xshift=5] at (c) cc;
node[shift=(5,0)] at (d) dd;
draw[help lines] (0,0) grid (5,3) ;
endtikzpicture
enddocument
It gives the following result:
For the two first lines given with 'cm' (a and b), the behavior of shift and xshift is the same.
But without dimensions (c and d) , it seems that shift uses default tikz dimensions, while xshift seems to use point?
I noticed that in the manual xshift is always given with cm, but this behavior is not explained.
Am I doing something incorrect? Is it a bug or a feature?
tikz-pgf
tikz-pgf
asked Jan 13 at 1:00
Alain MerigotAlain Merigot
1834
1834
2
You're not doing anything incorrect, and this has been noticed before. Another situation in which the default unit is cm is a cricle, sodraw (0,0) circle(1);
gives you a circle of radius 1cm, similarly for arcs. As you have noticed, this is also true for coordinates, soat (1,0)
andat (1cm,0)
are equivalent. That's why theshift=(5,0)
andshift=(5cm,0)
can be used interchangedly. But for "most" other situations the default unit ispt
.
– marmot
Jan 13 at 1:05
I can understand that commands doing completely different actions have different default dimensions. But shift and xshift seem very close, at least in terms of functionality. And this difference in behavior is really confusing...
– Alain Merigot
Jan 13 at 1:14
I agree it is confusing. But in my list of confusing things this is below the confusion which library one has to load to make an example from the pgfmanual run through. (And I would like to draw your attention to this source of confusion, which confuses me, too. ;-)
– marmot
Jan 13 at 1:17
add a comment |
2
You're not doing anything incorrect, and this has been noticed before. Another situation in which the default unit is cm is a cricle, sodraw (0,0) circle(1);
gives you a circle of radius 1cm, similarly for arcs. As you have noticed, this is also true for coordinates, soat (1,0)
andat (1cm,0)
are equivalent. That's why theshift=(5,0)
andshift=(5cm,0)
can be used interchangedly. But for "most" other situations the default unit ispt
.
– marmot
Jan 13 at 1:05
I can understand that commands doing completely different actions have different default dimensions. But shift and xshift seem very close, at least in terms of functionality. And this difference in behavior is really confusing...
– Alain Merigot
Jan 13 at 1:14
I agree it is confusing. But in my list of confusing things this is below the confusion which library one has to load to make an example from the pgfmanual run through. (And I would like to draw your attention to this source of confusion, which confuses me, too. ;-)
– marmot
Jan 13 at 1:17
2
2
You're not doing anything incorrect, and this has been noticed before. Another situation in which the default unit is cm is a cricle, so
draw (0,0) circle(1);
gives you a circle of radius 1cm, similarly for arcs. As you have noticed, this is also true for coordinates, so at (1,0)
and at (1cm,0)
are equivalent. That's why the shift=(5,0)
and shift=(5cm,0)
can be used interchangedly. But for "most" other situations the default unit is pt
.– marmot
Jan 13 at 1:05
You're not doing anything incorrect, and this has been noticed before. Another situation in which the default unit is cm is a cricle, so
draw (0,0) circle(1);
gives you a circle of radius 1cm, similarly for arcs. As you have noticed, this is also true for coordinates, so at (1,0)
and at (1cm,0)
are equivalent. That's why the shift=(5,0)
and shift=(5cm,0)
can be used interchangedly. But for "most" other situations the default unit is pt
.– marmot
Jan 13 at 1:05
I can understand that commands doing completely different actions have different default dimensions. But shift and xshift seem very close, at least in terms of functionality. And this difference in behavior is really confusing...
– Alain Merigot
Jan 13 at 1:14
I can understand that commands doing completely different actions have different default dimensions. But shift and xshift seem very close, at least in terms of functionality. And this difference in behavior is really confusing...
– Alain Merigot
Jan 13 at 1:14
I agree it is confusing. But in my list of confusing things this is below the confusion which library one has to load to make an example from the pgfmanual run through. (And I would like to draw your attention to this source of confusion, which confuses me, too. ;-)
– marmot
Jan 13 at 1:17
I agree it is confusing. But in my list of confusing things this is below the confusion which library one has to load to make an example from the pgfmanual run through. (And I would like to draw your attention to this source of confusion, which confuses me, too. ;-)
– marmot
Jan 13 at 1:17
add a comment |
3 Answers
3
active
oldest
votes
In TikZ always the default unit for length values is pt
. And we have
/tikz/xshift=<dimension>
So the default unit for xshift
is pt
.
In (1,0)
you can think of cm
as default unit but there is no default unit. Simply (1,0)
is 1.x+0.y
so it depends on the value of the x
vector, which is initially set to (1cm,0)
.
If "In TikZ always the default unit for length values ispt
. " is really always true, why doesn't it apply to radii and the like? Or is in your opinion a radius not a length unit?
– marmot
Jan 13 at 4:45
The manual is slightly more subtle. For the coordinates, it defines unit vectors (x-vector
,y-vector
andz-vector
) which have by default a length of1 cm
. See page 366 of manual 3.1
– AndréC
Jan 13 at 8:02
@marmotcircle(1)
is the same ascircle[radius=1]
which is the same ascircle[x radius=1,y radius=1]
which is the ellipse that goes throw the points+x-vector
and+y-vector
. You can check this withcircle[x=(1,1),radius=1]
. In the manualradius
is not adimension
but avalue
because it can bedimension
orfactor
.
– Kpym
Jan 13 at 10:04
Well, I disagree. This is all under the question "Different dimensions with shift and xshift". My take is that the OP is wondering that, if they use dimensionless numbers, dimensions will be appended and they are different in different contexts. I agree with this observation and give another example in whichcm
get appended. If it was always a factor, why woulddraw (0,0) circle (1cm);
work.
– marmot
Jan 13 at 15:06
add a comment |
Some thoughts:
- You're not doing anything incorrect.
- Is it a bug? It is not a bug in the sense that the program crashes or that the result deviates from what one may expect from the manual. So my take it is not a bug.
- The default unit for coordinates is
cm
, soat (1,0)
andat (1cm,0)
are equivalent. That's why the shift=(5,0) and shift=(5cm,0) can be used interchangedly. - Is this not the only situation where
cm
is the unit. Another situation in which the default unit is cm is a cricle, sodraw (0,0) circle(1);
gives you a circle of radius1cm
, similarly for arcs. - But for "most" other situations the default unit is
pt
.
1
marmot, see Kpym's answer,pt
is the default unit for length.
– CarLaTeX
Jan 13 at 4:38
@CarLaTeX Well, depends on how you define default unit. From the OP's post I thought their definition is what is inserted when you do not specify the unit. If you adopt this definition, it is not the case for, say, circles and arcs. I would even make the stronger statement that, in view of the behavior of circles etc., the statement "In TikZ always the default unit for length values ispt
." is not entirely correct. What is a radius if not a length (scale)?
– marmot
Jan 13 at 4:40
I don't know, maybe it is considered a sort of polar coordinate.
– CarLaTeX
Jan 13 at 5:28
@CarLaTeX Yes, sure. I really thin it boils down how you interpret "I discovered that there is a different default dimension in shift and xshift.". My interpretation is that the question concerns the observation that, if you do not specify the dimensions, TikZ will insert some for you, and the dimension TikZ inserts depends on the context. All I am saying is that this is true, and that the dimension automatically inserted in the case of a circle is alsocm
, whereas it ispt
for most other situations.
– marmot
Jan 13 at 5:33
The syntaxdraw (0,0) circle (1)
is an old syntax that still works but is deprecated. tex.stackexchange.com/q/303130/138900
– AndréC
Jan 13 at 7:57
add a comment |
An example that ilustrate @Kpym's nice answer.
documentclassarticle
usepackagetikz
begindocument
begintikzpicture
draw[help lines] (0,0) grid (5,3) ;
node (a) at (0,3) a;
node (b) at (0,2) b;
node (c) at (0,1) c;
node (d) at (0,0) d;
beginscope[x=(2,1)] % change the vector x
node[xshift=2cm] at (a) aa; % 2cm to the right
node[shift=(2cm,0)] at (b) bb; % 2cm to the right and 0pt to the top
node[xshift=2] at (c) cc; % 2pt to the right
node[shift=(2,0)] at (d) dd; % 2x+0y
draw[blue] circle[radius=0.5]; % 0.5 is interpreted as xradius =0.5x and yradius =0.5 y
draw[red] circle[radius=0.5cm]; % .0.5cm is interpreted as xradius=yradius=0.5cm
endscope
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%2f469893%2fdifferent-dimensions-with-shift-and-xshift%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
In TikZ always the default unit for length values is pt
. And we have
/tikz/xshift=<dimension>
So the default unit for xshift
is pt
.
In (1,0)
you can think of cm
as default unit but there is no default unit. Simply (1,0)
is 1.x+0.y
so it depends on the value of the x
vector, which is initially set to (1cm,0)
.
If "In TikZ always the default unit for length values ispt
. " is really always true, why doesn't it apply to radii and the like? Or is in your opinion a radius not a length unit?
– marmot
Jan 13 at 4:45
The manual is slightly more subtle. For the coordinates, it defines unit vectors (x-vector
,y-vector
andz-vector
) which have by default a length of1 cm
. See page 366 of manual 3.1
– AndréC
Jan 13 at 8:02
@marmotcircle(1)
is the same ascircle[radius=1]
which is the same ascircle[x radius=1,y radius=1]
which is the ellipse that goes throw the points+x-vector
and+y-vector
. You can check this withcircle[x=(1,1),radius=1]
. In the manualradius
is not adimension
but avalue
because it can bedimension
orfactor
.
– Kpym
Jan 13 at 10:04
Well, I disagree. This is all under the question "Different dimensions with shift and xshift". My take is that the OP is wondering that, if they use dimensionless numbers, dimensions will be appended and they are different in different contexts. I agree with this observation and give another example in whichcm
get appended. If it was always a factor, why woulddraw (0,0) circle (1cm);
work.
– marmot
Jan 13 at 15:06
add a comment |
In TikZ always the default unit for length values is pt
. And we have
/tikz/xshift=<dimension>
So the default unit for xshift
is pt
.
In (1,0)
you can think of cm
as default unit but there is no default unit. Simply (1,0)
is 1.x+0.y
so it depends on the value of the x
vector, which is initially set to (1cm,0)
.
If "In TikZ always the default unit for length values ispt
. " is really always true, why doesn't it apply to radii and the like? Or is in your opinion a radius not a length unit?
– marmot
Jan 13 at 4:45
The manual is slightly more subtle. For the coordinates, it defines unit vectors (x-vector
,y-vector
andz-vector
) which have by default a length of1 cm
. See page 366 of manual 3.1
– AndréC
Jan 13 at 8:02
@marmotcircle(1)
is the same ascircle[radius=1]
which is the same ascircle[x radius=1,y radius=1]
which is the ellipse that goes throw the points+x-vector
and+y-vector
. You can check this withcircle[x=(1,1),radius=1]
. In the manualradius
is not adimension
but avalue
because it can bedimension
orfactor
.
– Kpym
Jan 13 at 10:04
Well, I disagree. This is all under the question "Different dimensions with shift and xshift". My take is that the OP is wondering that, if they use dimensionless numbers, dimensions will be appended and they are different in different contexts. I agree with this observation and give another example in whichcm
get appended. If it was always a factor, why woulddraw (0,0) circle (1cm);
work.
– marmot
Jan 13 at 15:06
add a comment |
In TikZ always the default unit for length values is pt
. And we have
/tikz/xshift=<dimension>
So the default unit for xshift
is pt
.
In (1,0)
you can think of cm
as default unit but there is no default unit. Simply (1,0)
is 1.x+0.y
so it depends on the value of the x
vector, which is initially set to (1cm,0)
.
In TikZ always the default unit for length values is pt
. And we have
/tikz/xshift=<dimension>
So the default unit for xshift
is pt
.
In (1,0)
you can think of cm
as default unit but there is no default unit. Simply (1,0)
is 1.x+0.y
so it depends on the value of the x
vector, which is initially set to (1cm,0)
.
edited Jan 13 at 2:52
answered Jan 13 at 2:41
KpymKpym
16k23987
16k23987
If "In TikZ always the default unit for length values ispt
. " is really always true, why doesn't it apply to radii and the like? Or is in your opinion a radius not a length unit?
– marmot
Jan 13 at 4:45
The manual is slightly more subtle. For the coordinates, it defines unit vectors (x-vector
,y-vector
andz-vector
) which have by default a length of1 cm
. See page 366 of manual 3.1
– AndréC
Jan 13 at 8:02
@marmotcircle(1)
is the same ascircle[radius=1]
which is the same ascircle[x radius=1,y radius=1]
which is the ellipse that goes throw the points+x-vector
and+y-vector
. You can check this withcircle[x=(1,1),radius=1]
. In the manualradius
is not adimension
but avalue
because it can bedimension
orfactor
.
– Kpym
Jan 13 at 10:04
Well, I disagree. This is all under the question "Different dimensions with shift and xshift". My take is that the OP is wondering that, if they use dimensionless numbers, dimensions will be appended and they are different in different contexts. I agree with this observation and give another example in whichcm
get appended. If it was always a factor, why woulddraw (0,0) circle (1cm);
work.
– marmot
Jan 13 at 15:06
add a comment |
If "In TikZ always the default unit for length values ispt
. " is really always true, why doesn't it apply to radii and the like? Or is in your opinion a radius not a length unit?
– marmot
Jan 13 at 4:45
The manual is slightly more subtle. For the coordinates, it defines unit vectors (x-vector
,y-vector
andz-vector
) which have by default a length of1 cm
. See page 366 of manual 3.1
– AndréC
Jan 13 at 8:02
@marmotcircle(1)
is the same ascircle[radius=1]
which is the same ascircle[x radius=1,y radius=1]
which is the ellipse that goes throw the points+x-vector
and+y-vector
. You can check this withcircle[x=(1,1),radius=1]
. In the manualradius
is not adimension
but avalue
because it can bedimension
orfactor
.
– Kpym
Jan 13 at 10:04
Well, I disagree. This is all under the question "Different dimensions with shift and xshift". My take is that the OP is wondering that, if they use dimensionless numbers, dimensions will be appended and they are different in different contexts. I agree with this observation and give another example in whichcm
get appended. If it was always a factor, why woulddraw (0,0) circle (1cm);
work.
– marmot
Jan 13 at 15:06
If "In TikZ always the default unit for length values is
pt
. " is really always true, why doesn't it apply to radii and the like? Or is in your opinion a radius not a length unit?– marmot
Jan 13 at 4:45
If "In TikZ always the default unit for length values is
pt
. " is really always true, why doesn't it apply to radii and the like? Or is in your opinion a radius not a length unit?– marmot
Jan 13 at 4:45
The manual is slightly more subtle. For the coordinates, it defines unit vectors (
x-vector
, y-vector
and z-vector
) which have by default a length of 1 cm
. See page 366 of manual 3.1– AndréC
Jan 13 at 8:02
The manual is slightly more subtle. For the coordinates, it defines unit vectors (
x-vector
, y-vector
and z-vector
) which have by default a length of 1 cm
. See page 366 of manual 3.1– AndréC
Jan 13 at 8:02
@marmot
circle(1)
is the same as circle[radius=1]
which is the same as circle[x radius=1,y radius=1]
which is the ellipse that goes throw the points +x-vector
and +y-vector
. You can check this with circle[x=(1,1),radius=1]
. In the manual radius
is not a dimension
but a value
because it can be dimension
or factor
.– Kpym
Jan 13 at 10:04
@marmot
circle(1)
is the same as circle[radius=1]
which is the same as circle[x radius=1,y radius=1]
which is the ellipse that goes throw the points +x-vector
and +y-vector
. You can check this with circle[x=(1,1),radius=1]
. In the manual radius
is not a dimension
but a value
because it can be dimension
or factor
.– Kpym
Jan 13 at 10:04
Well, I disagree. This is all under the question "Different dimensions with shift and xshift". My take is that the OP is wondering that, if they use dimensionless numbers, dimensions will be appended and they are different in different contexts. I agree with this observation and give another example in which
cm
get appended. If it was always a factor, why would draw (0,0) circle (1cm);
work.– marmot
Jan 13 at 15:06
Well, I disagree. This is all under the question "Different dimensions with shift and xshift". My take is that the OP is wondering that, if they use dimensionless numbers, dimensions will be appended and they are different in different contexts. I agree with this observation and give another example in which
cm
get appended. If it was always a factor, why would draw (0,0) circle (1cm);
work.– marmot
Jan 13 at 15:06
add a comment |
Some thoughts:
- You're not doing anything incorrect.
- Is it a bug? It is not a bug in the sense that the program crashes or that the result deviates from what one may expect from the manual. So my take it is not a bug.
- The default unit for coordinates is
cm
, soat (1,0)
andat (1cm,0)
are equivalent. That's why the shift=(5,0) and shift=(5cm,0) can be used interchangedly. - Is this not the only situation where
cm
is the unit. Another situation in which the default unit is cm is a cricle, sodraw (0,0) circle(1);
gives you a circle of radius1cm
, similarly for arcs. - But for "most" other situations the default unit is
pt
.
1
marmot, see Kpym's answer,pt
is the default unit for length.
– CarLaTeX
Jan 13 at 4:38
@CarLaTeX Well, depends on how you define default unit. From the OP's post I thought their definition is what is inserted when you do not specify the unit. If you adopt this definition, it is not the case for, say, circles and arcs. I would even make the stronger statement that, in view of the behavior of circles etc., the statement "In TikZ always the default unit for length values ispt
." is not entirely correct. What is a radius if not a length (scale)?
– marmot
Jan 13 at 4:40
I don't know, maybe it is considered a sort of polar coordinate.
– CarLaTeX
Jan 13 at 5:28
@CarLaTeX Yes, sure. I really thin it boils down how you interpret "I discovered that there is a different default dimension in shift and xshift.". My interpretation is that the question concerns the observation that, if you do not specify the dimensions, TikZ will insert some for you, and the dimension TikZ inserts depends on the context. All I am saying is that this is true, and that the dimension automatically inserted in the case of a circle is alsocm
, whereas it ispt
for most other situations.
– marmot
Jan 13 at 5:33
The syntaxdraw (0,0) circle (1)
is an old syntax that still works but is deprecated. tex.stackexchange.com/q/303130/138900
– AndréC
Jan 13 at 7:57
add a comment |
Some thoughts:
- You're not doing anything incorrect.
- Is it a bug? It is not a bug in the sense that the program crashes or that the result deviates from what one may expect from the manual. So my take it is not a bug.
- The default unit for coordinates is
cm
, soat (1,0)
andat (1cm,0)
are equivalent. That's why the shift=(5,0) and shift=(5cm,0) can be used interchangedly. - Is this not the only situation where
cm
is the unit. Another situation in which the default unit is cm is a cricle, sodraw (0,0) circle(1);
gives you a circle of radius1cm
, similarly for arcs. - But for "most" other situations the default unit is
pt
.
1
marmot, see Kpym's answer,pt
is the default unit for length.
– CarLaTeX
Jan 13 at 4:38
@CarLaTeX Well, depends on how you define default unit. From the OP's post I thought their definition is what is inserted when you do not specify the unit. If you adopt this definition, it is not the case for, say, circles and arcs. I would even make the stronger statement that, in view of the behavior of circles etc., the statement "In TikZ always the default unit for length values ispt
." is not entirely correct. What is a radius if not a length (scale)?
– marmot
Jan 13 at 4:40
I don't know, maybe it is considered a sort of polar coordinate.
– CarLaTeX
Jan 13 at 5:28
@CarLaTeX Yes, sure. I really thin it boils down how you interpret "I discovered that there is a different default dimension in shift and xshift.". My interpretation is that the question concerns the observation that, if you do not specify the dimensions, TikZ will insert some for you, and the dimension TikZ inserts depends on the context. All I am saying is that this is true, and that the dimension automatically inserted in the case of a circle is alsocm
, whereas it ispt
for most other situations.
– marmot
Jan 13 at 5:33
The syntaxdraw (0,0) circle (1)
is an old syntax that still works but is deprecated. tex.stackexchange.com/q/303130/138900
– AndréC
Jan 13 at 7:57
add a comment |
Some thoughts:
- You're not doing anything incorrect.
- Is it a bug? It is not a bug in the sense that the program crashes or that the result deviates from what one may expect from the manual. So my take it is not a bug.
- The default unit for coordinates is
cm
, soat (1,0)
andat (1cm,0)
are equivalent. That's why the shift=(5,0) and shift=(5cm,0) can be used interchangedly. - Is this not the only situation where
cm
is the unit. Another situation in which the default unit is cm is a cricle, sodraw (0,0) circle(1);
gives you a circle of radius1cm
, similarly for arcs. - But for "most" other situations the default unit is
pt
.
Some thoughts:
- You're not doing anything incorrect.
- Is it a bug? It is not a bug in the sense that the program crashes or that the result deviates from what one may expect from the manual. So my take it is not a bug.
- The default unit for coordinates is
cm
, soat (1,0)
andat (1cm,0)
are equivalent. That's why the shift=(5,0) and shift=(5cm,0) can be used interchangedly. - Is this not the only situation where
cm
is the unit. Another situation in which the default unit is cm is a cricle, sodraw (0,0) circle(1);
gives you a circle of radius1cm
, similarly for arcs. - But for "most" other situations the default unit is
pt
.
answered Jan 13 at 1:33
marmotmarmot
95.1k4110210
95.1k4110210
1
marmot, see Kpym's answer,pt
is the default unit for length.
– CarLaTeX
Jan 13 at 4:38
@CarLaTeX Well, depends on how you define default unit. From the OP's post I thought their definition is what is inserted when you do not specify the unit. If you adopt this definition, it is not the case for, say, circles and arcs. I would even make the stronger statement that, in view of the behavior of circles etc., the statement "In TikZ always the default unit for length values ispt
." is not entirely correct. What is a radius if not a length (scale)?
– marmot
Jan 13 at 4:40
I don't know, maybe it is considered a sort of polar coordinate.
– CarLaTeX
Jan 13 at 5:28
@CarLaTeX Yes, sure. I really thin it boils down how you interpret "I discovered that there is a different default dimension in shift and xshift.". My interpretation is that the question concerns the observation that, if you do not specify the dimensions, TikZ will insert some for you, and the dimension TikZ inserts depends on the context. All I am saying is that this is true, and that the dimension automatically inserted in the case of a circle is alsocm
, whereas it ispt
for most other situations.
– marmot
Jan 13 at 5:33
The syntaxdraw (0,0) circle (1)
is an old syntax that still works but is deprecated. tex.stackexchange.com/q/303130/138900
– AndréC
Jan 13 at 7:57
add a comment |
1
marmot, see Kpym's answer,pt
is the default unit for length.
– CarLaTeX
Jan 13 at 4:38
@CarLaTeX Well, depends on how you define default unit. From the OP's post I thought their definition is what is inserted when you do not specify the unit. If you adopt this definition, it is not the case for, say, circles and arcs. I would even make the stronger statement that, in view of the behavior of circles etc., the statement "In TikZ always the default unit for length values ispt
." is not entirely correct. What is a radius if not a length (scale)?
– marmot
Jan 13 at 4:40
I don't know, maybe it is considered a sort of polar coordinate.
– CarLaTeX
Jan 13 at 5:28
@CarLaTeX Yes, sure. I really thin it boils down how you interpret "I discovered that there is a different default dimension in shift and xshift.". My interpretation is that the question concerns the observation that, if you do not specify the dimensions, TikZ will insert some for you, and the dimension TikZ inserts depends on the context. All I am saying is that this is true, and that the dimension automatically inserted in the case of a circle is alsocm
, whereas it ispt
for most other situations.
– marmot
Jan 13 at 5:33
The syntaxdraw (0,0) circle (1)
is an old syntax that still works but is deprecated. tex.stackexchange.com/q/303130/138900
– AndréC
Jan 13 at 7:57
1
1
marmot, see Kpym's answer,
pt
is the default unit for length.– CarLaTeX
Jan 13 at 4:38
marmot, see Kpym's answer,
pt
is the default unit for length.– CarLaTeX
Jan 13 at 4:38
@CarLaTeX Well, depends on how you define default unit. From the OP's post I thought their definition is what is inserted when you do not specify the unit. If you adopt this definition, it is not the case for, say, circles and arcs. I would even make the stronger statement that, in view of the behavior of circles etc., the statement "In TikZ always the default unit for length values is
pt
." is not entirely correct. What is a radius if not a length (scale)?– marmot
Jan 13 at 4:40
@CarLaTeX Well, depends on how you define default unit. From the OP's post I thought their definition is what is inserted when you do not specify the unit. If you adopt this definition, it is not the case for, say, circles and arcs. I would even make the stronger statement that, in view of the behavior of circles etc., the statement "In TikZ always the default unit for length values is
pt
." is not entirely correct. What is a radius if not a length (scale)?– marmot
Jan 13 at 4:40
I don't know, maybe it is considered a sort of polar coordinate.
– CarLaTeX
Jan 13 at 5:28
I don't know, maybe it is considered a sort of polar coordinate.
– CarLaTeX
Jan 13 at 5:28
@CarLaTeX Yes, sure. I really thin it boils down how you interpret "I discovered that there is a different default dimension in shift and xshift.". My interpretation is that the question concerns the observation that, if you do not specify the dimensions, TikZ will insert some for you, and the dimension TikZ inserts depends on the context. All I am saying is that this is true, and that the dimension automatically inserted in the case of a circle is also
cm
, whereas it is pt
for most other situations.– marmot
Jan 13 at 5:33
@CarLaTeX Yes, sure. I really thin it boils down how you interpret "I discovered that there is a different default dimension in shift and xshift.". My interpretation is that the question concerns the observation that, if you do not specify the dimensions, TikZ will insert some for you, and the dimension TikZ inserts depends on the context. All I am saying is that this is true, and that the dimension automatically inserted in the case of a circle is also
cm
, whereas it is pt
for most other situations.– marmot
Jan 13 at 5:33
The syntax
draw (0,0) circle (1)
is an old syntax that still works but is deprecated. tex.stackexchange.com/q/303130/138900– AndréC
Jan 13 at 7:57
The syntax
draw (0,0) circle (1)
is an old syntax that still works but is deprecated. tex.stackexchange.com/q/303130/138900– AndréC
Jan 13 at 7:57
add a comment |
An example that ilustrate @Kpym's nice answer.
documentclassarticle
usepackagetikz
begindocument
begintikzpicture
draw[help lines] (0,0) grid (5,3) ;
node (a) at (0,3) a;
node (b) at (0,2) b;
node (c) at (0,1) c;
node (d) at (0,0) d;
beginscope[x=(2,1)] % change the vector x
node[xshift=2cm] at (a) aa; % 2cm to the right
node[shift=(2cm,0)] at (b) bb; % 2cm to the right and 0pt to the top
node[xshift=2] at (c) cc; % 2pt to the right
node[shift=(2,0)] at (d) dd; % 2x+0y
draw[blue] circle[radius=0.5]; % 0.5 is interpreted as xradius =0.5x and yradius =0.5 y
draw[red] circle[radius=0.5cm]; % .0.5cm is interpreted as xradius=yradius=0.5cm
endscope
endtikzpicture
enddocument
add a comment |
An example that ilustrate @Kpym's nice answer.
documentclassarticle
usepackagetikz
begindocument
begintikzpicture
draw[help lines] (0,0) grid (5,3) ;
node (a) at (0,3) a;
node (b) at (0,2) b;
node (c) at (0,1) c;
node (d) at (0,0) d;
beginscope[x=(2,1)] % change the vector x
node[xshift=2cm] at (a) aa; % 2cm to the right
node[shift=(2cm,0)] at (b) bb; % 2cm to the right and 0pt to the top
node[xshift=2] at (c) cc; % 2pt to the right
node[shift=(2,0)] at (d) dd; % 2x+0y
draw[blue] circle[radius=0.5]; % 0.5 is interpreted as xradius =0.5x and yradius =0.5 y
draw[red] circle[radius=0.5cm]; % .0.5cm is interpreted as xradius=yradius=0.5cm
endscope
endtikzpicture
enddocument
add a comment |
An example that ilustrate @Kpym's nice answer.
documentclassarticle
usepackagetikz
begindocument
begintikzpicture
draw[help lines] (0,0) grid (5,3) ;
node (a) at (0,3) a;
node (b) at (0,2) b;
node (c) at (0,1) c;
node (d) at (0,0) d;
beginscope[x=(2,1)] % change the vector x
node[xshift=2cm] at (a) aa; % 2cm to the right
node[shift=(2cm,0)] at (b) bb; % 2cm to the right and 0pt to the top
node[xshift=2] at (c) cc; % 2pt to the right
node[shift=(2,0)] at (d) dd; % 2x+0y
draw[blue] circle[radius=0.5]; % 0.5 is interpreted as xradius =0.5x and yradius =0.5 y
draw[red] circle[radius=0.5cm]; % .0.5cm is interpreted as xradius=yradius=0.5cm
endscope
endtikzpicture
enddocument
An example that ilustrate @Kpym's nice answer.
documentclassarticle
usepackagetikz
begindocument
begintikzpicture
draw[help lines] (0,0) grid (5,3) ;
node (a) at (0,3) a;
node (b) at (0,2) b;
node (c) at (0,1) c;
node (d) at (0,0) d;
beginscope[x=(2,1)] % change the vector x
node[xshift=2cm] at (a) aa; % 2cm to the right
node[shift=(2cm,0)] at (b) bb; % 2cm to the right and 0pt to the top
node[xshift=2] at (c) cc; % 2pt to the right
node[shift=(2,0)] at (d) dd; % 2x+0y
draw[blue] circle[radius=0.5]; % 0.5 is interpreted as xradius =0.5x and yradius =0.5 y
draw[red] circle[radius=0.5cm]; % .0.5cm is interpreted as xradius=yradius=0.5cm
endscope
endtikzpicture
enddocument
edited Jan 13 at 7:23
answered Jan 13 at 7:16
Hafid BoukhouldaHafid Boukhoulda
2,5371519
2,5371519
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%2f469893%2fdifferent-dimensions-with-shift-and-xshift%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
2
You're not doing anything incorrect, and this has been noticed before. Another situation in which the default unit is cm is a cricle, so
draw (0,0) circle(1);
gives you a circle of radius 1cm, similarly for arcs. As you have noticed, this is also true for coordinates, soat (1,0)
andat (1cm,0)
are equivalent. That's why theshift=(5,0)
andshift=(5cm,0)
can be used interchangedly. But for "most" other situations the default unit ispt
.– marmot
Jan 13 at 1:05
I can understand that commands doing completely different actions have different default dimensions. But shift and xshift seem very close, at least in terms of functionality. And this difference in behavior is really confusing...
– Alain Merigot
Jan 13 at 1:14
I agree it is confusing. But in my list of confusing things this is below the confusion which library one has to load to make an example from the pgfmanual run through. (And I would like to draw your attention to this source of confusion, which confuses me, too. ;-)
– marmot
Jan 13 at 1:17