Bug 157200 - table of content with duplicate entries
Summary: table of content with duplicate entries
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
7.6.0.0 alpha1+
Hardware: x86-64 (AMD64) All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: bibisected, bisected
Depends on:
Blocks: TableofContents-Indexes
  Show dependency treegraph
 
Reported: 2023-09-12 07:47 UTC by SusanneMohn
Modified: 2025-10-13 03:12 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Attachments
Document with table of content with custom styles (3.01 MB, application/vnd.oasis.opendocument.text)
2023-09-12 07:49 UTC, SusanneMohn
Details
Example file after setting category to Abb. and updating the ToF in German UI (53.55 KB, image/png)
2023-09-14 23:50 UTC, Gabor Kelemen (Collabora)
Details
Similar example for simple TOC (13.16 KB, application/vnd.oasis.opendocument.text)
2023-09-15 11:45 UTC, Gabor Kelemen (Collabora)
Details
The second example file in Writer (72.29 KB, image/png)
2023-09-15 11:48 UTC, Gabor Kelemen (Collabora)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description SusanneMohn 2023-09-12 07:47:20 UTC
new fetaure in LO 7.6.: Table of Figures can be generated more flexibly based on a paragraph style, not only by categories or object names. tdf#153090 (Michael Stahl, allotropia) 
Result: In the List of Figures, the entries formatted with the custom style AbbRot are duplicated.
Comment 1 SusanneMohn 2023-09-12 07:49:40 UTC
Created attachment 189508 [details]
Document with table of content with custom styles
Comment 2 Stéphane Guillou (stragu) 2023-09-12 12:41:40 UTC
Thank you, Susanne.
Checking with linux-64-7.6 bibisect repo, this started at 2178d1ef764ec3e4cf0e8096392f1a4789fc8a64 which points to:

commit 90e1698dab3d286c10136719aa85fee2f56ad9fd
author	Michael Stahl Mon Jan 23 16:38:03 2023 +0100
committer	Michael Stahl Tue Jan 24 13:39:23 2023 +0000
tdf#153090 xmloff: ODF import/export of source style on ToX
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146013

Updating the index before this commit removes the two duplicate entries, which makes sense as using additional paragraph styles was not available then.

So to be clear: the duplicated entries are expected, as the default table of figures relies on the captions' "number range" fields, and the "new additional paragraph style" feature relies on the style of the paragraph.
If you needs an index based on only styles, you can use the index type "user-defined".
Let me know if I'm missing something. (I'm only really exploring the feature now :) )

However, testing the feature made me hit this regression:
0. Right-click > update the index: Illustration references remain
1. Open the dialog to edit the Table of Figures, but don't change any setting in the dialog
2. Click OK

Result: entries based on caption fields are removed. That's because, since 6.3, opening the dialog resets the type to Figure (instead of keeping Illustration).

Still current with recent master build:

Version: 24.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: cea165a3ebdb5f2a2b172004ff1b3848f303d78a
CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: en-AU (en_AU.UTF-8); UI: en-US
Calc: threaded

