Figure Caption -- Keep With Next

This forum is for all Flare issues related to PDF, eBook, Microsoft Word, Adobe FrameMaker, XPS, and XHTML book targets.
Post Reply
Evetsm
Propeller Head
Posts: 90
Joined: Wed Apr 30, 2014 8:32 am

Figure Caption -- Keep With Next

Post by Evetsm »

For PDFs I want to keep figure captions with the figure that follows.

In a similar post, one of the contributors said to create a class with a page-break-after: avoid declaration, then apply the class to the figure caption element.

I created the class:

Code: Select all

@media print
{
	body.pgBreakKeepWithNext
	{
		page-break-after: avoid;		
	}
But my issue is that the figure caption element already has a class applied to it:

Code: Select all

<p class="FigureCaption"><span class="span_3">Figure 1. </span>My Figure Caption</p>
Can I apply a second class to the element? If so, what is the syntax?

Thanks!
Steve
Psider
Propellus Maximus
Posts: 816
Joined: Wed Jul 06, 2011 1:32 am

Re: Figure Caption -- Keep With Next

Post by Psider »

I think you just need to make sure your FigureCaption class exists in your print section, with the page-break-after: avoid declaration.

So if the class doesn't already exist in your print section, just change you new body.pgBreakKeepWithNext to p.FigureCaption.

Hopefully that achieves what you need.
Lydia
Sr. Propeller Head
Posts: 373
Joined: Tue Apr 23, 2013 3:19 am
Location: The Netherlands, Amsterdam Area

Re: Figure Caption -- Keep With Next

Post by Lydia »

I agree with Psider, but I think, you want to avoid a page break before the caption, so it would be page-break-before: avoid.
Using Flare 10.2 and Flare 11 on Win 7
Evetsm
Propeller Head
Posts: 90
Joined: Wed Apr 30, 2014 8:32 am

Re: Figure Caption -- Keep With Next

Post by Evetsm »

Thanks, Psider and Lydia. I appreciate your replies.

Clarification: the figure caption precedes the figure so I want to avoid a page break after. Like this:

Code: Select all

Figure Caption
------------------
|                |
| Figure         |
|                |
------------------
Question: What is a print section? I'm completely new to Flare, still trying to learn the basics.

Thanks very much,
Steve
atomdocs
Sr. Propeller Head
Posts: 308
Joined: Tue Jun 18, 2013 3:00 am
Location: Eastern Seaboard, Thailand
Contact:

Re: Figure Caption -- Keep With Next

Post by atomdocs »

Steve, I think you could also put the image and caption in a div and set it to avoid page breaks inside the div, I think that is an available option.
Tom
Flare 2022, Capture 7
Image
Evetsm
Propeller Head
Posts: 90
Joined: Wed Apr 30, 2014 8:32 am

Re: Figure Caption -- Keep With Next

Post by Evetsm »

Atomdocs,

Thanks. Is there a way to enclose an existing caption/figure without hand-coding? Or do I need to manually edit the XML?

Kind regards,
Steve
atomdocs
Sr. Propeller Head
Posts: 308
Joined: Tue Jun 18, 2013 3:00 am
Location: Eastern Seaboard, Thailand
Contact:

Re: Figure Caption -- Keep With Next

Post by atomdocs »

You don't need to manually edit the XML, as in type the code character by character, if that is what you mean. You can do it through Flare's normal editor: select the caption and the figure, then click the Group button in the toolbar/ribbon (I haven't got access to Flare at the moment, I can't remember the exact function name). Then select a div style in the following dialog box (set up an appropriate div style beforehand, something specifically for this purpose). It's quick easy to apply a div in this way. Here's the Flare help page for details:

http://webhelp.madcapsoftware.com/flare ... Groups.htm
Tom
Flare 2022, Capture 7
Image
Evetsm
Propeller Head
Posts: 90
Joined: Wed Apr 30, 2014 8:32 am

Re: Figure Caption -- Keep With Next

Post by Evetsm »

Tom,

Thanks! Grouping into a div is indeed easy. Is there a shortcut way to apply a class? For that I had to switch to the TextEditor and add class="keepLinesTogether" to the div.

Thanks again,
Steve
atomdocs
Sr. Propeller Head
Posts: 308
Joined: Tue Jun 18, 2013 3:00 am
Location: Eastern Seaboard, Thailand
Contact:

Re: Figure Caption -- Keep With Next

Post by atomdocs »

Steve, ideally you'd set up the style class in your stylesheet beforehand, then when you open the Group dialog box, the style class appears as one of the options, and you can just select it there, job done. If you've added the class to the topic via the text editor, but have not yet set up the style in your stylesheet, it won't work yet. Set the style up in your stylesheet and you should be good to go. But in future, configure the style in the stylesheet first, then it will be available in the Group function.
Tom
Flare 2022, Capture 7
Image
Evetsm
Propeller Head
Posts: 90
Joined: Wed Apr 30, 2014 8:32 am

Re: Figure Caption -- Keep With Next

Post by Evetsm »

Tom,

Something is amiss. I did indeed set up the style first. It looks like this:

Code: Select all

@media print
{
	.keepLinesTogether
	{
		page-break-inside: avoid;		
	}
}
When I select the caption in the XMLEditor then open the Group dialog box it looks like this:
Group Dialog Box.JPG
Did I so something wrong?

I tested the style and it does indeed keep the caption and the figure together.

Thanks!
You do not have the required permissions to view the files attached to this post.
wclass
Propellus Maximus
Posts: 1238
Joined: Mon Feb 27, 2006 5:56 am
Location: Melbourne, Australia

Re: Figure Caption -- Keep With Next

Post by wclass »

It looks like you've created a generic style rather than a specific "div" one. I think only the specific ones will show up in the group list.
That is:

div.keepTogether { ... }
Margaret Hassall - Melbourne
atomdocs
Sr. Propeller Head
Posts: 308
Joined: Tue Jun 18, 2013 3:00 am
Location: Eastern Seaboard, Thailand
Contact:

Re: Figure Caption -- Keep With Next

Post by atomdocs »

Margaret is right. Sorry Steve, I was too vague in my posts: set this up as a class of div, and then it will appear in the Groups list.
Tom
Flare 2022, Capture 7
Image
Evetsm
Propeller Head
Posts: 90
Joined: Wed Apr 30, 2014 8:32 am

Re: Figure Caption -- Keep With Next

Post by Evetsm »

Tom, Margaret,

Many thanks!

The style is now visible in the group dialog box.

Cheers,
Steve
Psider
Propellus Maximus
Posts: 816
Joined: Wed Jul 06, 2011 1:32 am

Re: Figure Caption -- Keep With Next

Post by Psider »

Evetsm wrote:
Question: What is a print section? I'm completely new to Flare, still trying to learn the basics.

To clarify, I meant the part of your stylesheet that starts with "@media print". :)
Evetsm
Propeller Head
Posts: 90
Joined: Wed Apr 30, 2014 8:32 am

Re: Figure Caption -- Keep With Next

Post by Evetsm »

Thanks, Psider.
Post Reply