Expand my Community achievements bar.

SOLVED

How to autonumber table titles

Avatar

Level 3

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

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Accepted Solution

Avatar

Correct answer by
Level 2

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

 

View solution in original post

4 Replies

Avatar

Correct answer by
Level 2

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

 

Avatar

Administrator

@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

Avatar

Level 3

For some reason I'm able to get figures to autonumber by using the above code (with fig in place of table), but the table autonumbering isn't working for me in the bookmap. It works great in a map! Is there something I need to change? I'm pretty much using the identical code from your snippet.

Thank you!

Josh