Tikz Understand white space between node and draw










4














I am new to Tikz and during some experiments I ended doing something like the example below but I can' quite understand why is there a space left between my two lines...



documentclass[tikz,border=10pt]standalone
usepackagetikz

begindocument
begintikzpicture[every node/.style=inner sep=0,outer sep=0]
node at (0,0) (test) tikz draw (0,0) -- (1,0);;
draw (test.east) --++ (1,0);
endtikzpicture
enddocument


It is very simple example of what I wanted to do and maybe I took it the wrong way and should not proceed this way but I would love to know if it possible to eliminate this space or not.



enter image description here










share|improve this question



















  • 1




    For future reference, it is much easier for people to hep you if you post a minimal working example that, in particular, compiles. Although it is "legal" to put tikz... inside a node it is certainly unusual. You problem here is that the node has a border as you can see using node[draw]... which is why there is a small gap.
    – Andrew
    Aug 24 at 12:39







  • 1




    Welcome to TeX.sx! Usually, we don't put a greeting or a "thank you" in our posts. While this might seem strange at first, it is not a sign of lack of politeness, but rather part of our trying to keep everything very concise. Upvoting is the preferred way here to say "thank you" to users who helped you. Additionally, you don't need to sign off with your name as this is already at the bottom right hand side of your post.
    – Milo
    Aug 24 at 12:42










  • I will take your remark into account for the next post ! For the border I saw it but I thought that adding inner and outer sep to zero would do the job... In fact in my real case I wanted to put a pic I created with tikzset inside the node to be able to connect it rather easily to other objects... But maybe I am on the wrong direction
    – Gautier Bureau
    Aug 24 at 12:49











  • You are nesting tikzpictures, what one should not do. That's the reason why this happens.
    – marmot
    Aug 24 at 12:59











  • You shouldn't need to nest a pic inside a node. There is almost certainly an alternative solution (but without knowing why you think you should nest a pic in a node then I don't know what to propose). Ask another question on that. (Don't edit this one - it's a good question to ask.)
    – Loop Space
    Aug 24 at 13:03















4














I am new to Tikz and during some experiments I ended doing something like the example below but I can' quite understand why is there a space left between my two lines...



documentclass[tikz,border=10pt]standalone
usepackagetikz

begindocument
begintikzpicture[every node/.style=inner sep=0,outer sep=0]
node at (0,0) (test) tikz draw (0,0) -- (1,0);;
draw (test.east) --++ (1,0);
endtikzpicture
enddocument


It is very simple example of what I wanted to do and maybe I took it the wrong way and should not proceed this way but I would love to know if it possible to eliminate this space or not.



enter image description here










share|improve this question



















  • 1




    For future reference, it is much easier for people to hep you if you post a minimal working example that, in particular, compiles. Although it is "legal" to put tikz... inside a node it is certainly unusual. You problem here is that the node has a border as you can see using node[draw]... which is why there is a small gap.
    – Andrew
    Aug 24 at 12:39







  • 1




    Welcome to TeX.sx! Usually, we don't put a greeting or a "thank you" in our posts. While this might seem strange at first, it is not a sign of lack of politeness, but rather part of our trying to keep everything very concise. Upvoting is the preferred way here to say "thank you" to users who helped you. Additionally, you don't need to sign off with your name as this is already at the bottom right hand side of your post.
    – Milo
    Aug 24 at 12:42










  • I will take your remark into account for the next post ! For the border I saw it but I thought that adding inner and outer sep to zero would do the job... In fact in my real case I wanted to put a pic I created with tikzset inside the node to be able to connect it rather easily to other objects... But maybe I am on the wrong direction
    – Gautier Bureau
    Aug 24 at 12:49











  • You are nesting tikzpictures, what one should not do. That's the reason why this happens.
    – marmot
    Aug 24 at 12:59











  • You shouldn't need to nest a pic inside a node. There is almost certainly an alternative solution (but without knowing why you think you should nest a pic in a node then I don't know what to propose). Ask another question on that. (Don't edit this one - it's a good question to ask.)
    – Loop Space
    Aug 24 at 13:03













4












4








4







I am new to Tikz and during some experiments I ended doing something like the example below but I can' quite understand why is there a space left between my two lines...



