Drawing a circle with nodes shift with TikzHow do I place nodes around a circle in Tikz?Rotate a node but not its content: the case of the ellipse decorationHow to define the default vertical distance between nodes?Flowchart: adding label in top of pictureNumerical conditional within tikz keys?TikZ: Drawing an arc from an intersection to an intersectionNode position based on two nodesDraw nodes with path in tikzDrawing rectilinear curves in Tikz, aka an Etch-a-Sketch drawingLine up nested tikz enviroments or how to get rid of themUsing tikz Calc package to add cordinates
Why is the Intel 8086 CPU called a 16-bit CPU?
"This used to be my phone number"
How to tell the object type of an Attachment
Did Hitler say this quote about homeschooling?
What is the period of Langton's ant on a torus?
When can a polynomial be written as a polynomial function of another polynomial?
How much water can a ship take on before sinking?
Is there a difference between PIO and GPIO pins?
How to not confuse readers with simultaneous events?
Term “console” in game consoles
How to remove the first colon ':' from a timestamp?
How would you say "Sorry, that was a mistake on my part"?
What would be the safest way to drop thousands of small, hard objects from a typical, high wing, GA airplane?
Is it possible to have a career in SciComp without contributing to arms research?
Is it possible to breed neanderthals through selective breeding?
Naming your baby - does the name influence the child?
Desecrating Shabbos to ask a Gadol to daven for a patient?
What did Jeremy Hunt mean by "slipped" to miss a vote?
Is surviving this (blood loss) scenario possible?
Which modern firearm should a time traveler bring to be easily reproducible for a historic civilization?
What details should I consider before agreeing for part of my salary to be 'retained' by employer?
Why do space operations use "nominal" to mean "working correctly"?
What was the difference between a Games Console and a Home Computer?
Why can't I hear fret buzz through the amp?
Drawing a circle with nodes shift with Tikz
How do I place nodes around a circle in Tikz?Rotate a node but not its content: the case of the ellipse decorationHow to define the default vertical distance between nodes?Flowchart: adding label in top of pictureNumerical conditional within tikz keys?TikZ: Drawing an arc from an intersection to an intersectionNode position based on two nodesDraw nodes with path in tikzDrawing rectilinear curves in Tikz, aka an Etch-a-Sketch drawingLine up nested tikz enviroments or how to get rid of themUsing tikz Calc package to add cordinates
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I am newby in Tikz and want to draw a circle with on it 16 circle-shaped nodes.
Each slide increment would shift to the next node rightward or leftward ( an example with both should be fine), while highlighting it (the highlight should be about the current position/node).
Anybody could help me achieving this ?
An example of the drawing is attached :

Thank you
EDIT : This is a good start but i need circle shaped nodes not text with one node each time hightlighted (colored with blue) (the current position) and node shift could be right or left :
documentclassreport
usepackagetikz,calc
begindocument
begintikzpicture
foreach a in 1,2,...,17
draw (a*360/17: 4cm) nodeangle a;
endtikzpicture
enddocument
tikz-pgf beamer
New contributor
user1319236 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
I am newby in Tikz and want to draw a circle with on it 16 circle-shaped nodes.
Each slide increment would shift to the next node rightward or leftward ( an example with both should be fine), while highlighting it (the highlight should be about the current position/node).
Anybody could help me achieving this ?
An example of the drawing is attached :

Thank you
EDIT : This is a good start but i need circle shaped nodes not text with one node each time hightlighted (colored with blue) (the current position) and node shift could be right or left :
documentclassreport
usepackagetikz,calc
begindocument
begintikzpicture
foreach a in 1,2,...,17
draw (a*360/17: 4cm) nodeangle a;
endtikzpicture
enddocument
tikz-pgf beamer
New contributor
user1319236 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
Welcome to TeX.SX! With what part are you having problems with? What have you tried so far? Also see this question which is similar.
– siracusa
9 hours ago
Thx pls see edit i need to move to the next or previous node on increment slide button
– user1319236
8 hours ago
add a comment |
I am newby in Tikz and want to draw a circle with on it 16 circle-shaped nodes.
Each slide increment would shift to the next node rightward or leftward ( an example with both should be fine), while highlighting it (the highlight should be about the current position/node).
Anybody could help me achieving this ?
An example of the drawing is attached :

