Tikz - increase the spacing between 2 nodes of a stencil












4















I want to increase the spacing between 2 nodes of a stencil. The original design of the stencil comes from this question.



stencil



documentclass[a4paper, 12pt]{book}
usepackage{pgfplots, tikz}

newcommand{stencilptbig}[4]{node[circle,draw,inner sep=0.1em, outer sep=0pt, minimum size=0.7cm,font=normalfont,#1] at (#2) (#3) {#4}}
begin{document}

begin{center}
begin{tikzpicture}
stencilptbig {-1,1} {i-1} {$frac{-1}{h^2_t}$};
stencilptbig {0,1} {i} {$frac{-2}{h^2_t}+frac{2}{h^2_x}$};
stencilptbig {0,0} {ij-1} {$frac{1}{h^2_t}$};
stencilptbig {0,2} {ij+1} {$frac{1}{h^2_t}$};
stencilptbig {1,1} {i+1} {$frac{-1}{h^2_t}$};
draw
(i-1) -- (i)
(i) -- (i+1)
(i) -- (ij-1)
(i) -- (ij+1);
end{tikzpicture}
end{center}
end{document}


I also tried newcommand{stencilptbig}[4]{node[circle,draw,inner sep=0.1em, outer sep=0pt, minimum size=0.7cm,font=normalfont,#1, node distance=2cm] at (#2) (#3) {#4}} according to that question but it didn't work



By the way: If there is an easier way to draw the whole thing, please let know.










share|improve this question





























    4















    I want to increase the spacing between 2 nodes of a stencil. The original design of the stencil comes from this question.



    stencil



    documentclass[a4paper, 12pt]{book}
    usepackage{pgfplots, tikz}

    newcommand{stencilptbig}[4]{node[circle,draw,inner sep=0.1em, outer sep=0pt, minimum size=0.7cm,font=normalfont,#1] at (#2) (#3) {#4}}
    begin{document}

    begin{center}
    begin{tikzpicture}
    stencilptbig {-1,1} {i-1} {$frac{-1}{h^2_t}$};
    stencilptbig {0,1} {i} {$frac{-2}{h^2_t}+frac{2}{h^2_x}$};
    stencilptbig {0,0} {ij-1} {$frac{1}{h^2_t}$};
    stencilptbig {0,2} {ij+1} {$frac{1}{h^2_t}$};
    stencilptbig {1,1} {i+1} {$frac{-1}{h^2_t}$};
    draw
    (i-1) -- (i)
    (i) -- (i+1)
    (i) -- (ij-1)
    (i) -- (ij+1);
    end{tikzpicture}
    end{center}
    end{document}


    I also tried newcommand{stencilptbig}[4]{node[circle,draw,inner sep=0.1em, outer sep=0pt, minimum size=0.7cm,font=normalfont,#1, node distance=2cm] at (#2) (#3) {#4}} according to that question but it didn't work



    By the way: If there is an easier way to draw the whole thing, please let know.










    share|improve this question



























      4












      4








      4


      0






      I want to increase the spacing between 2 nodes of a stencil. The original design of the stencil comes from this question.



      stencil



      documentclass[a4paper, 12pt]{book}
      usepackage{pgfplots, tikz}

      newcommand{stencilptbig}[4]{node[circle,draw,inner sep=0.1em, outer sep=0pt, minimum size=0.7cm,font=normalfont,#1] at (#2) (#3) {#4}}
      begin{document}

      begin{center}
      begin{tikzpicture}
      stencilptbig {-1,1} {i-1} {$frac{-1}{h^2_t}$};
      stencilptbig {0,1} {i} {$frac{-2}{h^2_t}+frac{2}{h^2_x}$};
      stencilptbig {0,0} {ij-1} {$frac{1}{h^2_t}$};
      stencilptbig {0,2} {ij+1} {$frac{1}{h^2_t}$};
      stencilptbig {1,1} {i+1} {$frac{-1}{h^2_t}$};
      draw
      (i-1) -- (i)
      (i) -- (i+1)
      (i) -- (ij-1)
      (i) -- (ij+1);
      end{tikzpicture}
      end{center}
      end{document}


      I also tried newcommand{stencilptbig}[4]{node[circle,draw,inner sep=0.1em, outer sep=0pt, minimum size=0.7cm,font=normalfont,#1, node distance=2cm] at (#2) (#3) {#4}} according to that question but it didn't work



      By the way: If there is an easier way to draw the whole thing, please let know.










      share|improve this question
















      I want to increase the spacing between 2 nodes of a stencil. The original design of the stencil comes from this question.



      stencil



      documentclass[a4paper, 12pt]{book}
      usepackage{pgfplots, tikz}

      newcommand{stencilptbig}[4]{node[circle,draw,inner sep=0.1em, outer sep=0pt, minimum size=0.7cm,font=normalfont,#1] at (#2) (#3) {#4}}
      begin{document}

      begin{center}
      begin{tikzpicture}
      stencilptbig {-1,1} {i-1} {$frac{-1}{h^2_t}$};
      stencilptbig {0,1} {i} {$frac{-2}{h^2_t}+frac{2}{h^2_x}$};
      stencilptbig {0,0} {ij-1} {$frac{1}{h^2_t}$};
      stencilptbig {0,2} {ij+1} {$frac{1}{h^2_t}$};
      stencilptbig {1,1} {i+1} {$frac{-1}{h^2_t}$};
      draw
      (i-1) -- (i)
      (i) -- (i+1)
      (i) -- (ij-1)
      (i) -- (ij+1);
      end{tikzpicture}
      end{center}
      end{document}


      I also tried newcommand{stencilptbig}[4]{node[circle,draw,inner sep=0.1em, outer sep=0pt, minimum size=0.7cm,font=normalfont,#1, node distance=2cm] at (#2) (#3) {#4}} according to that question but it didn't work



      By the way: If there is an easier way to draw the whole thing, please let know.







      tikz-pgf graphics nodes






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jan 1 at 22:09







      ecjb

















      asked Jan 1 at 19:28









      ecjbecjb

      3276




      3276






















          1 Answer
          1






          active

          oldest

          votes


















          9














          Same comments as in my previous answer apply here. ;-)



          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) {$frac{-2}{h^2_t}+frac{2}{h^2_x}$};
          node[stencilptbig,left=of i] (i-1) {$frac{-1}{h^2_t}$};
          node[stencilptbig,right=of i] (i+1) {$frac{-1}{h^2_t}$};
          node[stencilptbig,above=of i] (ij+1) {$frac{1}{h^2_t}$};
          node[stencilptbig,below=of i] (ij-1) {$frac{1}{h^2_t}$};
          draw
          (i-1) -- (i)
          (i) -- (i+1)
          (i) -- (ij-1)
          (i) -- (ij+1);
          end{tikzpicture}
          end{document}


          enter image description here



          You may also draw the lines with



          draw (i) edge   (i-1)  edge  (i+1) edge  (ij-1) edge  (ij+1);


          Depending on what you really want to achieve in the end, you may want to use chains or other tricks. And almost certainly someone will want use a matrix here. I guess that what is most elegant can only decided when it is clear what the full picture is.






          share|improve this answer


























          • many thanks again @marmot. That was indeed a similar question ;n)

            – ecjb
            Jan 1 at 19:48












          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%2f468169%2ftikz-increase-the-spacing-between-2-nodes-of-a-stencil%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









          9














          Same comments as in my previous answer apply here. ;-)



          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) {$frac{-2}{h^2_t}+frac{2}{h^2_x}$};
          node[stencilptbig,left=of i] (i-1) {$frac{-1}{h^2_t}$};
          node[stencilptbig,right=of i] (i+1) {$frac{-1}{h^2_t}$};
          node[stencilptbig,above=of i] (ij+1) {$frac{1}{h^2_t}$};
          node[stencilptbig,below=of i] (ij-1) {$frac{1}{h^2_t}$};
          draw
          (i-1) -- (i)
          (i) -- (i+1)
          (i) -- (ij-1)
          (i) -- (ij+1);
          end{tikzpicture}
          end{document}


          enter image description here



          You may also draw the lines with



          draw (i) edge   (i-1)  edge  (i+1) edge  (ij-1) edge  (ij+1);


          Depending on what you really want to achieve in the end, you may want to use chains or other tricks. And almost certainly someone will want use a matrix here. I guess that what is most elegant can only decided when it is clear what the full picture is.






          share|improve this answer


























          • many thanks again @marmot. That was indeed a similar question ;n)

            – ecjb
            Jan 1 at 19:48
















          9














          Same comments as in my previous answer apply here. ;-)



          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) {$frac{-2}{h^2_t}+frac{2}{h^2_x}$};
          node[stencilptbig,left=of i] (i-1) {$frac{-1}{h^2_t}$};
          node[stencilptbig,right=of i] (i+1) {$frac{-1}{h^2_t}$};
          node[stencilptbig,above=of i] (ij+1) {$frac{1}{h^2_t}$};
          node[stencilptbig,below=of i] (ij-1) {$frac{1}{h^2_t}$};
          draw
          (i-1) -- (i)
          (i) -- (i+1)
          (i) -- (ij-1)
          (i) -- (ij+1);
          end{tikzpicture}
          end{document}


          enter image description here



          You may also draw the lines with



          draw (i) edge   (i-1)  edge  (i+1) edge  (ij-1) edge  (ij+1);


          Depending on what you really want to achieve in the end, you may want to use chains or other tricks. And almost certainly someone will want use a matrix here. I guess that what is most elegant can only decided when it is clear what the full picture is.






          share|improve this answer


























          • many thanks again @marmot. That was indeed a similar question ;n)

            – ecjb
            Jan 1 at 19:48














          9












          9








          9







          Same comments as in my previous answer apply here. ;-)



          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) {$frac{-2}{h^2_t}+frac{2}{h^2_x}$};
          node[stencilptbig,left=of i] (i-1) {$frac{-1}{h^2_t}$};
          node[stencilptbig,right=of i] (i+1) {$frac{-1}{h^2_t}$};
          node[stencilptbig,above=of i] (ij+1) {$frac{1}{h^2_t}$};
          node[stencilptbig,below=of i] (ij-1) {$frac{1}{h^2_t}$};
          draw
          (i-1) -- (i)
          (i) -- (i+1)
          (i) -- (ij-1)
          (i) -- (ij+1);
          end{tikzpicture}
          end{document}


          enter image description here



          You may also draw the lines with



          draw (i) edge   (i-1)  edge  (i+1) edge  (ij-1) edge  (ij+1);


          Depending on what you really want to achieve in the end, you may want to use chains or other tricks. And almost certainly someone will want use a matrix here. I guess that what is most elegant can only decided when it is clear what the full picture is.






          share|improve this answer















          Same comments as in my previous answer apply here. ;-)



          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) {$frac{-2}{h^2_t}+frac{2}{h^2_x}$};
          node[stencilptbig,left=of i] (i-1) {$frac{-1}{h^2_t}$};
          node[stencilptbig,right=of i] (i+1) {$frac{-1}{h^2_t}$};
          node[stencilptbig,above=of i] (ij+1) {$frac{1}{h^2_t}$};
          node[stencilptbig,below=of i] (ij-1) {$frac{1}{h^2_t}$};
          draw
          (i-1) -- (i)
          (i) -- (i+1)
          (i) -- (ij-1)
          (i) -- (ij+1);
          end{tikzpicture}
          end{document}


          enter image description here



          You may also draw the lines with



          draw (i) edge   (i-1)  edge  (i+1) edge  (ij-1) edge  (ij+1);


          Depending on what you really want to achieve in the end, you may want to use chains or other tricks. And almost certainly someone will want use a matrix here. I guess that what is most elegant can only decided when it is clear what the full picture is.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Jan 1 at 19:43

























          answered Jan 1 at 19:36









          marmotmarmot

          112k5144271




          112k5144271













          • many thanks again @marmot. That was indeed a similar question ;n)

            – ecjb
            Jan 1 at 19:48



















          • many thanks again @marmot. That was indeed a similar question ;n)

            – ecjb
            Jan 1 at 19:48

















          many thanks again @marmot. That was indeed a similar question ;n)

          – ecjb
          Jan 1 at 19:48





          many thanks again @marmot. That was indeed a similar question ;n)

          – ecjb
          Jan 1 at 19:48


















          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%2f468169%2ftikz-increase-the-spacing-between-2-nodes-of-a-stencil%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

          Wiesbaden

          Marschland

          Dieringhausen