TOC - no chapters/page numbering

I’m writing a book and I already have 90 subdocuments (on average 3 to 4 pages each document) with styles assigned by using the template for all 90 chapters.

The chapter is in the header (Heading 1) and the page number in the footer.

Once Master document was created and sub-documents inserted, inserting ‘Table of Contents/index>Table of Contents, Index or Bibliography>okay, the TOC only show ‘Table of Contents against a grey box but no chapters nor their corresponding page numbers.

When I checked the subdocuments, I was surprised to see the size of the font for the page Header as ‘130%’. I originally assigned 28 pt to the font in ‘Heading 1’ so I do not know what changed or if that is the reason why TOC didn’t work?

I’ve searched through LibreOffice Writer Guide and I am unable to find where I went wrong.

LO 6.5.2 x64
Home Windows 10

Please make clear what you edited in the question. Is it the 130% size unit?

If you are Peter McD, you know how to contact me about your current book creation.

Remark: as of the date of writing, 6.5.2 does not exist. Do you mean 6.3.5.2?

There are some subtleties with master and sub-documents.

Formatting occurs in the master document. The master imports the text from the sub-documents and uses its style definitions to lay out the paragraphs in the page(s). Only if the style does not exist in the master will the style definition be imported from the sub-doc. This means that master styles with same name override those in the sub-doc.

Unless you changed explicitly the font size in the sub-docs, all (master+subs) should have the same font size because you claim all are based on the same template. When you have a template, you don’t fancy yourself to add patches in some documents, which would ruin the interest of template.

Don’t worry about the 120% size instead of 28pt. %-sizes are just another way of specifying them. It guarantees to keep the same general relative ratios when you change a key style. All Heading n styles are relative to Heading style. When you changed the font style in the latter, all sizes in Heading n adjust accordingly.

Now to the main issue.

If you did not make vocabulary mistake, you tell us that you put your chapter heading (title) in the header, likely in the intention of repeating it on every page. This heading was styled Heading 1 as usual and I supposed you got the numbering too (1 because there is only one chapter per sub-document).

The header is an attribute of the page style.

As I explained above, the master uses its own styles when formatting the global document. Consequently, it does not reference the sub-document page style and does not import the header. You end up with no Heading 1 in your master and the TOC engine rightfully reports an empty table.

How to fix it?

It is very unusual to put the Heading 1 paragraph in the header. First reason, what will be its page number? It is duplicated on every page. Then it has multiple pages associated with it. The header is internally managed in a special way, it then probable that Writer will give it a single page number (first, last, other?) but this is not what you want to control.

Put your Heading 1 where it belongs, i.e. in the text area, not in header, not footer. This will fix the TOC issue.

If you want to repeat the chapter heading in the header, use field insertion.

In the master, modify the header to contain only Insert>Field>More Fields. Go to Document tab. In Type select Chapter and in Format Chapter name or Chapter number and name.

EDIT 2020-05-09

Your problem is quite simple. You have not understood the basic principle behind the styles concept.

Styles (whether paragraph or character) are used to mark up the structure of your text in semantic terms: some paragraphs are headings, others are “common” discourse, others source tagging (like Isaiah 63), others are comments, etc. The styles system is meant to explicit this structure. Primarily, it is not meant to confer typographical attributes to the text; this comes later when you try to show a reader how your text is structured.

Consequently, styles with names like “Head bold green” or “Head bold black” don’t make sense because you don’t indicate what they tag. They are just a reminder for which rendering you’d like the text to be formatted. On the contrary, a style like Psalm or Explanation has a real significance with regards to the text structure.

In the end, you’ll assign specific typographical attributes to those styles so that the content will stand out of the context and be identified as a specific component of your book.

A very important built-in family of styles is the Heading n set (n=1 to 10). They are provided as a very strong structuring function. Usually Heading 1 is used to flag chapter headings, Heading 2 for sub-chapters, etc.

