Draw a line not touching edges











up vote
5
down vote

favorite












I'm drawing a line between 2 nodes and I'd like to avoid to touch the nodes, I have been able to do it with the first node but not with the second.



documentclass{article}
usepackage[utf8]{inputenc}
usepackage{tikz}

begin{document}


tikzstyle{every picture}+=[remember picture]



tikz[baseline] node[fill opacity=0.1,circle,label=left:2016,fill=black,inner sep=3pt] at (0,0) (n1) {};
tikz[baseline] node[draw=none,fill=none,align=left] {
vbox{
bar
}
};
tikz[baseline] node[draw=none,align=left] {
hspace*{20mm}parbox{10cm}{
foo
}
};

tikz[baseline] node[fill opacity=0.1,circle,label=left:2016,fill=black,inner sep=3pt] at (0,0) (n2) {};
tikz[baseline] node[draw=none,fill=none,align=left] {
vbox{
bar
}
};
tikz[baseline] node[draw=none,align=left] {
hspace*{20mm}parbox{10cm}{
foo
}
};
begin{tikzpicture}[overlay]
draw (n1)++(0, -0.25) -- (n2)++(0, 0.25);
end{tikzpicture}
end{document}


https://www.overleaf.com/project/5c00283f4365993602702d4f










share|improve this question







New contributor




Rod is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















  • Try draw ([yshift=-0.1cm]n1.south) -- ([yshift=0.1cm]n2.north);. (And replace tikzstyle{every picture}+=[remember picture] by tikzset{every picture/.append style={remember picture}}) Not sure if I would draw this picture in the way you do, why don't you just draw one picture?
    – marmot
    Nov 29 at 18:25












  • It works nicely, thanks again @marmot. I also replaced the section you mentioned. I'm not using one picture because I'm mixing text and a few nodes, if I used begin{tikzpicture} It would not allow me to use some commands. Probably because I do not know Latex
    – Rod
    Nov 29 at 18:35















up vote
5
down vote

favorite












I'm drawing a line between 2 nodes and I'd like to avoid to touch the nodes, I have been able to do it with the first node but not with the second.



documentclass{article}
usepackage[utf8]{inputenc}
usepackage{tikz}

begin{document}


tikzstyle{every picture}+=[remember picture]



tikz[baseline] node[fill opacity=0.1,circle,label=left:2016,fill=black,inner sep=3pt] at (0,0) (n1) {};
tikz[baseline] node[draw=none,fill=none,align=left] {
vbox{
bar
}
};
tikz[baseline] node[draw=none,align=left] {
hspace*{20mm}parbox{10cm}{
foo
}
};

tikz[baseline] node[fill opacity=0.1,circle,label=left:2016,fill=black,inner sep=3pt] at (0,0) (n2) {};
tikz[baseline] node[draw=none,fill=none,align=left] {
vbox{
bar
}
};
tikz[baseline] node[draw=none,align=left] {
hspace*{20mm}parbox{10cm}{
foo
}
};
begin{tikzpicture}[overlay]
draw (n1)++(0, -0.25) -- (n2)++(0, 0.25);
end{tikzpicture}
end{document}


https://www.overleaf.com/project/5c00283f4365993602702d4f










share|improve this question







New contributor




Rod is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















  • Try draw ([yshift=-0.1cm]n1.south) -- ([yshift=0.1cm]n2.north);. (And replace tikzstyle{every picture}+=[remember picture] by tikzset{every picture/.append style={remember picture}}) Not sure if I would draw this picture in the way you do, why don't you just draw one picture?
    – marmot
    Nov 29 at 18:25












  • It works nicely, thanks again @marmot. I also replaced the section you mentioned. I'm not using one picture because I'm mixing text and a few nodes, if I used begin{tikzpicture} It would not allow me to use some commands. Probably because I do not know Latex
    – Rod
    Nov 29 at 18:35













up vote
5
down vote

favorite









up vote
5
down vote

favorite











I'm drawing a line between 2 nodes and I'd like to avoid to touch the nodes, I have been able to do it with the first node but not with the second.



documentclass{article}
usepackage[utf8]{inputenc}
usepackage{tikz}

begin{document}


tikzstyle{every picture}+=[remember picture]



tikz[baseline] node[fill opacity=0.1,circle,label=left:2016,fill=black,inner sep=3pt] at (0,0) (n1) {};
tikz[baseline] node[draw=none,fill=none,align=left] {
vbox{
bar
}
};
tikz[baseline] node[draw=none,align=left] {
hspace*{20mm}parbox{10cm}{
foo
}
};

