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
2 weeks and a tight budget to prepare for Z-day. How long can I hunker down?
reconstruction filter - How does it actually work?
Did the Americans trade destroyers in the "destroyer deal" that they would later need themselves?
Name These Animals
Wand of the War Mage spellcasting focus and bonus interaction with multiclassing
Sci-fi change: Too much or Not enough
Should I accept an invitation to give a talk from someone who might review my proposal?
To find islands of 1 and 0 in matrix
Why do they sell Cat 5 Ethernet splitters if you can’t split the signal?
Assuring luggage isn't lost with short layover
If Trump gets impeached, how long would Pence be president?
Why is の所 used after ドア in this sentence?
What container to use to store developer concentrate?
What do you call a flexible diving platform?
Did Vladimir Lenin have a cat?
Is it error of law to judge on less relevant case law when there is much more relevant one?
Can you place a support header in the ceiling?
How do you pronounce "Hain"?
Is it safe if the neutral lead is exposed and disconnected?
How likely is fragmentation on a table with 40000 products likely to affect performance
Can I change the license of a forked project to the MIT if the license of the parent project has changed from the GPL to the MIT?
What happens when a flying sword is killed?
Examples of simultaneous independent breakthroughs
What is more environmentally friendly? An A320 or a car?
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
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
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
Jul 18 at 15:53
Thx pls see edit i need to move to the next or previous node on increment slide button
– user1319236
Jul 18 at 16:07
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
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
edited Jul 18 at 16:07
user1319236
asked Jul 18 at 15:36
user1319236user1319236
333 bronze badges
333 bronze badges
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
Jul 18 at 15:53
Thx pls see edit i need to move to the next or previous node on increment slide button
– user1319236
Jul 18 at 16:07
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
Jul 18 at 15:53
Thx pls see edit i need to move to the next or previous node on increment slide button
– user1319236
Jul 18 at 16:07
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
Jul 18 at 15:53
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
Jul 18 at 15:53
Thx pls see edit i need to move to the next or previous node on increment slide button
– user1319236
Jul 18 at 16:07
Thx pls see edit i need to move to the next or previous node on increment slide button
– user1319236
Jul 18 at 16:07
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
Jul 18 at 17:30
@user1319236 Just addfill
to the node options for thenode
in theforeach
loop.
– Torbjørn T.
Jul 18 at 17:32
Yep you got it right thx
– user1319236
Jul 18 at 17:48
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
Jul 18 at 18:00
+1, but I would have expected an l3draw circle :D
– TeXnician
Jul 18 at 19:32
@TeXnician Thanks! Regardingl3draw
, I believe its edges are still a bit rough for me. :-p
– frougon
Jul 18 at 19:38
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%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
Jul 18 at 17:30
@user1319236 Just addfill
to the node options for thenode
in theforeach
loop.
– Torbjørn T.
Jul 18 at 17:32
Yep you got it right thx
– user1319236
Jul 18 at 17:48
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
Jul 18 at 17:30
@user1319236 Just addfill
to the node options for thenode
in theforeach
loop.
– Torbjørn T.
Jul 18 at 17:32
Yep you got it right thx
– user1319236
Jul 18 at 17:48
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 Jul 18 at 17:34
answered Jul 18 at 16:41
Torbjørn T.Torbjørn T.
163k13 gold badges267 silver badges453 bronze badges
163k13 gold badges267 silver badges453 bronze badges
Thx its almost that except the current position / node should be all colored not just the periphery
– user1319236
Jul 18 at 17:30
@user1319236 Just addfill
to the node options for thenode
in theforeach
loop.
– Torbjørn T.
Jul 18 at 17:32
Yep you got it right thx
– user1319236
Jul 18 at 17:48
add a comment |
Thx its almost that except the current position / node should be all colored not just the periphery
– user1319236
Jul 18 at 17:30
@user1319236 Just addfill
to the node options for thenode
in theforeach
loop.
– Torbjørn T.
Jul 18 at 17:32
Yep you got it right thx
– user1319236
Jul 18 at 17:48
Thx its almost that except the current position / node should be all colored not just the periphery
– user1319236
Jul 18 at 17:30
Thx its almost that except the current position / node should be all colored not just the periphery
– user1319236
Jul 18 at 17:30
@user1319236 Just add
fill
to the node options for the node
in the foreach
loop.– Torbjørn T.
Jul 18 at 17:32
@user1319236 Just add
fill
to the node options for the node
in the foreach
loop.– Torbjørn T.
Jul 18 at 17:32
Yep you got it right thx
– user1319236
Jul 18 at 17:48
Yep you got it right thx
– user1319236
Jul 18 at 17:48
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
Jul 18 at 18:00
+1, but I would have expected an l3draw circle :D
– TeXnician
Jul 18 at 19:32
@TeXnician Thanks! Regardingl3draw
, I believe its edges are still a bit rough for me. :-p
– frougon
Jul 18 at 19:38
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
Jul 18 at 18:00
+1, but I would have expected an l3draw circle :D
– TeXnician
Jul 18 at 19:32
@TeXnician Thanks! Regardingl3draw
, I believe its edges are still a bit rough for me. :-p
– frougon
Jul 18 at 19:38
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 Jul 18 at 20:13
answered Jul 18 at 17:33
frougonfrougon
6,0251 gold badge10 silver badges20 bronze badges
6,0251 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
Jul 18 at 18:00
+1, but I would have expected an l3draw circle :D
– TeXnician
Jul 18 at 19:32
@TeXnician Thanks! Regardingl3draw
, I believe its edges are still a bit rough for me. :-p
– frougon
Jul 18 at 19:38
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
Jul 18 at 18:00
+1, but I would have expected an l3draw circle :D
– TeXnician
Jul 18 at 19:32
@TeXnician Thanks! Regardingl3draw
, I believe its edges are still a bit rough for me. :-p
– frougon
Jul 18 at 19:38
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
Jul 18 at 18:00
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
Jul 18 at 18:00
+1, but I would have expected an l3draw circle :D
– TeXnician
Jul 18 at 19:32
+1, but I would have expected an l3draw circle :D
– TeXnician
Jul 18 at 19:32
@TeXnician Thanks! Regarding
l3draw
, I believe its edges are still a bit rough for me. :-p– frougon
Jul 18 at 19:38
@TeXnician Thanks! Regarding
l3draw
, I believe its edges are still a bit rough for me. :-p– frougon
Jul 18 at 19:38
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.
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
Jul 18 at 15:53
Thx pls see edit i need to move to the next or previous node on increment slide button
– user1319236
Jul 18 at 16:07