Thank you
EDIT : This is a good start but i need circle shaped nodes not text with one node each time hightlighted (colored with blue) (the current position) and node shift could be right or left :
documentclassreport
usepackagetikz,calc
begindocument
begintikzpicture
foreach a in 1,2,...,17
draw (a*360/17: 4cm) nodeangle a;
endtikzpicture
enddocument
tikz-pgf beamer
New contributor
user1319236 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
I am newby in Tikz and want to draw a circle with on it 16 circle-shaped nodes.
Each slide increment would shift to the next node rightward or leftward ( an example with both should be fine), while highlighting it (the highlight should be about the current position/node).
Anybody could help me achieving this ?
An example of the drawing is attached :

Thank you
EDIT : This is a good start but i need circle shaped nodes not text with one node each time hightlighted (colored with blue) (the current position) and node shift could be right or left :
documentclassreport
usepackagetikz,calc
begindocument
begintikzpicture
foreach a in 1,2,...,17
draw (a*360/17: 4cm) nodeangle a;
endtikzpicture
enddocument
tikz-pgf beamer
tikz-pgf beamer
New contributor
user1319236 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
user1319236 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
edited 8 hours ago
user1319236
New contributor
user1319236 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
asked 9 hours ago
user1319236user1319236
183 bronze badges
183 bronze badges
New contributor
user1319236 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
user1319236 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
Welcome to TeX.SX! With what part are you having problems with? What have you tried so far? Also see this question which is similar.
– siracusa
9 hours ago
Thx pls see edit i need to move to the next or previous node on increment slide button
– user1319236
8 hours ago
add a comment |
Welcome to TeX.SX! With what part are you having problems with? What have you tried so far? Also see this question which is similar.
– siracusa
9 hours ago
Thx pls see edit i need to move to the next or previous node on increment slide button
– user1319236
8 hours ago
Welcome to TeX.SX! With what part are you having problems with? What have you tried so far? Also see this question which is similar.
– siracusa
9 hours ago
Welcome to TeX.SX! With what part are you having problems with? What have you tried so far? Also see this question which is similar.
– siracusa
9 hours ago
Thx pls see edit i need to move to the next or previous node on increment slide button
– user1319236
8 hours ago
Thx pls see edit i need to move to the next or previous node on increment slide button
– user1319236
8 hours ago
add a comment |
2 Answers
2
active
oldest
votes
I think something like this is what you're after.
documentclassbeamer
usepackagetikz
% define a counter
newcountCircNum
% macro to hold a color name
newcommandClrblack
begindocument
beginframe
% set up an animation, CircNum changes from 1 to 17
% with each frame
animatevalue<1-17>CircNum117
begintikzpicture
% draw the main circle
node [circle, draw, minimum size=8cm] (c) ;
foreach a in 1,2,...,17
% if a is equal to CircNum, set the color to blue
% otherwise set it to black
ifnuma=theCircNum
renewcommandClrblue
else
renewcommandClrblack
fi
% make a new node for the small circles
node[Clr, % with the color defined by the macro
draw, thick, % draw the outline
fill, % fill it
minimum size=5mm, % set the size
circle, % circular shape
label=[Clr]a*360/17+180:a % add the number on the inside
] at (c.a*360/17) % position it on the edge of the main circle
;
endtikzpicture
endframe
enddocument
Here are the first three slides of the PDF:

