Anchor snapping problems

Hi!

I’ve had real issues getting anchored objects to behave. It’s actually really bad and I don’t understand whether I’m doing something wrong or the anchoring function is really bad. I’ll try to be as descriptive as possible.

I’m working with an inserted text box on top of a text paragraph that overlaps two pages. I need the text box to be anchored in a way that the inserted text box is on the second page, below some text at the end of the paragraph.

However, because the anchor always snaps to the start of any paragraph it hovers over (including anchoring to character!) I am unable to place the text box where it’s supposed to be. It will always snap to the start of the paragraph, and then be unclickable at the bottom of the first page, instead of the second page where it’s supposed to go.

I want to stress: whether I anchor the text box to paragraph or to character does not matter as to my problem (as character is useless).

Clicking the anchor itself when anchoring to character, I can move it around freely, but doing so does not move the text box around.

Clicking the text box and moving it around, while holding down the mouse button, I can technically do so freely, but the anchor will always snap to the start of the paragraph as I move it around, regardless of the previous placement. When I then let go of the mouse button to place the text object, as the anchor is snapped to the start of the paragraph, the text object breaks position and is, again, unclickable at the end of the first page.

Now, this is all technically solvable by just snapping to page, which I’ve then done. But from what I gathered from googling what was going on, many comments did not like snap to page; this function was removed from the default UI specifically because getting the anchored object to freely move with the text content is… ideal? However, as is, it’s completely broken the moment a paragraph spans two pages, which is, mindedly, not uncommon. It’s literally not useful for the purpose of live editing a text page when more pages are involved, meaning you want to snap to page anyways. I’m at a loss for what’s going on.

I know this isn’t QA, but if I were to make an suggestion here, but why is moving the text object also moving the anchor around? Shouldn’t it be, since the text object uses the anchor as a root to position itself from, that moving the anchor would move the text object instead. I believe it worked like this in previous versions, too?

I seriously hope it’s just me who’s doing something wrong.

Hope you can help, best regards.

1 Like

There are several flaws in your procedure.

  • It is usually a bad choice to use a Text Box to attach a “side note” to a paragraph. A Text Box is a Drawing Object (said it otherwise, a shape with a label). Drawing Objects don’t interact well with text. They can’t be controlled by styles and must be handled individually.
    The correct “container” is a frame.
  • There is a very common confusion for newbies and even confirmed users about anchor and position. The anchor determines in which page the frame will be rendered. The position tells where in this page. The position can be made relative to a reference, such as the bottom of a paragraph, so that the frame always appears there, no matter edits to text.
  • To page anchor means you attach your object to a specific page number. It is no longer related to a paragraph. It will no longer “follow” the paragraph.
  • Frames and drawing objects are very sensitive to direct formatting (like resizing or moving with the mouse) which cancels automatic positioning set by parameters.

The solution is to change your “labelling” from text box to frame, create a frame style for automatic layout. However before giving adequate instructions, I’d like to have more information on your goal: what is this “label”? what is its content?

Attached a sample file (max 3 pages) with an example of your “label” on a paragraph spanning a page break. The button to attach a file is the seventh from left in the toolbar of the editing box on this site. It looks like a desk tray with an upward arrow.

More generally: OS name, exact LO version and save format. Be aware that any stable, predictable and reliable result is only possible with .odt format.

Thank you so much for the quick answer!

I’ll start with the general: I’m using Windows 11, LibreOffice version 25.2.4.3 (X86_64), and I’m using the .odt format.

For the label and the purpose of it, the content, the document is poetic prose, it’s a manuscript for a book. The overlap is to make some sort of visual noise, in a sense. I’ve attached a png how it’s supposed to look like as well as an .odt of the issue (I’ve changed the text, but the functional issue is the same).

example for troubleshooting.odt (22.6 KB)
example for troubleshooting

I am completely all in for making a frame instead of a text object. However, doing that has the exact same anchoring issues as a text box. The problem is that the anchor changes positions as you drag the frame or text box around, snapping to a previous page. Using a frame causes the same issues as a text box.

I will add, by the way, that just creating the text object or frame at its intended placement, without moving it, causes the same issue. The automatic anchoring to the start of the paragraph happens regardless of whether it’s when the object is created or later manipulated.

As to anchoring to pages, I will add that I believe I understand how anchoring works as to positions and placement; the issue is that the anchor moves when you move the object (frame or text object), the purpose of this I’m at a loss of. It works just fine elsewhere I’ve used it when it’s not in a paragraph that spans two pages. It just breaks in the specific situation of a paragraph spanning two pages.

Is there just a way to make anchors not move when you move their dependent objects?

I suspect there is a bug in handling a split paragraph. I experiment and report back here when I have made up my mind.

EDIT I confirm there is a bug. I’ll prepare a sample document tomorrow and submit a bug report tdf#167397

If this is the case, a “text-only” workaround is needed.

If your “noise” is to be attached to the very end of the paragraph, an As character frame with textual contents could be the solution. A text frame is a complete subdocument where styles can be applied (paragraph and character), what you can’t do on a Drawing Object. And the insertion can be simplified by creating an AutoText entry.

PS: you gave name Text Frame 1 to your “decoration” but it is still a Drawing Object, not a frame.

It being a bug explains everything! Thank you so much for the prompt help here.

FWIW, in the attached document, it was indeed just a text object (ie a drawing object, I guess), not a frame. I just wanted to reproduce the original issue.

I’ll try messing around with anchoring “as a character”, does that allow me to freely move it around "independently of the paragraph? Because sadly the text overlays like this are present a bunch of places in the document, and they’re not only consistently added as appends. My experience with anchoring “as character” places it in the text itself, which is not what I try to do.

Regardless - until then, luckily anchor to page works somewhat.

Thank you so much for the help. :slight_smile: I hope the bug gets fixed.

Avoid this mode as much as possible. Your “decorations” are linked to the paragraph. After you edit your text, the frames will no longer positioned as needed with To page mode.

Not “freely”, but you still have some possibilities. In example for troubleshooting.odt (37.9 KB), I tried to reproduce the look of the screenshot.

Your “decoration” seems to be added at end of paragraph text. This is a “dynamic” position (as opposed to a “static” one like centre) which can’t be achieved with “normal” frames. Therefore I chose As character to make the “decoration” part of text and managed through text-flow algorithm.

I inserted a 2-line paragraph (with forced linebreak) styled with Frame Contents. I customised this paragraph style to reduce line spacing so that it looks similar to the screenshot.

I played with the frame position properties (with direct formatting for quick’n’dirty experiment but you can save the parameters in a frame style for sharing with other occurrences) to shift downwards the frame.

With As character anchor, the frame remains a part of paragraph text. Therefore it is always in the vicinity of its insertion point. For an end-of-paragraph flag, it is fine.

Don’t hesitate to request more suggestions, but describe as accurately what you want to show.

1 Like