put a label inside loop made by path












2















I am completely new to tikz so excuse me if it seems easy.
I am going to put a label inside the closed path I have written(mostly taken from here):



begin{tikzpicture}[->,>=stealth',shorten >=1pt,auto,node distance=3cm,
thick,main node/.style={circle,draw,font=Largebfseries}]
node[main node] (2) {2};
node[main node] (1) [below left of=2] {1};
node[main node] (3) [below right of=2] {3};
path
(1) edge node [below]{} (2)
edge node[below] {} (3)
(2) edge node[right] {} (3)
(3) ;
end{tikzpicture}


enter image description here



Thanks for any guide.










share|improve this question























  • Your code is not compileable. It must start with the document{class} and end with the document{document}.

    – AndréC
    Jan 12 at 8:21











  • Where exactly do you want to add the text?

    – AndréC
    Jan 12 at 8:23











  • @AndréC just in the middle of three nodes.

    – Abolfazl
    Jan 12 at 8:33


















2















I am completely new to tikz so excuse me if it seems easy.
I am going to put a label inside the closed path I have written(mostly taken from here):



begin{tikzpicture}[->,>=stealth',shorten >=1pt,auto,node distance=3cm,
thick,main node/.style={circle,draw,font=Largebfseries}]
node[main node] (2) {2};
node[main node] (1) [below left of=2] {1};
node[main node] (3) [below right of=2] {3};
path
(1) edge node [below]{} (2)
edge node[below] {} (3)
(2) edge node[right] {} (3)
(3) ;
end{tikzpicture}


enter image description here



Thanks for any guide.










share|improve this question























  • Your code is not compileable. It must start with the document{class} and end with the document{document}.

    – AndréC
    Jan 12 at 8:21











  • Where exactly do you want to add the text?

    – AndréC
    Jan 12 at 8:23











  • @AndréC just in the middle of three nodes.

    – Abolfazl
    Jan 12 at 8:33
















2












2








2








I am completely new to tikz so excuse me if it seems easy.
I am going to put a label inside the closed path I have written(mostly taken from here):



begin{tikzpicture}[->,>=stealth',shorten >=1pt,auto,node distance=3cm,
thick,main node/.style={circle,draw,font=Largebfseries}]
node[main node] (2) {2};
node[main node] (1) [below left of=2] {1};
node[main node] (3) [below right of=2] {3};
path
(1) edge node [below]{} (2)
edge node[below] {} (3)
(2) edge node[right] {} (3)
(3) ;
end{tikzpicture}


enter image description here



Thanks for any guide.










share|improve this question














I am completely new to tikz so excuse me if it seems easy.
I am going to put a label inside the closed path I have written(mostly taken from here):



begin{tikzpicture}[->,>=stealth',shorten >=1pt,auto,node distance=3cm,
thick,main node/.style={circle,draw,font=Largebfseries}]
node[main node] (2) {2};
node[main node] (1) [below left of=2] {1};
node[main node] (3) [below right of=2] {3};
path
(1) edge node [below]{} (2)
edge node[below] {} (3)
(2) edge node[right] {} (3)
(3) ;
end{tikzpicture}


enter image description here



Thanks for any guide.







tikz-pgf






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Jan 12 at 8:14









AbolfazlAbolfazl

133




133













  • Your code is not compileable. It must start with the document{class} and end with the document{document}.

    – AndréC
    Jan 12 at 8:21











  • Where exactly do you want to add the text?

    – AndréC
    Jan 12 at 8:23











  • @AndréC just in the middle of three nodes.

    – Abolfazl
    Jan 12 at 8:33





















  • Your code is not compileable. It must start with the document{class} and end with the document{document}.

    – AndréC
    Jan 12 at 8:21











  • Where exactly do you want to add the text?

    – AndréC
    Jan 12 at 8:23











  • @AndréC just in the middle of three nodes.

    – Abolfazl
    Jan 12 at 8:33



















Your code is not compileable. It must start with the document{class} and end with the document{document}.

– AndréC
Jan 12 at 8:21





Your code is not compileable. It must start with the document{class} and end with the document{document}.

– AndréC
Jan 12 at 8:21













Where exactly do you want to add the text?

– AndréC
Jan 12 at 8:23





Where exactly do you want to add the text?

– AndréC
Jan 12 at 8:23













