Numbering things
Discussion
We often need to number things in our web code, particularly when labelling footnotes or index items.
The problem with any numbering scheme which is created by hand is that when we need to insert some new item into the order we will have to re-number every subsequent item in the sequence.
Or at least at first glance it looks that way, but it's actually not so bad.
The first thing to remember is that in the code itself—the invisible framework for our visible text—there is seldom any requirement for the numbers to be sequential. We are usually providing links between anchors, so as long as their values match we don't need to concern ourselves too much with keeping things rigourously tidy. The computer doesn't care.
However, for our own sanity it's good to have things numbered in pretty much the order they appear. It makes navigating our code a lot easier and quicker.
So we leave room to add items into the sequence if we need to, and one method is to use the intermediate number technique.
Technique
Intermediate number
For instance, let's say we're labelling headings but we're unsure whether the 10 items we've labelled are all that will be required, instead of labelling them from 01 to 10 we should use 1000 to 9000. Now, when a new item is added between second and third in the sequence we can label the new item with an intermediate number like this: 2000, 2500, 3000. Using "2500" (rather than "2001") allows room to add further items into the sequence either side of the new item. (Remember that these are the invisible labels which we use in our code, and not visible when reading the web page itself.)
Why don't we just start with labels from 1 to 10 and then add any old number to the end when we need to? Well, there's nothing stopping us. We already know that the labels (the attribute values) don't matter as far as the computer goes. But what we're trying to do here is set things up in a reasonably logical manner which will work for us in long and complex documents. The method described has the virtue of allowing us to keep things such as index items labelled in numerical order.
If we're marking-up items which already have a fixed order then we should use that established order. In the case of chapter headings then the first characters of the label number should be the same as the chapter number (again, for the sake of our sanity). Items preceding "section 1" can be numbered "00" or lettered instead (or use roman numerals such as i, ii, iii, iv, etc.).
