Page 1 of 1

Numbering titles

Posted: Thu May 17, 2018 10:44 am
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)". ";
}

Re: Numbering titles

Posted: Thu May 17, 2018 3:42 pm
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;
}