Drawing node within node (Tikz)












1















I don't get any error for the compiling, but I don't get what I expected either, which was for my second node to show up with the same set of numbers as my first node. Can someone please let me know what is it that I am doing wrong for this problem? I appreciate any help given.



documentclass[a4paper]{article}
usepackage[utf8]{inputenc}
usepackage[T1]{fontenc}
usepackage{amssymb}
usepackage{tikz}
usetikzlibrary{calc,shapes,fit,positioning}
letoldemptysetemptyset
letemptysetvarnothing
begin{document}

centering
begin{tikzpicture}[every node/.style={draw=black},scale=0.75,every
node/.append style={transform shape}]

begin{scope}[local bounding box=f1,scale=0.5]
node(one1){1};
node[below left of=one1]{2};
node[below right of=one1]{3};
end{scope}
node[circle,draw,fit=(f1)](root){};
begin{scope}[local bounding box=f2,scale=0.5]
node(one2){1};
node[below left of=one2]{2};
node[below right of=one2]{3};
end{scope}
node [above right=2cm and -7.5 cm of root,circle,draw,fit=(f2)](11){};
end{tikzpicture}

end{document}


enter image description here










share|improve this question


















  • 1





    Shoudn't you shift the node one2 instead of the fit?

    – marmot
    Mar 27 at 20:36
















1















I don't get any error for the compiling, but I don't get what I expected either, which was for my second node to show up with the same set of numbers as my first node. Can someone please let me know what is it that I am doing wrong for this problem? I appreciate any help given.



documentclass[a4paper]{article}
usepackage[utf8]{inputenc}
usepackage[T1]{fontenc}
usepackage{amssymb}
usepackage{tikz}
usetikzlibrary{calc,shapes,fit,positioning}
letoldemptysetemptyset
letemptysetvarnothing
begin{document}

centering
begin{tikzpicture}[every node/.style={draw=black},scale=0.75,every
node/.append style={transform shape}]

begin{scope}[local bounding box=f1,scale=0.5]
node(one1){1};
node[below left of=one1]{2};
node[below right of=one1]{3};
end{scope}
node[circle,draw,fit=(f1)](root){};
begin{scope}[local bounding box=f2,scale=0.5]
node(one2){1};
node[below left of=one2]{2};
node[below right of=one2]{3};
end{scope}
node [above right=2cm and -7.5 cm of root,circle,draw,fit=(f2)](11){};
end{tikzpicture}

end{document}


enter image description here










share|improve this question


















  • 1





    Shoudn't you shift the node one2 instead of the fit?

    – marmot
    Mar 27 at 20:36














1












1








1








I don't get any error for the compiling, but I don't get what I expected either, which was for my second node to show up with the same set of numbers as my first node. Can someone please let me know what is it that I am doing wrong for this problem? I appreciate any help given.



documentclass[a4paper]{article}
usepackage[utf8]{inputenc}
usepackage[T1]{fontenc}
usepackage{amssymb}
usepackage{tikz}
usetikzlibrary{calc,shapes,fit,positioning}
letoldemptysetemptyset
letemptysetvarnothing
begin{document}

centering
begin{tikzpicture}[every node/.style={draw=black},scale=0.75,every
node/.append style={transform shape}]

begin{scope}[local bounding box=f1,scale=0.5]
node(one1){1};
node[below left of=one1]{2};
node[below right of=one1]{3};
end{scope}
node[circle,draw,fit=(f1)](root){};
begin{scope}[local bounding box=f2,scale=0.5]
node(one2){1};
node[below left of=one2]{2};
node[below right of=one2]{3};
end{scope}
node [above right=2cm and -7.5 cm of root,circle,draw,fit=(f2)](11){};
end{tikzpicture}

end{document}


enter image description here










share|improve this question














I don't get any error for the compiling, but I don't get what I expected either, which was for my second node to show up with the same set of numbers as my first node. Can someone please let me know what is it that I am doing wrong for this problem? I appreciate any help given.



documentclass[a4paper]{article}
usepackage[utf8]{inputenc}
usepackage[T1]{fontenc}
usepackage{amssymb}
usepackage{tikz}
usetikzlibrary{calc,shapes,fit,positioning}
letoldemptysetemptyset
letemptysetvarnothing
begin{document}

