Problem with point position in tikz












5














I am quite new to tikz and I am trying to draw a circle with points regularly positioned on it. My code works well if I ask lower or equal to 46 points. For more points everyting is going wrong (points are mispositioned) but there is no error message with the compilation.



Here is my code :



documentclass[french,12pt]{article} % I'm in France.

usepackage[utf8]{inputenc}
usepackage[T1]{fontenc}
usepackage{lmodern}
usepackage[a4paper]{geometry}
geometry{top=1.5cm,bottom=1.5cm,left=1.5cm,right=1.5cm}
usepackage[french]{babel}
usepackage{pgfplots}

usetikzlibrary{calc,quotes,arrows}
usepackage{fancyhdr}
usepackage{graphicx}

pagestyle{empty}

begin{document}

sffamily

newcommand{rayon}{5cm} % Rayon du cercle en cm (radius of the circle)
newcommand{nbPt}{46} % Nombre de points sur le cercle (Number of points on the circle)
pgfmathsetmacro{nb}{nbPt-1}

begin{center}
begin{tikzpicture}
draw(0,0) circle (rayon); % Tracer le cercle (Draw the circle)
foreach i in {0,1,...,nb} {
pgfmathsetmacro{angle}{360*i/nbPt};
draw(angle:rayon) node{+}; draw(angle:rayon*1.08) node{i};
}
end{tikzpicture}
end{center}

end{document}


May be I do some mistakes but I can't find where. It will be great if someone can give me some help.



Thank you.










