tikz: increase the spacing between the nodes












3














I want to increase the spacing between the nodes in a stencil, linked to each other by a stroke



documentclass[a4paper, 12pt]{book}
usepackage{tikz}
newcommand{stencilptbig}[4]{node[circle,draw,inner sep=0.1em, outer sep=0pt, minimum size=0.7cm,font=scriptsize,#1] at (#2) (#3) {#4}}
begin{document}
begin{tikzpicture}
stencilptbig{ -1,0}{i-1} {$frac{1}{h^2}+frac{3}{2h}$};
stencilptbig{ 0,0}{i} {$frac{-2}{h^2}$};
stencilptbig{ 1,0}{i+1}{$frac{1}{h^2}-frac{3}{2h}$};
draw
(i-1) -- (i)
(i) -- (i+1);
end{tikzpicture}
end{document}


enter image description here










share|improve this question


















  • 1




    The first (non optional) argument of stencilptbig is the node position. Change -1,0 to -2,0 and 1,0 to 2,0. Or you can scale down the nodes (for example with using scale=.5).
    – Kpym
    13 hours ago










  • Many thanks @kpym. short and accurate
    – ecjb
    10 hours ago
















3














I want to increase the spacing between the nodes in a stencil, linked to each other by a stroke



documentclass[a4paper, 12pt]{book}
usepackage{tikz}
newcommand{stencilptbig}[4]{node[circle,draw,inner sep=0.1em, outer sep=0pt, minimum size=0.7cm,font=scriptsize,#1] at (#2) (#3) {#4}}
begin{document}
begin{tikzpicture}
stencilptbig{ -1,0}{i-1} {$frac{1}{h^2}+frac{3}{2h}$};
stencilptbig{ 0,0}{i} {$frac{-2}{h^2}$};
stencilptbig{ 1,0}{i+1}{$frac{1}{h^2}-frac{3}{2h}$};
draw
(i-1) -- (i)
(i) -- (i+1);
end{tikzpicture}
end{document}


enter image description here










share|improve this question


















  • 1




    The first (non optional) argument of stencilptbig is the node position. Change -1,0 to -2,0 and 1,0 to 2,0. Or you can scale down the nodes (for example with using scale=.5).
    – Kpym
    13 hours ago










  • Many thanks @kpym. short and accurate
    – ecjb
    10 hours ago














3












3








3


0





I want to increase the spacing between the nodes in a stencil, linked to each other by a stroke



documentclass[a4paper, 12pt]{book}
usepackage{tikz}
newcommand{stencilptbig}[4]{node[circle,draw,inner sep=0.1em, outer sep=0pt, minimum size=0.7cm,font=scriptsize,#1] at (#2) (#3) {#4}}
begin{document}
begin{tikzpicture}
stencilptbig{ -1,0}{i-1} {$frac{1}{h^2}+frac{3}{2h}$};
stencilptbig{ 0,0}{i} {$frac{-2}{h^2}$};
stencilptbig{ 1,0}{i+1}{$frac{1}{h^2}-frac{3}{2h}$};
draw
(i-1) -- (i)
(i) -- (i+1);
end{tikzpicture}
end{document}


enter image description here










share|improve this question













I want to increase the spacing between the nodes in a stencil, linked to each other by a stroke



documentclass[a4paper, 12pt]{book}
usepackage{tikz}
newcommand{stencilptbig}[4]{node[circle,draw,inner sep=0.1em, outer sep=0pt, minimum size=0.7cm,font=scriptsize,#1] at (#2) (#3) {#4}}
begin{document}
begin{tikzpicture}
stencilptbig{ -1,0}{i-1} {$frac{1}{h^2}+frac{3}{2h}$};
stencilptbig{ 0,0}{i} {$frac{-2}{h^2}$};
stencilptbig{ 1,0}{i+1}{$frac{1}{h^2}-frac{3}{2h}$};
draw
(i-1) -- (i)
(i) -- (i+1);
end{tikzpicture}
end{document}


enter image description here







tikz-pgf






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked 14 hours ago









ecjb

1346




1346








  • 1




    The first (non optional) argument of stencilptbig is the node position. Change -1,0 to -2,0 and 1,0 to 2,0. Or you can scale down the nodes (for example with using scale=.5).
    – Kpym
    13 hours ago










  • Many thanks @kpym. short and accurate
    – ecjb
    10 hours ago














  • 1




    The first (non optional) argument of stencilptbig is the node position. Change -1,0 to -2,0 and 1,0 to 2,0. Or you can scale down the nodes (for example with using scale=.5).
    – Kpym
    13 hours ago










  • Many thanks @kpym. short and accurate
    – ecjb
    10 hours ago








1




1




The first (non optional) argument of stencilptbig is the node position. Change -1,0 to -2,0 and 1,0 to 2,0. Or you can scale down the nodes (for example with using scale=.5).
– Kpym
13 hours ago




The first (non optional) argument of stencilptbig is the node position. Change -1,0 to -2,0 and 1,0 to 2,0. Or you can scale down the nodes (for example with using scale=.5).
– Kpym
13 hours ago












Many thanks @kpym. short and accurate
– ecjb
10 hours ago




Many thanks @kpym. short and accurate
– ecjb
10 hours ago










1 Answer
1






active

oldest

votes


















5














Kpym already gave you a nice solution for your problem. I am writing this answer in order to persuade you to use a different syntax. Rather than defining a new command, you may just define a node style, and use positioning for relative positioning. (If you have many of these nodes, you may want look into chains, but here it would be a bit of an overkill IMHO.)



documentclass[a4paper, 12pt]{book}
usepackage{tikz}
usetikzlibrary{positioning}
begin{document}
begin{tikzpicture}[stencilptbig/.style={circle,draw,inner sep=0.1em, outer
sep=0pt, minimum size=0.7cm,font=scriptsize},
node distance=2mm]
node[stencilptbig] (i-1) {$frac{1}{h^2}+frac{3}{2h}$};
node[stencilptbig,right=of i-1] (i) {$frac{-2}{h^2}$};
node[stencilptbig,right=of i] (i+1){$frac{1}{h^2}-frac{3}{2h}$};
draw (i-1) -- (i) (i) -- (i+1);
end{tikzpicture}
end{document}


enter image description here



If you want to change the gaps, just adjust node distance.






share|improve this answer























    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "85"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f468036%2ftikz-increase-the-spacing-between-the-nodes%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














    Kpym already gave you a nice solution for your problem. I am writing this answer in order to persuade you to use a different syntax. Rather than defining a new command, you may just define a node style, and use positioning for relative positioning. (If you have many of these nodes, you may want look into chains, but here it would be a bit of an overkill IMHO.)



    documentclass[a4paper, 12pt]{book}
    usepackage{tikz}
    usetikzlibrary{positioning}
    begin{document}
    begin{tikzpicture}[stencilptbig/.style={circle,draw,inner sep=0.1em, outer
    sep=0pt, minimum size=0.7cm,font=scriptsize},
    node distance=2mm]
    node[stencilptbig] (i-1) {$frac{1}{h^2}+frac{3}{2h}$};
    node[stencilptbig,right=of i-1] (i) {$frac{-2}{h^2}$};
    node[stencilptbig,right=of i] (i+1){$frac{1}{h^2}-frac{3}{2h}$};
    draw (i-1) -- (i) (i) -- (i+1);
    end{tikzpicture}
    end{document}


    enter image description here



    If you want to change the gaps, just adjust node distance.






    share|improve this answer




























      5














      Kpym already gave you a nice solution for your problem. I am writing this answer in order to persuade you to use a different syntax. Rather than defining a new command, you may just define a node style, and use positioning for relative positioning. (If you have many of these nodes, you may want look into chains, but here it would be a bit of an overkill IMHO.)



      documentclass[a4paper, 12pt]{book}
      usepackage{tikz}
      usetikzlibrary{positioning}
      begin{document}
      begin{tikzpicture}[stencilptbig/.style={circle,draw,inner sep=0.1em, outer
      sep=0pt, minimum size=0.7cm,font=scriptsize},
      node distance=2mm]
      node[stencilptbig] (i-1) {$frac{1}{h^2}+frac{3}{2h}$};
      node[stencilptbig,right=of i-1] (i) {$frac{-2}{h^2}$};
      node[stencilptbig,right=of i] (i+1){$frac{1}{h^2}-frac{3}{2h}$};
      draw (i-1) -- (i) (i) -- (i+1);
      end{tikzpicture}
      end{document}


      enter image description here



      If you want to change the gaps, just adjust node distance.






      share|improve this answer


























        5












        5








        5






        Kpym already gave you a nice solution for your problem. I am writing this answer in order to persuade you to use a different syntax. Rather than defining a new command, you may just define a node style, and use positioning for relative positioning. (If you have many of these nodes, you may want look into chains, but here it would be a bit of an overkill IMHO.)



        documentclass[a4paper, 12pt]{book}
        usepackage{tikz}
        usetikzlibrary{positioning}
        begin{document}
        begin{tikzpicture}[stencilptbig/.style={circle,draw,inner sep=0.1em, outer
        sep=0pt, minimum size=0.7cm,font=scriptsize},
        node distance=2mm]
        node[stencilptbig] (i-1) {$frac{1}{h^2}+frac{3}{2h}$};
        node[stencilptbig,right=of i-1] (i) {$frac{-2}{h^2}$};
        node[stencilptbig,right=of i] (i+1){$frac{1}{h^2}-frac{3}{2h}$};
        draw (i-1) -- (i) (i) -- (i+1);
        end{tikzpicture}
        end{document}


        enter image description here



        If you want to change the gaps, just adjust node distance.






        share|improve this answer














        Kpym already gave you a nice solution for your problem. I am writing this answer in order to persuade you to use a different syntax. Rather than defining a new command, you may just define a node style, and use positioning for relative positioning. (If you have many of these nodes, you may want look into chains, but here it would be a bit of an overkill IMHO.)



        documentclass[a4paper, 12pt]{book}
        usepackage{tikz}
        usetikzlibrary{positioning}
        begin{document}
        begin{tikzpicture}[stencilptbig/.style={circle,draw,inner sep=0.1em, outer
        sep=0pt, minimum size=0.7cm,font=scriptsize},
        node distance=2mm]
        node[stencilptbig] (i-1) {$frac{1}{h^2}+frac{3}{2h}$};
        node[stencilptbig,right=of i-1] (i) {$frac{-2}{h^2}$};
        node[stencilptbig,right=of i] (i+1){$frac{1}{h^2}-frac{3}{2h}$};
        draw (i-1) -- (i) (i) -- (i+1);
        end{tikzpicture}
        end{document}


        enter image description here



        If you want to change the gaps, just adjust node distance.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited 12 hours ago

























        answered 12 hours ago









        marmot

        87.5k4100188




        87.5k4100188






























            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%2f468036%2ftikz-increase-the-spacing-between-the-nodes%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

            Ellipse (mathématiques)

            Quarter-circle Tiles

            Mont Emei