Avoid Chapter numbering of some topics

dpksaini89
Posts: 59
Joined: Thu Feb 08, 2018 2:44 pm

Avoid Chapter numbering of some topics

Post by dpksaini89 » Wed Jul 04, 2018 1:53 pm

In the user manual, I do not wish to count topics such as Acronyms, Glossary, About Us, Admonishments Used, General Safety Instructions as Chapters.
Ideally the above named topics should be present after TOC and before actual Chapters start from System Overview.
Kindly suggest how can we achieve this.
Image

Costin
Posts: 543
Joined: Mon Dec 05, 2011 6:04 pm

Re: Avoid Chapter numbering of some topics

Post by Costin » Thu Jul 05, 2018 11:38 am

As your document contains chapters, I suppose you are using a Bookmap specialization, not a general DITA Map.
If you aren't using it already, then it is recommended to work on a Bookmap.

You could set the toc="no" attribute on the specific topics you want to hide from the TOC.
However, as this would just hide them from the table of contents, they will still appear in the bookmarks view.
That's is why more complex customization is required for your use-case.

Besides the toc="no" attribute, you should also set a custom outputclass attribute on those specific topics.
In your custom .css, you could then filter the topics by the specific outputclass name you would set (the outputclass will actually translate in a "class" attribute in the HTML output), then apply additional rules only on those topics, to also hide them from bookmarks and omit them from chapter counting in your PDF.

More exactly, on each of the source topics you need to hide from TOC/bookmarks, you should set the attributes: toc="no" and outputclass="hide-bm-labels", then add the below rules in your custom CSS (the rules also make the bookmarks counter disconsider those topics):

Code: Select all

/* Remove the labels from the bookmarks view */
*[class~="topic/topic"][outputclass ~= "hide-bm-labels"] *[class~="topic/title"] {
bookmark-label:none;
}
/* Make sure the chapter counter is not altered by these topics */
*[class ~= "topic/topic"][outputclass ~= "hide-bm-labels"] {
counter-increment:none !important;
}
/* No Chapter NN before the titles of these topics in the main content. */
*[class ~= "topic/topic"][outputclass ~= "hide-bm-labels"] *[class ~= "topic/title"]:before {
content: none !important;
}
/* No Chapter NN in the page headings for these topics. */
*[class ~= "topic/topic"][outputclass ~= "hide-bm-labels"] *[class ~= "topic/title"] {
string-set: chaptertitle content();
}
Regarding the position where they would appear in the output, they can only be displayed in the order they appear in your bookmap.
If you need them to appear in a specific place, you should move their corresponding topicrefs in that specific position in your map.
Costin Sandoi
oXygen XML Editor and Author Support

dpksaini89
Posts: 59
Joined: Thu Feb 08, 2018 2:44 pm

Re: Avoid Chapter numbering of some topics

Post by dpksaini89 » Fri Jul 06, 2018 10:36 am

I am a newbie, please bear with me.
But how to create Bookmap, How is it different from Ditamap. How to decide which is apt for our requirement.
Can you direct me to right resources in this regard.

Can my requirement be catered through front matter? What is front matter and how does it output look like.

Radu
Posts: 6179
Joined: Fri Jul 09, 2004 5:18 pm

Re: Avoid Chapter numbering of some topics

Post by Radu » Fri Jul 06, 2018 11:49 am

Hi,

If you have parts in your PDF output that you consider to be "chapter"'s then indeed you should probably use a DITA bookmap because a bookmap is more oriented towards book-like publications, it contains various specific DITA elements like front-matter, backmatter, index and so on..
The DITA 1.3 specification showing what a bookmap is:

https://www.oxygenxml.com/dita/1.3/spec ... okmap.html

and a link to the Oxygen user's manual about creating a bookmap:

https://www.oxygenxml.com/doc/versions/ ... k-map.html

The frontmatter is the part of the book which comes before the actual book contents:

https://www.oxygenxml.com/dita/1.3/spec ... atter.html

The front matter usually has a structure like this:

Code: Select all

  <frontmatter>
<booklists>
<toc/>
</booklists>
<bookabstract href="MyBookAbstract.dita"/>
<preface href="preface.dita"></preface>
</frontmatter>
The <toc> element specifies where the table of contents will appear, you can for example move the reference to the preface before the table of contents.
There is also a bookmap example in the OXYGEN_INSTALL_DIR\samples\dita\it-book\taskbook.ditamap which you can analyze.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com

paulkhillier
Posts: 13
Joined: Wed Jun 27, 2018 12:44 am

Re: Avoid Chapter numbering of some topics

Post by paulkhillier » Tue Jul 10, 2018 9:05 pm

Hello,

I am in the midst of customizing our CSS and used the following methods to hide labels from Body/TOC/PDF Bookmarks:

Code: Select all


/* Hide Part and Chapter Label/Number */

*[class ~= "topic/topic"] > *[class ~= "topic/title"]:before {
display:none;
}

/* Hide Figure and Table Label/Number */

*[class ~= "topic/table"] > *[class ~= "topic/title"]:before {
display:none;
}

*[class~="topic/fig"] > *[class~="topic/title"]:before {
display:none;

/* Hide Table of Contents Label/Number */

*[class ~= "map/topicmeta"] > *[class ~= "topic/navtitle"]:before {
display:none !important;
}
Hope this helps, these forums are great.

Cheers,

Paul Hillier

Stanislav
Posts: 10
Joined: Thu Aug 30, 2018 7:25 pm

Re: Avoid Chapter numbering of some topics

Post by Stanislav » Tue Sep 11, 2018 1:54 pm

How i can to remove only the "chapter" word and leave the chapter numbering.

Dan
Posts: 385
Joined: Mon Feb 03, 2003 10:56 am

Re: Avoid Chapter numbering of some topics

Post by Dan » Wed Sep 12, 2018 11:53 am

Hello Stanislav,

Please check this topic from the urser-guide: https://www.oxygenxml.com/doc/versions/ ... ntent.html

Many regards,
Dan

Stanislav
Posts: 10
Joined: Thu Aug 30, 2018 7:25 pm

Re: Avoid Chapter numbering of some topics

Post by Stanislav » Fri Sep 14, 2018 3:00 pm

Hello Dan.
This example does not work. The word Chapter is not removed

Dan
Posts: 385
Joined: Mon Feb 03, 2003 10:56 am

Re: Avoid Chapter numbering of some topics

Post by Dan » Mon Sep 17, 2018 10:27 am

Can you send us your CSS to our support email address?
Thank you, Dan

Post Reply