Epub ebooks: How to set up figures in Writer

Conversion from odt to epub appears to have some rather random seeming affects on the captions and figures.

Is there a best way to set them up in Writer (eg. preferrred method of anchoring) to prevent a mess?!

And, judging by said mess, I take it that having figures set into the cells of a table can’t be done?

Could you give examples of “mess”? Also mention OS name, LO versio and save format.

Having reliable and stable figure positioning is possible through strict usage of frame styles. As you mention, anchor mode is also an important factor. Personally, I use preferentially To paragraph and sometimes As character when the image must coexist subtly with text.

Did you get the files sent via email?

Here did you send it? To start private mail, click on my name above this comment then on the “Message” button. It may be that some privilege (seniority on this site) is needed to protect against spam. If it doesn’t work I’ll give you a bounce mail address.

After discussion through private mail, here is the solution.

As always, document structure must be as simple as possible for reliability, stability and performance. Here the case is complicated by the fact that the document must be translated to foreign format, exacerbating the need for a simple structure so that the converter understands it.

The starting state is a captioned image created by menu Insert>Caption. This has created a frame containing a paragraph, styled Figure with auto-numbering, anchoring the picture frame. The composite frame is itself anchored to a paragraph which resides in a table cell. This double nesting makes tuning the exact position of the frame and the image very difficult and unstable (a slight change in cell text may easily flush the captioned frame on next page or into the bottom margin).

In the document, the caption and the image are intended to appear sequentially in the main text, not as a side illustration. Consequently, as is frequently the case, Insert>Caption is not the good solution. It is simpler to enter a Figure paragraph followed by an Inserted Image paragraph whose sole purpose is to be host the image. The paragraph styles are customised as follows:

  • built-in Figure: Next Style = Inserted Image, Keep with next paragraph enabled
  • custom Inserted Image, alignment = center

The image is anchored As character. Thus positioning can be tuned with paragraph indents and spacing which causes less problems than frames. Caption is manually entered which the use of a field for the Figure number range.

To provide the same “comfort” as Insert>Caption, the whole sequence with “Figure xxx: <void caption> Enter <empty “Inserted Image” paragraph> Enter” can be stored in an AutoText entry. All is left is then to paste the image, anchor is As character and type the real caption.

If the caption is to be positioned after the image, style Inserted Image is to be flagged Keep with next paragraph with Next Style set to Figure while Figure is not.

1 Like

Hervorragend!
Excellent!

Please could you attach a screenshot showing how you set up the Autotext. I’ve not coded that before.

AutoText: type what you want to store into the entry.
Here: type your caption manually with Insert>Field>More Fields, Variables tab, Type Number range, Select Figure, default Format for figure numbering. Style this caption Figure paragraph style. Add an empty Inserted Image styled paragraph (custom paragraph style to be created) and an extra Enter to revert to Text Body or Table Contents paragraph style. Don’t forget to assign it the ad-hoc style.

To record the entry:

  1. Select what you typed above
  2. Tools>AutoText
  3. Give it a name like “Caption+Figure”
  4. Assign a keyboard shortcut like “CFZ” (Z added so that it is not accidentally a legal word)
  5. AutoText>New

To use it:

  1. type the shortcut, i.e. “cfz” (case is irrelevant, upper- and lower-case are equivalent)
  2. press F3

I think I’m getting closer to implementing the suggestion. However, a more fundamental problem is that despite:

  • Figure: Next Style = Inserted Image, Keep with next paragraph enabled
    The figure does NOT appear on the same page as the caption and is often excessively large, whereas on the occasions the caption and figure appear on the same page, for some reason, the figure is a lot smaller than intended.

I experimented by anchoring image ‘to character’ so that it could be part of the caption paragraph and checking not to split the paragraph, but that too failed.

I’m not sure how much of this Writer or the conversion to epub.

The guidelines I have given don’t include image scaling which must be done at every insertion.

“Locking” together the Figure and Inserted Image paragraphs works only if the paragraphs are styled accordingly. Don’t think too hard of Next Style. It is used only when you type and has no effect on layout. Keep with next paragraph is the layout control parameter.

Anchor mode: I’ve experimented on your sample document and only As character gave the expected result without problem. But take a very big care on styling. A mistake on the style of the paragraph following the image may ruin the layout. This is why I created specifically a Solution paragraph style to “disconnect” the paragraph below the image from material above.
With To character anchored in the caption, you can no longer “glue” together the caption and the image (which can bleed into the bottom margin or even be clipped).

Considering you export to ePub with a third party service (hence not integrated with Writer and probably not managing the latest Writer features), make your document structure as simple as possible. Avoid frames if you can. As character makes the image a (big) character scanned sequentially. It is equivalent to a change of font face and size, very easy.