toc numbering alignment issue for two digit numbers

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

toc numbering alignment issue for two digit numbers

Post by dpksaini89 » Fri Apr 27, 2018 9:28 am

Hi,

The toc numbering is fine till one digit no. only. When a two digit no. appears the heading shift to next line.

Please help.
Image

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

Re: toc numbering alignment issue for two digit numbers

Post by Costin » Fri Apr 27, 2018 12:08 pm

Hello,

What specific version and build of oXygen are you using? You can find this information in the Help > About dialog.
Are you trying to output PDF using the default DITA Map PDF - WYSIWYG transformation scenario, or a custom scenario?
Also, what DITA OT are you using? The default one that comes bundled with oXygen, or an external one? You can check what DITA OT is in use in the oXygen menu Options > Preferences >DITA.

Please try using the default DITA Map PDF - WYSIWYG transformation scenario, clean of any changes, with the default (Built-in) DITA OT in oXygen and see if this issue still occurs. If it does, please send us a screenshot to our support email address (support@oxygenxml.com).

Regards,
Costin
Costin Sandoi
oXygen XML Editor and Author Support

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

Re: toc numbering alignment issue for two digit numbers

Post by dpksaini89 » Fri Apr 27, 2018 3:42 pm

<oXygen/> XML Editor 20.0, build 2018031511
yes using custom.css
chemistry for css rendering
Built-in DITA-OT 2.X

In my custom.css, I am using following code, please check if this is due to below mentioned code that it is behaving like this.

Code: Select all

/*
* Showing the counters before the titles from TOC.
*/
*[class ~= "map/topicref"][is-chapter] > *[class ~= "map/topicmeta"]:before {
content: counter(toc-chapter);
}

*[class ~= "map/topicref"][is-chapter] > *[class ~= "map/topicref"] > *[class ~= "map/topicmeta"]:before {
content: counter(toc-chapter) "." counter(toc-section1);
}

*[class ~= "map/topicref"][is-chapter] > *[class ~= "map/topicref"] > *[class ~= "map/topicref"] > *[class ~= "map/topicmeta"]:before {
content: counter(toc-chapter) "." counter(toc-section1) "." counter(toc-section2);
}


/*
* Make the long titles wrap, but not under the numbering
*/
*[class ~= "map/topicref"][is-chapter] *[class ~= "topic/navtitle"] {
display: inline-block;
margin: 0;
padding: 0 !important;
}

*[class ~= "map/topicref"][is-chapter] > *[class ~= "map/topicmeta"] > *[class ~= "topic/navtitle"] {
width: 98%;
}

*[class ~= "map/topicref"][is-chapter] > *[class ~= "map/topicref"] > *[class ~= "map/topicmeta"] > *[class ~= "topic/navtitle"] {
width: 96%;
}

[class ~= "map/topicref"][is-chapter] > *[class ~= "map/topicref"] > *[class ~= "map/topicref"] > *[class ~= "map/topicmeta"] > *[class ~= "topic/navtitle"] {
width: 95%;
}


/* Remove the basic CSS "Counter" prefix */
*[class ~= "map/topicref"][is-chapter] > *[class ~= "map/topicmeta"] > *[class ~= "topic/navtitle"]:before,
*[class ~= "map/topicref"][is-chapter] > *[class ~= "map/topicmeta"] > *[class ~= "map/linktext"]:before {
content:none !important;
}

/*
* =======================================
* Numbering of the titles from the content.
*/

/*
* Increment the counters.
*/

*[class ~= "topic/topic"][is-chapter] {
counter-increment: chapter;
counter-reset:section1;
}

*[class ~= "topic/topic"][is-chapter] > *[class ~= "topic/topic"] {
counter-increment:section1;
counter-reset:section2;
}

*[class ~= "topic/topic"][is-chapter] > *[class ~= "topic/topic"] > *[class ~= "topic/topic"] {
counter-increment:section2;
counter-reset:section3;
}

*[class ~= "topic/topic"][is-chapter] > *[class ~= "topic/topic"] > *[class ~= "topic/topic"] > *[class ~= "topic/topic"] {
counter-increment:section3;
counter-reset:section4;
}

/*
* Alter the string sets that are shown in the headers.
*/
*[class ~= "topic/topic"][is-chapter]:not([is-part]) > *[class ~= "topic/title"]{
string-set: chaptertitle " | " counter(chapter) " " content();
}

*[class ~= "topic/topic"][is-chapter]:not([is-part]) > *[class ~= "topic/topic"] > *[class ~= "topic/title"] {
string-set: sectiontitle " | " counter(chapter) "." counter(section1) " " content();
}