This family is so important that it is collected by default to build the TOC. No paragraph (at least in the sample) has been styled Heading n; therefore the TOC will be empty.

To complicate matters, many paragraphs have their attributes set manually: the base style is Default Style and variants (font size, bold, colour) have been applied manually with toolbar buttons. The visual effect may be to give the appearance of a heading, but basically the paragraph remains a Default Style and is invisible to the TOC machinery.

As is, your master and sub-docs are unstructured and any attempt to make an elaborate synthesis out of it is doomed to fail. You must first restructure them. If you don’t know how to do it, I’d be glad to help you. Contact me privately on ajlittoz (at) users (dot) sourceforge (dot) net. This email address is given in an obfuscated form to protect me againt bots. Replace the descriptions within the parentheses by the single character and remove blanks. Once contact is made, you’ll have my real email address to start private discussion.

To show the community your question has been answered, click the ✓ next to the correct answer, and “upvote” by clicking on the ^ arrow of any helpful answers. These are the mechanisms for communicating the quality of the Q&A on this site. Thanks!

In case you need clarification, edit your question (not an answer) or comment the relevant answer.

Good answer. Supplemental background ; the one thing which makes the “heading in header” strategy a bad idea:

In Writer, header is tied to page style. With the OP strategy, you need one page style for each chapter.

This is different from what you may be used to from MS Word. Word does not have any concept of page style. Page formatting/layout (including header) is linked to a sequence of pages until you decide to “break the chain”. This makes it slightly easier to change page formatting midway (or “mid-document”), and also makes your “heading in header” strategy workable. Maintaining consistent appearance will be harder in Word if you have a document where you go back and forth between different page layouts.

When you get used to it, and if you create several large documents, you will learn to appreciate Writer’s enforcement of a rigid document structure.

Thank you for your comments.

First of all, you are correct: LO version is 6.3.5.2.

I understand I need to put Heading 1 in the text area. The problem is I’m writing a church book and the normal custom is to put the chapter heading at the very top – the Header.

I have tried to modify the header in the master: Insert>Field>More fields…. as you suggested. This did not work. But may I ask: how to modify the master since the Sidebar doesn’t exist in master document?

To clarify: three main bodies in my book (front matter, body, and back matter)

• one column preface (12 pages including front cover, title page, introduction… and TOC) using Roman numerals i to xii;

• main body: two column starting on page 13 but I noticed in the master document it shows ‘13’ (Arabic) and not ‘1’ as I wanted.

Clearly I have not done the setup properly?

Since you are able to change from Roman to Arabic page numbers, you are using page styles. Edit the page break before the main body to force page numbering to restart at one.

The “sidebar” exists also in the master (same F11 command to display it) but it has 2 modes: the traditional one and the structure for the master. You toggle between both with a click on the first icon in the pane toolbar.

With Heading 1 in the text area, is your TOC as expected? This is the first step before getting the header correct.

Thank you for the comments.

I’m pleased to say I’ve been able to sort out the page number and the Arabic number now starts as ‘1’ on the thirteen page. And you are correct that TOC does work well when I insert it in the text area.

So… I still want to try ‘Header 1’ in the Header but since as you say it’s not recommended, I’m wondering if I just dispense the Header altogether and instead add a frame (one column) at the top and use it as ‘Header 1’ and below it add another frame (two columns for the main text body). Would that work?

No. The solution is very simple. Erase everything in your header (to start with, you can add decorations later when you’re familiar with the concept).

Put the cursor in the header. Insert>Field>More Fields. Go toà the Document tab. In Type, select Chapter. In Format select Chapter name. Insert, then Close.

This puts the content of the Heading 1 in effect at the top of the page. This remark is very important. In your case, you must put your Heading 1 as the first paragraph of your chapter, otherwise it will take effect only on next page. If you change Heading 1 mid-page, the one known at the top is used; the new one on next page.

Finally, if you don’t want both the chapter title in the header and as the first paragraph of the chapter (non aesthetic duplication), modify Heading 1 to give it Hidden attribute in Font Effects tab. But Tools>Options, LibreOffice Writer>View and enable Hidden text to facilitate writing.

