Method

There are two parts to get numbered headings.

Setting up the CSS

RoboHelp 2019 allows multiple CSS files to be applied to a topic.

The method used here is to set up the numbering in a separate CSS, then apply add that to the CSS file(s) already applied to topics.

In this example, default.css has been applied to the two example projects, then autonum-headings.css has been applied.

The autonum-headings.css used in this project is based on wanting to have all headings in all topics numbered. If you only want numbering in some topics, you would create a copy of h1 and add a class name.

Instead of

h1 {
  counter-increment: level1_var;
}
h1::before {
  content: counter(level1_var, decimal) " ";
}

you would leave your original h1 definitions as they are and then create classes with just the numbering defined.

h1.autonum {
  counter-increment: level1_var;
}
h1.autonum::before {
  content: counter(level1_var, decimal) " ";
}

Using the Numbered Headings

In the first topic you simply apply the h1 or h1.autonum class to the topic heading. It will be numbered 1 and all the other headings in that topic will follow the numbering.

In subsequent topics you need to add some inline code to the topic heading.

<h1 style="counter-reset: level1_var 1;">Second Topic</h1>

The number after var is always one less than the number you want to see. Thus the second topic will be var 1, the third topic will be var 2 and so on.

Different Outputs

Used as above, all your outputs will have numbered headings. If that is what you want, then you could add the contents of autonum-headings.css to your own css. Keeping it separate however has the advantage that you can use it with any other css you may use in different projects.

If you only want some outputs, such as printed documentation, there are various ways to work.

Using Master Pages

Create two master pages, one with autonum-headings.css applied and one without. Select the appropriate master page in your presets.

Bulk Linking / Unlinking the CSS

  1. When you want numbering, go to Reports and select the Topic List.
  2. In the top left tick the check box so that all topics are selected.
  3. Right click and select properties.
  4. Add/Remove the autonum-headings.css file.