Contents | Start | End | Previous: KB0159: How can I create better-looking Thai language books? | Next: KB0161: How to import equations/maths into Jutoh


KB0160: How do I add or remove automatic heading numbering?

See also:
Working with numbered headings in the Jutoh manual
Working with fields in the Jutoh manual
How do I add a cross-reference to an automatically numbered heading?

There are two ways you can get Jutoh to automatically number your chapters:

  1. Use the built-in automatic numbering feature, which will insert numbers at the start of headings.

  2. Insert sequence fields, which allow you to have a number anywhere you wish in the heading, not just the start.

Note that you can't automatically number the document names that appear in the Organizer window, but you can omit chapter numbering in document names, and by creating an advanced table of contents, your TOC entries will appear correctly numbered - the document names will not be used.

1. Built-in automatic numbering

If you wish to have Jutoh insert numbers or arbitrary text in front of headings, follow these steps.

  1. Use consistent heading styles in your book such as Heading 1, Heading 2 and so on.

  2. Go to the Project Properties dialog (e.g. by clicking on Edit in the toolbar), click on Fields & Numbering, and check Number headings automatically.

  3. Click Edit Document Outline Style and assign number formatting for each level. Make the heading style match the styles you are using. To show an outline number such as 1.2.3, set the number of sublevels to be shown.

  4. If you wish to show the heading as, say "Chapter 1: My Heading", set the Separator before text to "Chapter " and the Separator after text to ":".

  5. Close the Project Properties dialog and use the menu command Book | Update. Check Fields and numbering and click Update.

Your headings should now show numbering, which can't be edited manually.

Note that in Jutoh the number and separator text appear left-aligned, even if the actual chapter title is centred or right-aligned. This is a side-effect of the way heading numbering is implemented using list numbering. The text will appear correctly aligned in the generated book.

Whenever you have edited your books such that numbering is out of date, use the Update command. Or, to ensure numbering is always up-to-date when generating a book, check Automatically update fields and headings in Project Properties/Fields & Numbering.

If you only want automatic heading numbering to appear in OpenDocument (ODT) files, or if you simply want to tell the ODT file where to find chapter headings when you're using the chapter field in headers and footers, you can clear Number headings automatically. ODT will still use the outline style settings to determine whether to number headings, so you should set the outline Numbering style to (none) and clear the separator text to avoid numbering in ODT.

You can remove heading numbering by clearing Number headings automatically in Project Properties/Fields & Numbering. Then update the headings again by using Book | Update, ensuring Fields and Numbering is checked.

2. Insert sequence fields

In order to implement automatic numbering for different types of content, such as illustrations, figures, tables and so on, Jutoh has the concept of sequence. You can also use this for numbering chapter headings, and subheadings.

Here's how to do it.

  1. In Project Properties (click Edit on the toolbar), go to Fields & Numbering and click Edit Sequence Definitions.

  2. Create a new sequence category, called e.g. Chapter.

  3. Specify the numbering style - probably "1,2,3" unless you're writing a Roman historical mystery.

  4. Click OK and OK again.

  5. In each chapter heading, insert a sequence field where you want the number to appear, e.g. with Shift+Alt+Q or Format | Insert | Fields | Sequence. In the field dialog, choose "Chapter" in the Category option.

  6. For subsequent fields, you can simply copy and paste the fields. When you update (with Build | Update) or compile, the numbers will be updated.

When you create an advanced TOC with Format | Book | Build Table of Contents (or simply Book | Update to update it later), the field values will be incorporated into the TOC entries since Jutoh grabs the heading text.

If you need to number subheadings automatically too, add a sequence category "Subheading", and set it to restart at level 1. Ensure your top-level heading style has its outline level set to 1 so that Jutoh knows when to restart the subheading. Now when you insert sequence fields with category "Subheading", they will be renumbered appropriately when the project is updated. Ensure that your heading styles have their Outline level property set appropriately, e.g. Level 1 for "Heading 1" and Level 2 for "Heading 2", and so on.


Contents | Start | End | Previous: KB0159: How can I create better-looking Thai language books? | Next: KB0161: How to import equations/maths into Jutoh