Bug 91048 - Table of contents lists first subheading before master
Summary: Table of contents lists first subheading before master
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: medium minor
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: TableofContents-Indexes
  Show dependency treegraph
 
Reported: 2015-05-03 17:17 UTC by wilcox
Modified: 2022-10-15 13:49 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:
Regression By:


Attachments
Libreoffice 4.4.2.2 table of contents off by one bug (11.58 KB, application/vnd.oasis.opendocument.text)
2015-05-03 17:17 UTC, wilcox
Details
Libreoffice 4.4.2.2 table of contents off by one bug. Workaround in Appendix A. (15.42 KB, application/vnd.oasis.opendocument.text)
2015-05-04 09:10 UTC, wilcox
Details
A proposed document structure with correct ToC order (17.88 KB, application/vnd.oasis.opendocument.text)
2022-10-15 12:06 UTC, Mike Kaganski
Details

Note You need to log in before you can comment on or make changes to this bug.
Description wilcox 2015-05-03 17:17:17 UTC
Created attachment 115288 [details]
Libreoffice 4.4.2.2 table of contents off by one bug

Table of contents looks like this:
TOC
First chapter
Second chapter
First chapter of appendix A
A - This is Appendix A
Second chapter of appendix A
...

But it should look like this:
TOC
First chapter
Second chapter
A - This is Appendix A
First chapter of appendix A
Second chapter of appendix A

I have used different styles for appendices and "This is Appendix X" has been placed in the header of the style.

The file attached is a simplified demo of what I believe is a bug.
It popped up in a real document. The current workaround is to manually modify table of contents.

Libreoffice version: 4.4.2.2
OS: Microsoft Windows 7 Professional N (AMD64).
Comment 1 Cor Nouws 2015-05-03 17:52:00 UTC
Hi Wilcox,

thanks for the description of your problem and the sample document,
Why do you put for example "A - This is Appendix A  in the header?
If you put it in the main text part, the TOC is fine and you can place a cross reference to the title in the header..?
Cheers
Cor
Comment 2 wilcox 2015-05-03 18:01:37 UTC
Thanks for prompt reply!

 Yes, when I place it in main text then yeah, no problem.
But business requirements are not defined by me.

Every appendix will have a lot of pages and subheaders. Every (appendix) page needs to have Appendix number and some extra text displayed in the header.

I was pleasantly surprised that TOC almost looked like I wanted it to be. I was afraid that "A - This is Appendix A" would be listed several times but fortunately only the reference to the first occurrence will be displayed.
Comment 3 Cor Nouws 2015-05-03 20:35:11 UTC
(In reply to wilcox from comment #2)
> Thanks for prompt reply!

You're welcome. No guarantee for future experiences though ;)

> Every appendix will have a lot of pages and subheaders. Every (appendix)
> page needs to have Appendix number and some extra text displayed in the
> header.

Hence my suggestion : "you can place a cross reference to the title in the header" ;)

I think with that it's fair to set this WorksForMe.
In case you have any detailed question, would you please be so kind to refer to our user support options, as listed here
  http://www.libreoffice.org/get-help/community-support/

If I really see this wrong: do reopen and give appropriate details.

