Different dimensions with shift and xshift
I discovered that there is a different default dimension in shift and xshift.
Consider the following mwe
documentclass{article}
usepackage{tikz}
begin{document}
begin{tikzpicture}
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) ;
end{tikzpicture}
end{document}
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
documentclass{article}
usepackage{tikz}
begin{document}
begin{tikzpicture}
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) ;
end{tikzpicture}
end{document}
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
1
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
2 hours ago
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
2 hours ago
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
2 hours ago
add a comment |
I discovered that there is a different default dimension in shift and xshift.
Consider the following mwe
documentclass{article}
usepackage{tikz}
begin{document}
begin{tikzpicture}
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) ;
end{tikzpicture}
end{document}
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
documentclass{article}
usepackage{tikz}
begin{document}
begin{tikzpicture}
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) ;
end{tikzpicture}
end{document}
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 2 hours ago
Alain MerigotAlain Merigot
612
612
1
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
2 hours ago
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
2 hours ago
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
2 hours ago
add a comment |
1
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
2 hours ago
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
2 hours ago
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
2 hours ago
1
1
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
2 hours ago
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
2 hours ago
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
2 hours ago
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
2 hours ago
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
2 hours ago
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
2 hours ago
add a comment |
2 Answers
2
active
oldest
votes
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
.
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)
.
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
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
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
.
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
.
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 1 hour ago
marmotmarmot
90.9k4104196
90.9k4104196
add a comment |
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)
.
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)
.
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 29 mins ago
answered 40 mins ago
KpymKpym
15.8k23986
15.8k23986
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
1
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
2 hours ago
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
2 hours ago
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
2 hours ago