Expand my Community achievements bar.

Page Numbering in Appendices (in Backmatter)

Avatar

Level 1

My 2 appendices are <topicref>'s in backmatter.

 

<backmatter>
     <topicref href="A.dita" type="topic"></topicref>
     <topicref href="B.dita" type="topic"></topicref>
</backmatter>

 

Appendix A

      I want the page numbering to show in the footer "A-1, A-2, A-3..." for appendix A

Appendix B

      and "B-1, B-2, B-3..." for Appendix B.

 

I have page numbers working fine but cannot seem to find a way to add the A or the B as a prefix.

Secondly, I will need to restart the page numbering in Appendix B.

 

How to accomplish this?

1 Reply

Avatar

Employee

Hi Timothy,

There are multiple ways to achieve this. Steps below describe one such solution.

 

Step 1: Create a new Page Layout for back matter in PDF Template.

Step 2: Insert page-number field at the desired location and wrap it with another span and assign a class to wrapper span, we will use this class to apply some css on page number field.

It should look like something as example given below in source view

<p class="backmatter-footer" style="text-align: center;"><span data-field="page-number">1</span></p>

 Step 3: In the Page Properties panel on the right, set value to 1 in Page Numbering field, It will restart page counter for each topic in back matter.

vikchand_0-1727327312801.png

Step 4: Open PDF template setting, switch to Page Layouts tab and select Back Matter Layout.

Step 5: Open layout.css file and add css given below in it

.backmatter-footer [data-field="page-number"]::before {
  content: string(pageNoPrefix);
}

.rh-back-matter-wrapper > .topic-body:nth-child(1) { /* A.dita */
  string-set: pageNoPrefix "A";
}

.rh-back-matter-wrapper > .topic-body:nth-child(2) { /* B.dita */
  string-set: pageNoPrefix "B";
}

Step 6: Save all changes and generate PDF output.

 

Let us know if this works for you, if not then let us know what are the challenges and we will suggest solution accordingly.