Thx its almost that except the current position / node should be all colored not just the periphery
– user1319236
7 hours ago
@user1319236 Just addfillto the node options for thenodein theforeachloop.
– Torbjørn T.
7 hours ago
Yep you got it right thx
– user1319236
7 hours ago
add a comment |
Welcome to TeX.SE!
Here is a solution that borrows int_step_variable:nnnNn from expl3:
documentclassbeamer
usepackageexpl3
usepackagetikz
ExplSyntaxOn
% Borrow a loop macro from expl3
cs_set_eq:NN intstepvariable int_step_variable:nnnNn
ExplSyntaxOff
begindocument
beginframeCircles in circle
begincenter
begintikzpicture
defnsteps10
defbigcircleradius3cm
defsmallcirclewidth0.5cm
% The big circle
node[circle, minimum width=2*bigcircleradius, draw] (C) ;
% The small circles and their labels
intstepvariable01nsteps - 1i% initstepfinalvariable
pgfmathsetmacroangle90 - i*360/nsteps
pgfmathsetmacroothersideangle+180
pgfmathsetmacroiplusoneint(i+1)
pgfmathsetmacroiplustwoint(i+2)
uncover<iplustwo->
node[circle, draw, minimum width=2*smallcirclewidth,
label=otherside:iplusone] at (C.angle) ;
uncover<iplustwo> % fill one small circle per frame
node[circle, fill=red!20, minimum width=2*smallcirclewidth]
at (C.angle) ;
endtikzpicture
endcenter
endframe
enddocument



...

...

Note: as an alternative to the following code:
pgfmathsetmacroiplustwoint(i+2)
(...)
uncover<iplustwo-> (...)
uncover<iplustwo> (...)
one could use, assuming e-TeX extensions are available:
uncover<thenumexpr i+2relax-> (...)
uncover<thenumexpr i+2relax> (...)
Now, let's redo the same beamer presentation, but using a more straightforward order (small circles at angles 1*360/10, 2*360/10, ..., 10*360/10 degrees, respectively). The main code is written in a (slightly) different way from the previous example: it uses two loops and the pause macro from beamer, whereas the first example did everything in one loop, and used only uncover.
documentclassbeamer
usepackageexpl3
usepackagetikz
ExplSyntaxOn
% Borrow a loop macro from expl3
cs_set_eq:NN intstepvariable int_step_variable:nnnNn
ExplSyntaxOff
begindocument
beginframeCircles in circle
begincenter
begintikzpicture
defnsteps10
defbigcircleradius3cm
defsmallcirclewidth0.5cm
% The big circle
node[circle, minimum width=2*bigcircleradius, draw] (C) ;
% The filled circles: highlight a single small circle on each frame starting
% from frame 2.
intstepvariable21nsteps+1i% initstepfinalvariable
pgfmathsetmacroangle(i-1)*360/nsteps
uncover<i>
node[circle, fill=red!20, minimum width=2*smallcirclewidth]
at (C.angle) ;
% The unfilled circles and their labels
intstepvariable11nstepsi% initstepfinalvariable
pgfmathsetmacroanglei*360/nsteps
pgfmathsetmacroothersideangle+180
pause
node[circle, draw, minimum width=2*smallcirclewidth, label=otherside:i]
at (C.angle) ;
endtikzpicture
endcenter
endframe
enddocument



...

...

Thx for the answer maybe next time i use this in another project but for now i'm going to go with the solution not requiring additional package setup like the usepackageexpl3
– user1319236
7 hours ago
+1, but I would have expected an l3draw circle :D
– TeXnician
5 hours ago
@TeXnician Thanks! Regardingl3draw, I believe its edges are still a bit rough for me. :-p
– frougon
5 hours ago
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
);
);
user1319236 is a new contributor. Be nice, and check out our Code of Conduct.
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%2f500521%2fdrawing-a-circle-with-nodes-shift-with-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
I think something like this is what you're after.
documentclassbeamer
usepackagetikz
% define a counter
newcountCircNum
% macro to hold a color name
newcommandClrblack
begindocument
beginframe
% set up an animation, CircNum changes from 1 to 17
% with each frame
animatevalue<1-17>CircNum117
begintikzpicture
% draw the main circle
node [circle, draw, minimum size=8cm] (c) ;
foreach a in 1,2,...,17
% if a is equal to CircNum, set the color to blue
% otherwise set it to black
ifnuma=theCircNum
renewcommandClrblue
else
renewcommandClrblack
fi
% make a new node for the small circles
node[Clr, % with the color defined by the macro
draw, thick, % draw the outline
fill, % fill it
minimum size=5mm, % set the size
circle, % circular shape
label=[Clr]a*360/17+180:a % add the number on the inside
] at (c.a*360/17) % position it on the edge of the main circle
;
endtikzpicture
endframe
enddocument
Here are the first three slides of the PDF:

