Chapter Numbering out-of-sync

Having trouble installing Oxygen PDF Chemistry? Got a bug to report? Post it all here.
rwmm415
Posts: 3
Joined: Mon May 15, 2023 7:23 pm

Chapter Numbering out-of-sync

Post by rwmm415 »

Hello,

While building a large PDF manual (in Oxy+Chemistry), I am running into an inconsistency in the chapter numbering (described below). We're using Deep-Chapter-Scope numbering. Here's a simplified version of the ditamap. Within the chapters there are topics and subtopics, sometimes several level of subtopics.

Code: Select all

    <frontmatter> </frontmatter>
    <part href="codestructtheory" collection-type="family">
        <chapter href="code_structure.dita"> </chapter>
        <chapter href="system_modeling.dita"> </chapter>
        <chapter href="phenomenology_models.dita"> </chapter>
    </part>
    <part href="subroutines_and_their_functional_requirements.dita">
        <chapter href="introduction.dita"> </chapter>
        <chapter href="subroutines_by_module.dita">	</chapter>
        <chapter href="account_for_grid.dita" chunk="to-content"> </chapter>
		MANY MORE CHAPTERS
    </part>
    MORE PARTS
As this project is configured, chapter numbers appear as the first number in multipart section numbers (e.g. 12.2.7 for a subtopic in chap. 12) and also as the prefix to figure and table numbers (e.g. Table 12-5).

So, the problem is this: The chapter number prefix in the section numbering resets when you reach part #2, as I believe it should. However, the chapter numbers that appear as part of the figure and table numbers do not. So, for example, in the Introduction chapter you will find a subtopic 1.2.7, but the figures and tables will be labeled 4-1, 4-2, 4-3, etc. This off-by-three discrepancy persists for every chapter in part #2. The discrepancy becomes even greater in subsequent parts.

There is nothing in our custom CSS that attempts to reset or change the handling of the built-in counters. I've reviewed the relevant settings (parameters tab) and made a few experiments, but nothing I found so far has changed this behavior.

Can anyone explain what's going on here, or what's wrong with our setup?

Thanks,
Robert Miller
julien_lacour
Posts: 529
Joined: Wed Oct 16, 2019 3:47 pm

Re: Chapter Numbering out-of-sync

Post by julien_lacour »

Hello,

You can add the following rules in your custom CSS stylesheet:

Code: Select all

*[class ~= "map/map"][numbering ^= 'deep-chapter-scope'] *[class ~= "topic/topic"][is-chapter] {
  counter-reset: page 1 chapter section1 tablecount figcount !important;
}

*[class ~= "map/map"][numbering ^= 'deep-chapter-scope'] *[class ~= "topic/topic"] *[class ~= "topic/topic"] *[class ~= "topic/topic"] *[class ~= "topic/table"] > caption > .table--title-label:after {
  content: " " counter(chapter) "-" counter(section1) "-" counter(tablecount) "  ";
}
*[class ~= "map/map"][numbering ^= 'deep-chapter-scope'] *[class ~= "topic/topic"] *[class ~= "topic/topic"] *[class ~= "topic/topic"] *[class ~= "topic/fig"] > figcaption > .fig--title-label:after {
  content: " " counter(chapter) "-" counter(section1) "-" counter(figcount) "  ";
}
The above rules work for Part > Chapter > Topic, if you have figures/images at deeper levels (Part > Chapter > Topic > Subtopic), you need to extend the selectors:

Code: Select all

*[class ~= "map/map"][numbering ^= 'deep-chapter-scope'] *[class ~= "topic/topic"] *[class ~= "topic/topic"] *[class ~= "topic/topic"] *[class ~= "topic/topic"] *[class ~= "topic/table"] > caption > .table--title-label:after {
  content: " " counter(chapter) "-" counter(section1) "-" counter(section2) "-" counter(tablecount) "  ";
}
*[class ~= "map/map"][numbering ^= 'deep-chapter-scope'] *[class ~= "topic/topic"] *[class ~= "topic/topic"] *[class ~= "topic/topic"] *[class ~= "topic/topic"] *[class ~= "topic/fig"] > figcaption > .fig--title-label:after {
  content: " " counter(chapter) "-" counter(section1) "-" counter(section2) "-" counter(figcount) "  ";
}
You can use the same logic for section3 and section4 counters if needed.

Regards,
Julien
Post Reply