tikz[baseline] node[fill opacity=0.1,circle,label=left:2016,fill=black,inner sep=3pt] at (0,0) (n2) {};
tikz[baseline] node[draw=none,fill=none,align=left] {
vbox{
bar
}
};
tikz[baseline] node[draw=none,align=left] {
hspace*{20mm}parbox{10cm}{
foo
}
};
begin{tikzpicture}[overlay]
draw (n1)++(0, -0.25) -- (n2)++(0, 0.25);
end{tikzpicture}
end{document}


https://www.overleaf.com/project/5c00283f4365993602702d4f










share|improve this question







New contributor




Rod is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











I'm drawing a line between 2 nodes and I'd like to avoid to touch the nodes, I have been able to do it with the first node but not with the second.



documentclass{article}
usepackage[utf8]{inputenc}
usepackage{tikz}

begin{document}


tikzstyle{every picture}+=[remember picture]



tikz[baseline] node[fill opacity=0.1,circle,label=left:2016,fill=black,inner sep=3pt] at (0,0) (n1) {};
tikz[baseline] node[draw=none,fill=none,align=left] {
vbox{
bar
}
};
tikz[baseline] node[draw=none,align=left] {
hspace*{20mm}parbox{10cm}{
foo
}
};

tikz[baseline] node[fill opacity=0.1,circle,label=left:2016,fill=black,inner sep=3pt] at (0,0) (n2) {};
tikz[baseline] node[draw=none,fill=none,align=left] {
vbox{
bar
}
};
tikz[baseline] node[draw=none,align=left] {
hspace*{20mm}parbox{10cm}{
foo
}
};
begin{tikzpicture}[overlay]
draw (n1)++(0, -0.25) -- (n2)++(0, 0.25);
end{tikzpicture}
end{document}


https://www.overleaf.com/project/5c00283f4365993602702d4f







tikz-pgf xetex






share|improve this question







New contributor




Rod is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question







New contributor




Rod is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question






New contributor




Rod is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked Nov 29 at 18:21









Rod

1035




1035




New contributor




Rod is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





Rod is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






Rod is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












  • Try draw ([yshift=-0.1cm]n1.south) -- ([yshift=0.1cm]n2.north);. (And replace tikzstyle{every picture}+=[remember picture] by tikzset{every picture/.append style={remember picture}}) Not sure if I would draw this picture in the way you do, why don't you just draw one picture?
    – marmot
    Nov 29 at 18:25












  • It works nicely, thanks again @marmot. I also replaced the section you mentioned. I'm not using one picture because I'm mixing text and a few nodes, if I used begin{tikzpicture} It would not allow me to use some commands. Probably because I do not know Latex
    – Rod
    Nov 29 at 18:35


















  • Try draw ([yshift=-0.1cm]n1.south) -- ([yshift=0.1cm]n2.north);. (And replace tikzstyle{every picture}+=[remember picture] by tikzset{every picture/.append style={remember picture}}) Not sure if I would draw this picture in the way you do, why don't you just draw one picture?
    – marmot
    Nov 29 at 18:25












  • It works nicely, thanks again @marmot. I also replaced the section you mentioned. I'm not using one picture because I'm mixing text and a few nodes, if I used begin{tikzpicture} It would not allow me to use some commands. Probably because I do not know Latex
    – Rod
    Nov 29 at 18:35
















Try draw ([yshift=-0.1cm]n1.south) -- ([yshift=0.1cm]n2.north);. (And replace tikzstyle{every picture}+=[remember picture] by tikzset{every picture/.append style={remember picture}}) Not sure if I would draw this picture in the way you do, why don't you just draw one picture?
– marmot
Nov 29 at 18:25






Try draw ([yshift=-0.1cm]n1.south) -- ([yshift=0.1cm]n2.north);. (And replace tikzstyle{every picture}+=[remember picture] by tikzset{every picture/.append style={remember picture}}) Not sure if I would draw this picture in the way you do, why don't you just draw one picture?
– marmot
Nov 29 at 18:25














It works nicely, thanks again @marmot. I also replaced the section you mentioned. I'm not using one picture because I'm mixing text and a few nodes, if I used begin{tikzpicture} It would not allow me to use some commands. Probably because I do not know Latex
– Rod
Nov 29 at 18:35




