How to eliminate gap at the start and at the end of a line when it's drawn along a side of a node's bounding box?tikz: double lines are shiftedtikz bounding box / cropping: too much space for curvesHow to define the default vertical distance between nodes?Define tikz node based on pagenodesComputing the rectangle encompassing a node and a pointNumerical conditional within tikz keys?TikZ: Drawing an arc from an intersection to an intersectionDraw a transparency gradient arc over a rectangle with tikzDrawing rectilinear curves in Tikz, aka an Etch-a-Sketch drawingLine up nested tikz enviroments or how to get rid of themHow to draw a square and its diagonals with arrows?beginfigure… endfigure is not working with tikz package

A steel cutting sword?

Is the derivative with respect to a fermion field Grassmann-odd?

How to use libraries with delays inside within a time critical STM32 HAL application?

Why aren't space telescopes put in GEO?

Grammar Question Regarding "Are the" or "Is the" When Referring to Something that May or May not be Plural

Count rotary dial pulses in a phone number (including letters)

Why is this Simple Puzzle impossible to solve?

Would Jetfuel for a modern jet like an F-16 or a F-35 be producable in the WW2 era?

Is it rude to call a professor by their last name with no prefix in a non-academic setting?

Is Jon Snow the last of his House?

Gladys goes shopping

Why did David Cameron offer a referendum on the European Union?

Is the field of q-series 'dead'?

Installed Tankless Water Heater - Internet loss when active

number headings

Plot twist where the antagonist wins

Why would Ryanair allow me to book this journey through a third party, but not through their own website?

Purpose and meaning of "dabei" in the sentence "sehen Sie dabei nicht ins Bildlexikon"?

Did the UK Government ask for the Irish backstop?

NIntegrate doesn't evaluate

How to deal with a colleague who is being aggressive?

Boss wants me to falsify a report. How should I document this unethical demand?

Should breaking down something like a door be adjudicated as an attempt to beat its AC and HP, or as an ability check against a set DC?

What are the real benefits of using Salesforce DX?



How to eliminate gap at the start and at the end of a line when it's drawn along a side of a node's bounding box?


tikz: double lines are shiftedtikz bounding box / cropping: too much space for curvesHow to define the default vertical distance between nodes?Define tikz node based on pagenodesComputing the rectangle encompassing a node and a pointNumerical conditional within tikz keys?TikZ: Drawing an arc from an intersection to an intersectionDraw a transparency gradient arc over a rectangle with tikzDrawing rectilinear curves in Tikz, aka an Etch-a-Sketch drawingLine up nested tikz enviroments or how to get rid of themHow to draw a square and its diagonals with arrows?beginfigure… endfigure is not working with tikz package













3















There are some gaps.



documentclassstandalone
usepackagetikz
begindocument
begintikzpicture
path node(n1)text;
path[draw](n1.north east)--(n1.north west);
% uncomment following line to see gaps clearly
%path[draw](n1.north west)--(n1.south west);
endtikzpicture
enddocument











