How to autonumber table titles | Community
Skip to main content
Level 4
April 5, 2024
Solved

How to autonumber table titles

  • April 5, 2024
  • 1 reply
  • 1316 views

Hello,

 

Right now I have my Native PDF template set to add a prefix before all tables titles. It looks like this:

 

Table #: Title here in DITA

 

My question is, how do I replace that with autonumbering? I'd like it to count the entirety of the document for this number (not reset per topic/chapter).

 

Here is the source I'm using:

table .title {
font-size: 12pt;
font-weight: bold;
text-align: left;
color: #001F3F;
margin-top: 2px;
margin-bottom: 2px;
}
table .title::before {
content: "Table #: ";
font-weight: bold;
}

 

Thanks in advance for your help!

Josh

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by surbhiM

Hi,

 

You can use something like below CSS :

table .title { text-align: left; color: #001F3F; font-size: 14pt; font-weight: bold; margin-bottom: 14pt; margin-top: 14pt; } table .title::before { counter-increment: table\.title; content: "Table " counter(table\.title, decimal) ": "; font-weight: bold; } body { counter-reset: table\.title 0; }

Along with table style, you will need to reset the counter in body. Using the above CSS, numbering should run for table titles in entire PDF document.

Please give it a try and let us know if it solves your use case.

Thanks and Regards,
Surbhi Maheshwari

 

1 reply

surbhiMAccepted solution
Level 2
April 9, 2024

Hi,

 

You can use something like below CSS :

table .title { text-align: left; color: #001F3F; font-size: 14pt; font-weight: bold; margin-bottom: 14pt; margin-top: 14pt; } table .title::before { counter-increment: table\.title; content: "Table " counter(table\.title, decimal) ": "; font-weight: bold; } body { counter-reset: table\.title 0; }

Along with table style, you will need to reset the counter in body. Using the above CSS, numbering should run for table titles in entire PDF document.

Please give it a try and let us know if it solves your use case.

Thanks and Regards,
Surbhi Maheshwari

 

Level 4
April 9, 2024

Worked like magic! Thanks so much!

kautuk_sahni
Community Manager
Community Manager
June 7, 2024

@joshm19816095 I hope the AEM community has been helpful. We look forward to your return as either a learner or a contributor. The community grows with SMEs like you. Invite your AEM peers to contribute too. Happy AEM learning!

Kautuk Sahni