/*
* Use the chapter and section numbers in front of titles.
*/
*[class ~= "topic/topic"][is-chapter] > *[class ~= "topic/title"]:before{
content: counter(chapter) " ";
}
*[class ~= "topic/topic"][is-chapter] > *[class ~= "topic/topic"] > *[class ~= "topic/title"]:before{
content: counter(chapter) "." counter(section1) " ";
}
*[class ~= "topic/topic"][is-chapter] > *[class ~= "topic/topic"] > *[class ~= "topic/topic"] > *[class ~= "topic/title"]:before{
content: counter(chapter) "." counter(section1) "." counter(section2) " ";
}
Image

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

Re: toc numbering alignment issue for two digit numbers

Post by Costin » Wed May 02, 2018 4:02 pm

Hi,

I could reproduce the issue (line break after the number in TOC for numbers higher than 10), using your CSS set in the "args.css" parameter for the DITA Map WYSIWYG transformation scenario.
So I can confirm that the issue lays somewhere in the CSS rules you have in your CSS file.

However, there is a "Numbering" section in the DITA-OT CSS Publishing to PDF Plugin User-Guide, so you should consider that as a starting point when you develop the custom css.

Regards,
Costin
Costin Sandoi
oXygen XML Editor and Author Support

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

Re: toc numbering alignment issue for two digit numbers

Post by dpksaini89 » Tue Jun 12, 2018 2:19 pm

Still it is not perfect.
Image
Kindly help in resolving this issue.
I had to change the page margins for my recent document delivery, cannot decrease the margin further.

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

Re: toc numbering alignment issue for two digit numbers

Post by dpksaini89 » Tue Jun 12, 2018 2:20 pm

Can we also remove numbering before "Chapter X" numbering that is not required.

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

Re: toc numbering alignment issue for two digit numbers

Post by Costin » Tue Jun 12, 2018 4:00 pm

Hi,

After we took a second look over the CSS snippet you provided in a previous post, it looks that you either copied the rules from an older forum thread, or might be still using an older version of oXygen.
That's because we changed the structure of the "p-optional-numbering-deep.css", so now many of the old rules we had in the previous version were changed, specifically to avoid wrapping in TOC numbering under special circumstances.

Therefore, you should either try using the latest version of oXygen XML available from the Downloads section on our website (in case you have a v20 compatible license key), or, in case you want/need to stick with a previous oXygen version, you should try using the rules for deep numbering - which are even the rules we have now in the actual p-optional-numbering-deep.css CSS file, in your customization.css file.
You should pay special attention to the table of contents numbering part in the CSS:

Code: Select all

*[class ~= "map/topicref"] {
position:relative;
}

*[class ~= "map/topicref"] > *[class ~= "map/topicmeta"]:before {
display:block;
position:absolute; /* If the TOC item is wrapping, it won't wrap under the numbering. */
top:0.4em; /* This aligns the before with the TOC item text. */
}

*[class ~= "map/topicref"][is-part] > *[class ~= "map/topicmeta"]:before {
left: -1.5em; /* Increase the value of width and left as the depth increases. */
width:1em;
}
*[class ~= "map/topicref"][is-chapter]:not([is-part]) > *[class ~= "map/topicmeta"]:before {
left: -1.5em;
width:1em;
}
*[class ~= "map/topicref"][is-chapter]:not([is-part]) > *[class ~= "map/topicref"] > *[class ~= "map/topicmeta"]:before {
left: -2em;
width:2em;
}
*[class ~= "map/topicref"][is-chapter]:not([is-part]) > *[class ~= "map/topicref"] > *[class ~= "map/topicref"] > *[class ~= "map/topicmeta"]:before {
left: -2.5em;
width:2.5em;
}
Another thing you should do, if you use deep numbering, is to override the built-in CSS rule that come from p-numbering-shallow.css, in order to remove the "Chapter x" labels before the navigation titles in the TOC. This way you will avoid duplicate numbering in the table of contents.
Specifically, in your customization.css the following rule should be also added:

Code: Select all

*[class ~= "map/topicref"][is-chapter]:not([is-part]) > *[class ~= "map/topicmeta"] > *[class ~= "topic/navtitle"]:before{
content:none !important;
}
Costin Sandoi
oXygen XML Editor and Author Support

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

Re: toc numbering alignment issue for two digit numbers

Post by dpksaini89 » Wed Jun 13, 2018 9:20 am

Hi Costin,

thanks for reply, but it is confusing for me to understand you completely.

Kindly clearly state which lines of code in my custom.css needs to be replaced and with what code.