share|improve this question


























    3















    There are some gaps.



    documentclassstandalone
    usepackagetikz
    begindocument
    begintikzpicture
    path node(n1)text;
    path[draw](n1.north east)--(n1.north west);
    % uncomment following line to see gaps clearly
    %path[draw](n1.north west)--(n1.south west);
    endtikzpicture
    enddocument











    share|improve this question
























      3












      3








      3


      1






      There are some gaps.



      documentclassstandalone
      usepackagetikz
      begindocument
      begintikzpicture
      path node(n1)text;
      path[draw](n1.north east)--(n1.north west);
      % uncomment following line to see gaps clearly
      %path[draw](n1.north west)--(n1.south west);
      endtikzpicture
      enddocument











      share|improve this question














      There are some gaps.



      documentclassstandalone
      usepackagetikz
      begindocument
      begintikzpicture
      path node(n1)text;
      path[draw](n1.north east)--(n1.north west);
      % uncomment following line to see gaps clearly
      %path[draw](n1.north west)--(n1.south west);
      endtikzpicture
      enddocument








      tikz-pgf






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked May 20 at 1:24









      bp2017bp2017

      1,181116




      1,181116




















          1 Answer
          1






          active

          oldest

          votes


















          5














          documentclass[tikz]standalone
          begindocument
          begintikzpicture
          path node(n1)text;
          path[draw,line cap=rect](n1.north east)--(n1.north west);
          % uncomment following line to see gaps clearly
          %path[draw](n1.north west)--(n1.south west);
          endtikzpicture
          enddocument


          enter image description here



          What is going on here? Let's start with



          documentclass[tikz]standalone
          begindocument
          begintikzpicture
          path node[draw](n1)text;
          path[fill=blue](n1.north east) circle[radius=0.1pt]
          (n1.north west)circle[radius=0.1pt];
          path[draw,red](n1.north east)--(n1.north west);
          endtikzpicture
          enddocument


          enter image description here



          This does not have any unnecessary gap. If you uncomment



           path[draw,red](n1.north east)--(n1.north west);


          you get



          enter image description here



          So the gap is there. This is because TikZ is rather "generous" with the bounding box, here it adds the "natural extension" of the line which emerges when you do line cap=rect. Note that the bounding box gets much more "overestimated", see e.g. here. AFAIK there is no built-in way to obtain the exact bounding box.






          share|improve this answer

























          • See also loopspace answer here tex.stackexchange.com/a/130472/2388 regarding "exact bounding box".

            – Ulrike Fischer
            May 20 at 7:06











          • @UlrikeFischer Yes, but this doesn't work for Bezier curves AFAIK

            – marmot
            May 20 at 12:03











          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%2f491679%2fhow-to-eliminate-gap-at-the-start-and-at-the-end-of-a-line-when-its-drawn-along%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          5














          documentclass[tikz]standalone
          begindocument
          begintikzpicture
          path node(n1)text;
          path[draw,line cap=rect](n1.north east)--(n1.north west);
          % uncomment following line to see gaps clearly
          %path[draw](n1.north west)--(n1.south west);
          endtikzpicture
          enddocument


          enter image description here



          What is going on here? Let's start with



          documentclass[tikz]standalone
          begindocument
          begintikzpicture
          path node[draw](n1)text;
          path[fill=blue](n1.north east) circle[radius=0.1pt]
          (n1.north west)circle[radius=0.1pt];
          path[draw,red](n1.north east)--(n1.north west);
          endtikzpicture
          enddocument


          enter image description here



          This does not have any unnecessary gap. If you uncomment



           path[draw,red](n1.north east)--(n1.north west);


          you get



          enter image description here



          So the gap is there. This is because TikZ is rather "generous" with the bounding box, here it adds the "natural extension" of the line which emerges when you do line cap=rect. Note that the bounding box gets much more "overestimated", see e.g. here. AFAIK there is no built-in way to obtain the exact bounding box.






          share|improve this answer

























          • See also loopspace answer here tex.stackexchange.com/a/130472/2388 regarding "exact bounding box".

            – Ulrike Fischer
            May 20 at 7:06











          • @UlrikeFischer Yes, but this doesn't work for Bezier curves AFAIK

            – marmot
            May 20 at 12:03















          5














          documentclass[tikz]standalone
          begindocument
          begintikzpicture
          path node(n1)text;
          path[draw,line cap=rect](n1.north east)--(n1.north west);
          % uncomment following line to see gaps clearly
          %path[draw](n1.north west)--(n1.south west);
          endtikzpicture
          enddocument


          enter image description here



          What is going on here? Let's start with



          documentclass[tikz]standalone
          begindocument
          begintikzpicture
          path node[draw](n1)text;
          path[fill=blue](n1.north east) circle[radius=0.1pt]
          (n1.north west)circle[radius=0.1pt];
          path[draw,red](n1.north east)--(n1.north west);
          endtikzpicture
          enddocument


          enter image description here



          This does not have any unnecessary gap. If you uncomment



           path[draw,red](n1.north east)--(n1.north west);


          you get



          enter image description here



          So the gap is there. This is because TikZ is rather "generous" with the bounding box, here it adds the "natural extension" of the line which emerges when you do line cap=rect. Note that the bounding box gets much more "overestimated", see e.g. here. AFAIK there is no built-in way to obtain the exact bounding box.






          share|improve this answer

























          • See also loopspace answer here tex.stackexchange.com/a/130472/2388 regarding "exact bounding box".

            – Ulrike Fischer
            May 20 at 7:06











          • @UlrikeFischer Yes, but this doesn't work for Bezier curves AFAIK

            – marmot
            May 20 at 12:03













          5












          5








          5







          documentclass[tikz]standalone
          begindocument
          begintikzpicture
          path node(n1)text;
          path[draw,line cap=rect](n1.north east)--(n1.north west);
          % uncomment following line to see gaps clearly
          %path[draw](n1.north west)--(n1.south west);
          endtikzpicture
          enddocument


          enter image description here



          What is going on here? Let's start with



          documentclass[tikz]standalone
          begindocument
          begintikzpicture
          path node[draw](n1)text;
          path[fill=blue](n1.north east) circle[radius=0.1pt]
          (n1.north west)circle[radius=0.1pt];
          path[draw,red](n1.north east)--(n1.north west);
          endtikzpicture
          enddocument


          enter image description here



          This does not have any unnecessary gap. If you uncomment



           path[draw,red](n1.north east)--(n1.north west);


          you get



          enter image description here



          So the gap is there. This is because TikZ is rather "generous" with the bounding box, here it adds the "natural extension" of the line which emerges when you do line cap=rect. Note that the bounding box gets much more "overestimated", see e.g. here. AFAIK there is no built-in way to obtain the exact bounding box.






          share|improve this answer















          documentclass[tikz]standalone
          begindocument
          begintikzpicture
          path node(n1)text;
          path[draw,line cap=rect](n1.north east)--(n1.north west);
          % uncomment following line to see gaps clearly
          %path[draw](n1.north west)--(n1.south west);
          endtikzpicture
          enddocument


          enter image description here



          What is going on here? Let's start with



          documentclass[tikz]standalone
          begindocument
          begintikzpicture
          path node[draw](n1)text;
          path[fill=blue](n1.north east) circle[radius=0.1pt]
          (n1.north west)circle[radius=0.1pt];
          path[draw,red](n1.north east)--(n1.north west);
          endtikzpicture
          enddocument


          enter image description here



          This does not have any unnecessary gap. If you uncomment



           path[draw,red](n1.north east)--(n1.north west);


          you get



          enter image description here



          So the gap is there. This is because TikZ is rather "generous" with the bounding box, here it adds the "natural extension" of the line which emerges when you do line cap=rect. Note that the bounding box gets much more "overestimated", see e.g. here. AFAIK there is no built-in way to obtain the exact bounding box.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited May 20 at 1:54

























          answered May 20 at 1:28









          marmotmarmot

          130k6164312




          130k6164312












          • See also loopspace answer here tex.stackexchange.com/a/130472/2388 regarding "exact bounding box".

            – Ulrike Fischer
            May 20 at 7:06











          • @UlrikeFischer Yes, but this doesn't work for Bezier curves AFAIK

            – marmot
            May 20 at 12:03

















          • See also loopspace answer here tex.stackexchange.com/a/130472/2388 regarding "exact bounding box".

            – Ulrike Fischer
            May 20 at 7:06











          • @UlrikeFischer Yes, but this doesn't work for Bezier curves AFAIK

            – marmot
            May 20 at 12:03
















          See also loopspace answer here tex.stackexchange.com/a/130472/2388 regarding "exact bounding box".

          – Ulrike Fischer
          May 20 at 7:06





          See also loopspace answer here tex.stackexchange.com/a/130472/2388 regarding "exact bounding box".

          – Ulrike Fischer
          May 20 at 7:06













          @UlrikeFischer Yes, but this doesn't work for Bezier curves AFAIK

          – marmot
          May 20 at 12:03





          @UlrikeFischer Yes, but this doesn't work for Bezier curves AFAIK

          – marmot
          May 20 at 12:03

















          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%2f491679%2fhow-to-eliminate-gap-at-the-start-and-at-the-end-of-a-line-when-its-drawn-along%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

          Get product attribute by attribute group code in magento 2get product attribute by product attribute group in magento 2Magento 2 Log Bundle Product Data in List Page?How to get all product attribute of a attribute group of Default attribute set?Magento 2.1 Create a filter in the product grid by new attributeMagento 2 : Get Product Attribute values By GroupMagento 2 How to get all existing values for one attributeMagento 2 get custom attribute of a single product inside a pluginMagento 2.3 How to get all the Multi Source Inventory (MSI) locations collection in custom module?Magento2: how to develop rest API to get new productsGet product attribute by attribute group code ( [attribute_group_code] ) in magento 2

          Category:9 (number) SubcategoriesMedia in category "9 (number)"Navigation menuUpload mediaGND ID: 4485639-8Library of Congress authority ID: sh85091979ReasonatorScholiaStatistics

          Magento 2.3: How do i solve this, Not registered handle, on custom form?How can i rewrite TierPrice Block in Magento2magento 2 captcha not rendering if I override layout xmlmain.CRITICAL: Plugin class doesn't existMagento 2 : Problem while adding custom button order view page?Magento 2.2.5: Overriding Admin Controller sales/orderMagento 2.2.5: Add, Update and Delete existing products Custom OptionsMagento 2.3 : File Upload issue in UI Component FormMagento2 Not registered handleHow to configured Form Builder Js in my custom magento 2.3.0 module?Magento 2.3. How to create image upload field in an admin form