Bug 97397 - When adding a caption to an image, an extra space is added
Summary: When adding a caption to an image, an extra space is added
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
(earliest affected) rc
Hardware: All All
: medium trivial
Assignee: Not Assigned
Depends on:
Blocks: Caption
  Show dependency treegraph
Reported: 2016-01-27 15:11 UTC by Moritz Ulmer
Modified: 2022-03-23 07:54 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:

Illustration Space Bug sample (20.70 KB, application/vnd.oasis.opendocument.text)
2016-01-27 15:11 UTC, Moritz Ulmer

Note You need to log in before you can comment on or make changes to this bug.
Description Moritz Ulmer 2016-01-27 15:11:55 UTC
Created attachment 122239 [details]
Illustration Space Bug sample

When adding a caption to an image, an invisible space is added at the beginning of the caption, before "Illustration 1.2: FooBar".

This can only be seen when creating a cross reference or in the index. A sample document has been attached to show this effect. This bug has only appeared since the 5.x releases. I've used several of them and most if not all show this behaviour.

To fix this problem, go into the caption and press delete with the cursor placed before the "I" of Illustration.
Comment 1 FutureProject 2016-01-27 15:53:13 UTC
Hello, and thank you for bringing this issue to our attention.

I was not able to reproduce this issue with:
Build ID: 2b9802c1994aa0b7dc6079e128979269cf95bc78
Locale: en-US (de_DE)

But I was able to reproduce with:
Version: (x64)
Build ID: ecd3574d51754b043f865cf5bafee286d24db7cc
CPU Threads: 4; OS Version: Windows 6.19; UI Render: GL; 
Locale: de-DE (de_DE)

The issue was introduced somewhere in between, probably with the change in how illustrations are referenced.

In it takes the form of "Illustration <n>: <caption>"
While changed it to " <n>. Illustration: <caption>", note the space

To reproduce in
1. Open new Writer document, insert any image.
2. Right-click on image -> "Insert Caption..."
3. In the new window, insert any text for caption, choose any properties, click "okay"
4. Put the writing cursor into any valid line and "Insert -> Cross-reference..."
5. In the new dialog: Type: Illustration, Insert reference to: Reference, click "Insert"
6. The new reference has a leading space

I'm setting this issue to NEW, but I'm not sure if this was an intentional choice or not.

In the meantime, a valid workaround might be not use a manual leading space and just let the reference touch against the previous word. The grey background will not be visible in print and the automatic space will not be noticeable. Because of this I will be lowering this issue to TRIVIAL.

Windows 10 Pro, Version 1511 (OS Build 10586.36)
Comment 2 Moritz Ulmer 2016-01-28 09:06:08 UTC
I agree that it is a trivial bug. A case where the work-around does not work is in indexes and if a sentence is started with the reference. This is especially noticeable if some of the captions were created with earlier versions of LO.

Out of curiosity, why was the change made?
Comment 3 QA Administrators 2017-03-06 14:25:58 UTC Comment hidden (obsolete)
Comment 4 lomacar 2019-03-02 01:16:23 UTC
I can confirm that this is still an issue in (Windows x64).

Although strangely, sometimes it seems like it is not an issue, because other captions I created yesterday do not have the extra space, for no apparent reason. I can't recall doing anything different to those other images/captions. I certainly didn't delete the invisible space.
Comment 5 Cathy Crumbley 2019-08-18 14:59:39 UTC
I hope that this problem can be treated as more than trivial.

I am working on a chapter with many figures. All of the captions I created directly from screenshots have this space in the cross-reference list.  Figures created in other ways do not have the space. The lack of consistent order in the cross-reference list has been driving me crazy.

Now that I finally have some understanding of what is causing the problem, I need to manually delete the spaces in many figures. That is not how I should be spending my time.

Note that this is not just an issue for illustrations.

I hope that someone is willing to solve this problem.
Comment 6 Andreas Säger 2019-08-18 15:29:57 UTC
(In reply to Cathy Crumbley from comment #5)
> I hope that this problem can be treated as more than trivial.
Trivial does not mean that the issue is trivial. Issues marked as trivial indicate issues that are trivial to solve. This is one of those issues which might be solvable by someone who is new to LibreOffice programming.
Comment 7 Cathy Crumbley 2019-08-21 19:23:28 UTC
Ah, thank you for clarifying, Andreas.
Comment 8 Dieter 2022-03-23 07:54:51 UTC
I can't confirm it with

Version: (x64) / LibreOffice Community
Build ID: 0b2e59a88b7e225b655db87910f97dca7aef27aa
CPU threads: 4; OS: Windows 10.0 Build 19044; UI render: Skia/Raster; VCL: win
Locale: de-DE (de_DE); UI: en-GB
Calc: CL

and attachment 122239 [details].

So it seems to be resolved.

Feel free to change it back to NEW with a short reasoning, if you disagree.

Additional information:
I can see a space between top of the image and caption border, but I think this report doesn't refer to this problem, that is reported in bug 147770.