Previous images sometimes move when "Insert Text From File" used

I’m using Libre Office 7.3.7.2 on Linux Mint 21.3. I’m building up a large document by repeatedly adding small documents to the end of the big one, using “Insert Text From File”.

The small documents often have images.

After inserting a new document, existing images sometimes move far away from their previous location, often to page 1. Sometimes a duplicate image is created.

Typically the images are photos in a caption frame. Anchoring varies but I haven’t been able to establish whether this is a factor.

Ideally, I would like to prevent this behaviour, because it means that I must scan the entire document for cases of this after every insertion, and then spend time on repairing the doc.

Any thoughts?

Images anchored As character can get pushed into the bottom margin and disappear from sight. Most of the time you can retrieve them using Navigator to select the image and then using Format > Anchor > To character but it isn’t quick unless you have named the images.
See tdf#87912

The only method I know to achieve predictable and stable image positioning is to use frame styles and absolutely avoid direct formatting on them.

Frame styles are the most disregarded styles in Writer. They suffer less attention from developers and are plagued with a lot of “non-conforming” behaviours, which really confuse users, even experts like me. Coping with these behaviours requires the absence of direct formatting (DF). And DF on frames comes very easily and quickly!

Anchoring plays a major role. Don’t confuse anchor and position. For example, To page anchor mode is to be avoided until you understand what it does. It is intended for very special cases akin to desktop publishing (DTP). Position is independent from anchor, except for As character. You can anchor To paragraph and simultaneously send the frame into the header.

Give us an idea about your document styling and we can then suggest fixes.

Just to make sure: you document is saved .odt, isn’t it? Any other format will cause problems.

The document is a collection of newspaper articles. Each article starts on a new page.

There is a headline at the top of the page. This is followed by the article text, in three columns. This usually occupies the rest of the page and part of the next page.

Finally, there may be one or more images. These are not inside the column area but follow it.

I insert the image, and using the properties menu, give it a border. I then add a caption, using the Insert Caption menu item.

I add the caption text, and recently have been setting the anchor to “page” to try to stop the images from moving around.

Finally, I resize and drag the caption frame to position and size the image. (I do realize that resizing is better done before importing, using an external graphics editor.) In any case, I believe that there is no direct formatting of the caption frame.

The document is indeed saved .odt.

      • Peter

All you describe in your procedure are direct formatting for frames: resize and drag, adding properties through the menu, … Any action other than applying a frame style is direct formatting! And frame styles are very very sensitive to direct formatting. And the fact that frame styles are not as rock-solid as the others complicates the matter.

Anchor mode To page is more liable than other anchors to lose sync between article and images: images will remain to a defined physical page and no longer flow with text. This is the least issue. Another one is the occurrence of undeletable blank pages.

Attach a one-page sample so that I can have a look.

Here’s a one-page sample, which was created by deleting other content in
the document I am in the process of creating.

      • Peter

One_page_sample.odt (372 KB)

There are many flaws in your sample:

  • pointless nested sections
  • frame anchored To page
  • direct formatting
  • spacing with empty paragraphs and spaces

Let’s start with the picture. You have captioned it with Insert>Caption which creates “nested” frames. Since frames cannot be constrained to remain inside other frames, I eliminated the inner frame by anchoring the image As character. I added a paragraph break after it. The frame now contains:

  • a paragraph for the image “character”,
  • a paragraph for the caption

By playing with Caption paragraph style properties, you can adjust separation between these paragraphs.

I created an Illustration frame style with anchor To paragraph, autosize, position horizontal center, vertical bottom, both relative to Page Text Area, spacing around 0,2 cm except bottom 0. I requested Keep inside text boundaries and forbade Allow overlap (the latter is useful if you have several images).

The frame anchor was moved to the Heading 1 paragraph "Cecil Landry … and style Illustration was applied.

I configured Heading 1 and Heading 2 so that I could eliminate the spacing empty paragraphs.

Heading 2 was applied to the titlt in the article. Since this article is single “logical unit”, I replaced your pointless paragraph breaks by line breaks (thus, the full title is collected in the TOC as a single entry instead of 3).