It works nicely, thanks again @marmot. I also replaced the section you mentioned. I'm not using one picture because I'm mixing text and a few nodes, if I used begin{tikzpicture} It would not allow me to use some commands. Probably because I do not know Latex
– Rod
Nov 29 at 18:35










3 Answers
3






active

oldest

votes

















up vote
5
down vote



accepted










In your setting, you'd only need to use draw ([yshift=-0.1cm]n1.south) -- ([yshift=0.1cm]n2.north);. However, one can draw your picture in a single picture without remember picture.



documentclass{article}
usepackage[utf8]{inputenc}
usepackage{tikz}
usetikzlibrary{positioning}
begin{document}


begin{tikzpicture}
node[fill opacity=0.1,circle,label=left:2016,fill=black,inner
sep=3pt,label={[xshift=5mm]right:bar},label={[xshift=2mm,yshift=-5mm]right:foo},] (N1){};
node[below=1cm of N1,fill opacity=0.1,circle,label=left:2016,fill=black,inner
sep=3pt,label={[xshift=5mm]right:bar},label={[xshift=2mm,yshift=-5mm]right:foo}] (N2) {};
draw ([yshift=-0.1cm]N1.south) -- ([yshift=0.1cm]N2.north);
end{tikzpicture}
end{document}


enter image description here



ADDENDUM: Using Zarko's way to define a universal style, one could use outer sep to produce the gaps. I would rather not use shorten as this can have unwanted side-effects if you consider using curved paths.



documentclass{article}
usepackage[utf8]{inputenc}
usepackage{tikz}
usetikzlibrary{positioning}
begin{document}
begin{tikzpicture}[pfft/.style={circle,fill opacity=0.1,fill=black,inner
sep=3pt,outer sep=1mm}]
node[pfft,label=left:2016,,label={[xshift=5mm]right:bar},label={[xshift=2mm,yshift=-5mm]right:foo},] (N1){};
node[below=1cm of N1,pfft,label=left:2016,label={[xshift=5mm]right:bar},label={[xshift=2mm,yshift=-5mm]right:foo}] (N2) {};
draw (N1) -- (N2);
end{tikzpicture}
end{document}





share|improve this answer























  • When did shorten get deprecated? It is still used in the examples in the 3.0.1a manual.
    – Peter Grill
    Nov 29 at 19:52












  • @PeterGrill I do not think it got officially deprecated. However, it can cause issues on curved paths, see e.g. here. So I do not see that it is better than the yshift solution, rather it can backfire.
    – marmot
    Nov 29 at 19:56


















up vote
4
down vote













And a third option, without yshift and without outer sep but shorten option in line between nodes:



documentclass[tikz, margin=3.141592mm]{standalone}
usetikzlibrary{positioning}

begin{document}
begin{tikzpicture}[
node distance = 12mm,
dot/.style = {circle, fill=black, fill opacity=0.1,
inner sep=3pt, %No outer sep like in Zarko's answer
node contents={}}
]
node (n1) [dot, label=left:2016, label={[xshift=3mm]right:bar}, label=below right:foo];
node (n2) [dot, label=left:2017, label={[xshift=3mm]right:bar}, label=below right:foo,
below=of n1];
draw[shorten >=2pt, shorten <=2pt] (n1) -- (n2); %No `yshift` like in Marmot's answer
end{tikzpicture}
end{document}


enter image description here






