Anchor Frame to Page, Columns and Caption Number Wrong

I have discovered a repeatable cause of Caption Miss-numbering. The format I am using is fixed by the publisher so any help anyone can give would be appreciated.

In a document with two columns I have inserted two graphs, one above the other in the second column. The frames must stay at the bottom of the column so I anchored both of them to the page.

PROBLEM: the caption numbers keep switching from #1 on top and #2 to the one below, to #2 on top, and #1 on the one below.

HOW TO REPLICATE: If the two frames are moved to be next to each other, (one above the other), the caption numbers switch and #2 is on top.
If the top frame is moved up so that text is automatically moved down and appears between them, then the caption numbering corrects itself and #1 appears on top, and #2 appears in the caption in the frame below.
If the top frame is moved lower toward the lower frame to the point the text between them is moved and there is none, then the caption numbering switches again with #2 in the top frame and #1 in the bottom.
The frames are not overlapping.

Can anyone help?

The caption feature has a design flaw IMHO. Whenever you use numbering sequences, correct visual order is guaranteed only inside a flow. Frames create secondary flows and there is no specified ordering between flows. Since Insert>Caption creates a frame to contain both the caption (which, after all, is nothing but an ordinary paragraph with a special field) and the image (which is another frame), you’re vulnerable to the seqencing issue.

The solution is not to use the caption feature in complex design and do captioning manually. This is not much more effort than using Insert>Caption and you control everything. For taht, it is crucial to understand the subtleties of frame styles.

I could help but basic information is missing: OS name, LO version and save format. Also, provide a 1- or 2-page sample so that we can have an idea of the layout. Mention also the requirement for the captions.

Thank you for responding. This is very frustrating as it is a long technical document with many cross-references and it is being continually edited. Without auto-numbering it could turn into a major re-write.

Version: 7.3.7.2 / LibreOffice Community
Build ID: 30(Build:2)
CPU threads: 32; OS: Linux 6.2; UI render: default; VCL: gtk3
Locale: en-US (en_US.UTF-8); UI: en-US
Ubuntu package version: 1:7.3.7-0ubuntu0.22.04.3
Calc: threaded
Saved as odt.
The captions are for each frame. They need only be figures, and tables (in frames so as to anchor it to the page) with increasing numbers as normal. But they must maintain the same numbering as the cross-references to them. Figures and tables are continually added at different places and moved.

No! Don’t use To page unless you are 200% aware of the consequences. See my reply to your comment in the other question.

I don’t understand the problem. Cross references can reference the caption number. So they are always in sync.

Provide a 1- or 2-page sample so that I have an idea about your formatting. Only styling will guarantee layout stability. If you practise direct formatting, you lose.

These are technical journal submissions and the acceptance format is unchangeable. Two-columns, tables, graphs and other images at either the top or bottom of the columns.
It is possible to put two images with captions in the same frame if they can be stacked, and the frame anchored to the page so it stays put.

However I have run into another problem when trying to put multiple things in a frame: the option to ANCHOR TO FRAME appears and disappears seemingly without reason.

lo_caption_numbering_issue.odt (12.6 KB)

I just had a look at your sample file. I suspect you don’t practice styling because everything is Default Paragraph Style and you indent with spaces. This track will lead you nowhere and formatting your paper will be an unbearable pain. I highly recommend you read the introduction to styles in the Writer Guide. Then practice to get accustomed to them.

To solve the sequencing problem, proceed the other way round. Create the number at first occurrence in your text (numbers will be increasing monotonically along reading direction) and use a cross-reference in the caption.

EDIT

I’m sorry, I can’t reproduce frame auto placement I did in ComplexLayoutExample.odt (43.7 KB) (for marginal notes).

My frame style Frame_at_top does correctly its job only when there is a single figure in column. Otherwise for an unknown reason, frames stack upon each other despite Allow overlap being unticked.

Nevertheless, study how I reversed numbering to make sure that whatever edit you may do, figures will always be numbered monotonically from start to end. The only restriction for correct cross-references is a single occurrence of figure number is the definition paragraph. Non-definition paragraphs may reference any number of figures. The reason for this restriction is related to Writer internal implementation of what is considered a “caption”.
lo_caption_numbering_issue-ajl.odt (12.2 KB)

But I urge you to use styles in your paper to maximise your chances of success. This will allow you to tune the layout from a central location without the need to act upon text in case you missed some requirements in the publisher’s layout. The sample you submitted is direct formatted (which may perhaps badly penalise my attempt to tidy things up).

As soon as you anchor the frames “To paragraph” and then select Tools > Update > Update All in the menu, the number sequence of the frames is also correct.


98524 HB lo_caption_numbering_issue.odt (12,8 KB)

2 Likes

That was a default document that reproduced the issue. There should not be any custom styles.

@Hrbrgr. Imagine a little bit - developing a document of a few hundred pages with frames, formatted to have the frames at the tops and bottom of columns.

