Question

How do I add section numbering of topics in PDF output in the DITA OT? I mean numbering like this:

1. Heading

     Some content

1.2. Heading

     Some more content

1.2.1. Heading

     Some further content

EDIT: My question was a bit unclear, I realize. I meant to say topic numbering (meant section in the more generic sense than section as a DITA element). Also, I know how to do this in code, but was wondering if I had missed some easier way to do this by simple configuration in the DITA OT - like a switch on or off argument or something. It's such a common request that it should be easier than having to modify stylesheets like this all the time:

http://tech.groups.yahoo.com/group/dita-users/message/18417

Was it helpful?

Solution

You could use DITA-OT PDF plug-in generator, it has a switch for numbering all hierarchy levels. DITA-OT doesn't provide a separate configuration property for this, because it makes more sense to keep the built-in configuration set small.

OTHER TIPS

Here's what I do. CSS:

body { counter-reset: H1; }     /* Create the counter for H1 */
h1:before {
  content: counter(H1) ". ";    /* Print the H1 number */
  counter-increment: H1;    /* Add 1 to next H1 */
 }
h1 { counter-reset: H2; }
h2:before {
  content: counter(H1) "." counter(H2) " ";
  counter-increment: H2;
}
h2 { counter-reset: H3; }
h3:before {
  content: counter(H1) "." counter(H2) "." counter(H3) " ";
  counter-increment:H3;

then render to XHTML (chunked to a single page) and convert the web page to PDF. Possibly not the canonical approach, but it works.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top