Keeping figure captions with figures

This forum is for all Flare issues related to styles, stylesheets and XML.
Post Reply
RJP_TIBCO
Propeller Head
Posts: 11
Joined: Thu Apr 21, 2022 1:25 pm

Keeping figure captions with figures

Post by RJP_TIBCO »

If I want to make sure there is no page break in PDF output between a figure (typically a .png file) and its associated caption, which is the preferred method:

Wrapping caption and figure in a <div> that is styled with page-break-inside: avoid; or
Applying page-break-after: avoid; to the figure caption paragraph style (assuming caption is always above image, of course), or
Applying page-break-before: avoid; to the figure img style

Styling the figure caption paragraph seems more compact and simple to me, but the <div> has merit as well, really signifying what's meant to be kept together.

Thanks.
robdocsmith
Sr. Propeller Head
Posts: 247
Joined: Thu May 24, 2018 3:11 pm
Location: Queensland, Australia

Re: Keeping figure captions with figures

Post by robdocsmith »

If your figures are always in containing paragraphs and are always followed (or preceded) by a figure caption, I'd apply the relevant page-break/column-break styles to the paragraphs involved. It's sort of set-and-forget then. You don't have to remember to apply a separate DIV to the section. I do apply the relevant page-break parameter to both styles though to make sure it sticks.

For me, I don't always have a figure caption and sometimes don't have a containing paragraph for the image, so where there is potential for an issue I use the encapsulate-in-a-DIV method.

I guess it depends on your usage :)

Cheers,

Rob
Post Reply