title: How to Autonumber Cell Tags in Mathematica Notebooks?
body: <p>I tried to follow the directions on autonumbering cells in a Mathematica-8 notebook, here</p>
  
  <p><a href="http://reference.wolfram.com/mathematica/tutorial/AutomaticNumbering.html" rel="nofollow">http://reference.wolfram.com/mathematica/tutorial/AutomaticNumbering.html</a></p>
  
  <p>I created a tiny notebook with four text cells</p>
  
  <pre><code>foo
  qux
  blancmange
  bar
  </code></pre>
  
  <p>Placing the cursor just before <code>foo</code>, I then used the <code>Insert</code> menu, <code>Automatic numbering</code> item, giving me the <code>Create Automatic Numbering Object</code> dialog box.  I chose in the <code>Counter</code> dropdown then item <code>Text</code>, clicked <code>This counter object</code> radio button, and Huzzah! got the number 1 just before <code>foo</code>, presumably referring to the first cell of type <code>Text</code> in the notebook.  I now see</p>
  
  <pre><code>1foo
  qux
  blancmange
  bar
  </code></pre>
  
  <p>and I insert my own <code>dot space</code> after the 1 to get a nice-looking</p>
  
  <pre><code>1. foo
  qux
  blancmange
  bar
  </code></pre>
  
  <p>I do likewise with <code>bar</code> and see the expected</p>
  
  <pre><code>1. foo
  qux
  blancmange
  4. bar
  </code></pre>
  
  <p>because <code>bar</code> is the fourth cell of type <code>Text</code>. Great. Now I want to create an independent numbering system for cells <code>qux</code> and <code>blancmange</code>.  I use <code>Cell</code> menu, <code>Cell Tags...</code>, <code>Add/Remove Cell tags...</code>  item and put the tag <code>test</code> on cells <code>qux</code> and <code>blancmange</code>. I use <code>Cell</code> menu, <code>Cell Tags...</code>, <code>Show cell tags</code> item to make sure they're there, and, sure enough, they show up in the notebook (I won't attempt to mimic the display, here, but there is a link to my notebook in a Dropbox public folder at the bottom of this question if you want to have a look).  I then position the cursor before <code>qux</code> and use <code>Insert</code> menu, <code>Automatic numbering</code> item, this time choosing <code>Use the counter value corresponding to the location of:</code>, then <code>The first cell with the tag:</code>, then <code>test</code>, my user-created tag, go OK, and i get a ZERO!  ditto before <code>blancmange</code>.  My final (bad) result, after putting a little lipstick on the pig with my own <code>dot</code> and <code>space</code>, looks like </p>
  
  <pre><code>1. foo
  0. qux
  0. blancmange
  4. bar
  </code></pre>
  
  <p>If try referring to a non-existent tag, I get</p>
  
  <pre><code>1. foo
  XXXqux
  XXXblancmange
  4. bar
  </code></pre>
  
  <p>so Mathematica recognized something, but not what I expected or needed.</p>
  
  <p>I also need to say that I tried the <code>Item Numbered</code> item in the <code>Format</code> item, but I have two problems with it: (1) I don't know how to RESTART the numbering from 1, so every block of <code>Item Numbered</code> cells belongs to the same sequence of numbered items. I get 1, 2, 3, here, then 4, 5, 6, later, and 7, 8, 9, even later, etc. I really need independently numbered blocks of items: 1, 2, 3 here, 1, 2, 3 later, and 1, 2, 3 even later, etc.  (2) I need to number various different kinds of cells, so I really need to create my own tags and control my tracking of them.</p>
  
  <p>I will be very grateful for any advice.</p>
  
  <p>Here's a link to my trivial little notebook.</p>
  
  <p><a href="http://dl.dropbox.com/u/1997638/CellTagsAutoNumbering.nb" rel="nofollow">CellTagsAutonumbering.nb</a></p>