Without anchor to page - each time you add a sentence the rest of the document goes blotto as frames are pushed to the next page – all the way down. Cut a paragraph and whammo … you have the same in reverse.

What the author is trying to do is figure out how to layout the text so that it best references the graphics, something that becomes very difficult to do when the frames that contain the images keep bouncing between pages.

I have noticed the coments of @ajlittoz and your own, I get the impression that LibreOffice is going to do away with anchor to page. Is this correct?

Not at all. The issue here is to understand what anchor To page does. It is a very specialised anchor mode which should not routinely be used. It is a DTP feature. DTP documents are based on pages (primary objects) where text is constrained within areas and does not spill over automatically to other pages. You have to do that explicitly. In such a context, anchor To page is a necessary tool because you must layout the image in some area of the designated page next to the text area.

In Writer, the primary object is the main text flow. You have no page object. Pages are kind of necessary “accidents” to cope with the available output devices which print on quantised media, i.e. text is sliced onto sheets of paper.

Since text location is unpredictable (it depends on too many factors for user to make a reliable guess), it is much better to anchor to the referencing element (usually a paragraph) so that Writer allocates the frame in the same page as its reference element.

As I already explained, anchoring To paragraph does not define position. You can send the frame anywhere inside the page. This is what I configured in my Frame_at_top frame style: the frame goes to the top of the column. Unfortunately, I could not remember the conflict-resolving trick I implemented in the complex layout document I attached. This trick would shift downwards second, third, … frame competing for the same position. Instead, they overlay each other in my last attempt. This is why I said that my style does what is expected only if there is a single frame in each column.

Understand that anchor and position are independent settings. A frame, except As character can indeed be positioned anywhere in the page. But refrain from moving it manually because you’ll easily and frequently change the anchor, resulting in undesired layout after edits (this change in anchor is one reason for seemingly random changes in position).

Has the publisher provided you a template with the desired styles? Considering the average “quality” of"templates" I see on this site, I doubt it. Styles collection is most commonly limited to paragraph styles. To a lesser extent, you sometimes find page styles. But there is a complete lack of character, frame and list styles (because Word has no notion of them?). And this ends up with documents full of direct formatting which turns tuning to the mandatory graphical charter into a nightmare.

As an author, don’t hesitate to bridge the missing parts in the graphical charter with custom styles of your own in order to reduce as much as possible direct formatting and facilitate conformance to format/layout.

Your ultimate achievement is to separate contents from appearance. Contents (i.e. your creative discourse) should be tagged with styles, the names of which translate the semantic value, the significance of objects (paragraphs, words, pages, lists, …), not how they look. Then all the formatting and layout work is in styles configuration and you should not, never, review text contents during this step. If you must, your styling is faulty.

Well my imagination is very big. If your knowledge of LibreOffice is proportionally as great, there should be no problems :wink:.

Now a little more seriously, I have tried to implement your instructions.

If you want to position and anchor the frames on the side, at the top and bottom of each of the two columns, you have to pay attention to the wrap and the protection for the frame. See screenshots:




98524 HB2 lo_caption_numbering_issue.odt (13,1 KB)

None of the replies have helped. The caption auto-numbering closer to the top of the page (across all columns) get numbered first. They should be numbered in the first column from top to bottom, then continue the numbering in the second column from top to bottom, etc.

There seems to be a problem when using columns and auto-numbering. Is there a way to tell Libreoffice that the text in columns flows down first, then up to the next column, and so on, for caption auto-numbering?