best regards,
Cor
Comment 4 wilcox 2015-05-03 20:46:53 UTC
(In reply to Cor Nouws from comment #3)
> (In reply to wilcox from comment #2)
> > Thanks for prompt reply!
> 
> You're welcome. No guarantee for future experiences though ;)

:)

> > Every appendix will have a lot of pages and subheaders. Every (appendix)
> > page needs to have Appendix number and some extra text displayed in the
> > header.
> 
> Hence my suggestion : "you can place a cross reference to the title in the
> header" ;)

Well, since the title is in the header of the Appendix it would be a self-reference.

> I think with that it's fair to set this WorksForMe.
[SNIP]
> 
> If I really see this wrong: do reopen and give appropriate details.

While my example might not be best one out there I would still say this a bug waiting to be stumbled upon. Or perhaps a gotcha, because I can not see the logic behind this ordering of headings in TOC. For example - why only the first heading is put before Appendix in TOC but not the others?
Comment 5 Cor Nouws 2015-05-04 08:41:25 UTC
If you so wish..

(In reply to wilcox from comment #4)

> While my example might not be best one out there I would still say this a
> bug waiting to be stumbled upon.

I waited since 2004 to see it happen ;)
No surprise, since we have the references to do what you did in a different manner.

> Or perhaps a gotcha, because I can not see
> the logic behind this ordering of headings in TOC. For example - why only
> the first heading is put before Appendix in TOC but not the others?

That should have to to with the handling of the first paragraph on the page, and that triggering the handling of the other content in that part of the document.
Pls put another not heading paragraph before First chapter of appendix A and see what happens.
Comment 6 wilcox 2015-05-04 09:10:40 UTC
Created attachment 115302 [details]
Libreoffice 4.4.2.2 table of contents off by one bug. Workaround in Appendix A.
Comment 7 wilcox 2015-05-04 09:12:40 UTC
(In reply to Cor Nouws from comment #5)
> > Or perhaps a gotcha, because I can not see
> > the logic behind this ordering of headings in TOC. For example - why only
> > the first heading is put before Appendix in TOC but not the others?
> 
> That should have to to with the handling of the first paragraph on the page,
> and that triggering the handling of the other content in that part of the
> document.
> Pls put another not heading paragraph before First chapter of appendix A and
> see what happens.

I have just uploaded a new version.
Yes, when there's text before first heading in Appendix A, TOC looks the way it should.
Comment 8 Buovjaga 2015-10-09 18:12:02 UTC
Bug does not meet the criteria for Status 'REOPENED'
https://wiki.documentfoundation.org/QA/Bugzilla/Fields/Status/REOPENED#Criteria
Status -> NEW

Confirmed with attachment 115302 [details]

Win 7 Pro 64-bit, Version: 5.0.2.2 (x64)
Build ID: 37b43f919e4de5eeaca9b9755ed688758a8251fe
Locale: fi-FI (fi_FI)
Comment 9 QA Administrators 2016-11-08 11:39:21 UTC Comment hidden (obsolete, spam)
Comment 10 Roman Kuznetsov 2019-02-01 21:35:23 UTC
still repro in

Version: 6.1.4.2
Build ID: 1:6.1.4-0ubuntu0.18.10.1
CPU threads: 4; OS: Linux 4.18; UI render: default; VCL: gtk3_kde5; 
Locale: ru-RU (ru_RU.UTF-8); Calc: group threaded
Comment 11 QA Administrators 2021-02-01 03:58:02 UTC Comment hidden (obsolete)
Comment 12 Mike Kaganski 2022-10-15 12:06:19 UTC
Created attachment 183060 [details]
A proposed document structure with correct ToC order

A heading in a header is not the correct document structure. Header is a property of a page style; this also leads to proliferation of page styles.

It is actually unclear how such a heading should appear relative to the main text flow, because the page style is a property of the first paragraph, and the paragraph itself has an outline level, and deep inside its properties (inside page style, inside its heading, as a property of that heading's first paragraph), another outline element is.

As far as I see, the requirement for the heading in the header came from the requirement to have it in other pages of the appendices; and that could be done using a special page style for first page of appendix (without header, and with normal paragraph for the heading in that area), and the page styles with headers and chapter references for the rest of the pages. Having that page style, and associating it with respective appendix header paragraph style, could automate it all; of course, if the requirements for each appendix are different, then it would not automated, but still provide the same level of functionality.

Attached is a sample with the explained structure, which is an edited attachment 115288 [details] from comment 0.
Comment 13 Cor Nouws 2022-10-15 13:39:45 UTC
(In reply to Mike Kaganski from comment #12)
> Created attachment 183060 [details]
> A proposed document structure with correct ToC order
Looks good. And thanks for the explanation ;)

So - though not straight forwarded - it looks as WFM?
Comment 14 Mike Kaganski 2022-10-15 13:49:21 UTC
(In reply to Cor Nouws from comment #13)
> So - though not straight forwarded - it looks as WFM?

This is the same as bug 70624; and even though I personally would tell this is NOTABUG (not WFM, which is "there definitely was a problem, but got fixed by unknown commit"), but e.g. Justin confirmed that; I don't think there's a consensus here, so I didn't close it.