share|improve this question





























    5














    I am quite new to tikz and I am trying to draw a circle with points regularly positioned on it. My code works well if I ask lower or equal to 46 points. For more points everyting is going wrong (points are mispositioned) but there is no error message with the compilation.



    Here is my code :



    documentclass[french,12pt]{article} % I'm in France.

    usepackage[utf8]{inputenc}
    usepackage[T1]{fontenc}
    usepackage{lmodern}
    usepackage[a4paper]{geometry}
    geometry{top=1.5cm,bottom=1.5cm,left=1.5cm,right=1.5cm}
    usepackage[french]{babel}
    usepackage{pgfplots}

    usetikzlibrary{calc,quotes,arrows}
    usepackage{fancyhdr}
    usepackage{graphicx}

    pagestyle{empty}

    begin{document}

    sffamily

    newcommand{rayon}{5cm} % Rayon du cercle en cm (radius of the circle)
    newcommand{nbPt}{46} % Nombre de points sur le cercle (Number of points on the circle)
    pgfmathsetmacro{nb}{nbPt-1}

    begin{center}
    begin{tikzpicture}
    draw(0,0) circle (rayon); % Tracer le cercle (Draw the circle)
    foreach i in {0,1,...,nb} {
    pgfmathsetmacro{angle}{360*i/nbPt};
    draw(angle:rayon) node{+}; draw(angle:rayon*1.08) node{i};
    }
    end{tikzpicture}
    end{center}

    end{document}


    May be I do some mistakes but I can't find where. It will be great if someone can give me some help.



    Thank you.










    share|improve this question



























      5












      5








      5


      0





      I am quite new to tikz and I am trying to draw a circle with points regularly positioned on it. My code works well if I ask lower or equal to 46 points. For more points everyting is going wrong (points are mispositioned) but there is no error message with the compilation.



      Here is my code :



      documentclass[french,12pt]{article} % I'm in France.

      usepackage[utf8]{inputenc}
      usepackage[T1]{fontenc}
      usepackage{lmodern}
      usepackage[a4paper]{geometry}
      geometry{top=1.5cm,bottom=1.5cm,left=1.5cm,right=1.5cm}
      usepackage[french]{babel}
      usepackage{pgfplots}

      usetikzlibrary{calc,quotes,arrows}
      usepackage{fancyhdr}
      usepackage{graphicx}

      pagestyle{empty}

      begin{document}

      sffamily

      newcommand{rayon}{5cm} % Rayon du cercle en cm (radius of the circle)
      newcommand{nbPt}{46} % Nombre de points sur le cercle (Number of points on the circle)
      pgfmathsetmacro{nb}{nbPt-1}

      begin{center}
      begin{tikzpicture}
      draw(0,0) circle (rayon); % Tracer le cercle (Draw the circle)
      foreach i in {0,1,...,nb} {
      pgfmathsetmacro{angle}{360*i/nbPt};
      draw(angle:rayon) node{+}; draw(angle:rayon*1.08) node{i};
      }
      end{tikzpicture}
      end{center}

      end{document}


      May be I do some mistakes but I can't find where. It will be great if someone can give me some help.



      Thank you.










      share|improve this question















      I am quite new to tikz and I am trying to draw a circle with points regularly positioned on it. My code works well if I ask lower or equal to 46 points. For more points everyting is going wrong (points are mispositioned) but there is no error message with the compilation.



      Here is my code :



      documentclass[french,12pt]{article} % I'm in France.

      usepackage[utf8]{inputenc}
      usepackage[T1]{fontenc}
      usepackage{lmodern}
      usepackage[a4paper]{geometry}
      geometry{top=1.5cm,bottom=1.5cm,left=1.5cm,right=1.5cm}
      usepackage[french]{babel}
      usepackage{pgfplots}

      usetikzlibrary{calc,quotes,arrows}
      usepackage{fancyhdr}
      usepackage{graphicx}

      pagestyle{empty}

      begin{document}

      sffamily

      newcommand{rayon}{5cm} % Rayon du cercle en cm (radius of the circle)
      newcommand{nbPt}{46} % Nombre de points sur le cercle (Number of points on the circle)
      pgfmathsetmacro{nb}{nbPt-1}

      begin{center}
      begin{tikzpicture}
      draw(0,0) circle (rayon); % Tracer le cercle (Draw the circle)
      foreach i in {0,1,...,nb} {
      pgfmathsetmacro{angle}{360*i/nbPt};
      draw(angle:rayon) node{+}; draw(angle:rayon*1.08) node{i};
      }
      end{tikzpicture}
      end{center}

      end{document}


      May be I do some mistakes but I can't find where. It will be great if someone can give me some help.



      Thank you.







      tikz-pgf






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Dec 21 '18 at 14:10









      AboAmmar

      33.3k22882




      33.3k22882










      asked Dec 21 '18 at 8:11









      Olivier MAES

      283




      283






















          1 Answer
          1






          active

          oldest

          votes


















          7














          The problem is that pgf uses TeX dimensions to do its mathematics. The maximum dimension it could handle is 16383.99998 pt (TeX’s largest dimen). So, you have to change the order of this calculation pgfmathsetmacro{angle}{360*i/nbPt};. First divide by nbPt then multiply by i or just put two parens around (i/nbPt) to avoid large dimensions.



          documentclass[french,12pt]{article} % I'm in France.

          usepackage[utf8]{inputenc}
          usepackage[T1]{fontenc}
          usepackage{lmodern}
          usepackage[a4paper]{geometry}
          geometry{top=1.5cm,bottom=1.5cm,left=1.5cm,right=1.5cm}
          usepackage[french]{babel}
          usepackage{tikz}

          usetikzlibrary{calc,quotes,arrows}
          usepackage{fancyhdr}
          usepackage{graphicx}

          pagestyle{empty}

          begin{document}

          sffamily

          newcommand{rayon}{5cm} % Rayon du cercle en cm (radius of the circle)
          newcommand{nbPt}{60} % Nombre de points sur le cercle (Number of points on the circle)
          pgfmathsetmacro{nb}{nbPt-1}

          begin{center}
          begin{tikzpicture}
          draw(0,0) circle (rayon); % Tracer le cercle (Draw the circle)
          foreach i in {0,1,...,nb} {
          pgfmathsetmacro{angle}{360/nbPt*i};
          draw(angle:rayon) node{+}; draw(angle:rayon*1.08) node{i};
          }
          end{tikzpicture}
          end{center}

          end{document}


          enter image description here






          share|improve this answer























          • Thank you for your answer. I know this problem with tikz but I am not able to understand why this limit is reached here.
            – Olivier MAES
            Dec 21 '18 at 15:15








          • 1




            @OlivierMAES: 360*45 = 16200 < 16383.99998, but 360*46 = 16560 > 16383.99998, this is the limit you see in your example.
            – AboAmmar
            Dec 21 '18 at 16:12












          • Ok that's now clear for me.
            – Olivier MAES
            Dec 21 '18 at 22:26











          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%2f466817%2fproblem-with-point-position-in-tikz%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









          7














          The problem is that pgf uses TeX dimensions to do its mathematics. The maximum dimension it could handle is 16383.99998 pt (TeX’s largest dimen). So, you have to change the order of this calculation pgfmathsetmacro{angle}{360*i/nbPt};. First divide by nbPt then multiply by i or just put two parens around (i/nbPt) to avoid large dimensions.



          documentclass[french,12pt]{article} % I'm in France.

          usepackage[utf8]{inputenc}
          usepackage[T1]{fontenc}
          usepackage{lmodern}
          usepackage[a4paper]{geometry}
          geometry{top=1.5cm,bottom=1.5cm,left=1.5cm,right=1.5cm}
          usepackage[french]{babel}
          usepackage{tikz}

          usetikzlibrary{calc,quotes,arrows}
          usepackage{fancyhdr}
          usepackage{graphicx}

          pagestyle{empty}

          begin{document}

          sffamily

          newcommand{rayon}{5cm} % Rayon du cercle en cm (radius of the circle)
          newcommand{nbPt}{60} % Nombre de points sur le cercle (Number of points on the circle)
          pgfmathsetmacro{nb}{nbPt-1}

          begin{center}
          begin{tikzpicture}
          draw(0,0) circle (rayon); % Tracer le cercle (Draw the circle)
          foreach i in {0,1,...,nb} {
          pgfmathsetmacro{angle}{360/nbPt*i};
          draw(angle:rayon) node{+}; draw(angle:rayon*1.08) node{i};
          }
          end{tikzpicture}
          end{center}

          end{document}


          enter image description here






          share|improve this answer























          • Thank you for your answer. I know this problem with tikz but I am not able to understand why this limit is reached here.
            – Olivier MAES
            Dec 21 '18 at 15:15








          • 1




            @OlivierMAES: 360*45 = 16200 < 16383.99998, but 360*46 = 16560 > 16383.99998, this is the limit you see in your example.
            – AboAmmar
            Dec 21 '18 at 16:12












          • Ok that's now clear for me.
            – Olivier MAES
            Dec 21 '18 at 22:26
















          7














          The problem is that pgf uses TeX dimensions to do its mathematics. The maximum dimension it could handle is 16383.99998 pt (TeX’s largest dimen). So, you have to change the order of this calculation pgfmathsetmacro{angle}{360*i/nbPt};. First divide by nbPt then multiply by i or just put two parens around (i/nbPt) to avoid large dimensions.



          documentclass[french,12pt]{article} % I'm in France.

          usepackage[utf8]{inputenc}
          usepackage[T1]{fontenc}
          usepackage{lmodern}
          usepackage[a4paper]{geometry}
          geometry{top=1.5cm,bottom=1.5cm,left=1.5cm,right=1.5cm}
          usepackage[french]{babel}
          usepackage{tikz}

          usetikzlibrary{calc,quotes,arrows}
          usepackage{fancyhdr}
          usepackage{graphicx}

          pagestyle{empty}

          begin{document}

          sffamily

          newcommand{rayon}{5cm} % Rayon du cercle en cm (radius of the circle)
          newcommand{nbPt}{60} % Nombre de points sur le cercle (Number of points on the circle)
          pgfmathsetmacro{nb}{nbPt-1}

          begin{center}
          begin{tikzpicture}
          draw(0,0) circle (rayon); % Tracer le cercle (Draw the circle)
          foreach i in {0,1,...,nb} {
          pgfmathsetmacro{angle}{360/nbPt*i};
          draw(angle:rayon) node{+}; draw(angle:rayon*1.08) node{i};
          }
          end{tikzpicture}
          end{center}

          end{document}


          enter image description here






          share|improve this answer























          • Thank you for your answer. I know this problem with tikz but I am not able to understand why this limit is reached here.
            – Olivier MAES
            Dec 21 '18 at 15:15








          • 1




            @OlivierMAES: 360*45 = 16200 < 16383.99998, but 360*46 = 16560 > 16383.99998, this is the limit you see in your example.
            – AboAmmar
            Dec 21 '18 at 16:12












          • Ok that's now clear for me.
            – Olivier MAES
            Dec 21 '18 at 22:26














          7












          7








          7






          The problem is that pgf uses TeX dimensions to do its mathematics. The maximum dimension it could handle is 16383.99998 pt (TeX’s largest dimen). So, you have to change the order of this calculation pgfmathsetmacro{angle}{360*i/nbPt};. First divide by nbPt then multiply by i or just put two parens around (i/nbPt) to avoid large dimensions.



          documentclass[french,12pt]{article} % I'm in France.

          usepackage[utf8]{inputenc}
          usepackage[T1]{fontenc}
          usepackage{lmodern}
          usepackage[a4paper]{geometry}
          geometry{top=1.5cm,bottom=1.5cm,left=1.5cm,right=1.5cm}
          usepackage[french]{babel}
          usepackage{tikz}

          usetikzlibrary{calc,quotes,arrows}
          usepackage{fancyhdr}
          usepackage{graphicx}

          pagestyle{empty}

          begin{document}

          sffamily

          newcommand{rayon}{5cm} % Rayon du cercle en cm (radius of the circle)
          newcommand{nbPt}{60} % Nombre de points sur le cercle (Number of points on the circle)
          pgfmathsetmacro{nb}{nbPt-1}

          begin{center}
          begin{tikzpicture}
          draw(0,0) circle (rayon); % Tracer le cercle (Draw the circle)
          foreach i in {0,1,...,nb} {
          pgfmathsetmacro{angle}{360/nbPt*i};
          draw(angle:rayon) node{+}; draw(angle:rayon*1.08) node{i};
          }
          end{tikzpicture}
          end{center}

          end{document}


          enter image description here






          share|improve this answer














          The problem is that pgf uses TeX dimensions to do its mathematics. The maximum dimension it could handle is 16383.99998 pt (TeX’s largest dimen). So, you have to change the order of this calculation pgfmathsetmacro{angle}{360*i/nbPt};. First divide by nbPt then multiply by i or just put two parens around (i/nbPt) to avoid large dimensions.



          documentclass[french,12pt]{article} % I'm in France.

          usepackage[utf8]{inputenc}
          usepackage[T1]{fontenc}
          usepackage{lmodern}
          usepackage[a4paper]{geometry}
          geometry{top=1.5cm,bottom=1.5cm,left=1.5cm,right=1.5cm}
          usepackage[french]{babel}
          usepackage{tikz}

          usetikzlibrary{calc,quotes,arrows}
          usepackage{fancyhdr}
          usepackage{graphicx}

          pagestyle{empty}

          begin{document}

          sffamily

          newcommand{rayon}{5cm} % Rayon du cercle en cm (radius of the circle)
          newcommand{nbPt}{60} % Nombre de points sur le cercle (Number of points on the circle)
          pgfmathsetmacro{nb}{nbPt-1}

          begin{center}
          begin{tikzpicture}
          draw(0,0) circle (rayon); % Tracer le cercle (Draw the circle)
          foreach i in {0,1,...,nb} {
          pgfmathsetmacro{angle}{360/nbPt*i};
          draw(angle:rayon) node{+}; draw(angle:rayon*1.08) node{i};
          }
          end{tikzpicture}
          end{center}

          end{document}


          enter image description here







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Dec 21 '18 at 8:58

























          answered Dec 21 '18 at 8:43









          AboAmmar

          33.3k22882




          33.3k22882












          • Thank you for your answer. I know this problem with tikz but I am not able to understand why this limit is reached here.
            – Olivier MAES
            Dec 21 '18 at 15:15








          • 1




            @OlivierMAES: 360*45 = 16200 < 16383.99998, but 360*46 = 16560 > 16383.99998, this is the limit you see in your example.
            – AboAmmar
            Dec 21 '18 at 16:12












          • Ok that's now clear for me.
            – Olivier MAES
            Dec 21 '18 at 22:26


















          • Thank you for your answer. I know this problem with tikz but I am not able to understand why this limit is reached here.
            – Olivier MAES
            Dec 21 '18 at 15:15








          • 1




            @OlivierMAES: 360*45 = 16200 < 16383.99998, but 360*46 = 16560 > 16383.99998, this is the limit you see in your example.
            – AboAmmar
            Dec 21 '18 at 16:12












          • Ok that's now clear for me.
            – Olivier MAES
            Dec 21 '18 at 22:26
















          Thank you for your answer. I know this problem with tikz but I am not able to understand why this limit is reached here.
          – Olivier MAES
          Dec 21 '18 at 15:15






          Thank you for your answer. I know this problem with tikz but I am not able to understand why this limit is reached here.
          – Olivier MAES
          Dec 21 '18 at 15:15






          1




          1




          @OlivierMAES: 360*45 = 16200 < 16383.99998, but 360*46 = 16560 > 16383.99998, this is the limit you see in your example.
          – AboAmmar
          Dec 21 '18 at 16:12






          @OlivierMAES: 360*45 = 16200 < 16383.99998, but 360*46 = 16560 > 16383.99998, this is the limit you see in your example.
          – AboAmmar
          Dec 21 '18 at 16:12














          Ok that's now clear for me.
          – Olivier MAES
          Dec 21 '18 at 22:26




          Ok that's now clear for me.
          – Olivier MAES
          Dec 21 '18 at 22:26


















          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%2f466817%2fproblem-with-point-position-in-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

          How do I know what Microsoft account the skydrive app is syncing to?

          Grease: Live!

          When does type information flow backwards in C++?