Thx its almost that except the current position / node should be all colored not just the periphery
– user1319236
7 hours ago
@user1319236 Just addfillto the node options for thenodein theforeachloop.
– Torbjørn T.
7 hours ago
Yep you got it right thx
– user1319236
7 hours ago
add a comment |
I think something like this is what you're after.
documentclassbeamer
usepackagetikz
% define a counter
newcountCircNum
% macro to hold a color name
newcommandClrblack
begindocument
beginframe
% set up an animation, CircNum changes from 1 to 17
% with each frame
animatevalue<1-17>CircNum117
begintikzpicture
% draw the main circle
node [circle, draw, minimum size=8cm] (c) ;
foreach a in 1,2,...,17
% if a is equal to CircNum, set the color to blue
% otherwise set it to black
ifnuma=theCircNum
renewcommandClrblue
else
renewcommandClrblack
fi
% make a new node for the small circles
node[Clr, % with the color defined by the macro
draw, thick, % draw the outline
fill, % fill it
minimum size=5mm, % set the size
circle, % circular shape
label=[Clr]a*360/17+180:a % add the number on the inside
] at (c.a*360/17) % position it on the edge of the main circle
;
endtikzpicture
endframe
enddocument
Here are the first three slides of the PDF:

Thx its almost that except the current position / node should be all colored not just the periphery
– user1319236
7 hours ago
@user1319236 Just addfillto the node options for thenodein theforeachloop.
– Torbjørn T.
7 hours ago
Yep you got it right thx
– user1319236
7 hours ago
add a comment |
I think something like this is what you're after.
documentclassbeamer
usepackagetikz
% define a counter
newcountCircNum
% macro to hold a color name
newcommandClrblack
begindocument
beginframe
% set up an animation, CircNum changes from 1 to 17
% with each frame
animatevalue<1-17>CircNum117
begintikzpicture
% draw the main circle
node [circle, draw, minimum size=8cm] (c) ;
foreach a in 1,2,...,17
% if a is equal to CircNum, set the color to blue
% otherwise set it to black
ifnuma=theCircNum
renewcommandClrblue
else
renewcommandClrblack
fi
% make a new node for the small circles
node[Clr, % with the color defined by the macro
draw, thick, % draw the outline
fill, % fill it
minimum size=5mm, % set the size
circle, % circular shape
label=[Clr]a*360/17+180:a % add the number on the inside
] at (c.a*360/17) % position it on the edge of the main circle
;
endtikzpicture
endframe
enddocument
Here are the first three slides of the PDF:

I think something like this is what you're after.
documentclassbeamer
usepackagetikz
% define a counter
newcountCircNum
% macro to hold a color name
newcommandClrblack
begindocument
beginframe
% set up an animation, CircNum changes from 1 to 17
% with each frame
animatevalue<1-17>CircNum117
begintikzpicture
% draw the main circle
node [circle, draw, minimum size=8cm] (c) ;
foreach a in 1,2,...,17
% if a is equal to CircNum, set the color to blue
% otherwise set it to black
ifnuma=theCircNum
renewcommandClrblue
else
renewcommandClrblack
fi
% make a new node for the small circles
node[Clr, % with the color defined by the macro
draw, thick, % draw the outline
fill, % fill it
minimum size=5mm, % set the size
circle, % circular shape
label=[Clr]a*360/17+180:a % add the number on the inside
] at (c.a*360/17) % position it on the edge of the main circle
;
endtikzpicture
endframe
enddocument
Here are the first three slides of the PDF:

edited 7 hours ago
answered 8 hours ago
Torbjørn T.Torbjørn T.
162k13 gold badges266 silver badges453 bronze badges
162k13 gold badges266 silver badges453 bronze badges
Thx its almost that except the current position / node should be all colored not just the periphery
– user1319236
7 hours ago
@user1319236 Just addfillto the node options for thenodein theforeachloop.
– Torbjørn T.
7 hours ago
Yep you got it right thx
– user1319236
7 hours ago
add a comment |
Thx its almost that except the current position / node should be all colored not just the periphery
– user1319236
7 hours ago
@user1319236 Just addfillto the node options for thenodein theforeachloop.
– Torbjørn T.
7 hours ago
Yep you got it right thx
– user1319236
7 hours ago
Thx its almost that except the current position / node should be all colored not just the periphery
– user1319236
7 hours ago
Thx its almost that except the current position / node should be all colored not just the periphery
– user1319236
7 hours ago
@user1319236 Just add
fill to the node options for the node in the foreach loop.– Torbjørn T.
7 hours ago
@user1319236 Just add
fill to the node options for the node in the foreach loop.– Torbjørn T.
7 hours ago
Yep you got it right thx
– user1319236
7 hours ago
Yep you got it right thx
– user1319236
7 hours ago
add a comment |
Welcome to TeX.SE!
Here is a solution that borrows int_step_variable:nnnNn from expl3:
documentclassbeamer
usepackageexpl3
usepackagetikz
ExplSyntaxOn
% Borrow a loop macro from expl3
cs_set_eq:NN intstepvariable int_step_variable:nnnNn
ExplSyntaxOff
begindocument
beginframeCircles in circle
begincenter
begintikzpicture
defnsteps10
defbigcircleradius3cm
defsmallcirclewidth0.5cm
% The big circle
node[circle, minimum width=2*bigcircleradius, draw] (C) ;
% The small circles and their labels
intstepvariable01nsteps - 1i% initstepfinalvariable
pgfmathsetmacroangle90 - i*360/nsteps
pgfmathsetmacroothersideangle+180
pgfmathsetmacroiplusoneint(i+1)
pgfmathsetmacroiplustwoint(i+2)
uncover<iplustwo->
node[circle, draw, minimum width=2*smallcirclewidth,
label=otherside:iplusone] at (C.angle) ;
uncover<iplustwo> % fill one small circle per frame
node[circle, fill=red!20, minimum width=2*smallcirclewidth]
at (C.angle) ;
endtikzpicture
endcenter
endframe
enddocument



...

...

Note: as an alternative to the following code:
pgfmathsetmacroiplustwoint(i+2)
(...)
uncover<iplustwo-> (...)
uncover<iplustwo> (...)
one could use, assuming e-TeX extensions are available:
uncover<thenumexpr i+2relax-> (...)
uncover<thenumexpr i+2relax> (...)
Now, let's redo the same beamer presentation, but using a more straightforward order (small circles at angles 1*360/10, 2*360/10, ..., 10*360/10 degrees, respectively). The main code is written in a (slightly) different way from the previous example: it uses two loops and the pause macro from beamer, whereas the first example did everything in one loop, and used only uncover.
documentclassbeamer
usepackageexpl3
usepackagetikz
ExplSyntaxOn
% Borrow a loop macro from expl3
cs_set_eq:NN intstepvariable int_step_variable:nnnNn
ExplSyntaxOff
begindocument
beginframeCircles in circle
begincenter
begintikzpicture
defnsteps10
defbigcircleradius3cm
defsmallcirclewidth0.5cm
% The big circle
node[circle, minimum width=2*bigcircleradius, draw] (C) ;
% The filled circles: highlight a single small circle on each frame starting
% from frame 2.
intstepvariable21nsteps+1i% initstepfinalvariable
pgfmathsetmacroangle(i-1)*360/nsteps
uncover<i>
node[circle, fill=red!20, minimum width=2*smallcirclewidth]
at (C.angle) ;
% The unfilled circles and their labels
intstepvariable11nstepsi% initstepfinalvariable
pgfmathsetmacroanglei*360/nsteps
pgfmathsetmacroothersideangle+180
pause
node[circle, draw, minimum width=2*smallcirclewidth, label=otherside:i]
at (C.angle) ;
endtikzpicture
endcenter
endframe
enddocument



...

...

