Keeping figure captions with figures

This forum is for all Flare issues related to styles, stylesheets and XML.

Keeping figure captions with figures

Postby RJP_TIBCO on Thu Sep 15, 2022 4:00 pm

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.

Jr. Propeller Head
Posts: 7
Joined: Thu Apr 21, 2022 1:25 pm

Re: Keeping figure captions with figures

Postby robdocsmith on Thu Sep 15, 2022 5:56 pm

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 :)


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

Return to Styles, Stylesheets and XML

Who is online

Users browsing this forum: Google [Bot] and 8 guests