[Solved] Chapter numbers not showing in TOC

Writing a book, Automating Document Production - Discuss your special needs here
Post Reply
hmunn
Posts: 71
Joined: Sat Feb 21, 2009 6:41 pm

[Solved] Chapter numbers not showing in TOC

Post by hmunn »

I have chapter numbers in my text which use a paragraph style called "chapter number" and which appears in Outline Numbering at level one with normal numbering. The style has the word "Chapter "(with a following space), in the "text before" box. This style is associated with my "first page of chapter" page style.
Each time I enter a new page with "first page of chapter" my text shows a new chapter heading correctly: Chapter 1, Chapter 2, Chapter 3, etc. This works perfectly.
On the line beneath this text, I insert a new paragraph style called "chapter name", and I enter the text of that particular chapter.
All that works perfectly.

My difficulty is that when I create a TOC, I get the "Chapter Name" heading correctly showing with its page number. But I have been unable to get the chapter number to show.

In the "edit index/table" screen, in the Entries tab, I click on the box "chapter number" to add it. But even though a box with E# appears, the chapter number does not appear in the TOC. I have tried this at several levels of the TOC edit screen, but nothing ever appears. All my other index entries appear correctly. It is only the actual chapter numbers which do not appear.

What am I doing wrong?

Thanks,
Harold
Last edited by hmunn on Tue Jul 11, 2017 6:27 am, edited 1 time in total.
Harold
OOO 4.1.3 on Windows 10 home.
User avatar
Zizi64
Volunteer
Posts: 11353
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: chapter numbers not showing in TOC

Post by Zizi64 »

Please upload a short .ODF type sample document here.
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
hmunn
Posts: 71
Joined: Sat Feb 21, 2009 6:41 pm

Re: chapter numbers not showing in TOC

Post by hmunn »

Thanks for checking, here's a sample .odt showing the problem.
Attachments
TOC problem.odt
(19.64 KiB) Downloaded 397 times
Harold
OOO 4.1.3 on Windows 10 home.
User avatar
Zizi64
Volunteer
Posts: 11353
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: chapter numbers not showing in TOC

Post by Zizi64 »

There is not ANY text in the line of the chapter heading. The visible text " Chapter 1" is the part of the Style, and/or the Outline numbering feature, but it is not a line content. Empty lines will not be displayed in the TOC. Type something into the line (at least a space character), then the it will appere in the TOC after a refreshing. (Maybe you need recreate the TOC, because it worked for me after recreation only in my LO 4.4.7. Your TOC seems as "Read-only-like".)
TOC problem.odt
(20.86 KiB) Downloaded 294 times
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
hmunn
Posts: 71
Joined: Sat Feb 21, 2009 6:41 pm

Re: chapter numbers not showing in TOC

Post by hmunn »

Thanks, Zizi64.
When I downloaded my sample from the forum, yes, it was read-only. Maybe the uploading process does that. I then saved it under a new name after downloading and it was editable.
I am now uploading the original sample with your suggestions, but no luck so far. I have added some characters as you suggested to the chapter number line, and made a change to the chapter name - the new chapter name is reflected in the TOC, but the new word in the chapter number is not updated in the TOC.

Thanks,
Harold
Attachments
TOC problem.odt
(19.25 KiB) Downloaded 316 times
Harold
OOO 4.1.3 on Windows 10 home.
User avatar
keme
Volunteer
Posts: 3699
Joined: Wed Nov 28, 2007 10:27 am
Location: Egersund, Norway

Re: chapter numbers not showing in TOC

Post by keme »

You are using a custom set of styles to build the ToC. Also there are a number of strangely named styles. This makes me suspect that the document has been edited using a different word processor. MS Word comes to mind. (The existence of "Convert x" page styles indicates that the file has been converted from a format which supports the formatting of page layout, but does not support page styles. The usual suspect is Microsoft Word.)