Thx for the answer maybe next time i use this in another project but for now i'm going to go with the solution not requiring additional package setup like the usepackageexpl3
– user1319236
7 hours ago
+1, but I would have expected an l3draw circle :D
– TeXnician
5 hours ago
@TeXnician Thanks! Regardingl3draw, I believe its edges are still a bit rough for me. :-p
– frougon
5 hours ago
add a comment |
Welcome to TeX.SE!
Here is a solution that borrows int_step_variable:nnnNn from expl3:
documentclassbeamer
usepackageexpl3
usepackagetikz
ExplSyntaxOn
% Borrow a loop macro from expl3
cs_set_eq:NN intstepvariable int_step_variable:nnnNn
ExplSyntaxOff
begindocument
beginframeCircles in circle
begincenter
begintikzpicture
defnsteps10
defbigcircleradius3cm
defsmallcirclewidth0.5cm
% The big circle
node[circle, minimum width=2*bigcircleradius, draw] (C) ;
% The small circles and their labels
intstepvariable01nsteps - 1i% initstepfinalvariable
pgfmathsetmacroangle90 - i*360/nsteps
pgfmathsetmacroothersideangle+180
pgfmathsetmacroiplusoneint(i+1)
pgfmathsetmacroiplustwoint(i+2)
uncover<iplustwo->
node[circle, draw, minimum width=2*smallcirclewidth,
label=otherside:iplusone] at (C.angle) ;
uncover<iplustwo> % fill one small circle per frame
node[circle, fill=red!20, minimum width=2*smallcirclewidth]
at (C.angle) ;
endtikzpicture
endcenter
endframe
enddocument



...

...

Note: as an alternative to the following code:
pgfmathsetmacroiplustwoint(i+2)
(...)
uncover<iplustwo-> (...)
uncover<iplustwo> (...)
one could use, assuming e-TeX extensions are available:
uncover<thenumexpr i+2relax-> (...)
uncover<thenumexpr i+2relax> (...)
Now, let's redo the same beamer presentation, but using a more straightforward order (small circles at angles 1*360/10, 2*360/10, ..., 10*360/10 degrees, respectively). The main code is written in a (slightly) different way from the previous example: it uses two loops and the pause macro from beamer, whereas the first example did everything in one loop, and used only uncover.
documentclassbeamer
usepackageexpl3
usepackagetikz
ExplSyntaxOn
% Borrow a loop macro from expl3
cs_set_eq:NN intstepvariable int_step_variable:nnnNn
ExplSyntaxOff
begindocument
beginframeCircles in circle
begincenter
begintikzpicture
defnsteps10
defbigcircleradius3cm
defsmallcirclewidth0.5cm
% The big circle
node[circle, minimum width=2*bigcircleradius, draw] (C) ;
% The filled circles: highlight a single small circle on each frame starting
% from frame 2.
intstepvariable21nsteps+1i% initstepfinalvariable
pgfmathsetmacroangle(i-1)*360/nsteps
uncover<i>
node[circle, fill=red!20, minimum width=2*smallcirclewidth]
at (C.angle) ;
% The unfilled circles and their labels
intstepvariable11nstepsi% initstepfinalvariable
pgfmathsetmacroanglei*360/nsteps
pgfmathsetmacroothersideangle+180
pause
node[circle, draw, minimum width=2*smallcirclewidth, label=otherside:i]
at (C.angle) ;
endtikzpicture
endcenter
endframe
enddocument



...

...

