Problem with chapter numbering and TOC.

I have set up chapter numbering as per the help page
https://tinyurl.com/vsq77lu and created a "New Chapter" page style.

After inserting a manual page break with the "New Chapter" page style I
set the first paragraph style to "Heading 1" and the correct chapter
name/number is displayed both on the page and in Navigator.

However, when I insert a TOC into the document no chapters appear in the
index.

Any thoughts or pointers would be welcome.

Thanks Dave

Dave,

Have you added your new style to the TOC?

Right-click on the TOC. Select "Edit Index".

If "Protected against manual changes" is checked, you will have to uncheck it, OK and re-edit the TOC.

Select the "Type" tab if not already shown. Down under "Create from", check "Additional Styles" and then the "Assign styles..." box to the right.

You should see a list of the styles in your document, including your "New Chapter" style, on the left column ("Not applied") and the associated TOC levels (associated to styles in the Styles tab) to the right of the first column. Scroll down to find your style, "New Chapter", and use the ">|" or "|<" buttons to assign a contents level for your style by moving the style into the proper level column. I would guess the "1" column, since it is higher than the headings.

Since by default, "heading1" style is associated to contents level 1 and this procedure reassigns TOC level 1, You may need to manually associate the heading styles to the correct level also. Do the same for all the heading levels you use in the document, since they are all shifted up a level. Note that the more custom levels you have, the less heading levels you will have, since the limit is 10. One way around that, is to assign a single TOC level style to all heading levels. But that may limit the look of your TOC if you want different styles for different levels, such as indents.

It may take some experimentation with this to get what you want out of it. For instance, if you want the "New Chapter" contents style to look different than the stock styles, you may need to make a contents style specific for the TOC rather than the default "contents*" styles. Then in the "Styles" tab, change the New Chapter level (1) to use your new contents style. Use the "<-" button by selecting the level and then the style followed by the "<-" button to make the assignment.

When you are all done, re-check the Protected Against Manual Changes box and OK.

HTH.

Girvin Herr

Hi Girvin,

Many thanks for taking the time to respond to my request.

It seems I didn't explain my problem accurately enough. The "New
Chapter" style referred to is a page style not a paragraph style.
Therefore it doesn't appear in the "Additional Styles" list.

I have always believed (maybe incorrectly) that the "Heading 1"
paragraph style was included int the TOC by default, unless otherwise
excluded.

I will try and construct a near identical sample document and post back
here with a link. Maybe someone could take a quick look at that sample
and see where I am going wrong.

Best Regards
Dave

I have created a sample document with a near identical structure and
made it available at:
http://www.mediafire.com/file/4dqiurp1sv9z1zk/TOC_Test.odt/file

It would be much appreciated if someone could take a look at this
document and offer any suggestions about why the automatically generated
chapter headings are not appearing in the TOC.

TIA
Dave

Something is wrong with your document, you do something wrong. First
chapter should not be greyed out if only thing you did is apply Heading
1 style to that paragraph.

This way seams like you inserted some kind of field or index and those
do not appear in TOC by default.

I deleted your Chapter 1 and typed my own Chapter 1 (to get rid of grey
shading) and everything worked great.

My guess is you're using it as not indented by design.

Kruno

Thanks for taking the time to look at the document Kronose.

You are correct in saying that you can manually type anything in
whatever might be chosen to be the chapter heading.

Unfortunately, you overlooked what I wrote in my original post about
following the instructions in the official help file
https://tinyurl.com/vsq77lu where it says:

<Q>To Create a Paragraph Style for Chapter Titles
    Choose Tools - Chapter Numbering.
    In the Style box, select the paragraph style that you want to use
for chapter titles, for example, "Heading 1".
    Select the numbering style for the chapter titles in the Number box,
for example, "1,2,3...".
    Type "Chapter" followed by a space in the Before box.
    Enter a space in the After box.
    Click OK.
</Q>

Please let the documentation team know of the the project documentation
is incorrect.

Regards
Dave

Hi Dave,

I have created a sample document with a near identical structure and
made it available at:
http://www.mediafire.com/file/4dqiurp1sv9z1zk/TOC_Test.odt/file

It would be much appreciated if someone could take a look at this
document and offer any suggestions about why the automatically generated
chapter headings are not appearing in the TOC.

Your headings have no content. You need to write at least a blank.

Kind regards
Regina

Hi Dave,

Looking at your original document, it is clear that in the chapters you have created, all that appears in the heading of each chapter is the 'Before' and 'After' elements that you have specified in the dialog box of Tools > Chapter Numbering. As Regina states in her reply, you have not typed anything of your own invention.

Directly after Chapter 1, in the H1 heading above your text, type for example 'The Start'. Then right click in the TOC and select 'Update Index' and watch 'The Start' appear directly after Chapter 1 and before the long line of dots leading to the page number (3).

The instructions you repeated from the help pages do work. Your later specially created test doc has a problem between the TOC and the first line - don't know what it is but when I created a similar file, leaving lots of space between the TOC and the body, it works perfectly.

