matter-page page counter

Having trouble installing Oxygen PDF Chemistry? Got a bug to report? Post it all here.
aabuan123
Posts: 7
Joined: Tue Jun 25, 2019 10:30 pm

matter-page page counter

Post by aabuan123 »

Hi!

I can't figure out how to continue the page count from the table of contents to the matter-page. The page number resets to 1 in the matter-page but I need it to increment from the last page count of the table of contents. I also need to reset the page count for the very first chapter but could not make it work. Please help.

@page matter-page {
counter-reset: none !important;
}

@page chapter:first {
counter-reset: page !important;
counter-increment: page 1 !important;
}
Costin
Posts: 833
Joined: Mon Dec 05, 2011 6:04 pm

Re: matter-page page counter

Post by Costin »

Hi Alicia,

In your customization CSS, you should overwrite the rules that come from the predefined CSS files that control numbering and content for specific named pages.

More specific, the numbering CSS files are available in Oxygen_install_dir\frameworks\dita\DITA-OT3.x\plugins\com.oxygenxml.pdf.css\css\print and their name starts with "p-numbering".
The header content for different page types is styled through "p-pages-and-headers.css", available in the same location.

For example, if you are using shallow numbering, you could use something like:

Code: Select all

*[class ~= "map/map"] > *[class ~= "toc/toc"] + *[class ~= "topic/topic"]{
    counter-reset: none !important;
}

@page matter-page:left {
    @top-left {
    content: string(maptitle) string(parttitle) string(chaptertitle) string(sectiontitle) " | " counter(page);
    }
}
@page matter-page:right {
    @top-right {
    content: string(maptitle) string(parttitle) string(chaptertitle) string(sectiontitle) " | " counter(page);
    }
}

*[class~="topic/topic"][outputclass ~= "pageReset"]{
    counter-reset:page 1;
    counter-increment:chapter;
}
At anytime, you could use your internet browser's CSS inspector tool to better notice which rules apply and from which CSS they come, so that you could overwrite them in your customization CSS, as described in the Debugging the CSS section from the User-Guide.

Regards,
Costin
Costin Sandoi
oXygen XML Editor and Author Support
Costin
Posts: 833
Joined: Mon Dec 05, 2011 6:04 pm

Re: matter-page page counter

Post by Costin »

I forgot to mention that, in order for the selector

Code: Select all

*[class~="topic/topic"][outputclass ~= "pageReset"]
to work, in case you didn't figured it out yourself already, you should first set the outputclass="pageReset" to the topicref element from the DITA Map, corresponding to the very 1st Chapter in your publication.

Regards,
Costin
Costin Sandoi
oXygen XML Editor and Author Support
aabuan123
Posts: 7
Joined: Tue Jun 25, 2019 10:30 pm

Re: matter-page page counter

Post by aabuan123 »

Thanks Costin, that did it! The matter-page and chapter page numbers are fixed now.

Although, a page break gets inserted between the chapter title and the first chapter topic, which still messes up the page number for the chapter title. I'll work on fixing this with the information I got from you.

Thanks so much.
Alice
aabuan123
Posts: 7
Joined: Tue Jun 25, 2019 10:30 pm

Re: matter-page page counter

Post by aabuan123 »

I added outputclass="pageReset" to the 1st topicref in the 1st ditamap (chapter).

A page-break was created after the chapter title, which caused the 1st topic to appear on the next page. The chapter title page count did not reset but the topic did. I tried adding page-break-before=avoid but that did not seem to work.

.pageReset {
page-break-before:avoid !important;
}
Attachments
toc.PNG
toc.PNG (9.08 KiB) Viewed 3158 times
Costin
Posts: 833
Joined: Mon Dec 05, 2011 6:04 pm

Re: matter-page page counter

Post by Costin »

I could not reproduce this at my side, so it seems to be something specific to your document.
Implicitly, there is a

Code: Select all

[class~="topic/title"] {
    page-break-after: avoid;
}
rule that is already applied, coming from "p-page-breaks.css" default CSS file and that should avoid breaking the page between the chapter and the content that follows, as long as you did not overwrite the selector in your CSS.

You should try inspecting the intermediary merged.html file and see what rules and from which CSS files are applied on a specific element, so you this might help in determining the cause for the page break after the topic title. Then you could probably overwrite that behavior through your own rules in the customization CSS.
See the Debugging the CSS section from the User-Guide.

Another thing I think you could try is adding the -oxy-page-group:start; property in your [class~="topic/topic"][outputclass ~= "pageReset"] selector, and remove the page-break-before:avoid !important;.

Hope this helps.

Regards,
Costin
Costin Sandoi
oXygen XML Editor and Author Support
aabuan123
Posts: 7
Joined: Tue Jun 25, 2019 10:30 pm

Re: matter-page page counter

Post by aabuan123 »

Thanks Costin! I tried your suggestions and it does apply the following from p-page-breaks.css:

[class~="topic/title"] {
page-break-after: avoid;
}

When I looked at the output .fo file, the page sequence changed. There's now a css2fo-default page-sequence which contains my first topic.
image.png
image.png (12.34 KiB) Viewed 3105 times
Post Reply