PS: I tried Insert>Field>More Fields as you suggested but it didn’t work. I only get ‘Table of Contents’ and nothing else.

Ah… I didn’t see the last comment you recently replied. I will try it… thanks again.

When I did as you suggested, I get the correct title for the first chapter but then the same title appears for all the following chapters!

Also when I tried to insert TOC, ‘Table of Contents’ is greyed out.

Warning! The Insert>Field>More Fields opens in the Cross-references tab. If you select a heading here, you get this specific one. You must activate the Document tab to get a “tracking” chapter name.

TOC: which command do you use?

Thanks.
I am clearly in the wrong place?

Within the Master document, at the end of ‘preface’ in the text area I clicked Insert>Table of Contents…. The dialog box shows several tabs: type; entries; styles; columns; background.

I see nothing there for me to ‘activate the document’ as you suggested.

I tried to address your problems in the same comment, probably a bad idea.

  1. the Document tab is related to the header issue

  2. you create the TOC by selecting a +Type* Table of Contents in the 7Type` tab; it is normally preselected when your enter the dialogue

In the subdocuments, I have ‘Chapter 1’ for the first document, ‘Chapter 2’ for the second document, ‘Chapter 3’ for the third document (I actually have specific names but using ‘Chapter*’ for this discussion.

When I open the Master document I have ‘Chapter 1’ for every subdocument!

Somehow, when I open the Master document I also have ‘Table of Contents’ in a grey box. I am unable to delete it. Right clicking and selecting ‘delete index’, saved Master document, then opened it, ‘Table of Contents’ was still there!

You said the Document tab is related to the header issue. Okay, what do I do? Click on the ‘Format Header’ in the Master document? I cannot proceed any further. Please clarify.

You also said: you create the TOC by selecting a +Type* Table of Contents in the 7Type` tab; it is normally preselected when your enter the dialogue

Sorry not clear to me: in the toolbar: Insert>Table of Contents> a dialog box appears and the tab ‘Type’ is already activated. Clicking ‘Okay I ge

Clicking okay I get the same thing again: ‘Table of Contents’ against a grey box and nothing else.

I am able to delete ‘Table of Contents’ by deleting ‘Front Matter’ from the Master document. Re-edit the Front Matter in the sub-document. Then in Master document, insert ‘Front matter’, ‘Table of Contents’ is no longer there. So that’s good. However… Insert>Table of Contents etc… only works on page 9 in the front matter and still I get ‘Table of Contents’ agains a grey box and nothing else. However the strange thing is on page 3 which is what I really want TOC clicking ‘Insert’>… ‘Table of Contents’ is greyed out. What is the difference between page 3 and 9 in the Front Matter? And why?

I don’t believe we can get anywhere from here, unless we have hands on the matter.

Can you upload your master document and one or two of your chapter subdocuments here?

Make a copy of said files, perhaps in a separate folder. Remove any content you deem confidential, private or otherwise “sensitive”. You can also remove links to the subdocuments you don’t submit. Keep front matter as it is if possible. Content does not matter, as long as general document structure is maintained. (Heading, a couple of pages, lists/indents or any other formatting/layout elements you use.)

The gray TOC background (which doesn’t print) is a visual clue that ths part was generated by Writer and not manually typed by you.

If I understand correctly your last comment, your TOC is in the sub-doc called “Front Matter”. This is not the right location. When you generate the TOC in the sub-doc, the TOC machinery only sees the sub-doc and no other chapter. To have a full TOC, it must be added in the master directly.

Be aware that sub-docs have their own independent lives. They don’t interact. You edit one and nothing leaks to the others. When you glue them together with a master, there is some form of “import” taking part of the data (in particular, header/footer are not transferred) to compose the global document.

IMHO your “Front Matter” is typically what should be put as raw material in the master (not linked through a sub-doc). This would solve the TOC issue.