Inspiring
February 16, 2023
Question
Numbered headings in PDF output only
- February 16, 2023
- 2 replies
- 598 views
Hi everyone,
I'm having trouble with numbered headings in my PDF output (RH 2022.0.346).
My goal:
I have content which is output into HTML as well as PDF. For HTML, I don't need numbered headings. For PDF, I do. It should look something like
1 Heading 1
1.1 Heading 2
1.2 Another heading 2
1.2.1 Heading 3
... you get the idea.
I have tried to do this in the layout.css of my PDF output using counters. Currently, my css looks as follows:
body {
font-family: 'IBM Plex Sans';
font-size: 9pt;
counter-reset: ebene1 ebene2 ebene3 ebene4;
}
h1 {
font-size: 17pt;
counter-increment: ebene1;
counter-reset: ebene2 ebene3 ebene4;
}
h2 {
font-size: 13pt;
counter-increment: ebene2;
counter-reset: ebene3 ebene4;
}
h3 {
font-size: 11pt;
counter-increment: ebene3;
counter-reset: ebene4;
}
h4 {
font-size: 10pt;
counter-increment: ebene4;
}
h5 {
font-size: 9pt;
}
h1:before {
counter-reset: ebene2 ebene3 ebene4;
content: counter(ebene1) " ";
}
h2:before {
counter-reset: ebene3 ebene4;
content: counter(ebene1) "." counter(ebene2) " ";
}
h3:before {
counter-reset: ebene4;
content: counter(ebene1) "." counter(ebene2) "." counter(ebene3) " ";
}
h4:before {
content: counter(ebene1) "." counter(ebene2) "." counter(ebene3) "." counter(ebene4) " ";
}I have tried different guides on counters in CSS on the internet and I'm not sure whether I'm doing something wrong or Robohelp is messing something up on output, because my TOC looks like the picture attached...
Anybody got an idea how I can fix this?