ToC field will fetch numbering from chapter headings. As far as I can tell, the styles you use for chapter headings do not use outline numbering. Hence, there is no number for the entry number (E#) placeholder to fetch.
Some workarounds:
  • Select a list style for the "Contents 1" style. (This will probably not work if you have multiple levels requiring numbering.)
  • Set numbering on the styles used for your headings. If you don't want the number displayed on the pages (only in the ToC), make it the same color as the background.
However, there may be other "residue" from the (assumed) MS Word detour, potentially making a mess of any operation depending on document structure. I suggest you copy content to a new document and start afresh. You could try to paste it with formatting intact, but that will most likely maintain the structural mess. Paste as "unformatted" will clean up, but then you need to set chapter headings to proper styles again manually.
Apache OO 4.1.12 and LibreOffice 7.5, mostly on Ms Windows 10
User avatar
Zizi64
Volunteer
Posts: 11353
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: chapter numbers not showing in TOC

Post by Zizi64 »

TOC problem_LO.odt
(23.14 KiB) Downloaded 329 times
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
Bill
Volunteer
Posts: 8932
Joined: Sat Nov 24, 2007 6:48 am

Re: chapter numbers not showing in TOC

Post by Bill »

The problem is caused by a corrupt style name for the style assigned to Level 1 TOC entries. The TOC is set to create the TOC from "Additional Styles" instead of "Outline", so the styles specified in Outline Numbering won't be used automatically. Clicking on the button by the "Additional Styles" option opens the "Assign Styles" dialog where the corrupt style name can be seen for Level 1. Attempts to remove that corrupt style name crashed my computer. I suggest deleting the TOC, then inserting a new TOC and leaving the default "Outline" setting instead of "Additional Styles".
Last edited by Bill on Mon Jul 10, 2017 4:05 pm, edited 1 time in total.
AOO 4.1.14 on Ubuntu MATE 22.04
John_Ha
Volunteer
Posts: 9583
Joined: Fri Sep 18, 2009 5:51 pm
Location: UK

Re: chapter numbers not showing in TOC

Post by John_Ha »

You can get more information on Page Styles, Page Breaks and Page and Chapter Numbering in Chapter 4 - Formatting Pages of the Writer Manual. Also see the Writer Tutorials where you will find [Example] Document structure and numbering and [Tutorial] Page numbering
LO 6.4.4.2, Windows 10 Home 64 bit

See the Writer Guide, the Writer FAQ, the Writer Tutorials and Writer for students.

Remember: Always save your Writer files as .odt files. - see here for the many reasons why.
hmunn
Posts: 71
Joined: Sat Feb 21, 2009 6:41 pm

Re: chapter numbers not showing in TOC

Post by hmunn »

Thanks, everyone, for all your help.
Bill: you suggest a corrupt style name is the problem. Please explain what a corrupt style name is - I would have thought the only way to have a corrupt style name would be to use illegal characters in the name. Did you mean "corrupt style"?
Your suggestion about working from the Outline box solved the problem, many thanks.

Keme: you are correct, I originally produced the document in .odt, distributed it in .doc for other people to edit, found it was too complex to manually copy and paste the changes, so saved it back into .odt.

I deleted the TOC, ensured the paragraphs were correctly assigned to levels in Tools/Outline_Numbering, inserted a new TOC, selected Outline and all worked well.

Now I have a new problem.

I have the first line of the TOC with the chapter number correctly displayed.
The second line has the title of that chapter.
So far all is fine.

But I would like the chapter number and chapter title on the same line. Is that possible?
Example: Chapter 1: The story begins
Where "Chapter 1" is one paragraph style on its own line in the text, and "The story begins" is another style on the line below the chapter in the text. Is there a way to put those on the same line in the TOC even if they are on different lines in the text?

Thanks
Harold
OOO 4.1.3 on Windows 10 home.
User avatar
Zizi64
Volunteer
Posts: 11353
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: chapter numbers not showing in TOC

Post by Zizi64 »

Now I have a new problem.

I have the first line of the TOC with the chapter number correctly displayed.
The second line has the title of that chapter.
So far all is fine.

But I would like the chapter number and chapter title on the same line. Is that possible?
Example: Chapter 1: The story begins
These lines have two different level of the Outline numbering function in your originally attached document. You can not concatenate the texts of two different levels.

Use same (one) level, and a SHIFT-ENTER between the two lines. In this case the two lines will be one paragraph only.
TOC.png
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
Bill
Volunteer
Posts: 8932
Joined: Sat Nov 24, 2007 6:48 am

Re: chapter numbers not showing in TOC

Post by Bill »

hmunn wrote:Please explain what a corrupt style name is - I would have thought the only way to have a corrupt style name would be to use illegal characters in the name.
On the Assign Styles dialog on Windows 10 the "Chapter number" style should be in the "1" (level 1) column, but it is in the "Not applied" column. The corrupt style name is in the line below "Chapter title" which is in column "2" (level 2). The corrupt style name is not visible, but the highlighting in the line below "Chapter title" starts in column "1", which is where the name of the style assigned to level 1 should appear.
Capture.JPG
AOO 4.1.14 on Ubuntu MATE 22.04
Bill
Volunteer
Posts: 8932
Joined: Sat Nov 24, 2007 6:48 am

Re: Chapter numbers not showing in TOC [SOLVED]

Post by Bill »

A screenshot of the Assign Styles dialog on Antergos does show a corrupt style name assigned to Level 1:
Attachments
AntergosCapture.jpg
AOO 4.1.14 on Ubuntu MATE 22.04
Post Reply