But you must, as Regina says, add some sort of title to your chapter heading, even a blank space.

hth
Philip

Hi Philip,

Thanks for taking the time to reply. My responses are given in-line.

I have set up chapter numbering as per the help page
https://tinyurl.com/vsq77lu and created a "New Chapter" page style.

After inserting a manual page break with the "New Chapter" page style I
set the first paragraph style to "Heading 1" and the correct chapter
name/number is displayed both on the page and in Navigator.

However, when I insert a TOC into the document no chapters appear in the
index.

Any thoughts or pointers would be welcome.

Thanks Dave

Hi Dave,

Looking at your original document, it is clear that in the chapters you
have created, all that appears in the heading of each chapter is the
'Before' and 'After' elements that you have specified in the dialog box
of Tools > Chapter Numbering. As Regina states in her reply, you have
not typed anything of your own invention.

Look at my reply to Regina. My own invention is the word "Chapter" plus
a single space in the Before field.

Directly after Chapter 1, in the H1 heading above your text, type for
example 'The Start'. Then right click in the TOC and select 'Update
Index' and watch 'The Start' appear directly after Chapter 1 and before
the long line of dots leading to the page number (3).

Yes I am fully aware of how to create a TOC. However, I stumbled over
this issue when preparing a LibreOffice training session for a group of
novice authors and I wanted to work "by the book" so that they could
accurately use our help files and documentation for future reference.

The instructions you repeated from the help pages do work. Your later
specially created test doc has a problem between the TOC and the first
line - don't know what it is but when I created a similar file, leaving
lots of space between the TOC and the body, it works perfectly.

I have unzipped both the origin documents that brought this issue to my
attention and the simplified example I created, but I have been unable
to find any issue with their internal structure.

I am having some difficulty working out what you mean by adding space
between the TOC and the (first line ?). Could I ask you to send me a
copy of your example file off list please?

But you must, as Regina says, add some sort of title to your chapter
heading, even a blank space.

See my reply above.

hth
Philip

Again thank you for trying to help.

Regards
Dave

My apologies Regina. I meant to post
        to the list not to you directly.

Regards

Dave

Many thanks for the perfect explanation Regina.

While it's unclear why it was coded that way and is definitely not
intuitive, it does provide a solution.

When I have the time I will add a not to the on-line help and ask
Olivier to make a note for the help file in the next release. I will
check out the Getting Started and Writer Guides to ensure this point is
made clear in the next revisions.

Kind Regards
Dave

Hi Dave:

Of course, my note was written before I saw your reply to Regina. It hadn't been received by the list at that time.
See below for other thoughts:

I have set up chapter numbering as per the help page
https://tinyurl.com/vsq77lu and created a "New Chapter" page style.

After inserting a manual page break with the "New Chapter" page style I
set the first paragraph style to "Heading 1" and the correct chapter
name/number is displayed both on the page and in Navigator.

However, when I insert a TOC into the document no chapters appear in the
index.

Any thoughts or pointers would be welcome.

Thanks Dave

Looking at your original document, it is clear that in the chapters you
have created, all that appears in the heading of each chapter is the
'Before' and 'After' elements that you have specified in the dialog box
of Tools > Chapter Numbering. As Regina states in her reply, you have
not typed anything of your own invention.

Look at my reply to Regina. My own invention is the word "Chapter" plus
a single space in the Before field.

When I  said 'your own invention' I wasn't explicit enough. I didn't take the 'Before' and 'After' fields' contents as 'your invention'. I took them as fields already prescribed as adjuncts to the Chapter number (the subject of the dialog box).  I was instead wishing to refer to material that the author would 'normally' write in the H1 heading at the top of his new chapter.

Here 'normally' is used, I admit, in reference to what I would do and what I have seen in many other books, that is some sort of short description of the order of one to five words. To this group of 'one to five words', LO's chapter numbering would add the number plus the contents of the 'Before' and 'After' fields either side of the number and before your choice of short description.

Example for a possible first chapter of a book :   "1 - Introduction"

where the 'Before' field has been left empty, the digit 1 is the number automatically supplied, the 'After' field contains <space>-<space><space> and 'Introduction' is my invention for the first chapter description.

This is what Regina meant when she said your headings have no content and you should supply some text even if only a blank space.

[Sorry, I cannot find your short one page example anymore - only the longer "World's Most Amazing Book" file]

As a check and demonstration, go to the page in your 'TOC test.odt' file where the new chapter 2 starts and highlight the heading on the page by clicking after the figure 2 and dragging to the beginning of the line. You'll see that nothing is selected - you can't drag to the start of the line. 'Chapter 2' is just the 'Before' and 'After' fields surrounding the figure 2 and with no other content.I have unzipped both the origin documents that brought this issue to my

attention and the simplified example I created, but I have been unable
to find any issue with their internal structure.