I am not used to the coding part of css. Please instruct in simple and straightforward.

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

Re: toc numbering alignment issue for two digit numbers

Post by dpksaini89 » Mon Jul 02, 2018 2:57 pm

the above css customization code has removed level 2 and 3 headings along with 'Chapter X' text to be removed.
Image

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

Re: toc numbering alignment issue for two digit numbers

Post by Costin » Mon Jul 02, 2018 3:48 pm

Hi dpksaini8,

Do you have an oXygen license, or are you using a trial?
As I suggested, have you tried using oXygen XML v20 and see if numbering works fine?

Is there a specific reason for which you need to stick with an older version (like an incompatible license key, in case you have a commercial license)?
If it is, one thing you should try is to use deep numbering, instead of shallow numbering.

Exactly, you should go into Oxygen_install_dir\frameworks\dita\DITA-OT2.x\plugins\com.oxygenxml.pdf.css\css\print and edit the "p-dita.css".
If you have installed oXygen in a location where you do not have write permissions, you should first copy the CSS file to desktop for editing.
You should just comment the line with the import of the CSS controlling shallow numbering "@import 'p-numbering-shallow.css" and uncomment the line with the import of the CSS controlling deep numbering (@import 'p-optional-numbering-deep.css';)
Then, you should just save the modified file and copy it into the css folder from the above mentioned location, replacing the original file already present there.
This will activate deep numbering by default.

If neither this helps, you might use CSS rules incorrectly in your customization .css file. We could try to have a look at it for you, but we would need you to send us both the specific DITA Map and the css source files to investigate.

Regards,
Costin
Costin Sandoi
oXygen XML Editor and Author Support

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

Re: toc numbering alignment issue for two digit numbers

Post by Costin » Mon Jul 02, 2018 5:43 pm

I tested again the deep numbering behavior, using oXygen XML v20.1 (and even an older version - v20.0, build 2018042410 - however, you seem to be using even an older one) and a custom .css file that enables deep numbering, as per the instructions in this page from the User-Guide and all worked OK.
Therefore I have an easier - and safe solution for you.

Please use a clean (new) .css file (drop the one you are currently using and which contains wrong CSS rules). Just create a clean custom.css file.
All you have to do is just copy the "p-optional-numbering-deep.css" in the same location where you have your newly created custom CSS, then import it (in your clean CSS add

Code: Select all

@import 'p-optional-numbering-deep.css
) and add also the lines:

Code: Select all

/* To hide the "Chapter NN." labels */
*[class ~= "map/topicref"][is-chapter]:not([is-part]) > *[class ~= "map/topicmeta"] > *[class ~= "topic/navtitle"]:before{
content:none !important;
}
in order to avoid double numbering in the TOC.
You do not need to add any other rules (we are just explaining in detail what each of the rules already present in the "p-optional-numbering-deep.css" is used for, but as you import the whole.css file, there is no need to also add them) - your customization CSS should contain only the import line and the rule that avoids double numbering.

Let me know if this works.

Regards,
Costin
Costin Sandoi
oXygen XML Editor and Author Support

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

Re: toc numbering alignment issue for two digit numbers

Post by dpksaini89 » Tue Jul 03, 2018 2:10 pm

Hi I am using <oXygen/> XML Editor 20.1, build 2018061313 licenced version.
What i did -
1. Updated my Oxygen software to latest available on your site.
2. Edited the "p-dita.css".
3. Un-commented - @import 'p-optional-numbering-deep.css and commented - @import 'p-numbering-shallow.css.
4. Applied the transformation scenerio - WYSIWYG
5. The TOC still does not include the level 2 and 3 items. Even the chapters does not provide heading to level 2 and 3 topics.
Image
Image

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

Re: toc numbering alignment issue for two digit numbers

Post by Costin » Tue Jul 03, 2018 2:19 pm

Please undo the changes performed to the "p-dita.css" (comment "@import 'p-optional-numbering-deep.css" and uncomment "@import 'p-numbering-shallow.css"), save the changes, then try the easy solution I provided in my last post.
Please use a clean (new) .css file (drop the one you are currently using and which contains wrong CSS rules). Just create a clean custom.css file.
All you have to do is just copy the "p-optional-numbering-deep.css" in the same location where you have your newly created custom CSS, then import it in your clean CSS add

Code: Select all

@import 'p-optional-numbering-deep.css
and add also the lines:

Code: Select all

/* To hide the "Chapter NN." labels */
*[class ~= "map/topicref"][is-chapter]:not([is-part]) > *[class ~= "map/topicmeta"] > *[class ~= "topic/navtitle"]:before{
content:none !important;
}
in order to avoid double numbering in the TOC.