documentclass[tikz,border=10pt]standalone
usepackagetikz

begindocument
begintikzpicture[every node/.style=inner sep=0,outer sep=0]
node at (0,0) (test) tikz draw (0,0) -- (1,0);;
draw (test.east) --++ (1,0);
endtikzpicture
enddocument


It is very simple example of what I wanted to do and maybe I took it the wrong way and should not proceed this way but I would love to know if it possible to eliminate this space or not.



enter image description here










share|improve this question















I am new to Tikz and during some experiments I ended doing something like the example below but I can' quite understand why is there a space left between my two lines...



documentclass[tikz,border=10pt]standalone
usepackagetikz

begindocument
begintikzpicture[every node/.style=inner sep=0,outer sep=0]
node at (0,0) (test) tikz draw (0,0) -- (1,0);;
draw (test.east) --++ (1,0);
endtikzpicture
enddocument


It is very simple example of what I wanted to do and maybe I took it the wrong way and should not proceed this way but I would love to know if it possible to eliminate this space or not.



enter image description here







tikz-pgf






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Aug 24 at 12:55

























asked Aug 24 at 12:27









Gautier Bureau

455




455







  • 1




    For future reference, it is much easier for people to hep you if you post a minimal working example that, in particular, compiles. Although it is "legal" to put tikz... inside a node it is certainly unusual. You problem here is that the node has a border as you can see using node[draw]... which is why there is a small gap.
    – Andrew
    Aug 24 at 12:39







  • 1




    Welcome to TeX.sx! Usually, we don't put a greeting or a "thank you" in our posts. While this might seem strange at first, it is not a sign of lack of politeness, but rather part of our trying to keep everything very concise. Upvoting is the preferred way here to say "thank you" to users who helped you. Additionally, you don't need to sign off with your name as this is already at the bottom right hand side of your post.
    – Milo
    Aug 24 at 12:42










  • I will take your remark into account for the next post ! For the border I saw it but I thought that adding inner and outer sep to zero would do the job... In fact in my real case I wanted to put a pic I created with tikzset inside the node to be able to connect it rather easily to other objects... But maybe I am on the wrong direction
    – Gautier Bureau
    Aug 24 at 12:49











  • You are nesting tikzpictures, what one should not do. That's the reason why this happens.
    – marmot
    Aug 24 at 12:59











  • You shouldn't need to nest a pic inside a node. There is almost certainly an alternative solution (but without knowing why you think you should nest a pic in a node then I don't know what to propose). Ask another question on that. (Don't edit this one - it's a good question to ask.)
    – Loop Space
    Aug 24 at 13:03












  • 1




    For future reference, it is much easier for people to hep you if you post a minimal working example that, in particular, compiles. Although it is "legal" to put tikz... inside a node it is certainly unusual. You problem here is that the node has a border as you can see using node[draw]... which is why there is a small gap.
    – Andrew
    Aug 24 at 12:39







  • 1




    Welcome to TeX.sx! Usually, we don't put a greeting or a "thank you" in our posts. While this might seem strange at first, it is not a sign of lack of politeness, but rather part of our trying to keep everything very concise. Upvoting is the preferred way here to say "thank you" to users who helped you. Additionally, you don't need to sign off with your name as this is already at the bottom right hand side of your post.
    – Milo
    Aug 24 at 12:42










  • I will take your remark into account for the next post ! For the border I saw it but I thought that adding inner and outer sep to zero would do the job... In fact in my real case I wanted to put a pic I created with tikzset inside the node to be able to connect it rather easily to other objects... But maybe I am on the wrong direction
    – Gautier Bureau
    Aug 24 at 12:49











  • You are nesting tikzpictures, what one should not do. That's the reason why this happens.
    – marmot
    Aug 24 at 12:59











  • You shouldn't need to nest a pic inside a node. There is almost certainly an alternative solution (but without knowing why you think you should nest a pic in a node then I don't know what to propose). Ask another question on that. (Don't edit this one - it's a good question to ask.)
    – Loop Space
    Aug 24 at 13:03







1




1




For future reference, it is much easier for people to hep you if you post a minimal working example that, in particular, compiles. Although it is "legal" to put tikz... inside a node it is certainly unusual. You problem here is that the node has a border as you can see using node[draw]... which is why there is a small gap.
– Andrew
Aug 24 at 12:39





