Hierarchical numbering in titles not incrementing correctly

I would like to use hierarchical numbering to number my chapters and subsections. However, I also need to number tables and figures with a chapter number prefix, e.g. so that the first table in chapter 2 would be Table 2.1.

As far as I can tell, that isn’t possible using the <$hn> or equivalent tags, so I tried using the approach suggested in the topic “Automatic hierarchical section title numbering in compile” (I’m not allowed to link to this, for some reason).

As I have a maximum of 4 levels, that means I use the following tags per level:

level 0 = <$n:chapter> TITLE <$rst_level1>
level 1 = <$n#chapter>.<$n:level1> TITLE <$rst_level2>
level 2 = <$n#chapter>.<$n#level1>.<$n:level2> TITLE <$rst_level3>
level 3 = <$n#chapter>.<$n#level1>.<$n#level2>.<$n:level3> TITLE

This works fine for each level other than level 3. For some reason, level 3 does not increment properly (see image from Word):

(for some reason I’m neither allowed to upload an image nor include a link, but if you remove the spaces from this url it should work.)
https:// imgur. com/a/PSU21rp

For some reason, the level 3 increments only work correctly for the sublevels of 1.3.2. I really don’t understand what could be causing this issue, or why it works correctly in that one case. As you can see from the screenshot, the other formatting of the titles is correct. And as far as I can tell, I’m doing the exact same thing for the hierarchical numbering for each of the different levels, so it’s strange that it only messes up for level 3.

Does anyone have any idea as to what I might be missing here? Thanks!

I’m wondering if you only have content in your Binder outline for level 3 in 1.3.2?
I see no issues with your tags per level.

I do have content in all of the levels, so unfortunately that can’t be it, but thanks for the suggestion.

I also checked whether perhaps it was an issue of folders vs files, but I checked and I consistently use folders for anything that has subdocuments, and files for anything that does not.

When I remove the <$rst_level3> tag from the title in level 2, the level 3 numbers do keep incrementing. Of course they don’t reset at all in that case though, so the numbering is completely wrong. But this makes it seem like most of the level 3 documents are all counted as being in separate level 2 documents, if you know what I mean.

When I add extra documents to any of the level 2 folders, some of those extra documents suddenly do get incremented correctly. However, I don’t really see any logic behind when they do or do not. For example, I added four new documents to 1.2.1. Those four are incremented correctly, but the original 2 are not. It doesn’t seem to matter what is in the level 3 files though, because if I move the two original files below the four new test files, those get incremented correctly. It just seems like the first two files don’t increment correctly, regardless of what those files are.

However, it actually gets more confusing, because adding those test files also changed the hierarchical numbering in the next folder! The files in 1.2.2 now also increment correctly. So I don’t understand anything about this logic, because those are in a different folder altogether and should be completely unaffected…

P.s. does anyone know why I’m not allowed to embed images? I feel like this would be a bit easier to explain with images, and it doesn’t seem like i’m supposed to link to external sites either.

To prevent spammers from establishing accounts and then spamming us/filling up the forum database, new accounts (and imported accounts from the old forums) have to establish themselves first. You may need to read a few other threads in various forums, as this description of the “Basic” badge I received… last September? (has this forum upgrade existed that long already!?):

Basic

This badge is granted when you reach trust level 1. Thanks for sticking around and reading a few topics to learn what our community is about. New user restrictions have been lifted; you’ve been granted all essential community abilities, such as personal messaging, flagging, wiki editing, and the ability to post multiple images and links.

As for your issue… how/where are you assigning these numbering tags? In a custom compile format? Directly in the text of your documents, or in the titles of your documents?

Are the document type assignments consistent with how you expect the hierarchy of your documents to work?

Could you reproduce the indentation of your binder items (if they’re supposed to reflect your hierarchy) using asterisks + 3 spaces per level, as below? Your image shows what appears to be a compiled output, but that outline could be a single document in your project, with your custom tags distributed all over, or it could be a compile layout that’s supposed to mirror the hierarchy of the binder, or it could be something else entirely.

  • Level 1
    • Level 2
    • Level 2
      • Level 3
  • Level 1
    • Level 2

This sounds to me a lot like a previously reported bug. Can you check and see if your context matches the criteria described there?

By the way, it should in theory be possible to test placeholder solutions in any context. You shouldn’t normally have to “debug” problems with your setup in compile settings, but can test them in a simple single-document project. For example, I can demonstrate the bug with the attached. Note how the first binder section fails to increment properly, while the second works.

placeholder_bug.zip (130.0 KB)

If you get a setup working in the text editor, but then they start to fail in direct implementation with the compiler, it helps to know that at least it’s not the placeholder solution at fault.

2 Likes

Thank you AmberV, I was able to solve it after taking a look at the example project that you posted! It was indeed similar to that bug in the thread that you linked, in that whenever a level 2 section was compiled with no subsections, the resets were “buffered” until it got to a level 3 subsection.

I fixed it now by making two new section types “level 1 no subsection” and “level 2 no subsection” which do not have a reset tag for their sublevel. Because I already used folders for anything containing further documents, and files for anything that didn’t, I can now also immediatlly automatically apply these new section types to level 1 and 2 files.

@Rdale thank you as well. Just for future reference, I’m assigning the tags in a custom compile format, and the document ytpe assignments were consistent with how I expected the hierarchy of my documents to work. The bug was caused by having level 2 sections with no subsections which led to a kind of “buffering” of the reset tag for level 3.

1 Like