Lack of whitespace normalization for the index

I have a document that contains

<text:p text:style-name="P417"><text:alphabetical-index-mark-start text:id="IMark522391580192"/><text:span text:style-name="T951">c</text:span><text:span text:style-name="T35">ompareSignalingGreater<text:line-break/></text:span><text:alphabetical-index-mark-end text:id="IMark522391580192"/><text:span text:style-name="T31">greater than</text:span></text:p>

The fact that <text:line-break/> is inside the alphabetical-index-mark yields a second index entry for “compareSignalingGreater”.

Shouldn’t LibreOffice normalize whitespace for the index (e.g. ignore line breaks and normal spaces at the end of the term, or move them after text:alphabetical-index-mark-end in the source)?

Please mention OS name, exact LO version and save format.
Attach a corresponding sample file for experimentation. Your sample is necessary: I don’t experience your behaviour under 26.2.6.3.

Linux (Debian/unstable) with LibreOffice 26.8.2.2, odt format.
Sample file: index-dup.odt (13,0 Ko)

What is really strange is that the compareSignalingGreater in the table is the only index entry containing a line break. In all other entries, the line break is external to the extent of the entry.

At first I suspected something related to you very weird character direct formatting (DF); they differ entry from entry (not consistent). However, clearing DF and applying character styles did not solve the issue

I could not find any way of getting rid of the line break, but by deleting the entry, adding a space at end as safety, recreating the entry and getting rid of the space.

Your document shows “anomalies” in the character style dictionary. Has your document ever been in contact or edited with M$ Word? If this is the case, it could be a remnant of M$ Word idiosyncrasies.

One last advice: avoid direct formatting: you can apply character styles and this will bring you central control on your enhancements. Similarly, don’t use Format → Bullets & Numbering. Instead apply a list style. Format → Bullets & Numbering is a clumsy equivalent of the ill-designed feature in M$ Word.

I don’t know how the line break got moved into the index entry; in the complete document, there is another table where there is the same issue on another one index entry. This happened between 2008 (where the line breaks were always after the index marks) and 2019. During this time, the styles in such tables changed (“compareSignalingGreater” was not in bold) and the contents changed too (“greater than” was previously “>”), but I don’t know whether such changes introduced the issue with the line break (I had access to intermediate PDF exports, but I haven’t kept them to check).

I fixed both line-break issues by editing the fodt file (moving <text:line-break/> after <text:alphabetical-index-mark-end text:id="..."/>). But I would have expected LibreOffice to automatically fix such issues.

The various style issues are due to old (pre-2008) versions, which started with the sxw format (2005-2006). I don’t know whether MS Word was used before, but most of the text (including the index) was added with old OpenOffice/LibreOffice versions, so style issues appeared with it, possibly because some style features were not present at that time.