Different dimensions with shift and xshift












5















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:
enter image description here



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?










share|improve this question


















  • 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













  • 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
















5















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:
enter image description here



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?










share|improve this question


















  • 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













  • 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














5












5








5








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:
enter image description here



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?










share|improve this question














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:
enter image description here



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






share|improve this question













share|improve this question











share|improve this question




share|improve this question










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, 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 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





    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 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










2 Answers
2






active

oldest

votes


















3














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, 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.

  • Is this not the only situation where cm is the unit. 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.

  • But for "most" other situations the default unit is pt.






share|improve this answer































    1














    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).






    share|improve this answer

























      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
      });


      }
      });














      draft saved

      draft discarded


















      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









      3














      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, 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.

      • Is this not the only situation where cm is the unit. 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.

      • But for "most" other situations the default unit is pt.






      share|improve this answer




























        3














        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, 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.

        • Is this not the only situation where cm is the unit. 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.

        • But for "most" other situations the default unit is pt.






        share|improve this answer


























          3












          3








          3







          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, 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.

          • Is this not the only situation where cm is the unit. 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.

          • But for "most" other situations the default unit is pt.






          share|improve this answer













          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, 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.

          • Is this not the only situation where cm is the unit. 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.

          • But for "most" other situations the default unit is pt.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered 1 hour ago









          marmotmarmot

          90.9k4104196




          90.9k4104196























              1














              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).






              share|improve this answer






























                1














                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).






                share|improve this answer




























                  1












                  1








                  1







                  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).






                  share|improve this answer















                  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).







                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited 31 mins ago

























                  answered 42 mins ago









                  KpymKpym

                  15.8k23986




                  15.8k23986






























                      draft saved

                      draft discarded




















































                      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.




                      draft saved


                      draft discarded














                      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





















































                      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







                      Popular posts from this blog

                      Eastern Orthodox Church

                      Zagreb

                      Understanding the information contained in the Deep Space Network XML data?