Thx for the answer maybe next time i use this in another project but for now i'm going to go with the solution not requiring additional package setup like the usepackageexpl3
– user1319236
7 hours ago
+1, but I would have expected an l3draw circle :D
– TeXnician
5 hours ago
@TeXnician Thanks! Regardingl3draw, I believe its edges are still a bit rough for me. :-p
– frougon
5 hours ago
add a comment |
Welcome to TeX.SE!
Here is a solution that borrows int_step_variable:nnnNn from expl3:
documentclassbeamer
usepackageexpl3
usepackagetikz
ExplSyntaxOn
% Borrow a loop macro from expl3
cs_set_eq:NN intstepvariable int_step_variable:nnnNn
ExplSyntaxOff
begindocument
beginframeCircles in circle
begincenter
begintikzpicture
defnsteps10
defbigcircleradius3cm
defsmallcirclewidth0.5cm
% The big circle
node[circle, minimum width=2*bigcircleradius, draw] (C) ;
% The small circles and their labels
intstepvariable01nsteps - 1i% initstepfinalvariable
pgfmathsetmacroangle90 - i*360/nsteps
pgfmathsetmacroothersideangle+180
pgfmathsetmacroiplusoneint(i+1)
pgfmathsetmacroiplustwoint(i+2)
uncover<iplustwo->
node[circle, draw, minimum width=2*smallcirclewidth,
label=otherside:iplusone] at (C.angle) ;
uncover<iplustwo> % fill one small circle per frame
node[circle, fill=red!20, minimum width=2*smallcirclewidth]
at (C.angle) ;
endtikzpicture
endcenter
endframe
enddocument



...

...

Note: as an alternative to the following code:
pgfmathsetmacroiplustwoint(i+2)
(...)
uncover<iplustwo-> (...)
uncover<iplustwo> (...)
one could use, assuming e-TeX extensions are available:
uncover<thenumexpr i+2relax-> (...)
uncover<thenumexpr i+2relax> (...)
Now, let's redo the same beamer presentation, but using a more straightforward order (small circles at angles 1*360/10, 2*360/10, ..., 10*360/10 degrees, respectively). The main code is written in a (slightly) different way from the previous example: it uses two loops and the pause macro from beamer, whereas the first example did everything in one loop, and used only uncover.
documentclassbeamer
usepackageexpl3
usepackagetikz
ExplSyntaxOn
% Borrow a loop macro from expl3
cs_set_eq:NN intstepvariable int_step_variable:nnnNn
ExplSyntaxOff
begindocument
beginframeCircles in circle
begincenter
begintikzpicture
defnsteps10
defbigcircleradius3cm
defsmallcirclewidth0.5cm
% The big circle
node[circle, minimum width=2*bigcircleradius, draw] (C) ;
% The filled circles: highlight a single small circle on each frame starting
% from frame 2.
intstepvariable21nsteps+1i% initstepfinalvariable
pgfmathsetmacroangle(i-1)*360/nsteps
uncover<i>
node[circle, fill=red!20, minimum width=2*smallcirclewidth]
at (C.angle) ;
% The unfilled circles and their labels
intstepvariable11nstepsi% initstepfinalvariable
pgfmathsetmacroanglei*360/nsteps
pgfmathsetmacroothersideangle+180
pause
node[circle, draw, minimum width=2*smallcirclewidth, label=otherside:i]
at (C.angle) ;
endtikzpicture
endcenter
endframe
enddocument



...

...

Welcome to TeX.SE!
Here is a solution that borrows int_step_variable:nnnNn from expl3:
documentclassbeamer
usepackageexpl3
usepackagetikz
ExplSyntaxOn
% Borrow a loop macro from expl3
cs_set_eq:NN intstepvariable int_step_variable:nnnNn
ExplSyntaxOff
begindocument
beginframeCircles in circle
begincenter
begintikzpicture
defnsteps10
defbigcircleradius3cm
defsmallcirclewidth0.5cm
% The big circle
node[circle, minimum width=2*bigcircleradius, draw] (C) ;
% The small circles and their labels
intstepvariable01nsteps - 1i% initstepfinalvariable
pgfmathsetmacroangle90 - i*360/nsteps
pgfmathsetmacroothersideangle+180
pgfmathsetmacroiplusoneint(i+1)
pgfmathsetmacroiplustwoint(i+2)
uncover<iplustwo->
node[circle, draw, minimum width=2*smallcirclewidth,
label=otherside:iplusone] at (C.angle) ;
uncover<iplustwo> % fill one small circle per frame
node[circle, fill=red!20, minimum width=2*smallcirclewidth]
at (C.angle) ;
endtikzpicture
endcenter
endframe
enddocument



...

...

