TOC renders no Chapter Numbes

LO, Windows 10 Home

This is the structure of my document:

Foreword (Heading 1)
Chapter 1 (Chapter Number Level 2)
Chapter 2 (Chapter Number Level 2)

The ideal TOC should look like this:


In “Edit Index” I put the fields this way:
LS | Chapter | E# |: | E | T | # | LE

Here’s the result after “Update Index”:
Chapter : Foreword

I have two questions:
1/ Why E# renders no Chapter Number?
2/ How make TOC not to use the word Chapter before Foreword?

(I am new to LO. Reading Writers Guide most diligently and studying the forum’s topics on TOC, I feel overwhelmed with information. Most probably the things I need can be achieved much easier than I have tried in the last three days.)
for-libreoffice-forum.odt (21.9 KB)

Automatic Numbering oh headings is configured in Tools - Chapter numbering. It offers many tricks for formatting headings. Numbering is off by default. Note that normally, chapter titles correspond with outline level 1. Once you tell Heading 1 styled text to be numbered, all chapter titles will be numbered, so you need separate paragraph styles for Introduction, Preface, etc. You can set their outline level to 1 so that they, too, will end up in the TOC.


please upload your ODF type sample file here.

1 Like

You can suppress automatic numbering on selected chapters by putting the cursor at the very beginning of the chapter heading then pressing Backspace. No need to define a special surrogate for Heading n (which is a delicate task for newbies – and even confirmed users – to get it consistent with the rest of the outline feature).

(For @floris_v: this is an acceptable direct formatting exception to the rule)

Follow @Zizi64’s advice and upload a sample file (by editing your question).

1 Like

Thanks for pointing that out, @ajlittoz, didn’t know that.

@floris_v: Tools>Chapter Numbering defines a reserved list style. This means all tricks applicable to “ordinary” numbered lists are also applicable to Heading n paragraphs, e.g. using Tab or Shift+Tab to change level instead of changing style (quite surprising at first but chapter numbering has additional properties I’d like to benefit from for special lists).

I have uploaded the ODT sample file. I am not quite sure how to make it ODF

ODF is the generic name for Open Document Format. This standard describes the encoding used in .odt, .ods, .odg and .odp files. Don’t worry about it. I can open your file.

Here’s a modified version with most of the direct formatting removed and some tricks for getting nice looking chapter titles without having to use special styles for the numbering, all done with the Tools - Chapter numbering settings, worth to study carefully.
for-libreoffice-forum-edited.odt (20,6 KB)

1 Like

Your main problem is your formatting. Everything is done manually.

In Writer, the fundamental workflow is style usage. The most important category is paragraph style. A style assigns a semantic significance to your paragraph. You, as an author, define what your paragraph stands for. You’ll assign Comment, Remark, Important, Citation to paragraph which have such value for you (you may have to create these styles). Common discourse will be assigned Text Body.

Default Paragraph Style should never be used for any text in Writer. This special style is the ancestor of all others which inherit the attributes if they don’t override them. It is a convenient way to define shared attributes among styles, e.g. the common font face.

A style is then customised to translate visually the significance. For example, Title is the built-in style ntended for the book title. You will usually center-align its text and give ample spacing above and below the text.

The fact that spacing is part of the style definition means you must not vertically space your text with empty paragraphs. Empty paragraphs have no meaning. Then, according to what I wrote about styles, “no meaning” implies there is no empty paragraph otherwise you logically contradict yourself: you give significance to empty text!

Your cover page is styled Default Paragraph Style instead of Title (and perhaps Subtitle for the auhor’s name).

The legalese page is also styled Default Paragraph Style instead of some specific style like Copyright and others. Your use of Text Body for the copyright text is faulty.

As already mentioned in comments, chapter headings should be styled Heading 1 unless you have “parts” with titles you want to appear in TOC.