centering
begin{tikzpicture}[every node/.style={draw=black},scale=0.75,every
node/.append style={transform shape}]

begin{scope}[local bounding box=f1,scale=0.5]
node(one1){1};
node[below left of=one1]{2};
node[below right of=one1]{3};
end{scope}
node[circle,draw,fit=(f1)](root){};
begin{scope}[local bounding box=f2,scale=0.5]
node(one2){1};
node[below left of=one2]{2};
node[below right of=one2]{3};
end{scope}
node [above right=2cm and -7.5 cm of root,circle,draw,fit=(f2)](11){};
end{tikzpicture}

end{document}


enter image description here







nodes tikz-trees tikz-node






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 27 at 20:33









Stiven GStiven G

764




764








  • 1





    Shoudn't you shift the node one2 instead of the fit?

    – marmot
    Mar 27 at 20:36














  • 1





    Shoudn't you shift the node one2 instead of the fit?

    – marmot
    Mar 27 at 20:36








1




1





Shoudn't you shift the node one2 instead of the fit?

– marmot
Mar 27 at 20:36





Shoudn't you shift the node one2 instead of the fit?

– marmot
Mar 27 at 20:36










2 Answers
2






active

oldest

votes


















2














A scope is just a way to apply special conditions or options to certain commands. Therefore, your second scope is drawn over the first one. But you can shift it:



documentclass[a4paper]{article}
usepackage[utf8]{inputenc}
usepackage[T1]{fontenc}
usepackage{amssymb}
usepackage{tikz}
usetikzlibrary{calc,shapes,fit,positioning}
letoldemptysetemptyset
letemptysetvarnothing
begin{document}

centering
begin{tikzpicture}[every node/.style={draw=black},scale=0.75,every
node/.append style={transform shape}]

begin{scope}[local bounding box=f1,scale=0.5]
node(one1){1};
node[below left of=one1]{2};
node[below right of=one1]{3};
end{scope}
node[circle,draw,fit=(f1)](root){};
begin{scope}[local bounding box=f2,scale=0.5, shift={(-7.5cm,2cm)}]
node(one2){1};
node[below left of=one2]{2};
node[below right of=one2]{3};
end{scope}
node[circle,draw,fit=(f2)](11){};
end{tikzpicture}

end{document}


enter image description here






