Problem with point position in tikz
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
add a comment |
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
add a comment |
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
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
tikz-pgf
edited Dec 21 '18 at 14:10
AboAmmar
33.3k22882
33.3k22882
asked Dec 21 '18 at 8:11
Olivier MAES
283
283
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
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}
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
, but360*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
add a comment |
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
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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}
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
, but360*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
add a comment |
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}
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
, but360*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
add a comment |
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}
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}
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
, but360*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
add a comment |
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
, but360*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
add a comment |
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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