Linking headings or captions to a table or image

This forum is for all Flare issues related to styles, stylesheets and XML.
Post Reply
cmoore66
Propeller Head
Posts: 15
Joined: Tue Jul 28, 2015 3:28 pm

Linking headings or captions to a table or image

Post by cmoore66 »

Similar to widows and orphans, I'm wondering if anyone has a trick in Flare for linking headings or captions to an image or a table that follows, so they don't become separated on different pages when generating PDFs. I understand you might do this by using a page break. But I believe that will also potentially leave large blanks on pages preceding or following the break. I simply want to make sure a line of text and its associated image or table stay together. Thanks for any suggestions.
ChoccieMuffin
Senior Propellus Maximus
Posts: 2636
Joined: Wed Apr 14, 2010 8:01 am
Location: Surrey, UK

Re: Linking headings or captions to a table or image

Post by ChoccieMuffin »

I have three classes for this.

.KeepWithNext is a generic class, which has the attribute page-break-after:avoid;
.KeepWithPrevious is another generic class, which has the attribute page-break-before:avoid;
p.graphic is the paragraph into which I paste my graphics, which has a bit of extra space before and after, and also has the attribute page-break-before:avoid;

To use these for graphics or images, put your image inside p.graphic, and apply .KeepWithNext to whatever it is you want to stick to the graphic, whether it's a caption, introductory paragraph or whatever.

For tables, if you are just using the regular stylesheet, apply .KeepWithPrevious to the table. (If you already have specific classes for your tables then you might want to include the page-break-before:avoid; attribute in your table class, if you ALWAYS want that kind of table to stick with the previous item.)

If you use captions for your tables or graphics you might have p.caption, in which case edit the style for p.caption to include page-break-after:avoid; if the caption is before the table/graphic.

Hope that helps.
Started as a newbie with Flare 6.1, now using Flare 2023.
Report bugs at http://www.madcapsoftware.com/bugs/submit.aspx.
Request features at https://www.madcapsoftware.com/feedback ... quest.aspx
acohen843
Jr. Propeller Head
Posts: 1
Joined: Tue Sep 01, 2015 6:46 am

Re: Linking headings or captions to a table or image

Post by acohen843 »

Can this solution be used to keep a list item with its associated graphic?
trent the thief
Propellus Maximus
Posts: 613
Joined: Wed Feb 01, 2006 6:21 am
Location: Off in the dark....

Re: Linking headings or captions to a table or image

Post by trent the thief »

acohen843 wrote:Can this solution be used to keep a list item with its associated graphic?

It will do so as long as the image's paragraph style has the page-break-after:avoid or page-break-before:avoid; settings, as applicable.

ChoccieMuffin created generic classes with those settings. Take a look at the base paragraph you intend to use in the Advanced CSS editor. Scroll down and expand PrintSupport to see the page break settings.

If you make your own class to use with those settings, double check you're modding the class and not the parent (learned via an annoying lesson that no one should have to repeat ;-) ).
Trent.

Certifiable.

Image

umm...
I meant MAD Certified.

Official Propeller Beanie Owner :-)

:flare: Are you on Flare's Slack channels? PM me for an invitation! :flare:
ChoccieMuffin
Senior Propellus Maximus
Posts: 2636
Joined: Wed Apr 14, 2010 8:01 am
Location: Surrey, UK

Re: Linking headings or captions to a table or image

Post by ChoccieMuffin »

acohen843 wrote:Can this solution be used to keep a list item with its associated graphic?
I think it depends how you insert your graphics.

If I have a list item, e.g. "The XXX dialog box appears." followed by a screenshot of the dialog box, in the list item I press Ctrl+; to make the list contain paragraphs, then press Return at the end of my sentence which gives me another paragraph within the list item. For the "The XXX dialog box appears." paragraph I apply .KeepWithNext, and to the paragraph with the graphic in, I apply the style p.graphic. That way, it (usually) all stays together.

Obviously if you insert your graphics some other way, I couldn't say for sure that it'll work.
Started as a newbie with Flare 6.1, now using Flare 2023.
Report bugs at http://www.madcapsoftware.com/bugs/submit.aspx.
Request features at https://www.madcapsoftware.com/feedback ... quest.aspx
kwag_myers
Propellus Maximus
Posts: 810
Joined: Wed Jul 25, 2012 11:36 am
Location: Ann Arbor, MI

Re: Linking headings or captions to a table or image

Post by kwag_myers »

This is just another option, but I've usee <caption> for tables and <figcaption> for images.
"I'm tryin' to think, but nothin' happens!" - Curly Joe Howard
Post Reply