share|improve this answer




























    up vote
    3
    down vote













    as complement to nice @marmot answer:



    documentclass[tikz, margin=3.141592mm]{standalone}
    usetikzlibrary{positioning}

    begin{document}
    begin{tikzpicture}[
    node distance = 12mm,
    dot/.style = {circle, fill=black, fill opacity=0.1,
    inner sep=3pt, outer sep=2pt,
    node contents={}}
    ]
    node (n1) [dot, label=left:2016, label={[xshift=3mm]right:bar}, label=below right:foo];
    node (n2) [dot, label=left:2017, label={[xshift=3mm]right:bar}, label=below right:foo,
    below=of n1];
    draw (n1) -- (n2);
    end{tikzpicture}
    end{document}


    enter image description here






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


      }
      });






      Rod is a new contributor. Be nice, and check out our Code of Conduct.










      draft saved

      draft discarded


















      StackExchange.ready(
      function () {
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f462433%2fdraw-a-line-not-touching-edges%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








      up vote
      5
      down vote



      accepted










      In your setting, you'd only need to use draw ([yshift=-0.1cm]n1.south) -- ([yshift=0.1cm]n2.north);. However, one can draw your picture in a single picture without remember picture.



      documentclass{article}
      usepackage[utf8]{inputenc}
      usepackage{tikz}
      usetikzlibrary{positioning}
      begin{document}


      begin{tikzpicture}
      node[fill opacity=0.1,circle,label=left:2016,fill=black,inner
      sep=3pt,label={[xshift=5mm]right:bar},label={[xshift=2mm,yshift=-5mm]right:foo},] (N1){};
      node[below=1cm of N1,fill opacity=0.1,circle,label=left:2016,fill=black,inner
      sep=3pt,label={[xshift=5mm]right:bar},label={[xshift=2mm,yshift=-5mm]right:foo}] (N2) {};
      draw ([yshift=-0.1cm]N1.south) -- ([yshift=0.1cm]N2.north);
      end{tikzpicture}
      end{document}


      enter image description here



      ADDENDUM: Using Zarko's way to define a universal style, one could use outer sep to produce the gaps. I would rather not use shorten as this can have unwanted side-effects if you consider using curved paths.



      documentclass{article}
      usepackage[utf8]{inputenc}
      usepackage{tikz}
      usetikzlibrary{positioning}
      begin{document}
      begin{tikzpicture}[pfft/.style={circle,fill opacity=0.1,fill=black,inner
      sep=3pt,outer sep=1mm}]
      node[pfft,label=left:2016,,label={[xshift=5mm]right:bar},label={[xshift=2mm,yshift=-5mm]right:foo},] (N1){};
      node[below=1cm of N1,pfft,label=left:2016,label={[xshift=5mm]right:bar},label={[xshift=2mm,yshift=-5mm]right:foo}] (N2) {};
      draw (N1) -- (N2);
      end{tikzpicture}
      end{document}





      share|improve this answer























      • When did shorten get deprecated? It is still used in the examples in the 3.0.1a manual.
        – Peter Grill
        Nov 29 at 19:52












      • @PeterGrill I do not think it got officially deprecated. However, it can cause issues on curved paths, see e.g. here. So I do not see that it is better than the yshift solution, rather it can backfire.
        – marmot
        Nov 29 at 19:56















      up vote
      5
      down vote



      accepted










      In your setting, you'd only need to use draw ([yshift=-0.1cm]n1.south) -- ([yshift=0.1cm]n2.north);. However, one can draw your picture in a single picture without remember picture.



      documentclass{article}
      usepackage[utf8]{inputenc}
      usepackage{tikz}
      usetikzlibrary{positioning}
      begin{document}


      begin{tikzpicture}
      node[fill opacity=0.1,circle,label=left:2016,fill=black,inner
      sep=3pt,label={[xshift=5mm]right:bar},label={[xshift=2mm,yshift=-5mm]right:foo},] (N1){};
      node[below=1cm of N1,fill opacity=0.1,circle,label=left:2016,fill=black,inner
      sep=3pt,label={[xshift=5mm]right:bar},label={[xshift=2mm,yshift=-5mm]right:foo}] (N2) {};
      draw ([yshift=-0.1cm]N1.south) -- ([yshift=0.1cm]N2.north);
      end{tikzpicture}
      end{document}


      enter image description here



      ADDENDUM: Using Zarko's way to define a universal style, one could use outer sep to produce the gaps. I would rather not use shorten as this can have unwanted side-effects if you consider using curved paths.



      documentclass{article}
      usepackage[utf8]{inputenc}
      usepackage{tikz}
      usetikzlibrary{positioning}
      begin{document}
      begin{tikzpicture}[pfft/.style={circle,fill opacity=0.1,fill=black,inner
      sep=3pt,outer sep=1mm}]
      node[pfft,label=left:2016,,label={[xshift=5mm]right:bar},label={[xshift=2mm,yshift=-5mm]right:foo},] (N1){};
      node[below=1cm of N1,pfft,label=left:2016,label={[xshift=5mm]right:bar},label={[xshift=2mm,yshift=-5mm]right:foo}] (N2) {};
      draw (N1) -- (N2);
      end{tikzpicture}
      end{document}





      share|improve this answer























      • When did shorten get deprecated? It is still used in the examples in the 3.0.1a manual.
        – Peter Grill
        Nov 29 at 19:52












      • @PeterGrill I do not think it got officially deprecated. However, it can cause issues on curved paths, see e.g. here. So I do not see that it is better than the yshift solution, rather it can backfire.
        – marmot
        Nov 29 at 19:56













      up vote
      5
      down vote



      accepted







      up vote
      5
      down vote



      accepted






      In your setting, you'd only need to use draw ([yshift=-0.1cm]n1.south) -- ([yshift=0.1cm]n2.north);. However, one can draw your picture in a single picture without remember picture.



      documentclass{article}
      usepackage[utf8]{inputenc}
      usepackage{tikz}
      usetikzlibrary{positioning}
      begin{document}


      begin{tikzpicture}
      node[fill opacity=0.1,circle,label=left:2016,fill=black,inner
      sep=3pt,label={[xshift=5mm]right:bar},label={[xshift=2mm,yshift=-5mm]right:foo},] (N1){};
      node[below=1cm of N1,fill opacity=0.1,circle,label=left:2016,fill=black,inner
      sep=3pt,label={[xshift=5mm]right:bar},label={[xshift=2mm,yshift=-5mm]right:foo}] (N2) {};
      draw ([yshift=-0.1cm]N1.south) -- ([yshift=0.1cm]N2.north);
      end{tikzpicture}
      end{document}


      enter image description here



      ADDENDUM: Using Zarko's way to define a universal style, one could use outer sep to produce the gaps. I would rather not use shorten as this can have unwanted side-effects if you consider using curved paths.



      documentclass{article}
      usepackage[utf8]{inputenc}
      usepackage{tikz}
      usetikzlibrary{positioning}
      begin{document}
      begin{tikzpicture}[pfft/.style={circle,fill opacity=0.1,fill=black,inner
      sep=3pt,outer sep=1mm}]
      node[pfft,label=left:2016,,label={[xshift=5mm]right:bar},label={[xshift=2mm,yshift=-5mm]right:foo},] (N1){};
      node[below=1cm of N1,pfft,label=left:2016,label={[xshift=5mm]right:bar},label={[xshift=2mm,yshift=-5mm]right:foo}] (N2) {};
      draw (N1) -- (N2);
      end{tikzpicture}
      end{document}





      share|improve this answer














      In your setting, you'd only need to use draw ([yshift=-0.1cm]n1.south) -- ([yshift=0.1cm]n2.north);. However, one can draw your picture in a single picture without remember picture.



      documentclass{article}
      usepackage[utf8]{inputenc}
      usepackage{tikz}
      usetikzlibrary{positioning}
      begin{document}


      begin{tikzpicture}
      node[fill opacity=0.1,circle,label=left:2016,fill=black,inner
      sep=3pt,label={[xshift=5mm]right:bar},label={[xshift=2mm,yshift=-5mm]right:foo},] (N1){};
      node[below=1cm of N1,fill opacity=0.1,circle,label=left:2016,fill=black,inner
      sep=3pt,label={[xshift=5mm]right:bar},label={[xshift=2mm,yshift=-5mm]right:foo}] (N2) {};
      draw ([yshift=-0.1cm]N1.south) -- ([yshift=0.1cm]N2.north);
      end{tikzpicture}
      end{document}


      enter image description here



      ADDENDUM: Using Zarko's way to define a universal style, one could use outer sep to produce the gaps. I would rather not use shorten as this can have unwanted side-effects if you consider using curved paths.



      documentclass{article}
      usepackage[utf8]{inputenc}
      usepackage{tikz}
      usetikzlibrary{positioning}
      begin{document}
      begin{tikzpicture}[pfft/.style={circle,fill opacity=0.1,fill=black,inner
      sep=3pt,outer sep=1mm}]
      node[pfft,label=left:2016,,label={[xshift=5mm]right:bar},label={[xshift=2mm,yshift=-5mm]right:foo},] (N1){};
      node[below=1cm of N1,pfft,label=left:2016,label={[xshift=5mm]right:bar},label={[xshift=2mm,yshift=-5mm]right:foo}] (N2) {};
      draw (N1) -- (N2);
      end{tikzpicture}
      end{document}






      share|improve this answer














      share|improve this answer



      share|improve this answer








      edited Nov 29 at 19:50

























      answered Nov 29 at 18:46









      marmot

      80.1k491171




      80.1k491171












      • When did shorten get deprecated? It is still used in the examples in the 3.0.1a manual.
        – Peter Grill
        Nov 29 at 19:52












      • @PeterGrill I do not think it got officially deprecated. However, it can cause issues on curved paths, see e.g. here. So I do not see that it is better than the yshift solution, rather it can backfire.
        – marmot
        Nov 29 at 19:56


















      • When did shorten get deprecated? It is still used in the examples in the 3.0.1a manual.
        – Peter Grill
        Nov 29 at 19:52












      • @PeterGrill I do not think it got officially deprecated. However, it can cause issues on curved paths, see e.g. here. So I do not see that it is better than the yshift solution, rather it can backfire.
        – marmot
        Nov 29 at 19:56
















      When did shorten get deprecated? It is still used in the examples in the 3.0.1a manual.
      – Peter Grill
      Nov 29 at 19:52






      When did shorten get deprecated? It is still used in the examples in the 3.0.1a manual.
      – Peter Grill
      Nov 29 at 19:52














      @PeterGrill I do not think it got officially deprecated. However, it can cause issues on curved paths, see e.g. here. So I do not see that it is better than the yshift solution, rather it can backfire.
      – marmot
      Nov 29 at 19:56




      @PeterGrill I do not think it got officially deprecated. However, it can cause issues on curved paths, see e.g. here. So I do not see that it is better than the yshift solution, rather it can backfire.
      – marmot
      Nov 29 at 19:56










      up vote
      4
      down vote













      And a third option, without yshift and without outer sep but shorten option in line between nodes:



      documentclass[tikz, margin=3.141592mm]{standalone}
      usetikzlibrary{positioning}

      begin{document}
      begin{tikzpicture}[
      node distance = 12mm,
      dot/.style = {circle, fill=black, fill opacity=0.1,
      inner sep=3pt, %No outer sep like in Zarko's answer
      node contents={}}
      ]
      node (n1) [dot, label=left:2016, label={[xshift=3mm]right:bar}, label=below right:foo];
      node (n2) [dot, label=left:2017, label={[xshift=3mm]right:bar}, label=below right:foo,
      below=of n1];
      draw[shorten >=2pt, shorten <=2pt] (n1) -- (n2); %No `yshift` like in Marmot's answer
      end{tikzpicture}
      end{document}


      enter image description here






      share|improve this answer

























        up vote
        4
        down vote













        And a third option, without yshift and without outer sep but shorten option in line between nodes:



        documentclass[tikz, margin=3.141592mm]{standalone}
        usetikzlibrary{positioning}

        begin{document}
        begin{tikzpicture}[
        node distance = 12mm,
        dot/.style = {circle, fill=black, fill opacity=0.1,
        inner sep=3pt, %No outer sep like in Zarko's answer
        node contents={}}
        ]
        node (n1) [dot, label=left:2016, label={[xshift=3mm]right:bar}, label=below right:foo];
        node (n2) [dot, label=left:2017, label={[xshift=3mm]right:bar}, label=below right:foo,
        below=of n1];
        draw[shorten >=2pt, shorten <=2pt] (n1) -- (n2); %No `yshift` like in Marmot's answer
        end{tikzpicture}
        end{document}


        enter image description here






        share|improve this answer























          up vote
          4
          down vote










          up vote
          4
          down vote









          And a third option, without yshift and without outer sep but shorten option in line between nodes:



          documentclass[tikz, margin=3.141592mm]{standalone}
          usetikzlibrary{positioning}

          begin{document}
          begin{tikzpicture}[
          node distance = 12mm,
          dot/.style = {circle, fill=black, fill opacity=0.1,
          inner sep=3pt, %No outer sep like in Zarko's answer
          node contents={}}
          ]
          node (n1) [dot, label=left:2016, label={[xshift=3mm]right:bar}, label=below right:foo];
          node (n2) [dot, label=left:2017, label={[xshift=3mm]right:bar}, label=below right:foo,
          below=of n1];
          draw[shorten >=2pt, shorten <=2pt] (n1) -- (n2); %No `yshift` like in Marmot's answer
          end{tikzpicture}
          end{document}


          enter image description here






          share|improve this answer












          And a third option, without yshift and without outer sep but shorten option in line between nodes:



          documentclass[tikz, margin=3.141592mm]{standalone}
          usetikzlibrary{positioning}

          begin{document}
          begin{tikzpicture}[
          node distance = 12mm,
          dot/.style = {circle, fill=black, fill opacity=0.1,
          inner sep=3pt, %No outer sep like in Zarko's answer
          node contents={}}
          ]
          node (n1) [dot, label=left:2016, label={[xshift=3mm]right:bar}, label=below right:foo];
          node (n2) [dot, label=left:2017, label={[xshift=3mm]right:bar}, label=below right:foo,
          below=of n1];
          draw[shorten >=2pt, shorten <=2pt] (n1) -- (n2); %No `yshift` like in Marmot's answer
          end{tikzpicture}
          end{document}


          enter image description here







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 29 at 19:17









          Ignasi

          90.5k4164303




          90.5k4164303






















              up vote
              3
              down vote













              as complement to nice @marmot answer:



              documentclass[tikz, margin=3.141592mm]{standalone}
              usetikzlibrary{positioning}

              begin{document}
              begin{tikzpicture}[
              node distance = 12mm,
              dot/.style = {circle, fill=black, fill opacity=0.1,
              inner sep=3pt, outer sep=2pt,
              node contents={}}
              ]
              node (n1) [dot, label=left:2016, label={[xshift=3mm]right:bar}, label=below right:foo];
              node (n2) [dot, label=left:2017, label={[xshift=3mm]right:bar}, label=below right:foo,
              below=of n1];
              draw (n1) -- (n2);
              end{tikzpicture}
              end{document}


              enter image description here






              share|improve this answer

























                up vote
                3
                down vote













                as complement to nice @marmot answer:



                documentclass[tikz, margin=3.141592mm]{standalone}
                usetikzlibrary{positioning}

                begin{document}
                begin{tikzpicture}[
                node distance = 12mm,
                dot/.style = {circle, fill=black, fill opacity=0.1,
                inner sep=3pt, outer sep=2pt,
                node contents={}}
                ]
                node (n1) [dot, label=left:2016, label={[xshift=3mm]right:bar}, label=below right:foo];
                node (n2) [dot, label=left:2017, label={[xshift=3mm]right:bar}, label=below right:foo,
                below=of n1];
                draw (n1) -- (n2);
                end{tikzpicture}
                end{document}


                enter image description here






                share|improve this answer























                  up vote
                  3
                  down vote










                  up vote
                  3
                  down vote









                  as complement to nice @marmot answer:



                  documentclass[tikz, margin=3.141592mm]{standalone}
                  usetikzlibrary{positioning}

                  begin{document}
                  begin{tikzpicture}[
                  node distance = 12mm,
                  dot/.style = {circle, fill=black, fill opacity=0.1,
                  inner sep=3pt, outer sep=2pt,
                  node contents={}}
                  ]
                  node (n1) [dot, label=left:2016, label={[xshift=3mm]right:bar}, label=below right:foo];
                  node (n2) [dot, label=left:2017, label={[xshift=3mm]right:bar}, label=below right:foo,
                  below=of n1];
                  draw (n1) -- (n2);
                  end{tikzpicture}
                  end{document}


                  enter image description here






                  share|improve this answer












                  as complement to nice @marmot answer:



                  documentclass[tikz, margin=3.141592mm]{standalone}
                  usetikzlibrary{positioning}

                  begin{document}
                  begin{tikzpicture}[
                  node distance = 12mm,
                  dot/.style = {circle, fill=black, fill opacity=0.1,
                  inner sep=3pt, outer sep=2pt,
                  node contents={}}
                  ]
                  node (n1) [dot, label=left:2016, label={[xshift=3mm]right:bar}, label=below right:foo];
                  node (n2) [dot, label=left:2017, label={[xshift=3mm]right:bar}, label=below right:foo,
                  below=of n1];
                  draw (n1) -- (n2);
                  end{tikzpicture}
                  end{document}


                  enter image description here







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Nov 29 at 19:07









                  Zarko

                  117k865155




                  117k865155






















                      Rod is a new contributor. Be nice, and check out our Code of Conduct.










                      draft saved

                      draft discarded


















                      Rod is a new contributor. Be nice, and check out our Code of Conduct.













                      Rod is a new contributor. Be nice, and check out our Code of Conduct.












                      Rod is a new contributor. Be nice, and check out our Code of Conduct.
















                      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%2f462433%2fdraw-a-line-not-touching-edges%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

                      "Incorrect syntax near the keyword 'ON'. (on update cascade, on delete cascade,)

                      Alcedinidae

                      RAC Tourist Trophy