On Tue, Jun 07, 2005 at 02:09:43PM +0100, Timwi wrote:
The auto-numbering assumes (quite reasonably) that the
headings are
nested correctly. Garbage in, garbage out.
Couldn't we just add a hack to detect such problems ?
And then do what? As you can see from the above, the software is
*already* trying to do something reasonable given unreasonable input.
Any system you can potentially propose, will have some seemingly
nonsensical output for some pathological case.
The input is not garbage, the assumption that level N section has only level N+1
subsections is broken.
Properties a good numbering system should have, and that current system doesn't,
in order of importance:
1. no duplicates
2. headings should be numbered monotonously
3. is section X is a descendant of Y, X's number should be <Y's
number>.something
Other nice properties are:
4. no numbers should be skipped, if there is 1.2 and 1.4, there should be 1.3
or at least 1.3.something
5. the numbers should not be unnecessarily long, for example this is bad:
= 1
===== 1.1.1.1.1
This gives at least 3 sane options.
Option 1. Treat all direct subsections equally, without considering their level.
This can be easily done in a single pass.
== 1
==== 1.1
==== 1.2
=== 1.3
=== 1.4
==== 1.4.1
Option 2. Add bogus supersections if a section has direct subsections of
different level. Requires some kind of 2-pass processing,
as we don't know if the second heading below should be
1.1, 1.1.1 or 1.1.1.1 before we reach the end.
== 1
==== 1.1.1
==== 1.1.2
=== 1.2
=== 1.3
==== 1.3.1
Option 3. Like 2, but use .0 for such sections, to make them look different.
== 1
==== 1.0.1
==== 1.0.2
=== 1.1
=== 1.2
==== 1.2.1
Are there any problems with those options (especially the easiest option 1) ?
Do they have pathological cases ?
Does the current system produce better results for any single case (no matter how
pathological) ?