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

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

          Circuit construction for execution of conditional statements using least significant bitHow are two different registers being used as “control”?How exactly is the stated composite state of the two registers being produced using the $R_zz$ controlled rotations?Efficiently performing controlled rotations in HHLWould this quantum algorithm implementation work?How to prepare a superposed states of odd integers from $1$ to $sqrtN$?Why is this implementation of the order finding algorithm not working?Circuit construction for Hamiltonian simulationHow can I invert the least significant bit of a certain term of a superposed state?Implementing an oracleImplementing a controlled sum operation

          Magento 2 “No Payment Methods” in Admin New OrderHow to integrate Paypal Express Checkout with the Magento APIMagento 1.5 - Sales > Order > edit order and shipping methods disappearAuto Invoice Check/Money Order Payment methodAdd more simple payment methods?Shipping methods not showingWhat should I do to change payment methods if changing the configuration has no effects?1.9 - No Payment Methods showing upMy Payment Methods not Showing for downloadable/virtual product when checkout?Magento2 API to access internal payment methodHow to call an existing payment methods in the registration form?