Your case is already advanced use because you want a heading with its number on a separate line. This can be done with a suitable customisation of Tools>Chapter Numbering (which you have already messed up). I’ll explain only level 2. Adapt to other levels.

  • in Position
    • set Numbering alignment to Centered
    • Numbering followed by New Line
  • in Numbering
    • Number to 1, 2, 3, …
    • restore Paragraph style to Heading 2
    • Character style will need some adjustment
    • set Separator Before to "Chapter " (with a trailing space)

Now all your chapter headings are automatically numbered. To remove the number before “Foreword”, put the cursor before the word and press Backspace.

You also need to remove literal “Capitulo” you added in the structure line for the TOC. Unfortunately, you can’t automatically remove the “:” before FOREWORD in the TOC, unless you put it into Separator After, but it will also appear in every heading. It is your choice.

The “FOREWORD” can also be automatically inserted in the page header as you did for the other chapters.

However I wonder if your document has ever been in contact with M$ Word because you have many Convertedx page styles. This will create problems when you tune your layout. Word is known to pollute and mess up document formatting because it knows only of paragraph styles and has no notion of character, page, frame and list styles.

Your best friends in formatting are styles, all categories of styles. Avoid as much as you can direct formatting otherwise you’ll never succeed in formatting your book the way you like. Presently, your document is doomed to fail because it is mainly styled Default Paragraph Style with direct formatting added without any character style.

Note about your multi-line headings.

I mentioned a Character style entry in Tools>Chapter Numbering. If you want the number to be different from the heading (font size and weight mainly), define a character style with the required attributes (don’t change font face unless this is a specification so that it inherits the font face defined in the paragraph style). Once it is created, select it in the Character style menu and you numbering will be automatically adjusted.

Sample file with only small adjustments in Chapter>Numbering: for-libreoffice-forum-ajl.odt (19.9 KB)

1 Like

Thank you very much for this eyeopener!

Yes, my file originated from M$ Word and I copy-pasted many chunks of text into a sort of primitive LO template. I am “ready and willing” to use styles the way you described but is there any “appropriate and morally justified” way to use the text itself from Word? I am to turn about a dozen of manuscripts from Word to LO and typing every single word of them will be an uphill job.

The only way to avoid Word mess is to paste contents as unformatted text. This eliminates all Word markup idiosyncrasies. After pasting, you have to “style” the raw text. Take the opportunity to eliminate all empty paragraphs (as I wrote, vertical spacing should be handled through paragraph style spacing – and you’ll end up with an “always consistent” document, no matter where pages break), even in headers. Header “geometry” is set in page styles.
Consequently, your first task is to think about the styles you’ll need. Consider the built-in ones. They have names which should give you clues about their intended usage. They are customisable so no need to reinvent the wheel (use Text Body for common text, don’t create a Discurso one). Using built-in styles when they exist makes your document more portable across versions and languages. Also, many of them are tightly integrated with the formatting engine, e.g. the Heading n family. Creating an alternate family is possible but giving it the same properties is a challenge when you’re beginning to learn styles.
From experience, in sophisticated technical document, I need ~15 paragraph styles, ~15 character styles, 5 page styles, a couple of list styles and optionally 2-3 frame styles if I have figures.
For a novel, I think ~10 paragraph styles, including those from the Heading n family, a maximum of 5 character styles, needed to emphasise words, and ~5 pages styles (front cover, legal material like copyright page, TOC and one for all chapters).

1 Like

paste contents as unformatted text…and “style” the raw text

How should it look in practice? Should I do everything in LO itself after pasting a chunk of any Word formatted text? Or M$ Word has some tricky way to strip off all formatting before copying? Or suppose I drop the text into Notepad++ before putting it into LO?

Thank you for your time! Your every word is extremely important and useful for me!

In Writer, instead of pasting with Ctrl+V, paste with Edit>Paste Special>Paste Unformatted Text or Ctrl+Alt+Shift+V. Writer will “unformat” everything for you.

Thank you! I learned so much from your clear and comprehensive answers! Much more than from any “relentless death march in regimented order through every item in menu”. (Bruce Byfield in Designing with LibreOffice)