Page 1 of 1
How to remove last dot after chapter and section number in TOC and titles?
Posted: Wed Jun 08, 2022 5:05 pm
by tanja
Hello,
I am using Oxygen XML Editor version 24.1 and a customized version of the 'DITA Map PDF - based on HTML5 & CSS' publishing template to generate my PDFs. The args.css.param.numbering parameter is set to 'deep'.
The TOC currently looks like this:
Code: Select all
1. First level topic
1.1. Second level topic
I would like to not have the last dot, like this:
Code: Select all
1 First level topic
1.1 Second level topic
The same goes for the titles in the actual content, where I would also like to remove the last dot.
I assume this is a CSS customization and tried to adapt the rules I found in your documentation:
https://www.oxygenxml.com/doc/versions/ ... tents.html like this for the TOC entries:
Code: Select all
*[class ~= "map/topicref"] *[class ~= "topic/navtitle"]:before {
content: counters(toc-chapter-and-sections, ".") " ";
}
This does not work, though. The dots are still displayed. Can you give me a hint regarding the correct CSS rule to use?
Thanks and best regards,
Tanja
Re: How to remove last dot after chapter and section number in TOC and titles?
Posted: Wed Jun 08, 2022 10:01 pm
by chrispitude
Hi Tanja,
Try inspecting the list item in your browser, as described here:
https://www.oxygenxml.com/doc/versions/ ... wl_jwq_5cb
(Most browsers have an inspector feature, but I've found Chrome's inspector to be the most useful.)
For the list item markers, take a look at both the HTML elements and containers and the CSS rules that apply to them. Note that the CSS rules also indicate which file they come from, which helps you know if rules from your custom CSS file are being applied.
Please let me know if this helps. If not, I'll make a small testcase and have a look too.
(Also, note that there is a section of the forum dedicated to PDF Chemistry here -
common-problems-f26/)
Re: How to remove last dot after chapter and section number in TOC and titles?
Posted: Thu Jun 09, 2022 4:31 pm
by julien_lacour
Hello Tanja,
You were really close to the solution, try to use the following rules, they must change the numbering as expected:
Code: Select all
*[class ~= "map/map"][numbering ^= 'deep'] *[class ~= "map/topicref"][is-chapter]:not([is-part]) > *[class ~= "map/topicmeta"]:before,
*[class ~= "map/map"][numbering ^= 'deep'] *[class ~= "map/topicref"][is-chapter]:not([is-part]) > *[class ~= "map/topicref"] > *[class ~= "map/topicmeta"]:before,
*[class ~= "map/map"][numbering ^= 'deep'] *[class ~= "map/topicref"][is-chapter]:not([is-part]) > *[class ~= "map/topicref"] > *[class ~= "map/topicref"] > *[class ~= "map/topicmeta"]:before,
*[class ~= "map/map"][numbering ^= 'deep'] *[class ~= "map/topicref"][is-chapter]:not([is-part]) > *[class ~= "map/topicref"] > *[class ~= "map/topicref"] > *[class ~= "map/topicref"] > *[class ~= "map/topicmeta"]:before {
content: counters(toc-chapter-and-sections, ".") " ";
}
*[class ~= "map/map"][numbering ^= 'deep'] *[class ~= "topic/topic"][is-chapter]:not([is-part]) > *[class ~= "topic/title"]:before,
*[class ~= "map/map"][numbering ^= 'deep'] *[class ~= "topic/topic"][is-chapter]:not([is-part]) *[class ~= "topic/topic"] > *[class ~= "topic/title"]:before {
content: counters(chapter-and-sections, ".") " ";
}
The first rule applied on Table of Contents elements and the second one applied on the rest of the content.
Regards,
Julien
Re: How to remove last dot after chapter and section number in TOC and titles?
Posted: Thu Jun 09, 2022 4:32 pm
by julien_lacour
A smaller variant consists in using the "!important" rule, like this:
Code: Select all
*[class ~= "map/topicref"] > *[class ~= "map/topicmeta"]:before {
content: counters(toc-chapter-and-sections, ".") " " !important;
}
*[class ~= "topic/topic"] > *[class ~= "topic/title"]:before {
content: counters(chapter-and-sections, ".") " " !important;
}
Same as before, first rule is for TOC, second for the rest of the content.
Regards,
Julien
Re: How to remove last dot after chapter and section number in TOC and titles?
Posted: Fri Jun 10, 2022 5:40 pm
by tanja
Hi Julien,
The smaller variant worked like a charm

Thanks a ton for following up on that one. Great support, as always!
Best regards,
Tanja