TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Apologies in advance for the slightly-crappy camera phone picture:

circular sequence

I'd like to include some figures like this in something I'm working on. I've just started learning tikz, which seems like it could be used to do something like this, but I'm not quite dextrous enough just yet.

The included picture has 16 cells, but I have another figure with 8 cells and a less important one with 27 cells, so if this can be done generally to make doing those easy as well, that'd be great.

share|improve this question
some related posts: question search for ring chart – cmhughes Dec 6 '12 at 4:20
It would be nice to have certain cells filled with color. – Uwe Ziegenhagen Dec 6 '12 at 4:21
You can check the examples of chains and foreach commands in the manual for a few examples similar to this one. Also you can check this one for the repetition task. tex.stackexchange.com/questions/42261/… – percusse Dec 6 '12 at 4:23
up vote 10 down vote accepted

The CircularSequence macro below takes three paramaters:

  • The outer radius
  • the inner radius
  • the sequence to be applied

which should be able to create this image with any desired number of elements. Below are examples with 8 and 16 elements:

enter image description here




% http://tex.stackexchange.com/questions/21559/macro-to-access-a-specific-member-of-a-list/21560#21560

    % #1 = outer circle radius
    % #2 = inner circle radius
    % #3 = seqeunce
    \draw [red,  ultra thick] circle (#2);
    \draw [blue, ultra thick] circle (#1);
    \foreach [count = \Count] \Angle in {0,\AngleSep,..., 360} {%
        \draw [gray, ultra thick] (\Angle:#2) -- (\Angle:#1);
        \node at (\MidPoint:\MidRadius) {\GetListMember{#3}{\Count}};

share|improve this answer
Thanks! (and fast) Sadly, this doesn't compile for me. The errors are: ./circular-sequence-test.tex:26: Missing control sequence inserted. <inserted text> \inaccessiblel.26 ...ularSequence{3.0cm}{2.cm}{1,2,3,4,5,6,7,8} ? ./circular-sequence-test.tex:26: Undefined control sequence. <argument> \Angle :2.cm l.26 ...ularSequence{3.0cm}{2.cm}{1,2,3,4,5,6,7,8} ... Replacing 2.cm with 2.0cm does not help. – Harold Dec 6 '12 at 4:57
I suspect that you are on an older release. Unless there is a good reason to stay on that you should probably to upgrade to TexLive 2012. – Peter Grill Dec 6 '12 at 4:59
Indeed I am. I shall upgrade. – Harold Dec 6 '12 at 5:08
@Harold How do I update my TeX distribution? – cmhughes Dec 6 '12 at 5:08
@Harold: My crystal ball says that you are on a 2009 release. :-) And if so, you should just install TeXLive2012 directly. – Peter Grill Dec 6 '12 at 5:08

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.