share|improve this answer































    2














    If you shift one2 instead of the fit you get



    documentclass[a4paper]{article}
    usepackage[utf8]{inputenc}
    usepackage[T1]{fontenc}
    usepackage{amssymb}
    usepackage{tikz}
    usetikzlibrary{calc,shapes,fit,positioning}
    letoldemptysetemptyset
    letemptysetvarnothing
    begin{document}

    centering
    begin{tikzpicture}[every node/.style={draw=black},scale=0.75,every
    node/.append style={transform shape}]

    begin{scope}[local bounding box=f1,scale=0.5]
    node(one1){1};
    node[below left of=one1]{2};
    node[below right of=one1]{3};
    end{scope}
    node[circle,draw,fit=(f1)](root){};
    begin{scope}[local bounding box=f2,scale=0.5]
    node[above right=2cm and -7.5 cm of one1](one2){1};
    node[below left of=one2]{2};
    node[below right of=one2]{3};
    end{scope}
    node[circle,draw,fit=(f2)](11){};
    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',
      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%2f481785%2fdrawing-node-within-node-tikz%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      2














      A scope is just a way to apply special conditions or options to certain commands. Therefore, your second scope is drawn over the first one. But you can shift it:



      documentclass[a4paper]{article}
      usepackage[utf8]{inputenc}
      usepackage[T1]{fontenc}
      usepackage{amssymb}
      usepackage{tikz}
      usetikzlibrary{calc,shapes,fit,positioning}
      letoldemptysetemptyset
      letemptysetvarnothing
      begin{document}

      centering
      begin{tikzpicture}[every node/.style={draw=black},scale=0.75,every
      node/.append style={transform shape}]

      begin{scope}[local bounding box=f1,scale=0.5]
      node(one1){1};
      node[below left of=one1]{2};
      node[below right of=one1]{3};
      end{scope}
      node[circle,draw,fit=(f1)](root){};
      begin{scope}[local bounding box=f2,scale=0.5, shift={(-7.5cm,2cm)}]
      node(one2){1};
      node[below left of=one2]{2};
      node[below right of=one2]{3};
      end{scope}
      node[circle,draw,fit=(f2)](11){};
      end{tikzpicture}

      end{document}


      enter image description here






      share|improve this answer




























        2














        A scope is just a way to apply special conditions or options to certain commands. Therefore, your second scope is drawn over the first one. But you can shift it:



        documentclass[a4paper]{article}
        usepackage[utf8]{inputenc}
        usepackage[T1]{fontenc}
        usepackage{amssymb}
        usepackage{tikz}
        usetikzlibrary{calc,shapes,fit,positioning}
        letoldemptysetemptyset
        letemptysetvarnothing
        begin{document}

        centering
        begin{tikzpicture}[every node/.style={draw=black},scale=0.75,every
        node/.append style={transform shape}]

        begin{scope}[local bounding box=f1,scale=0.5]
        node(one1){1};
        node[below left of=one1]{2};
        node[below right of=one1]{3};
        end{scope}
        node[circle,draw,fit=(f1)](root){};
        begin{scope}[local bounding box=f2,scale=0.5, shift={(-7.5cm,2cm)}]
        node(one2){1};
        node[below left of=one2]{2};
        node[below right of=one2]{3};
        end{scope}
        node[circle,draw,fit=(f2)](11){};
        end{tikzpicture}

        end{document}


        enter image description here






        share|improve this answer


























          2












          2








          2







          A scope is just a way to apply special conditions or options to certain commands. Therefore, your second scope is drawn over the first one. But you can shift it:



          documentclass[a4paper]{article}
          usepackage[utf8]{inputenc}
          usepackage[T1]{fontenc}
          usepackage{amssymb}
          usepackage{tikz}
          usetikzlibrary{calc,shapes,fit,positioning}
          letoldemptysetemptyset
          letemptysetvarnothing
          begin{document}

          centering
          begin{tikzpicture}[every node/.style={draw=black},scale=0.75,every
          node/.append style={transform shape}]

          begin{scope}[local bounding box=f1,scale=0.5]
          node(one1){1};
          node[below left of=one1]{2};
          node[below right of=one1]{3};
          end{scope}
          node[circle,draw,fit=(f1)](root){};
          begin{scope}[local bounding box=f2,scale=0.5, shift={(-7.5cm,2cm)}]
          node(one2){1};
          node[below left of=one2]{2};
          node[below right of=one2]{3};
          end{scope}
          node[circle,draw,fit=(f2)](11){};
          end{tikzpicture}

          end{document}


          enter image description here






          share|improve this answer













          A scope is just a way to apply special conditions or options to certain commands. Therefore, your second scope is drawn over the first one. But you can shift it:



          documentclass[a4paper]{article}
          usepackage[utf8]{inputenc}
          usepackage[T1]{fontenc}
          usepackage{amssymb}
          usepackage{tikz}
          usetikzlibrary{calc,shapes,fit,positioning}
          letoldemptysetemptyset
          letemptysetvarnothing
          begin{document}

          centering
          begin{tikzpicture}[every node/.style={draw=black},scale=0.75,every
          node/.append style={transform shape}]

          begin{scope}[local bounding box=f1,scale=0.5]
          node(one1){1};
          node[below left of=one1]{2};
          node[below right of=one1]{3};
          end{scope}
          node[circle,draw,fit=(f1)](root){};
          begin{scope}[local bounding box=f2,scale=0.5, shift={(-7.5cm,2cm)}]
          node(one2){1};
          node[below left of=one2]{2};
          node[below right of=one2]{3};
          end{scope}
          node[circle,draw,fit=(f2)](11){};
          end{tikzpicture}

          end{document}


          enter image description here







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Mar 27 at 20:47









          IgnasiIgnasi

          95.7k4175320




          95.7k4175320























              2














              If you shift one2 instead of the fit you get



              documentclass[a4paper]{article}
              usepackage[utf8]{inputenc}
              usepackage[T1]{fontenc}
              usepackage{amssymb}
              usepackage{tikz}
              usetikzlibrary{calc,shapes,fit,positioning}
              letoldemptysetemptyset
              letemptysetvarnothing
              begin{document}

              centering
              begin{tikzpicture}[every node/.style={draw=black},scale=0.75,every
              node/.append style={transform shape}]

              begin{scope}[local bounding box=f1,scale=0.5]
              node(one1){1};
              node[below left of=one1]{2};
              node[below right of=one1]{3};
              end{scope}
              node[circle,draw,fit=(f1)](root){};
              begin{scope}[local bounding box=f2,scale=0.5]
              node[above right=2cm and -7.5 cm of one1](one2){1};
              node[below left of=one2]{2};
              node[below right of=one2]{3};
              end{scope}
              node[circle,draw,fit=(f2)](11){};
              end{tikzpicture}
              end{document}


              enter image description here






              share|improve this answer




























                2














                If you shift one2 instead of the fit you get



                documentclass[a4paper]{article}
                usepackage[utf8]{inputenc}
                usepackage[T1]{fontenc}
                usepackage{amssymb}
                usepackage{tikz}
                usetikzlibrary{calc,shapes,fit,positioning}
                letoldemptysetemptyset
                letemptysetvarnothing
                begin{document}

                centering
                begin{tikzpicture}[every node/.style={draw=black},scale=0.75,every
                node/.append style={transform shape}]

                begin{scope}[local bounding box=f1,scale=0.5]
                node(one1){1};
                node[below left of=one1]{2};
                node[below right of=one1]{3};
                end{scope}
                node[circle,draw,fit=(f1)](root){};
                begin{scope}[local bounding box=f2,scale=0.5]
                node[above right=2cm and -7.5 cm of one1](one2){1};
                node[below left of=one2]{2};
                node[below right of=one2]{3};
                end{scope}
                node[circle,draw,fit=(f2)](11){};
                end{tikzpicture}
                end{document}


                enter image description here






                share|improve this answer


























                  2












                  2








                  2







                  If you shift one2 instead of the fit you get



                  documentclass[a4paper]{article}
                  usepackage[utf8]{inputenc}
                  usepackage[T1]{fontenc}
                  usepackage{amssymb}
                  usepackage{tikz}
                  usetikzlibrary{calc,shapes,fit,positioning}
                  letoldemptysetemptyset
                  letemptysetvarnothing
                  begin{document}

                  centering
                  begin{tikzpicture}[every node/.style={draw=black},scale=0.75,every
                  node/.append style={transform shape}]

                  begin{scope}[local bounding box=f1,scale=0.5]
                  node(one1){1};
                  node[below left of=one1]{2};
                  node[below right of=one1]{3};
                  end{scope}
                  node[circle,draw,fit=(f1)](root){};
                  begin{scope}[local bounding box=f2,scale=0.5]
                  node[above right=2cm and -7.5 cm of one1](one2){1};
                  node[below left of=one2]{2};
                  node[below right of=one2]{3};
                  end{scope}
                  node[circle,draw,fit=(f2)](11){};
                  end{tikzpicture}
                  end{document}


                  enter image description here






                  share|improve this answer













                  If you shift one2 instead of the fit you get



                  documentclass[a4paper]{article}
                  usepackage[utf8]{inputenc}
                  usepackage[T1]{fontenc}
                  usepackage{amssymb}
                  usepackage{tikz}
                  usetikzlibrary{calc,shapes,fit,positioning}
                  letoldemptysetemptyset
                  letemptysetvarnothing
                  begin{document}

                  centering
                  begin{tikzpicture}[every node/.style={draw=black},scale=0.75,every
                  node/.append style={transform shape}]

                  begin{scope}[local bounding box=f1,scale=0.5]
                  node(one1){1};
                  node[below left of=one1]{2};
                  node[below right of=one1]{3};
                  end{scope}
                  node[circle,draw,fit=(f1)](root){};
                  begin{scope}[local bounding box=f2,scale=0.5]
                  node[above right=2cm and -7.5 cm of one1](one2){1};
                  node[below left of=one2]{2};
                  node[below right of=one2]{3};
                  end{scope}
                  node[circle,draw,fit=(f2)](11){};
                  end{tikzpicture}
                  end{document}


                  enter image description here







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Mar 27 at 20:38









                  marmotmarmot

                  115k5146277




                  115k5146277






























                      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%2f481785%2fdrawing-node-within-node-tikz%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

                      Biblatex bibliography style without URLs when DOI exists (in Overleaf with Zotero bibliography)

                      ComboBox Display Member on multiple fields

                      Is it possible to collect Nectar points via Trainline?