So I'll close this report as "not a bug", and report the other issue separately if not already reported.
Do you know when this example file was created / with which version of LO?
Comment 3 Stéphane Guillou (stragu) 2023-09-14 13:16:01 UTC
(In reply to Stéphane Guillou (stragu) from comment #2)

> So I'll close this report as "not a bug", and report the other issue
> separately if not already reported.
> Do you know when this example file was created / with which version of LO?

I've reported it as bug 157223 and it has already been fixed by Caolán :)
Let us know if there are further issues or if I missed the point above.
Cheers!
Comment 4 Gabor Kelemen (Collabora) 2023-09-14 23:48:45 UTC
Hm, I believe there is merit in the report.

This new feature was inspired from Word, and there it works a bit differently than in Writer: 
It is possible to select a caption category and a custom style (although their UI is kinda counter-intuitive in this area, and selecting a custom style instantly resets the category setting to none - but it can be set again).

See attachment 184747 [details] from bug 153090 about this: the ToF is made from two settings: the category "ábra" (figure) and the custom style _CustomImageCaption. The small house images description has both these conditions true, but only one entry is added in the ToF, even after updating it in Word. Which makes sense, it's only one paragraph in the document body.

However in Writer it's also easy to reproduce the entry duplication with attachment 184745 [details] : 
- Set the LO UI to German
- Open the attachment 184745 [details]
- Edit the ToF, set the Kategorie to Abb.
- OK the dialog -> ToF is updated, the first two entries are duplicated.
(the same happens in Hungarian UI and selecting the ábra Category - this duplicates the third entry)

I think it would make sense to not duplicate ToF entries even if they match two criteria.

Version: 24.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: beaea2e992912b4747d790070b26371f557b1f57
CPU threads: 15; OS: Windows 10.0 Build 19045; UI render: Skia/Raster; VCL: win
Locale: en-US (hu_HU); UI: de-DE
Calc: threaded

Note that it's possible to set up a simple TOC with similarly duplicated entries that have both an outline level set and their para style is also assigned to a TOC level. That is also nonsense to show and does not match what Word does, which only shows one entry even if a paragraph matches multiple conditions.
Comment 5 Gabor Kelemen (Collabora) 2023-09-14 23:50:25 UTC
Created attachment 189583 [details]
Example file after setting category to Abb. and updating the ToF in German UI
Comment 6 Stéphane Guillou (stragu) 2023-09-15 09:50:27 UTC
Thanks Gabor.

It's true that following your steps, then opening the resulting DOCX in Office.com and updating the ToF removes the duplicates.

(I also tested saving Susanne's attachment 189508 [details] as DOCX, opening on Office.com and updating the ToF, it results in no duplicates but images included inline. Something else to have a look at.)

Michael, what do you think?
Comment 7 Gabor Kelemen (Collabora) 2023-09-15 11:45:40 UTC
Created attachment 189606 [details]
Similar example for simple TOC

Here is another example, the Hello World paragraph has Outline level set (by me), and also added as additional style as level 3. TOC shows it twice.
Comment 8 Gabor Kelemen (Collabora) 2023-09-15 11:48:19 UTC
Created attachment 189607 [details]
The second example file in Writer
Comment 9 QA Administrators 2025-10-13 03:12:32 UTC
Dear SusanneMohn,

To make sure we're focusing on the bugs that affect our users today, LibreOffice QA is asking bug reporters and confirmers to retest open, confirmed bugs which have not been touched for over a year.

There have been thousands of bug fixes and commits since anyone checked on this bug report. During that time, it's possible that the bug has been fixed, or the details of the problem have changed. We'd really appreciate your help in getting confirmation that the bug is still present.

If you have time, please do the following:

Test to see if the bug is still present with the latest version of LibreOffice from https://www.libreoffice.org/download/

If the bug is present, please leave a comment that includes the information from Help - About LibreOffice.
 
If the bug is NOT present, please set the bug's Status field to RESOLVED-WORKSFORME and leave a comment that includes the information from Help - About LibreOffice.

Please DO NOT

Update the version field
Reply via email (please reply directly on the bug tracker)
Set the bug's Status field to RESOLVED - FIXED (this status has a particular meaning that is not 
appropriate in this case)


If you want to do more to help you can test to see if your issue is a REGRESSION. To do so:
1. Download and install oldest version of LibreOffice (usually 3.3 unless your bug pertains to a feature added after 3.3) from https://downloadarchive.documentfoundation.org/libreoffice/old/

2. Test your bug
3. Leave a comment with your results.
4a. If the bug was present with 3.3 - set version to 'inherited from OOo';
4b. If the bug was not present in 3.3 - add 'regression' to keyword


Feel free to come ask questions or to say hello in our QA chat: https://web.libera.chat/?settings=#libreoffice-qa

Thank you for helping us make LibreOffice even better for everyone!

Warm Regards,
QA Team

MassPing-UntouchedBug