I am having some difficulty working out what you mean by adding space
between the TOC and the (first line ?). Could I ask you to send me a
copy of your example file off list please?

As I said, I couldn't identify what was causing the lack of correct display of the first chapter in your short example document. I assumed that it was somehow connected with the proximity to the TOC but I didn't exhaust the checking I just made my own example doc which I'll be pleased to send you by PM. I'm not sure it's useful to spend much time on it. And in any case, I didn't keep your file and the only one I can find today is the Word's Most Amazing Book file.

Best,

Philip

Hi Philip,

Thanks for coming back on this. There was only ever one "TOC test.odt"
sample document, which had a title page "World's Most Amazing Book" and
a few "New Chapter" styled pages.

Thanks to Regina's explanation and your further clarification here, I
now understand the situation.

While it is IMO totally wrong to require the user to add ANYTHING to the
outline style generated content to obtain a working TOC, that is the way
it has been coded and we users just have to live with it.

Best Regards
Dave

Hi Dave:

Of course, my note was written before I saw your reply to Regina. It
hadn't been received by the list at that time.
See below for other thoughts:

I have set up chapter numbering as per the help page
https://tinyurl.com/vsq77lu and created a "New Chapter" page style.

After inserting a manual page break with the "New Chapter" page style I
set the first paragraph style to "Heading 1" and the correct chapter
name/number is displayed both on the page and in Navigator.

However, when I insert a TOC into the document no chapters appear in
the
index.

Any thoughts or pointers would be welcome.

Thanks Dave

Looking at your original document, it is clear that in the chapters you
have created, all that appears in the heading of each chapter is the
'Before' and 'After' elements that you have specified in the dialog box
of Tools > Chapter Numbering. As Regina states in her reply, you have
not typed anything of your own invention.

Look at my reply to Regina. My own invention is the word "Chapter" plus
a single space in the Before field.

When I  said 'your own invention' I wasn't explicit enough. I didn't
take the 'Before' and 'After' fields' contents as 'your invention'. I
took them as fields already prescribed as adjuncts to the Chapter number
(the subject of the dialog box).  I was instead wishing to refer to
material that the author would 'normally' write in the H1 heading at the
top of his new chapter.

Here 'normally' is used, I admit, in reference to what I would do and
what I have seen in many other books, that is some sort of short
description of the order of one to five words. To this group of 'one to
five words', LO's chapter numbering would add the number plus the
contents of the 'Before' and 'After' fields either side of the number
and before your choice of short description.

Example for a possible first chapter of a book :   "1 - Introduction"

where the 'Before' field has been left empty, the digit 1 is the number
automatically supplied, the 'After' field contains
<space>-<space><space> and 'Introduction' is my invention for the first
chapter description.

This is what Regina meant when she said your headings have no content
and you should supply some text even if only a blank space.

[Sorry, I cannot find your short one page example anymore - only the
longer "World's Most Amazing Book" file]

As a check and demonstration, go to the page in your 'TOC test.odt' file
where the new chapter 2 starts and highlight the heading on the page by
clicking after the figure 2 and dragging to the beginning of the line.
You'll see that nothing is selected - you can't drag to the start of the
line. 'Chapter 2' is just the 'Before' and 'After' fields surrounding
the figure 2 and with no other content.I have unzipped both the origin
documents that brought this issue to my

attention and the simplified example I created, but I have been unable
to find any issue with their internal structure.

I am having some difficulty working out what you mean by adding space
between the TOC and the (first line ?). Could I ask you to send me a
copy of your example file off list please?

As I said, I couldn't identify what was causing the lack of correct
display of the first chapter in your short example document. I assumed
that it was somehow connected with the proximity to the TOC but I didn't
exhaust the checking I just made my own example doc which I'll be
pleased to send you by PM. I'm not sure it's useful to spend much time
on it. And in any case, I didn't keep your file and the only one I can
find today is the Word's Most Amazing Book file.

If I were you, I would make it like this: In Outline and Numbering...
set Level 1 so filed 'Number' is empty. In filed 'before' enter word
'Chapter' in filed 'After' put 'space'. Click OK.

Now, leave empty paragraph, next paragraph style as Heading one, and
then leave another empty paragraph.

Middle paragraph (Heading 1) will have 'Chapter '. Now follow
instructions at

https://ask.libreoffice.org/en/question/4331/how-can-i-have-a-custom-numbered-field/

Now you will have 'Chapter 1'.

Next step is to select all three paragraphs (Heading 1 being in the
middle) and hit CTRL + F3 as that will open AutoText dialog. Add name
for new AutoText and go AutoText → New.

On every page you wish to add 'Chapter #' just entery shortcut you
defined when naming new AutoText and hit F3.

Benefit: Having word 'Chapter ' followed by auto incremented numbers and
all appearing in TOC.

Kruno

Thanks Krono, but this is way too complicated and inconvenient for the
people I am training. Plus it is a workaround, not documented in our
help and documentation facilities.

Regards
Dave