@AndréC just in the middle of three nodes.

– Abolfazl
Jan 12 at 8:33







@AndréC just in the middle of three nodes.

– Abolfazl
Jan 12 at 8:33












2 Answers
2






active

oldest

votes


















3














If you don't know which "center" you're talking about, I suggest you use the barycentric coordinates to do so. (See pages 136 et seq. of manual 3.1
13.2.2 Barycentric Systems)



barycentre



documentclass[tikz,border=5mm]{standalone}
usetikzlibrary{arrows}


begin{document}
begin{tikzpicture}[->,>=stealth',shorten >=1pt,auto,node distance=3cm,
thick,main node/.style={circle,draw,font=Largebfseries}]
node[main node] (2) {2};
node[main node] (1) [below left of=2] {1};
node[main node] (3) [below right of=2] {3};
path
(1) edge node [below]{} (2)
edge node[below] {} (3)
(2) edge node[right] {} (3)
(3) ;
node at (barycentric cs:1=1,2=1 ,3=1) {Text};
end{tikzpicture}
end{document}





share|improve this answer

































    2














    off-topic:




    • use only numbers for node names is not good practice. instead 1, 2 and 3 is better to use for example n1, or n2 and n3

    • if you not label edges than don't clutter code with empty nodes.

    • for labeling of edges is handy to use quotes library

    • at using barycentric coordinates be careful: between colon or comas and node names had not be an empty space

    • it seems that you have a mess in code for drawing arrows


    using solution for placing nodes inside triangle suggested in @AndréC answer (+1) the mwe can be as follows:



    documentclass[tikz, margin=3mm]{standalone}
    usetikzlibrary{arrows.meta, positioning, quotes}

    begin{document}
    begin{tikzpicture}[
    node distance = 17.3mm and 10mm,
    every edge/.style = {draw, semithick, -Stealth, shorten >=1pt},
    every edge quotes/.style = {inner sep=1pt,
    font=footnotesize, text=gray,
    sloped, auto=left},
    main/.style = {circle, draw, semithick,
    minimum size=3ex, inner sep=2pt,
    font=bfseries}
    ]
    node (n1) [main] {1};
    node (n2) [main, above right=of n1] {2};
    node (n3) [main, below right=of n2] {3};

    % note: between ":" or "," and "<node name>" had not to be empty space!
    node at (barycentric cs:n1=1 ,n2=1 ,n3=1) {text};

    draw (n1) edge ["2" '] (n3)
    (n1) edge ["3"] (n2)
    (n2) edge ["1"] (n3);
    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%2f469798%2fput-a-label-inside-loop-made-by-path%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









      3














      If you don't know which "center" you're talking about, I suggest you use the barycentric coordinates to do so. (See pages 136 et seq. of manual 3.1
      13.2.2 Barycentric Systems)



      barycentre



      documentclass[tikz,border=5mm]{standalone}
      usetikzlibrary{arrows}


      begin{document}
      begin{tikzpicture}[->,>=stealth',shorten >=1pt,auto,node distance=3cm,
      thick,main node/.style={circle,draw,font=Largebfseries}]
      node[main node] (2) {2};
      node[main node] (1) [below left of=2] {1};
      node[main node] (3) [below right of=2] {3};
      path
      (1) edge node [below]{} (2)
      edge node[below] {} (3)
      (2) edge node[right] {} (3)
      (3) ;
      node at (barycentric cs:1=1,2=1 ,3=1) {Text};
      end{tikzpicture}
      end{document}





      share|improve this answer






























        3














        If you don't know which "center" you're talking about, I suggest you use the barycentric coordinates to do so. (See pages 136 et seq. of manual 3.1
        13.2.2 Barycentric Systems)



        barycentre



        documentclass[tikz,border=5mm]{standalone}
        usetikzlibrary{arrows}


        begin{document}
        begin{tikzpicture}[->,>=stealth',shorten >=1pt,auto,node distance=3cm,
        thick,main node/.style={circle,draw,font=Largebfseries}]
        node[main node] (2) {2};
        node[main node] (1) [below left of=2] {1};
        node[main node] (3) [below right of=2] {3};
        path
        (1) edge node [below]{} (2)
        edge node[below] {} (3)
        (2) edge node[right] {} (3)
        (3) ;
        node at (barycentric cs:1=1,2=1 ,3=1) {Text};
        end{tikzpicture}
        end{document}





        share|improve this answer




























          3












          3








          3







          If you don't know which "center" you're talking about, I suggest you use the barycentric coordinates to do so. (See pages 136 et seq. of manual 3.1
          13.2.2 Barycentric Systems)



          barycentre



          documentclass[tikz,border=5mm]{standalone}
          usetikzlibrary{arrows}


          begin{document}
          begin{tikzpicture}[->,>=stealth',shorten >=1pt,auto,node distance=3cm,
          thick,main node/.style={circle,draw,font=Largebfseries}]
          node[main node] (2) {2};
          node[main node] (1) [below left of=2] {1};
          node[main node] (3) [below right of=2] {3};
          path
          (1) edge node [below]{} (2)
          edge node[below] {} (3)
          (2) edge node[right] {} (3)
          (3) ;
          node at (barycentric cs:1=1,2=1 ,3=1) {Text};
          end{tikzpicture}
          end{document}





          share|improve this answer















          If you don't know which "center" you're talking about, I suggest you use the barycentric coordinates to do so. (See pages 136 et seq. of manual 3.1
          13.2.2 Barycentric Systems)



          barycentre



          documentclass[tikz,border=5mm]{standalone}
          usetikzlibrary{arrows}


          begin{document}
          begin{tikzpicture}[->,>=stealth',shorten >=1pt,auto,node distance=3cm,
          thick,main node/.style={circle,draw,font=Largebfseries}]
          node[main node] (2) {2};
          node[main node] (1) [below left of=2] {1};
          node[main node] (3) [below right of=2] {3};
          path
          (1) edge node [below]{} (2)
          edge node[below] {} (3)
          (2) edge node[right] {} (3)
          (3) ;
          node at (barycentric cs:1=1,2=1 ,3=1) {Text};
          end{tikzpicture}
          end{document}






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Jan 12 at 13:45









          Zarko

          122k865160




          122k865160










          answered Jan 12 at 8:37









          AndréCAndréC

          8,50111446




          8,50111446























              2














              off-topic:




              • use only numbers for node names is not good practice. instead 1, 2 and 3 is better to use for example n1, or n2 and n3

              • if you not label edges than don't clutter code with empty nodes.

              • for labeling of edges is handy to use quotes library

              • at using barycentric coordinates be careful: between colon or comas and node names had not be an empty space

              • it seems that you have a mess in code for drawing arrows


              using solution for placing nodes inside triangle suggested in @AndréC answer (+1) the mwe can be as follows:



              documentclass[tikz, margin=3mm]{standalone}
              usetikzlibrary{arrows.meta, positioning, quotes}

              begin{document}
              begin{tikzpicture}[
              node distance = 17.3mm and 10mm,
              every edge/.style = {draw, semithick, -Stealth, shorten >=1pt},
              every edge quotes/.style = {inner sep=1pt,
              font=footnotesize, text=gray,
              sloped, auto=left},
              main/.style = {circle, draw, semithick,
              minimum size=3ex, inner sep=2pt,
              font=bfseries}
              ]
              node (n1) [main] {1};
              node (n2) [main, above right=of n1] {2};
              node (n3) [main, below right=of n2] {3};

              % note: between ":" or "," and "<node name>" had not to be empty space!
              node at (barycentric cs:n1=1 ,n2=1 ,n3=1) {text};

              draw (n1) edge ["2" '] (n3)
              (n1) edge ["3"] (n2)
              (n2) edge ["1"] (n3);
              end{tikzpicture}
              end{document}


              enter image description here






              share|improve this answer




























                2














                off-topic:




                • use only numbers for node names is not good practice. instead 1, 2 and 3 is better to use for example n1, or n2 and n3

                • if you not label edges than don't clutter code with empty nodes.

                • for labeling of edges is handy to use quotes library

                • at using barycentric coordinates be careful: between colon or comas and node names had not be an empty space

                • it seems that you have a mess in code for drawing arrows


                using solution for placing nodes inside triangle suggested in @AndréC answer (+1) the mwe can be as follows:



                documentclass[tikz, margin=3mm]{standalone}
                usetikzlibrary{arrows.meta, positioning, quotes}

                begin{document}
                begin{tikzpicture}[
                node distance = 17.3mm and 10mm,
                every edge/.style = {draw, semithick, -Stealth, shorten >=1pt},
                every edge quotes/.style = {inner sep=1pt,
                font=footnotesize, text=gray,
                sloped, auto=left},
                main/.style = {circle, draw, semithick,
                minimum size=3ex, inner sep=2pt,
                font=bfseries}
                ]
                node (n1) [main] {1};
                node (n2) [main, above right=of n1] {2};
                node (n3) [main, below right=of n2] {3};

                % note: between ":" or "," and "<node name>" had not to be empty space!
                node at (barycentric cs:n1=1 ,n2=1 ,n3=1) {text};

                draw (n1) edge ["2" '] (n3)
                (n1) edge ["3"] (n2)
                (n2) edge ["1"] (n3);
                end{tikzpicture}
                end{document}


                enter image description here






                share|improve this answer


























                  2












                  2








                  2







                  off-topic:




                  • use only numbers for node names is not good practice. instead 1, 2 and 3 is better to use for example n1, or n2 and n3

                  • if you not label edges than don't clutter code with empty nodes.

                  • for labeling of edges is handy to use quotes library

                  • at using barycentric coordinates be careful: between colon or comas and node names had not be an empty space

                  • it seems that you have a mess in code for drawing arrows


                  using solution for placing nodes inside triangle suggested in @AndréC answer (+1) the mwe can be as follows:



                  documentclass[tikz, margin=3mm]{standalone}
                  usetikzlibrary{arrows.meta, positioning, quotes}

                  begin{document}
                  begin{tikzpicture}[
                  node distance = 17.3mm and 10mm,
                  every edge/.style = {draw, semithick, -Stealth, shorten >=1pt},
                  every edge quotes/.style = {inner sep=1pt,
                  font=footnotesize, text=gray,
                  sloped, auto=left},
                  main/.style = {circle, draw, semithick,
                  minimum size=3ex, inner sep=2pt,
                  font=bfseries}
                  ]
                  node (n1) [main] {1};
                  node (n2) [main, above right=of n1] {2};
                  node (n3) [main, below right=of n2] {3};

                  % note: between ":" or "," and "<node name>" had not to be empty space!
                  node at (barycentric cs:n1=1 ,n2=1 ,n3=1) {text};

                  draw (n1) edge ["2" '] (n3)
                  (n1) edge ["3"] (n2)
                  (n2) edge ["1"] (n3);
                  end{tikzpicture}
                  end{document}


                  enter image description here






                  share|improve this answer













                  off-topic:




                  • use only numbers for node names is not good practice. instead 1, 2 and 3 is better to use for example n1, or n2 and n3

                  • if you not label edges than don't clutter code with empty nodes.

                  • for labeling of edges is handy to use quotes library

                  • at using barycentric coordinates be careful: between colon or comas and node names had not be an empty space

                  • it seems that you have a mess in code for drawing arrows


                  using solution for placing nodes inside triangle suggested in @AndréC answer (+1) the mwe can be as follows:



                  documentclass[tikz, margin=3mm]{standalone}
                  usetikzlibrary{arrows.meta, positioning, quotes}

                  begin{document}
                  begin{tikzpicture}[
                  node distance = 17.3mm and 10mm,
                  every edge/.style = {draw, semithick, -Stealth, shorten >=1pt},
                  every edge quotes/.style = {inner sep=1pt,
                  font=footnotesize, text=gray,
                  sloped, auto=left},
                  main/.style = {circle, draw, semithick,
                  minimum size=3ex, inner sep=2pt,
                  font=bfseries}
                  ]
                  node (n1) [main] {1};
                  node (n2) [main, above right=of n1] {2};
                  node (n3) [main, below right=of n2] {3};

                  % note: between ":" or "," and "<node name>" had not to be empty space!
                  node at (barycentric cs:n1=1 ,n2=1 ,n3=1) {text};

                  draw (n1) edge ["2" '] (n3)
                  (n1) edge ["3"] (n2)
                  (n2) edge ["1"] (n3);
                  end{tikzpicture}
                  end{document}


                  enter image description here







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Jan 12 at 14:00









                  ZarkoZarko

                  122k865160




                  122k865160






























                      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%2f469798%2fput-a-label-inside-loop-made-by-path%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

                      How to change which sound is reproduced for terminal bell?

                      Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents

                      Can I use Tabulator js library in my java Spring + Thymeleaf project?