How can I preserve image caption position, keep image captions attached to respective image?

(Apologies if this sounds more like a bug report)


If I add 3+ images to a documents, some of different sizes, add captions to them, and save the document, a few annoying behaviors occur. Prior to saving the document, I can confirm the following:

  1. All images are set to a) anchor to paragraph, b) optimized page wrap, and c) center alignment.
  2. All frames are set to a) anchor to page, b) optimized page wrap, and c) center alignment.

Description of Current Behavior

The following behaviors occur when reopening a saved document with the above:

  1. Images will appear outside of their respective image frames (that is, frames made when a caption is added)
  2. Frames containing captions will be converted to text boxes (that is, the frames are no longer accessible via the navigator)
  3. All images are anchored “as character”, instead of “To Paragraph”
  4. Some images will overlap, typically smaller images on top of larger ones.

Desired Behavior

What I would like to do is:

  1. Add captions to figures, have their positioning relative to associated figures be preserved on subsequent document loads (I.e. have images STAY in their respective caption frames).
  2. Have caption frames be preserved on subsequent document loads (e.g. not have caption frames be converted to text boxes on subsequent document loads).
  3. Have image positioning a) retained within the respective caption frame, and b) be preserved in the order I specify (e.g. not have images overlapping on subsequent document loads).

In summary

Is the above a known problem/bug in LibreOffice? Is this potentially due to user error?

(Thank you so much for any clarification you, the community, can provide!)

Save as ODT not .doc or .docx as those formats don’t understand about frames. Cheers, Al

Thank you for the clarification!

Unfortunately, the people who edit my document only use MSOffice (and say they can’t open .odt files with it, for some reason).
Guess that means I will have to as well.

I only have MS Office 2010 but I cannot add a proper caption to a picture in it. There is an option to add a caption but it just adds a numbered line of coloured text below the picture, probably has a bookmark in it too. If the picture goes halfway across the page then the caption doesn’t care but will use the full width of the page. Maybe Office 2016 or 365 has better handling but you might be disappointed.

You could ask one of your colleagues to send you a .docx with pictures, captions and anything else you might need. You could then see if you could cobble something together that has the same effects. For example a picture anchored as a character, followed by a return with a text box with the caption anchored as a character - pretty awful

Of course the better option is to send them a link to LO :wink:

Adding images is possible in all applications of the suite, which makes tag legitimate. It seems your question should be read in Writer context but this not explicit.

Please retag to choose between common (universal case) or writer (text document target only).

Thanks @ajlittoz. Retaged. Should I add a tag about MS Word or compatibility?

Basically the issue is, all figures are required to have captions (Thesis layout requirements). I would like to add captions, in Loffice Writer, save as .docx, and have caption order and image associations preserved when moving the document between Word and Loffice Writer.

Should I reword the question as such?

@ajschadler: the more precise the question, the more chances to get an adequate answer.

Adding tags compatibility and docx is probably a good idea.

But this is a fundamental difference between the format as @EarnestAl explained. In my opinion, there’s no possible fix because this is a shortcoming in M$ docx.

Perhaps, try the other way round: create the caption as an ordinary paragraph (you can style it Caption afterwards) and add the numbering yourself with field insertion instead of the synthesis by the macros implementing the feature. Attach the image to the caption paragraph.

Does it solve the issue? If so, I’ll make my comment an answer with more detailed instructions.

(comment was edited. figured out how to implement fields*)

@ajlittoz: I implemented your suggestion the following way:

  1. Create the caption text, “Figure #”.
  2. With no carriage return, insert image using the “Insert Image” dialogue.
  3. Anchor the image “To paragraph”.
  4. Adjust position manually, to where image appears directly below caption paragraph.

This approximates the “caption” behavior, but looks like I will have to manually adjust image position in order to make the caption look “natural”.

In your answer, please update it with additional anchoring, page wrap, and misc. option suggestions that might also help!

This is a workaround to attempt and mitigate the format differences between LO Writer and M$ Word.

##Create a “caption”

  1. At start of to-become-caption paragraph, type "Figure "

  2. Insert>Field>More Fields, Variables tab; in Type, click on Number range, *Select Figure. By default Format is Arabic (1 2 3) but you are free to choose another one.

    This field retrieves the current value of the figure counter and increments it. It is the same way Insert>Caption operates. This is a perfect manual replacement for the menu command.

  3. Continue typing your caption, not forgetting ": " to separate the figure number from the caption proper.

  4. You can assign your caption paragraph style Caption so that all you captions can be easily formatted and updated easily (notably center alignment).

##Attach the image

  1. Insert>Image into your caption paragraph.
  2. Right-click on image and Properties
  3. In Type tab, change anchor to To paragraph; set Position Vertical Top relative to Margin
  4. In Wrap tab, set mode to None, uncheck Allow overlap and set some Bottom Spacing to separate the image from the caption (something like 0.5 cm or 0.2" is a good start).

I am confident about this workaround in Writer. However, I have no M$ Word copy to check if the Figure number range will be correctly interpreted by Word. Please give me feedback about it.

To show the community your question has been answered, click the ✓ next to the correct answer, and “upvote” by clicking on the ^ arrow of any helpful answers. These are the mechanisms for communicating the quality of the Q&A on this site. Thanks!

In case you need clarification, edit your question (not an answer which is reserved for solutions) or comment the relevant answer.

I’ll be sending my draft to my advisors later today. I will check the compatibility on M$ Office then and give you an update! If it all checks out, I will mark yours as the answer.

Opened it up in M$ Word. The captions reverted to left aligned. Other than that, it seems to work just fine.

The captions are left-aligned because they are written in a Default Paragraph Style or Text Body paragraph. If you styled them Caption, factory-provided Caption is italics but also left-aligned. Customise Caption for center alignment and other personal preferences.

I can verify that I set the caption style to center alignment in the original document. It looks like that’s just an M$ Word issue, which is easily remedied anyway.

Another small update:
I received an edited draft from my advisors today. The image positioning has been thankfully preserved, however the anchor is now set “To Character” instead of to paragraph.

This may be a consequence of the round trip to/from .docx. I think as long as you don’t play with the image/caption it should not move. But if if need to modify anything, re-anchor it To Paragraph otherwise you won’t be able to align it where you want it.