For future reference, it is much easier for people to hep you if you post a minimal working example that, in particular, compiles. Although it is "legal" to put tikz... inside a node it is certainly unusual. You problem here is that the node has a border as you can see using node[draw]... which is why there is a small gap.
– Andrew
Aug 24 at 12:39





1




1




Welcome to TeX.sx! Usually, we don't put a greeting or a "thank you" in our posts. While this might seem strange at first, it is not a sign of lack of politeness, but rather part of our trying to keep everything very concise. Upvoting is the preferred way here to say "thank you" to users who helped you. Additionally, you don't need to sign off with your name as this is already at the bottom right hand side of your post.
– Milo
Aug 24 at 12:42




Welcome to TeX.sx! Usually, we don't put a greeting or a "thank you" in our posts. While this might seem strange at first, it is not a sign of lack of politeness, but rather part of our trying to keep everything very concise. Upvoting is the preferred way here to say "thank you" to users who helped you. Additionally, you don't need to sign off with your name as this is already at the bottom right hand side of your post.
– Milo
Aug 24 at 12:42












I will take your remark into account for the next post ! For the border I saw it but I thought that adding inner and outer sep to zero would do the job... In fact in my real case I wanted to put a pic I created with tikzset inside the node to be able to connect it rather easily to other objects... But maybe I am on the wrong direction
– Gautier Bureau
Aug 24 at 12:49





I will take your remark into account for the next post ! For the border I saw it but I thought that adding inner and outer sep to zero would do the job... In fact in my real case I wanted to put a pic I created with tikzset inside the node to be able to connect it rather easily to other objects... But maybe I am on the wrong direction
– Gautier Bureau
Aug 24 at 12:49













You are nesting tikzpictures, what one should not do. That's the reason why this happens.
– marmot
Aug 24 at 12:59





You are nesting tikzpictures, what one should not do. That's the reason why this happens.
– marmot
Aug 24 at 12:59













You shouldn't need to nest a pic inside a node. There is almost certainly an alternative solution (but without knowing why you think you should nest a pic in a node then I don't know what to propose). Ask another question on that. (Don't edit this one - it's a good question to ask.)
– Loop Space
Aug 24 at 13:03




You shouldn't need to nest a pic inside a node. There is almost certainly an alternative solution (but without knowing why you think you should nest a pic in a node then I don't know what to propose). Ask another question on that. (Don't edit this one - it's a good question to ask.)
– Loop Space
Aug 24 at 13:03










3 Answers
3






active

oldest

votes


















6














This is an interesting case! I originally thought it was due to the fact that, as @Andrew says in a comment, node has a border. However, that border can be removed by setting inner sep and outer sep to 0 and this is exactly what you do. So the node does not have a border.



What is going on is that the inner tikz picture has a border. Exactly why this is so is quite subtle. When TikZ builds a picture then internally it keeps track of the size of that picture. The main way of doing so is to keep track of a rectangle that is big enough to contain every coordinate that has been used, this is enough to ensure that every path is inside the picture (there are some questions about this with relation to Bezier curves which are an interesting read). However, when a line is drawn then it is drawn with a thickness and so if a path goes between, say, (0,0) and (1,0) then its maximum height will actually be a half linewidth above 0. So when TikZ adds a point to the bounding box, it actually adds a half linewidth beyond it. So when you create a picture with coordinates (0,0) and (1,0) and (for ease of explanation) line width 2mm, the bounding box will have corners (-.1,-1.) to (1.1,.1). And this extends a bit beyond the line.



When this is embedded in another node (I would go one stronger than @Andrew and say that nesting TikZ pictures should be avoided), the outer TikZ doesn't know anything about what the inner TikZ drew and just knows about the box size. So it creates a node big enough to contain that box. Even though you make that node as tightly fitting as possible (via inner sep=0, outer sep=0) you don't make it touch the inner line.



The solution proposed by @AboAmmar gets round this by making the line in the inner TikZ picture extend to the boundary of the inner picture since line cap=rect ensures that the line extends by half a line width beyond the coordinate. This works in the case of horizontal/vertical lines as then the overreach of the line exactly matches the excess added to the box, but the situation with a diagonal line might need more adjustment.