I applied Body Text to the article text with a modification of style properties (feel free to customise). If you need first line indent, do it through style configuration, not with initial spaces. Space width is not reliable because Writer can expand them freely.

I finally cleared all direct formatting. I added extra text in your 3-column section (and after it) and the frame remained in its assigned position.

I repeat it once more: Frame styles are extremely sensitive to direct formatting. Never, never, never (should be repeated seventy-seven times) act on them with the mouse or the keyboard navigation keys (directional arrows). This will instantly add a direct formatting layer over them and you can’t get rid of it. Rather the trick is to apply another style, any one, and apply again the desired style.

Edited sample: One_page_sample-ajl.odt (380.0 KB)

Compare the difference of structure/contents in the Navigator.

Wow, a virtuoso performance!

Thanks very much for taking the time to analyse my own poor efforts and to supply a replacement, which no doubt uses LO Writer as the designers intend. I obviously have a lot to learn, but I intend to study your example and commentary and the docs, and I’m looking forward to fixing up the book I am working on. It will be great to have some understanding of how to use LO Writer properly.

Regards

      • Peter
1 Like

It is worth reading the beginning of Designing with LibreOffice to get an understanding of how styles should work to help you achieve fast consistent formatting results. The Writer Guide can help with specifics. Both can be downloaded from English documentation | LibreOffice Documentation - LibreOffice User Guides

1 Like

@ ajlittoz: I’ve studied both your sample page and the commentary above, but am unable to replicate your results. Perhaps it has something to do with the order of operations. Here’s what seems most likely to me to be correct procedure:

  1. Place a frame in the document
  2. Add a paragraph mark inside the frame, for a total of two.
  3. Apply your style “Illustration” to the frame.
  4. With the cursor inside the frame, import an image
  5. Apply your style “Graphics” to the image.

I didn’t use any direct formatting, on either the frame or image. The image is about 800 px wide.

Prior to importing the image, the frame is very small, just over 3/4 of an inch wide. After importing the image, I would have expected the frame to resize (autosize is selected in the style) but it does not change size. The image seems to be sized to fit within the frame.

In the style “Graphics” for the image, autosize is specified for horizontal, but turning this off does not affect the result.

The only difference I have made to your styles is to have the frame position to the bottom of a paragraph text area, because I want it to appear after the final paragraph of the text, whether the text occupies less than or more than a single page.

What am I doing wrong?

@ EarnestAl: Thanks for the pointers to the two documents. Designing with LibreOffice is new to me, and I’m enjoying reading it.

Sorry for not being clear. Here is the procedure:

  1. Click inside the paragraph you wish the image to be attached to (in the example document, this is the Heading 1 paragraph with the “global” heading
  2. Insert the image
    A frame for the image is created
  3. Click on the image (in fact this selects the frame containing it)
  4. Insert>Caption as you do routinely
    Up to this point, I think this is your usual procedure
  5. Right-click on the image and Anchor>As character
    This is direct formatting but I see I didn’t create a dedicated frame style with anchor As character. Create one or use Formula if you have no need for it, I mean for Math formulas.
    1.The image is now a huge glyph at left of caption; insert a paragraph break so that image centers above caption
  6. Select the outer caption frame and apply my customised Illustration frame styleThe image moves to its expected location.

Autosize works fine with text. I think I have mentioned that frames can’t be jailed (or constrained) within one another. This means when a frame expands it may grow beyond the limits of the frame inside which it is anchored (and this is consistent with the independence between anchor and position.

In your procedure you begin by creating a frame and you insert or paste an image inside: you have created two frames instead.

Mastering frames is the most difficult experience in Writer. I initially thought it was lis styles, but I was wrong. Frame styles need to be reworked to improve stability, robustness, predictability and reliability. It took me years to grasp the gist of it and I still meet unexpected results. So don’t be ashamed by your failures. Experiment, experiment and experiment again to learn the effect of the various parameters.

Only you know what layout you want to achieve. I used Page text area as an example of “decoupling” position from anchor. Choose whichever position fits your requirement, taste, puslisher constraint, …