Another thing I noticed is that when naming tables with the default names “table1” in the properties tab, is that they will change the name according to the position closest to the top of the page (across all columns). Yes, tables are in frames, and the frames are anchored to the page and, though it made no difference, the frames in which the tables reside are linked in sequential order (top to bottom in the first column, then to the top frame in the second column, etc…

Caption number are allocated by an “object” called a number range. This variable is incremented by one every time it is met. If the “incrementation event” is in the main flow, i.e. your text, you have absolutely no problem. If you use Insert>Caption, the command creates frames which have no ordering relationship against the main flow nor between them. The ordering will be approximately creation order. You may sometimes improve the situation with Tools>Update>Update All which may reorder per page. However, this “improvement” is only based on geometric location without taking into account the zig-zag reading “line”. This is why I recommended to exchange the role of caption definition and cross-references. The caption under the figure will use a cross-reference to the first mention in text. Then your order is guaranteed to follow reading order.

In addition you persist to anchot your frames To page despite being warned against it.

Also, you seem to insert your tables in frames. Tables are already roughly equivalent to frames. There is no need to nest them like this. All you do is make your document even more complex with more problems.

Since you’re writing a technical paper submission, you should be able to understand, as a higher-educated writer, that typography has its own conventions, with specific “technical” rules and a long-standing tradition. Writer tries to stick with these conventions. It may look difficult but the domain is itself technically difficult.

@ajlittoz , I must say that your continual comments about “warning not to use anchor to page” strikes me as a prelude to removing the functionality of “anchor to page” from Libreoffice.

I say this because anchoring an image or a table to a page position while letting the text flow past it while edititing, is unequivocally one of the great time-saving achievements in WYSIWYG document editing.

If one does not write according to specific formats, then it may mean little. However removing the capability to “anchor to page” is a SURE way to chase anyone that does away from Libreoffice, to the other major word processing program.

Perhaps the story of how another open software program fell from dominance to a commercial interest may be relevant?: [Here's Why Firefox is Seeing a Continuous Decline for Last 12 Years]

You have not understood the difference between anchor and position! (which anyway is not made clear in the documentation)

The anchor is a reference object with which the frame or image is related. The image will accompany this object, i.e. will be on the same page as the object. The anchor determines the page of insertion, nothing more.

The position can be absolute or relative within the page determined during the preceding step. This position can be anywhere in the page if you want so, e.g. at top or bottom of page. This is what you want (top of column). Other choices are close to the “object” or even inside the “object” (e.g. a paragraph).

Suppose you are presently at page 3 and a paragraph makes a statement about a diagram. You want this diagram to be on the same page as the statement for reader’s convenience. If you anchor To page, the diagram will be anchored to page 3 for ever. It does not matter at the time of insertion.
Now, you make modifications to page 1 and 2 and this causes the statement to be flushed to page 4. Your diagram remains on page 3.

If you anchor the diagram to To paragraph (the paragraph containing the statement), the diagram will also move to page 4 (and still be at top of column if the Position parameters requested so).

I insist on the difference between anchor (related to dynamic choice of page – where To page requests a static choice) and position where the frame can be located anywhere in the page, even decorrelated from the anchoring “object”.

The name To page does not convey clearly the consequences of this choice, but I don’t see which name could replace it. I don’t mean that To page should be removed. It is useful in some workflows akin to DTP but 90% of the time this is not what ordinary users want and they are surprised by strange but predictable consequences of this choice. In particular, anchoring To page will mess up the final document if your article is “imported” as part of a global master document (if your article starts at page 40, your diagram will still be at page 3!)

So, if you still think after these warnings that anchoring your frames To page is a good choice, this is your workflow and you’re happy with it. But be aware that you’ll need to manually move the frames if edits change the flow of your article in such a way that your publisher constraints no longer hold.

@ajlittoz Thank you for the time you spent answering.
You have made it quite clear that you want “Anchor to Page” functionality to be removed from Libreoffice, because you see no reason for fixing an image or a table to a specific position on a page.
You did not mention what happens when the paragraph or character to which a an image or table is anchored … is deleted or pasted over with a different one.
You seem intent to frighten people from using Anchor to Page, the method seems to be to imply that LibreOffice is becomming unstable when Anchor to Page is used.
The mechanics of what you are doing may have profound implications for LibreOffice. The description of Constant removal of features “that no-one uses” in the link https://news.itsfoss.com/firefox-continuous-decline/ is spot-on.
I am not sure where you got your “but 90% of the time this is not what ordinary users want” statistic. However, if you keep posting statements that imply LibreOffice is unstable when using Anchor to Page you will succeed in raising that percentage … because you have reduced the user base by frightening away the people that did use it.
This will be my last post on this subject.

Reread my post; you draw wrong conclusions.

Anchor To page is useful and I don’t want it to be removed. But you must understand what this mode implies.

Once again, I never wrote Writer becomes unstable when this mode is used. I only say that the behaviour surprises newbies who didn’t read the documentation because To page properties are quite “unusual” (because they are really technical, they don’t qualify for what lay people call “intuitive”).

To page must be reserved for page-oriented document (DTP paradigm) where “contents” must not overflow the page inside which it is positioned. This is different from the usual flow-oriented aspect of common office documents where the page doesn’t really matter: pages are allocated in numbers such that the whole text flow will be visible (if it overflows a page, a new page is allocated).

Simply, this deletes text; the frame remains where it is. If the anchor paragraph mark is itself deleted, the frame is re-anchored to the next paragraph (and you can never delete the last paragraph mark). You don’t lose your frame (image, secondary text, …).

From personal experience (and I boast myself of mastering Writer), the figure is rather 99%. But YMMV. If you feel comfortable with To page, use it. If you insert your frames as the last steps before releasing the document, you’ll have no problem. But, if you edit your document for version 2 or 3 or 4, … handle the consequences. It is extremely difficult to move a frame (to another page) once it has been anchored To page. You may even end up with undeletable blank pages.

To page is the same as direct formatting. Most people think wrongly this is “intuitive” (because this is how you’re doomed to work in Word) without realising the painful amount of work needed to achieved the desired result and the almost impossibility to tackle document maintenance in a professional way.

Please reread my posts and ponder every word. I don’t ask for feature removal. I only advocate to use feature for what they are intended. This requires introspection on your document, what you want to convey to your reader and how “comfortable” it is for a reader (no need to flip pages to access referenced information). The choice of the right feature can only be made after a thorough reading of the existing documentation and many trials & errors.