Note: as an alternative to the following code:
pgfmathsetmacroiplustwoint(i+2)
(...)
uncover<iplustwo-> (...)
uncover<iplustwo> (...)
one could use, assuming e-TeX extensions are available:
uncover<thenumexpr i+2relax-> (...)
uncover<thenumexpr i+2relax> (...)
Now, let's redo the same beamer presentation, but using a more straightforward order (small circles at angles 1*360/10, 2*360/10, ..., 10*360/10 degrees, respectively). The main code is written in a (slightly) different way from the previous example: it uses two loops and the pause macro from beamer, whereas the first example did everything in one loop, and used only uncover.
documentclassbeamer
usepackageexpl3
usepackagetikz
ExplSyntaxOn
% Borrow a loop macro from expl3
cs_set_eq:NN intstepvariable int_step_variable:nnnNn
ExplSyntaxOff
begindocument
beginframeCircles in circle
begincenter
begintikzpicture
defnsteps10
defbigcircleradius3cm
defsmallcirclewidth0.5cm
% The big circle
node[circle, minimum width=2*bigcircleradius, draw] (C) ;
% The filled circles: highlight a single small circle on each frame starting
% from frame 2.
intstepvariable21nsteps+1i% initstepfinalvariable
pgfmathsetmacroangle(i-1)*360/nsteps
uncover<i>
node[circle, fill=red!20, minimum width=2*smallcirclewidth]
at (C.angle) ;
% The unfilled circles and their labels
intstepvariable11nstepsi% initstepfinalvariable
pgfmathsetmacroanglei*360/nsteps
pgfmathsetmacroothersideangle+180
pause
node[circle, draw, minimum width=2*smallcirclewidth, label=otherside:i]
at (C.angle) ;
endtikzpicture
endcenter
endframe
enddocument



...

...

edited 4 hours ago
answered 7 hours ago
frougonfrougon
5,1571 gold badge10 silver badges20 bronze badges
5,1571 gold badge10 silver badges20 bronze badges
Thx for the answer maybe next time i use this in another project but for now i'm going to go with the solution not requiring additional package setup like the usepackageexpl3
– user1319236
7 hours ago
+1, but I would have expected an l3draw circle :D
– TeXnician
5 hours ago
@TeXnician Thanks! Regardingl3draw, I believe its edges are still a bit rough for me. :-p
– frougon
5 hours ago
add a comment |
Thx for the answer maybe next time i use this in another project but for now i'm going to go with the solution not requiring additional package setup like the usepackageexpl3
– user1319236
7 hours ago
+1, but I would have expected an l3draw circle :D
– TeXnician
5 hours ago
@TeXnician Thanks! Regardingl3draw, I believe its edges are still a bit rough for me. :-p
– frougon
5 hours ago
Thx for the answer maybe next time i use this in another project but for now i'm going to go with the solution not requiring additional package setup like the usepackageexpl3
– user1319236
7 hours ago
Thx for the answer maybe next time i use this in another project but for now i'm going to go with the solution not requiring additional package setup like the usepackageexpl3
– user1319236
7 hours ago
+1, but I would have expected an l3draw circle :D
– TeXnician
5 hours ago
+1, but I would have expected an l3draw circle :D
– TeXnician
5 hours ago
@TeXnician Thanks! Regarding
l3draw, I believe its edges are still a bit rough for me. :-p– frougon
5 hours ago
@TeXnician Thanks! Regarding
l3draw, I believe its edges are still a bit rough for me. :-p– frougon
5 hours ago
add a comment |
user1319236 is a new contributor. Be nice, and check out our Code of Conduct.
user1319236 is a new contributor. Be nice, and check out our Code of Conduct.
user1319236 is a new contributor. Be nice, and check out our Code of Conduct.
user1319236 is a new contributor. Be nice, and check out our Code of Conduct.
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.
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%2f500521%2fdrawing-a-circle-with-nodes-shift-with-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
Welcome to TeX.SX! With what part are you having problems with? What have you tried so far? Also see this question which is similar.
– siracusa
9 hours ago
Thx pls see edit i need to move to the next or previous node on increment slide button
– user1319236
8 hours ago