You do not need to add any other rules (we are just explaining in detail what each of the rules already present in the "p-optional-numbering-deep.css" is used for, but as you import the whole.css file, there is no need to also add them) - your customization CSS should contain only the import line and the rule that avoids double numbering.
I tested this and it should work.
Costin Sandoi
oXygen XML Editor and Author Support

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

Re: toc numbering alignment issue for two digit numbers

Post by dpksaini89 » Wed Jul 04, 2018 9:16 am

Did what you said, copy and pasted the deep.css file in the same folder as the custom.css and while pasting the import statement in new custom.css file it is showing following error:
Image

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

Re: toc numbering alignment issue for two digit numbers

Post by Costin » Wed Jul 04, 2018 9:41 am

When I pasted lines, it seems I made a typo and omitted the last part "';" of the import. Sorry for that.
The closing single quote is missing at the import, as well as the semicolon, always needed to separate CSS rules.

The correct CSS should look like:

Code: Select all

@import 'p-optional-numbering-deep.css';

/* To hide the "Chapter NN." labels */
*[class ~= "map/topicref"][is-chapter]:not([is-part]) > *[class ~= "map/topicmeta"] > *[class ~= "topic/navtitle"]:before{
content:none !important;
}
Costin Sandoi
oXygen XML Editor and Author Support

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

Re: toc numbering alignment issue for two digit numbers

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

Still same error.
Image

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

Re: toc numbering alignment issue for two digit numbers

Post by Costin » Wed Jul 04, 2018 3:06 pm

From your screenshot, I noticed you inserted the import at line 111 (instead of line 1), so I guess you have other CSS rules before it, which is wrong.
Also the error clearly reads:
"@import are not allowed after any" valid statement..." so it is self-descriptive.
I'm afraid I can not help you if you are not following my advice.
Please use a clean (new) .css file
I just sent the correct .css file (containing only the 2 statements) to your email address so you must use that specific .css file as-is (without adding any other rules).
I used the "taskbook.ditamap" bookmap from the sample project in <oXygen/> XML Editor 20.1, build 2018061313 to test the DITA Map PDF - Based on DITA and CSS, using this custom.css file and you can see in the below screenshot that the deep numbering works correctly in the PDF output.

Image

Exact steps to follow:
- install a clean oXygen XML v20.1 (clear of any changes)
- open in the DITA Maps Manager view the "taskbook.ditamap" bookmap from the "it-book" sample dita folder from oXygen's sample project (to test if it works correctly)
- go into the "Configure Transformation Scenario(s)" dialog and duplicate the predefined "DITA Map PDF - Based on DITA and CSS (WYSIWYG)" available in the transformation scenarios list, then edit the copy.
- go into the "Parameters" tab and enable the args.css parameter. As its value, browse for the "custom.css" file that I provided you by email, then apply the changes -> OK.
- apply the custom transformation scenario that you have just created at previous steps. Does the deep numbering work correctly?
If it does, try applying the same transformation scenario on your bookmap.

If the issue still persists even if you follow the exact above steps, I'm afraid I could not help you much, as this could be most probably related to your own customization, (be it a custom CSS of yours, modified DITA-OT files, or any other specific setup), not an oXygen functionality issue.

Please note that we can only provide support for oXygen products functionality issues, but we do not offer training, consultancy or customization services. There is a list of companies that could provide such services in the Partners section from our website so you should feel free to contact the one of your choice if you decide so.
Costin Sandoi
oXygen XML Editor and Author Support

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

Re: toc numbering alignment issue for two digit numbers

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

Thanks it worked fine when moved to first line of the custom.css.
Apologies, but one more help needed in this regard.
Is it possible to get TOC as shown below:
CHAPTER 1: ABC
1.1 Abc
1.1.1 Abc
CHAPTER 2: XYZ
2.1 Xyz
2.1.1 Xyz

Where to find resources for customizing the TOC as per our need.

Thanks for support

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

Re: toc numbering alignment issue for two digit numbers

Post by Radu » Tue Jul 10, 2018 2:47 pm

Hi,

You can probably try to replace the selector:

Code: Select all

*[class ~= "map/topicref"][is-chapter]:not([is-part]) > *[class ~= "map/topicmeta"] > *[class ~= "topic/navtitle"]:before{
content:none !important;
}
with:

Code: Select all

*[class ~= "map/topicref"][is-chapter]:not([is-part]) > *[class ~= "map/topicmeta"] > *[class ~= "topic/navtitle"]:before{
content:"Chapter: " !important;
display:inline !important;
}
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com

Post Reply