(I'm actually going to remember this one as another example of why nesting tikz pictures can cause strange effects and therefore is Not A Good Idea. If you have a situation where you think you need to nest tikz pictures, please ask here first and someone will come up with an alternative solution!)






share|improve this answer




























    6














    In this particular case, you can add line cap=rect and that tiny gap will disappear.



    documentclassarticle
    usepackagetikz

    begindocument

    begintikzpicture[every node/.style=inner sep=0,outer sep=0, line cap=rect]
    node at (0,0) (test) tikzdraw (0,0) -- (1,0);;
    draw [inner sep=0,outer sep=0](test.east) --++ (1,0);
    endtikzpicture

    enddocument


    At 1200% zoom:



    enter image description here






    share|improve this answer




























      4














      As written in my comment and Loop Space's nice answer, nesting tikzpictures should be avoided. The standard way to do that is to work with saveboxes. Of course, a node has a border given by the line width.



      documentclass[tikz,border=10pt]standalone
      usepackagetikz
      newsaveboxTikzBar
      sboxTikzBartikz draw (0,0) -- (1,0);
      begindocument
      begintikzpicture[every node/.style=inner sep=0,outer sep=0]
      node at (0,0) (test) useboxTikzBar;
      draw (test.east) --++ (1,0);
      endtikzpicture
      begintikzpicture[every node/.style=inner sep=0,outer sep=0]
      node at (0,0) (test) useboxTikzBar;
      draw ([xshift=-pgflinewidth/2]test.east) --++ (1,0);
      endtikzpicture
      enddocument


      enter image description here



      As you see, once you avoid the nesting of tikzpictures, the gap is almost gone, and if you correct for the border by moving the line closer by -pgflinewidth/2 it disappears completely.






      share|improve this answer




















      • Note that the pgflinewidth/2 needs to refer to the line width that is in effect when the box is created. If you put, say, line width=5mm on the inner picture (in the box) then you'll see what I mean.
        – Loop Space
        Aug 24 at 13:12










      • @LoopSpace Absolutely. I am aware of this. In this case, this is the right dimension, though, and I thought it would be easier to understand. Thanks!
        – marmot
        Aug 24 at 13:15






      • 1




        I know you know. It's just about making sure it's clear for others.
        – Loop Space
        Aug 24 at 13:31










      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%2f447513%2ftikz-understand-white-space-between-node-and-draw%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









      6














      This is an interesting case! I originally thought it was due to the fact that, as @Andrew says in a comment, node has a border. However, that border can be removed by setting inner sep and outer sep to 0 and this is exactly what you do. So the node does not have a border.



      What is going on is that the inner tikz picture has a border. Exactly why this is so is quite subtle. When TikZ builds a picture then internally it keeps track of the size of that picture. The main way of doing so is to keep track of a rectangle that is big enough to contain every coordinate that has been used, this is enough to ensure that every path is inside the picture (there are some questions about this with relation to Bezier curves which are an interesting read). However, when a line is drawn then it is drawn with a thickness and so if a path goes between, say, (0,0) and (1,0) then its maximum height will actually be a half linewidth above 0. So when TikZ adds a point to the bounding box, it actually adds a half linewidth beyond it. So when you create a picture with coordinates (0,0) and (1,0) and (for ease of explanation) line width 2mm, the bounding box will have corners (-.1,-1.) to (1.1,.1). And this extends a bit beyond the line.



      When this is embedded in another node (I would go one stronger than @Andrew and say that nesting TikZ pictures should be avoided), the outer TikZ doesn't know anything about what the inner TikZ drew and just knows about the box size. So it creates a node big enough to contain that box. Even though you make that node as tightly fitting as possible (via inner sep=0, outer sep=0) you don't make it touch the inner line.



      The solution proposed by @AboAmmar gets round this by making the line in the inner TikZ picture extend to the boundary of the inner picture since line cap=rect ensures that the line extends by half a line width beyond the coordinate. This works in the case of horizontal/vertical lines as then the overreach of the line exactly matches the excess added to the box, but the situation with a diagonal line might need more adjustment.



      (I'm actually going to remember this one as another example of why nesting tikz pictures can cause strange effects and therefore is Not A Good Idea. If you have a situation where you think you need to nest tikz pictures, please ask here first and someone will come up with an alternative solution!)






      share|improve this answer

























        6














        This is an interesting case! I originally thought it was due to the fact that, as @Andrew says in a comment, node has a border. However, that border can be removed by setting inner sep and outer sep to 0 and this is exactly what you do. So the node does not have a border.



        What is going on is that the inner tikz picture has a border. Exactly why this is so is quite subtle. When TikZ builds a picture then internally it keeps track of the size of that picture. The main way of doing so is to keep track of a rectangle that is big enough to contain every coordinate that has been used, this is enough to ensure that every path is inside the picture (there are some questions about this with relation to Bezier curves which are an interesting read). However, when a line is drawn then it is drawn with a thickness and so if a path goes between, say, (0,0) and (1,0) then its maximum height will actually be a half linewidth above 0. So when TikZ adds a point to the bounding box, it actually adds a half linewidth beyond it. So when you create a picture with coordinates (0,0) and (1,0) and (for ease of explanation) line width 2mm, the bounding box will have corners (-.1,-1.) to (1.1,.1). And this extends a bit beyond the line.



        When this is embedded in another node (I would go one stronger than @Andrew and say that nesting TikZ pictures should be avoided), the outer TikZ doesn't know anything about what the inner TikZ drew and just knows about the box size. So it creates a node big enough to contain that box. Even though you make that node as tightly fitting as possible (via inner sep=0, outer sep=0) you don't make it touch the inner line.



        The solution proposed by @AboAmmar gets round this by making the line in the inner TikZ picture extend to the boundary of the inner picture since line cap=rect ensures that the line extends by half a line width beyond the coordinate. This works in the case of horizontal/vertical lines as then the overreach of the line exactly matches the excess added to the box, but the situation with a diagonal line might need more adjustment.



        (I'm actually going to remember this one as another example of why nesting tikz pictures can cause strange effects and therefore is Not A Good Idea. If you have a situation where you think you need to nest tikz pictures, please ask here first and someone will come up with an alternative solution!)






        share|improve this answer























          6












          6








          6






          This is an interesting case! I originally thought it was due to the fact that, as @Andrew says in a comment, node has a border. However, that border can be removed by setting inner sep and outer sep to 0 and this is exactly what you do. So the node does not have a border.



          What is going on is that the inner tikz picture has a border. Exactly why this is so is quite subtle. When TikZ builds a picture then internally it keeps track of the size of that picture. The main way of doing so is to keep track of a rectangle that is big enough to contain every coordinate that has been used, this is enough to ensure that every path is inside the picture (there are some questions about this with relation to Bezier curves which are an interesting read). However, when a line is drawn then it is drawn with a thickness and so if a path goes between, say, (0,0) and (1,0) then its maximum height will actually be a half linewidth above 0. So when TikZ adds a point to the bounding box, it actually adds a half linewidth beyond it. So when you create a picture with coordinates (0,0) and (1,0) and (for ease of explanation) line width 2mm, the bounding box will have corners (-.1,-1.) to (1.1,.1). And this extends a bit beyond the line.



          When this is embedded in another node (I would go one stronger than @Andrew and say that nesting TikZ pictures should be avoided), the outer TikZ doesn't know anything about what the inner TikZ drew and just knows about the box size. So it creates a node big enough to contain that box. Even though you make that node as tightly fitting as possible (via inner sep=0, outer sep=0) you don't make it touch the inner line.



          The solution proposed by @AboAmmar gets round this by making the line in the inner TikZ picture extend to the boundary of the inner picture since line cap=rect ensures that the line extends by half a line width beyond the coordinate. This works in the case of horizontal/vertical lines as then the overreach of the line exactly matches the excess added to the box, but the situation with a diagonal line might need more adjustment.



          (I'm actually going to remember this one as another example of why nesting tikz pictures can cause strange effects and therefore is Not A Good Idea. If you have a situation where you think you need to nest tikz pictures, please ask here first and someone will come up with an alternative solution!)






          share|improve this answer












          This is an interesting case! I originally thought it was due to the fact that, as @Andrew says in a comment, node has a border. However, that border can be removed by setting inner sep and outer sep to 0 and this is exactly what you do. So the node does not have a border.



          What is going on is that the inner tikz picture has a border. Exactly why this is so is quite subtle. When TikZ builds a picture then internally it keeps track of the size of that picture. The main way of doing so is to keep track of a rectangle that is big enough to contain every coordinate that has been used, this is enough to ensure that every path is inside the picture (there are some questions about this with relation to Bezier curves which are an interesting read). However, when a line is drawn then it is drawn with a thickness and so if a path goes between, say, (0,0) and (1,0) then its maximum height will actually be a half linewidth above 0. So when TikZ adds a point to the bounding box, it actually adds a half linewidth beyond it. So when you create a picture with coordinates (0,0) and (1,0) and (for ease of explanation) line width 2mm, the bounding box will have corners (-.1,-1.) to (1.1,.1). And this extends a bit beyond the line.



          When this is embedded in another node (I would go one stronger than @Andrew and say that nesting TikZ pictures should be avoided), the outer TikZ doesn't know anything about what the inner TikZ drew and just knows about the box size. So it creates a node big enough to contain that box. Even though you make that node as tightly fitting as possible (via inner sep=0, outer sep=0) you don't make it touch the inner line.



          The solution proposed by @AboAmmar gets round this by making the line in the inner TikZ picture extend to the boundary of the inner picture since line cap=rect ensures that the line extends by half a line width beyond the coordinate. This works in the case of horizontal/vertical lines as then the overreach of the line exactly matches the excess added to the box, but the situation with a diagonal line might need more adjustment.



          (I'm actually going to remember this one as another example of why nesting tikz pictures can cause strange effects and therefore is Not A Good Idea. If you have a situation where you think you need to nest tikz pictures, please ask here first and someone will come up with an alternative solution!)







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Aug 24 at 13:01









          Loop Space

          111k29302600




          111k29302600





















              6














              In this particular case, you can add line cap=rect and that tiny gap will disappear.



              documentclassarticle
              usepackagetikz

              begindocument

              begintikzpicture[every node/.style=inner sep=0,outer sep=0, line cap=rect]
              node at (0,0) (test) tikzdraw (0,0) -- (1,0);;
              draw [inner sep=0,outer sep=0](test.east) --++ (1,0);
              endtikzpicture

              enddocument


              At 1200% zoom:



              enter image description here






              share|improve this answer

























                6














                In this particular case, you can add line cap=rect and that tiny gap will disappear.



                documentclassarticle
                usepackagetikz

                begindocument

                begintikzpicture[every node/.style=inner sep=0,outer sep=0, line cap=rect]
                node at (0,0) (test) tikzdraw (0,0) -- (1,0);;
                draw [inner sep=0,outer sep=0](test.east) --++ (1,0);
                endtikzpicture

                enddocument


                At 1200% zoom:



                enter image description here






                share|improve this answer























                  6












                  6








                  6






                  In this particular case, you can add line cap=rect and that tiny gap will disappear.



                  documentclassarticle
                  usepackagetikz

                  begindocument

                  begintikzpicture[every node/.style=inner sep=0,outer sep=0, line cap=rect]
                  node at (0,0) (test) tikzdraw (0,0) -- (1,0);;
                  draw [inner sep=0,outer sep=0](test.east) --++ (1,0);
                  endtikzpicture

                  enddocument


                  At 1200% zoom:



                  enter image description here






                  share|improve this answer












                  In this particular case, you can add line cap=rect and that tiny gap will disappear.



                  documentclassarticle
                  usepackagetikz

                  begindocument

                  begintikzpicture[every node/.style=inner sep=0,outer sep=0, line cap=rect]
                  node at (0,0) (test) tikzdraw (0,0) -- (1,0);;
                  draw [inner sep=0,outer sep=0](test.east) --++ (1,0);
                  endtikzpicture

                  enddocument


                  At 1200% zoom:



                  enter image description here







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Aug 24 at 12:37









                  AboAmmar

                  32.3k22781




                  32.3k22781





















                      4














                      As written in my comment and Loop Space's nice answer, nesting tikzpictures should be avoided. The standard way to do that is to work with saveboxes. Of course, a node has a border given by the line width.



                      documentclass[tikz,border=10pt]standalone
                      usepackagetikz
                      newsaveboxTikzBar
                      sboxTikzBartikz draw (0,0) -- (1,0);
                      begindocument
                      begintikzpicture[every node/.style=inner sep=0,outer sep=0]
                      node at (0,0) (test) useboxTikzBar;
                      draw (test.east) --++ (1,0);
                      endtikzpicture
                      begintikzpicture[every node/.style=inner sep=0,outer sep=0]
                      node at (0,0) (test) useboxTikzBar;
                      draw ([xshift=-pgflinewidth/2]test.east) --++ (1,0);
                      endtikzpicture
                      enddocument


                      enter image description here



                      As you see, once you avoid the nesting of tikzpictures, the gap is almost gone, and if you correct for the border by moving the line closer by -pgflinewidth/2 it disappears completely.






                      share|improve this answer




















                      • Note that the pgflinewidth/2 needs to refer to the line width that is in effect when the box is created. If you put, say, line width=5mm on the inner picture (in the box) then you'll see what I mean.
                        – Loop Space
                        Aug 24 at 13:12










                      • @LoopSpace Absolutely. I am aware of this. In this case, this is the right dimension, though, and I thought it would be easier to understand. Thanks!
                        – marmot
                        Aug 24 at 13:15






                      • 1




                        I know you know. It's just about making sure it's clear for others.
                        – Loop Space
                        Aug 24 at 13:31















                      4














                      As written in my comment and Loop Space's nice answer, nesting tikzpictures should be avoided. The standard way to do that is to work with saveboxes. Of course, a node has a border given by the line width.



                      documentclass[tikz,border=10pt]standalone
                      usepackagetikz
                      newsaveboxTikzBar
                      sboxTikzBartikz draw (0,0) -- (1,0);
                      begindocument
                      begintikzpicture[every node/.style=inner sep=0,outer sep=0]
                      node at (0,0) (test) useboxTikzBar;
                      draw (test.east) --++ (1,0);
                      endtikzpicture
                      begintikzpicture[every node/.style=inner sep=0,outer sep=0]
                      node at (0,0) (test) useboxTikzBar;
                      draw ([xshift=-pgflinewidth/2]test.east) --++ (1,0);
                      endtikzpicture
                      enddocument


                      enter image description here



                      As you see, once you avoid the nesting of tikzpictures, the gap is almost gone, and if you correct for the border by moving the line closer by -pgflinewidth/2 it disappears completely.






                      share|improve this answer




















                      • Note that the pgflinewidth/2 needs to refer to the line width that is in effect when the box is created. If you put, say, line width=5mm on the inner picture (in the box) then you'll see what I mean.
                        – Loop Space
                        Aug 24 at 13:12










                      • @LoopSpace Absolutely. I am aware of this. In this case, this is the right dimension, though, and I thought it would be easier to understand. Thanks!
                        – marmot
                        Aug 24 at 13:15






                      • 1




                        I know you know. It's just about making sure it's clear for others.
                        – Loop Space
                        Aug 24 at 13:31













                      4












                      4








                      4






                      As written in my comment and Loop Space's nice answer, nesting tikzpictures should be avoided. The standard way to do that is to work with saveboxes. Of course, a node has a border given by the line width.



                      documentclass[tikz,border=10pt]standalone
                      usepackagetikz
                      newsaveboxTikzBar
                      sboxTikzBartikz draw (0,0) -- (1,0);
                      begindocument
                      begintikzpicture[every node/.style=inner sep=0,outer sep=0]
                      node at (0,0) (test) useboxTikzBar;
                      draw (test.east) --++ (1,0);
                      endtikzpicture
                      begintikzpicture[every node/.style=inner sep=0,outer sep=0]
                      node at (0,0) (test) useboxTikzBar;
                      draw ([xshift=-pgflinewidth/2]test.east) --++ (1,0);
                      endtikzpicture
                      enddocument


                      enter image description here



                      As you see, once you avoid the nesting of tikzpictures, the gap is almost gone, and if you correct for the border by moving the line closer by -pgflinewidth/2 it disappears completely.






                      share|improve this answer












                      As written in my comment and Loop Space's nice answer, nesting tikzpictures should be avoided. The standard way to do that is to work with saveboxes. Of course, a node has a border given by the line width.



                      documentclass[tikz,border=10pt]standalone
                      usepackagetikz
                      newsaveboxTikzBar
                      sboxTikzBartikz draw (0,0) -- (1,0);
                      begindocument
                      begintikzpicture[every node/.style=inner sep=0,outer sep=0]
                      node at (0,0) (test) useboxTikzBar;
                      draw (test.east) --++ (1,0);
                      endtikzpicture
                      begintikzpicture[every node/.style=inner sep=0,outer sep=0]
                      node at (0,0) (test) useboxTikzBar;
                      draw ([xshift=-pgflinewidth/2]test.east) --++ (1,0);
                      endtikzpicture
                      enddocument


                      enter image description here



                      As you see, once you avoid the nesting of tikzpictures, the gap is almost gone, and if you correct for the border by moving the line closer by -pgflinewidth/2 it disappears completely.







                      share|improve this answer












                      share|improve this answer



                      share|improve this answer










                      answered Aug 24 at 13:08









                      marmot

                      84.7k495179




                      84.7k495179











                      • Note that the pgflinewidth/2 needs to refer to the line width that is in effect when the box is created. If you put, say, line width=5mm on the inner picture (in the box) then you'll see what I mean.
                        – Loop Space
                        Aug 24 at 13:12










                      • @LoopSpace Absolutely. I am aware of this. In this case, this is the right dimension, though, and I thought it would be easier to understand. Thanks!
                        – marmot
                        Aug 24 at 13:15






                      • 1




                        I know you know. It's just about making sure it's clear for others.
                        – Loop Space
                        Aug 24 at 13:31
















                      • Note that the pgflinewidth/2 needs to refer to the line width that is in effect when the box is created. If you put, say, line width=5mm on the inner picture (in the box) then you'll see what I mean.
                        – Loop Space
                        Aug 24 at 13:12










                      • @LoopSpace Absolutely. I am aware of this. In this case, this is the right dimension, though, and I thought it would be easier to understand. Thanks!
                        – marmot
                        Aug 24 at 13:15






                      • 1




                        I know you know. It's just about making sure it's clear for others.
                        – Loop Space
                        Aug 24 at 13:31















                      Note that the pgflinewidth/2 needs to refer to the line width that is in effect when the box is created. If you put, say, line width=5mm on the inner picture (in the box) then you'll see what I mean.
                      – Loop Space
                      Aug 24 at 13:12




                      Note that the pgflinewidth/2 needs to refer to the line width that is in effect when the box is created. If you put, say, line width=5mm on the inner picture (in the box) then you'll see what I mean.
                      – Loop Space
                      Aug 24 at 13:12












                      @LoopSpace Absolutely. I am aware of this. In this case, this is the right dimension, though, and I thought it would be easier to understand. Thanks!
                      – marmot
                      Aug 24 at 13:15




                      @LoopSpace Absolutely. I am aware of this. In this case, this is the right dimension, though, and I thought it would be easier to understand. Thanks!
                      – marmot
                      Aug 24 at 13:15




                      1




                      1




                      I know you know. It's just about making sure it's clear for others.
                      – Loop Space
                      Aug 24 at 13:31




                      I know you know. It's just about making sure it's clear for others.
                      – Loop Space
                      Aug 24 at 13:31

















                      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.





                      Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                      Please pay close attention to the following guidance:


                      • 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%2f447513%2ftikz-understand-white-space-between-node-and-draw%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

                      𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

                      Crossroads (UK TV series)

                      ữḛḳṊẴ ẋ,Ẩṙ,ỹḛẪẠứụỿṞṦ,Ṉẍừ,ứ Ị,Ḵ,ṏ ṇỪḎḰṰọửḊ ṾḨḮữẑỶṑỗḮṣṉẃ Ữẩụ,ṓ,ḹẕḪḫỞṿḭ ỒṱṨẁṋṜ ḅẈ ṉ ứṀḱṑỒḵ,ḏ,ḊḖỹẊ Ẻḷổ,ṥ ẔḲẪụḣể Ṱ ḭỏựẶ Ồ Ṩ,ẂḿṡḾồ ỗṗṡịṞẤḵṽẃ ṸḒẄẘ,ủẞẵṦṟầṓế