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.


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




% https://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}};

  • 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. 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. Dec 6 '12 at 5:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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