Numbering titles

Having trouble installing Oxygen? Got a bug to report? Post it all here.
anna_craneo
Posts: 33
Joined: Tue Feb 20, 2018 2:51 pm

Numbering titles

Post by anna_craneo »

Hi, I have a .ditamap (not a .bookmap) file with several topics and transform it via PDF Chemistry with custom CSS. I want to add numbering to some of them but omit them for other. Being more specific, I would like to skip numbers for my introduction (topicref in the main map), glossary (mapref in the main map), and appendix (topicref in the main map). Is there any way I alter my CSS styles to do so?

For now my styles for counters looks like this:

Code: Select all

/* Reset the counters */
*[class ~= "map/map"] {
counter-reset: page 1 part 0 chapter 0 figcount 0 tablecount 0 examplecount 0;
}

*[class ~= "topic/topic"][is-chapter] > *[class ~= "topic/title"]:before {
content: counter(chapter);
}

*[class ~= "topic/topic"][is-chapter]:not([is-part]) > *[class ~= "topic/title"]:before {
content: counter(chapter)". ";
}
Dan
Posts: 501
Joined: Mon Feb 03, 2003 10:56 am

Re: Numbering titles

Post by Dan »

One technique is to put an outputclass on the topicref elements in the map and on the root of the topics you do not want them numbered. Then in CSS match elements having this outputclass and avoid incrementing counters:

/* Content */
*[class ~= "topic/topic"][is-chapter][outputclass ~= "no-counters"] {
counter-increment:none;
counter-reset: none;
}

*[class ~= "topic/topic"][is-chapter][outputclass ~= "no-counters"] > *[class ~= "topic/title"]:before {
content: none;
}

/* TOC */
*[class ~= "map/topicref"][is-chapter][outputclass ~= "no-counters"] {
display:none;
counter-increment:none;
counter-reset: none;
}
*[class ~= "map/topicref"][is-chapter][outputclass ~= "no-counters"] > *[class ~= "map/topicmeta"] > *[class ~= "topic/navtitle"]:before{
content:none;
}
Post Reply