Chapter title numbering, counting sections from zero in a specific chapter
Having trouble installing Oxygen PDF Chemistry? Got a bug to report? Post it all here.
-
- Posts: 53
- Joined: Wed Mar 27, 2019 10:12 am
Chapter title numbering, counting sections from zero in a specific chapter
Post by Manohar_1024 »
Hello,
I want to get my chapter title numbers be like
1.1, 1.2, 1.2.1...
2.0, 2.0.1....2.1, 2.1.1
We have 3 chapters but for only 2nd chapter i want to get like 2.0 ...2.0.1 ...like that
I have tried using CSS..
So basically i want to get a 0 in chapter title and that to for 2nd chapter like using (If type condition in CSS way)
I using Pdf with CSS transformation scenario
Thank you,
Manohar.
I want to get my chapter title numbers be like
1.1, 1.2, 1.2.1...
2.0, 2.0.1....2.1, 2.1.1
We have 3 chapters but for only 2nd chapter i want to get like 2.0 ...2.0.1 ...like that
I have tried using CSS..
Code: Select all
*[class ~= "map/map"] {
counter-reset: page 1
section1 0 !important;
*[class ~= "map/map"] *[class ~= "topic/topic"][is-chapter]:not([is-part]) > *[class ~= "topic/topic"] > *[class ~= "topic/title"]:before{
content: counter(chapter) "." counter(section1) ". "!important;
}
*[class ~= "map/map"] *[class ~= "topic/topic"][is-chapter]:not([is-part]) > *[class ~= "topic/topic"] {
counter-increment:section1;
counter-reset:page 1 section2 tablecount figcount !important;
}
I using Pdf with CSS transformation scenario
Thank you,
Manohar.
-
- Posts: 501
- Joined: Mon Feb 03, 2003 10:56 am
Re: Chapter title numbering
This is a very specific requirement.
The solution is to reset the section1 counter to 0 by matching the topic chapter with a specific ID (or outputclass), or the first topic from that chapter.
You need to do this in both the TOC and content counters, so you will need an outputclass set on the topicref as well).
Pay attention to the counter-reset property, it will override other counter reset properties completely, even if you reset just one counter!
To speed up CSS development, please use a browser (like Chrome) to open the merged HTML file and make incremental changes to the CSS (refreshing in browser to see how counters are applied).
Many regards,
Dan
The solution is to reset the section1 counter to 0 by matching the topic chapter with a specific ID (or outputclass), or the first topic from that chapter.
You need to do this in both the TOC and content counters, so you will need an outputclass set on the topicref as well).
Pay attention to the counter-reset property, it will override other counter reset properties completely, even if you reset just one counter!
To speed up CSS development, please use a browser (like Chrome) to open the merged HTML file and make incremental changes to the CSS (refreshing in browser to see how counters are applied).
Many regards,
Dan
-
- Posts: 53
- Joined: Wed Mar 27, 2019 10:12 am
Re: Chapter title numbering
Post by Manohar_1024 »
Hello,
Thanks dan. It is working for chapter titiles. But can u help in getting the same in toc and footers...?
U have already mentioned about giving them in topic ref i have studied some of the oxygen xml links., but i am not able to figure it properly. So can you provide some sample about title numbering for topic ref in toc it will be more helpful for me.
Thankyou,
Manohar
Thanks dan. It is working for chapter titiles. But can u help in getting the same in toc and footers...?
U have already mentioned about giving them in topic ref i have studied some of the oxygen xml links., but i am not able to figure it properly. So can you provide some sample about title numbering for topic ref in toc it will be more helpful for me.
Thankyou,
Manohar
-
- Posts: 501
- Joined: Mon Feb 03, 2003 10:56 am
Re: Chapter title numbering
For the TOC you should see how the counters toc-section1 and toc-chapter-and-sections are used in the p-numbering-deep.css file (similar to section1 and chapter-and-section counters that are used for titles in the main content). The default numbering CSS file is located in:
OXYGEN_INSTALL_DIR/DITAplugins/com.oxygenxml.pdf.css/css/print/p-numbering-deep.css
If you set an outputclass attribute on a topicref in the map, it is copied in the TOC section of the merged map and also on the element of the referred topic, in the main content. In this way you can mark both the topicref and the content of the chapter with special numbering. Let's assume we use 'zero-numbering' for a chapter topicref in the map. Then, you need to cancel incrementation for the first section from the marked chapter.
I would use the following selectors to solve both TOC and content numbering (they affect the headers and footers, bookmarks tree, because the counters are automatically used in all these places)
Try this CSS on several map structures and let us know if it worked.
Many regards,
Dan
OXYGEN_INSTALL_DIR/DITAplugins/com.oxygenxml.pdf.css/css/print/p-numbering-deep.css
If you set an outputclass attribute on a topicref in the map, it is copied in the TOC section of the merged map and also on the element of the referred topic, in the main content. In this way you can mark both the topicref and the content of the chapter with special numbering. Let's assume we use 'zero-numbering' for a chapter topicref in the map. Then, you need to cancel incrementation for the first section from the marked chapter.
I would use the following selectors to solve both TOC and content numbering (they affect the headers and footers, bookmarks tree, because the counters are automatically used in all these places)
Code: Select all
*[class ~= "map/map"][numbering^='deep']
*[class ~= "map/topicref"][is-chapter]:not([is-part])[outputclass ~= 'zero-numbering']
> *[class ~= "map/topicmeta"] + *[class ~= "map/topicref"]{
counter-increment:none;
}
*[class ~= "map/map"][numbering^='deep']
*[class ~= "topic/topic"][is-chapter]:not([is-part])[outputclass ~= 'zero-numbering'] > *[class ~= "topic/topic"] {
counter-increment:none;
}
*[class ~= "map/map"][numbering^='deep']
*[class ~= "topic/topic"][is-chapter]:not([is-part])[outputclass ~= 'zero-numbering'] > *[class ~= "topic/topic"] + *[class ~= "topic/topic"] {
counter-increment:section1 chapter-and-sections;
}
Many regards,
Dan
-
- Posts: 53
- Joined: Wed Mar 27, 2019 10:12 am
Re: Chapter title numbering, counting sections from zero in a specific chapter
Post by Manohar_1024 »
Thanks Dan,
It worked well for the content but TOC remains the same.
For TOC Counters applied are:
As per your code, Counter-increment for TOC given "none" but counter-increment to toc-section1 and toc-chapter-and-sections is not applied.
Can u please share the code for TOC counter-increment alone.
Thanks in Advance
Manohar
It worked well for the content but TOC remains the same.
For TOC Counters applied are:
Code: Select all
/*
* Increment the counters.
*/
*[class ~= "map/map"][numbering^='deep'] *[class ~= "map/topicref"][is-chapter]:not([is-part]) {
counter-increment:toc-chapter toc-chapter-and-sections;
counter-reset: toc-section1;
}
*[class ~= "map/map"][numbering^='deep'] *[class ~= "map/topicref"][is-chapter]:not([is-part]) > *[class ~= "map/topicref"]{
counter-increment:toc-section1 toc-chapter-and-sections;
counter-reset: toc-section2;
}
*[class ~= "map/map"][numbering^='deep'] *[class ~= "map/topicref"][is-chapter]:not([is-part]) > *[class ~= "map/topicref"] > *[class ~= "map/topicref"]{
counter-increment:toc-section2 toc-chapter-and-sections;
counter-reset: toc-section3;
}
/* This starts with 2, the levels nested in the chapter */
*[class ~= "map/map"][numbering^='deep'] *[class ~= "map/topicref"][is-chapter]:not([is-part]) > *[class ~= "map/topicmeta"] + *[class ~= "map/topicref"]{
counter-reset: toc-chapter-and-sections;
}
*[class ~= "map/map"][numbering^='deep'] *[class ~= "map/topicref"][is-chapter]:not([is-part]) > *[class ~= "map/topicref"] > *[class ~= "map/topicmeta"] + *[class ~= "map/topicref"]{
counter-reset: toc-chapter-and-sections;
}
*[class ~= "map/map"][numbering^='deep'] *[class ~= "map/topicref"][is-chapter]:not([is-part]) > *[class ~= "map/topicref"] > *[class ~= "map/topicref"] > *[class ~= "map/topicmeta"] + *[class ~= "map/topicref"]{
counter-reset: toc-chapter-and-sections;
}
Can u please share the code for TOC counter-increment alone.
Thanks in Advance
Manohar
-
- Posts: 501
- Joined: Mon Feb 03, 2003 10:56 am
Re: Chapter title numbering, counting sections from zero in a specific chapter
Hello Manohar,
Could you please send your current customization CSS and a small sample using the form https://www.oxygenxml.com/techSupport.html?
What oXygen are you using right now?
Many regards,
Dan
Could you please send your current customization CSS and a small sample using the form https://www.oxygenxml.com/techSupport.html?
What oXygen are you using right now?
Many regards,
Dan
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ Artificial Intelligence (AI Positron Assistant add-on)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service