Faq/Writer/AnchoringAndPositioning

    From The Document Foundation Wiki
    < Faq‎ | Writer


    How can I anchor and position graphic elements (images, objects)?

    When working with the inserted objects and their positions in Writer, one should first try to understand two important concepts:

    • what anchoring the object means and
    • what positioning the object means.
    Anchoring and positioning options

    Anchoring modes

    Anchoring is what is there in the document content, to which this object is linked (some fundamental entity, such as a paragraph, or a character, or a frame): it means that when that entity moves in the document, the anchored objects may move with that entity. Anchoring creates semantical link between the text content and the inserted objects: the link means something like "this object helps to understand, or decorates, or otherwise relates to this part of document"; and naturally, when e.g. the paragraph goes a couple pages forth, it doesn't make sense that a picture that illustrates something in that paragraph would stay where it were, two pages behind.

    There are five possible anchoring modes: To Paragraph; To Character; As Character; To Frame; and To Page. The latter one is very special. While the first four mean that an object is linked to some real fundamental document elements - paragraphs, characters, or frames, that actually constitute the document, - the To Page anchoring links objects with something ephemeral, dynamic in the world of text processing software, to something created and destroyed on demand: to a page number. Any given page is only existing there because there's some text that needs to be placed on a page. As soon as the text gets modified/reformatted, it might take less paper space than before, and any given page may become unnecessary. Or the text may grow, edits may insert content before any given text, and so any paragraph may move to following pages. But objects linked to "page number" would stay where they were, would not move anywhere; would cause blank pages to be kept - just to let the linked object stay there. There's nothing in the document that would let these objects move forward or backward - if you insert more pages "before" such objects, the objects would "jump" to "previous" pages, actually keeping anchored to the same "page number 3 in the document, no matter what".

    Since the To Page anchoring does not put the anchored object into the document's text flow, but keeps external to it, this has one important property for this mode: such objects present in text documents will disappear from the master documents referencing those text documents. The same is true for sections linked to text documents with To Page anchored objects.

    In essence, all types of anchoring allow to define unambiguously on which page a given anchored object will be placed: for To Paragraph, To Character, As Character, To Frame, this is the page where the linked entity is placed; for To Page, it's a fixed page (as discussed).

    But anchoring, while giving us the page on which the object is placed, doesn't yet describe the image position on the page (with the exception of As Character anchoring). In case of the four "floating" anchoring modes (To Paragraph; To Character; To Frame; and To Page), positioning plays role in placement on page (and even for As Character, it has some significance).

    Anchor image "To page" - Context menu vs Frame style

    In earlier LibreOffice versions, the Context menu still offered Anchor "To page". This is no longer the case.

    In the Context menu the selection {bc|To Paragraph}}, {bc|To Character}} and {bc|As Character}} is possible.

    Many users are or were not aware of the effects of the Anchor To Page function in detail or have a different idea of how it should work.

    Since the function To page was very often misinterpreted, it was decided to remove it from the Context menu.

    However, the Anchor To page function is still accessible through the Styles/Frame Styles.

    Now how to reach the Anchor To page ?

    Here the just mentioned Frame styles play an important role.

    LibreOffice Writer has an internal process, so to speak, for inserting images.

    Every image that is inserted into Writer is associated or assigned to the "Graphics" Frame style. Yes, it is a Frame style.

    One special feature is the "Insert Caption" of images.

    So when you add a caption to an image using the Context menu, the image gets a Frame around the outside.

    The caption is placed in this Frame either above or below the image.

    This Frame around the image is assigned to the "Frame" Frame style.

    In the following, it is assumed that no caption is added to the image.

    This means that the "Graphics" Frame style is relevant for the image when it is inserted.

    Now, to anchor "To page" of an image on the page, create a new Frame style.

    And this is how it works

    Open Writer with a blank document.

    Create a new Frame style with the name "To page".

    To do this, right-click on the "Graphis" Frame style and choose New.

    In the "Organiser" tab, enter the name "To page".

    In the "Type" tab, for "Anchor", select "To page" and save with OK.

    Now save the document as a document template, possibly with the check mark at "Set as default template.".

    If you now open the template, you will get the document "Untitled 1". Now insert an image.

    Select the image and double-click the "To Page" Frame style.

    This will now anchor the image to the page, since it has been assigned to the modified Frame style "To page".

    Finally, I would like to point out that this procedure will only lead to a good and desired result in special cases.

    The most common anchors will probably be the variants offered in the Context menu (not "To page").

    Positioning

    So, positioning is the way to tell where the object will be placed on the page; and that may be something "near the linked object" (meaning that the position on the same page may change when anchor moves two lines forward); or it may be "fixed to some place on page" (meaning that the object will be, say, in the top right corner of the page on which its anchor is, no matter where exactly the anchor is on the page: the anchor could be in the top left part of the page, or on the bottom right, but the image would not move, until the anchor moves to a different page, when the linked object would follow there, but again would stick to top right corner).

    Positioning is always "relative" to something: current page (possibly one of its borders, or its text area, excluding margins); paragraph (allowing you to link the object to its left/right/top/bottom/center); character; or frame. The set of possible relational positioning options naturally vary with chosen anchoring, because e.g. only if you choose To Character anchoring, there's a meaningful "relative to character" positioning: otherwise, how would Writer know to which character you plan to align your image to?

    Several floating objects anchored to different parts of text or to some pages may create problems with proper document layout, if their anchoring and positioning isn't carefully planned. If you invest into some experimentation with the concepts, learning the effects you get with different combinations of those, you will have no problems; but without that understanding, trying to use "intuitive" tools like dragging things around pages (and in the process, allowing Writer to guess for you the anchoring points and positioning settings), you will likely end up with very fragile layout, where adding a single character somewhere in the middle of document could ruin your efforts, and make a good amount of mess.

    In the end of this too long text, I want to discuss one very useful, and often overlooked anchoring: As Character. It makes the inserted object just another - possibly very big - character; and as such, it will be positioned very firmly with the flow of the text, without any strange effects. One can make paragraphs consisting of a single image anchored As Character, and make following paragraphs its descriptions; one can use proper paragraph styles to make it look very neat and consistent; one will never get strange results when different As Character-anchored images overlap or behave otherwise unexpectedly. For this anchor type, only Vertical positioning is meaningful (allowing you to define how the inserted object will be placed relative to other parts of the string).