Hi there Forum.
For PDF output, I have a DIV called div.keeptogether, and it looks like this:
div.keeptogether
{
page-break-after: avoid;
page-break-before: avoid;
page-break-inside: avoid;
}
The idea is that you can select elements that run over two pages, click the Group button, select div.keeptogether and make sure that the selected items appear together on one page.
Obviously, I don't fully understand when and how the Group button works because sometimes when I click it it opens and allows me to select the DIV, and sometimes I get the message "Current selection cannot be grouped, i.e. found no tag type that can be contain the selected items" - this often occurs when I have selected different
Can someone please explain how the Group button is supposed to work, and/or if I am doing the right thing to force a "keep together"?
Thanks for your help,
Yossi Karp
Grouping for Keeptogether
Re: Grouping for Keeptogether
I do keep together in a very similar way. But do you actually want the page-break-before and page-break-after: avoid set though? That means that everything in the div will be on one page (where possible) as will the element before it and the element that follows it. That's because what you have said, for this block of stuff you've put in a div, apply these properties, so the page-break-before and page-break-after apply to what precedes and follows the div, not each of the items in the div.
And just a thought, how are you applying the div? Are you just selecting some stuff, then selecting the div style from the styles window? or are you selecting Home > Group (in the Paragraph block), then selecting the div (with the div style) from there? You need to do the latter (which adds a div around the selected content, then applies the div style you select), not the former, which takes what you've selected and tries to make them into a div. Depending on what you select, you may get errors if you do the former (and may lose formatting you want to keep too).
If you are doing it the first way, then, then next time you get an error, tell us what the tag types are that you are trying to surround with div.keeptogether
And just a thought, how are you applying the div? Are you just selecting some stuff, then selecting the div style from the styles window? or are you selecting Home > Group (in the Paragraph block), then selecting the div (with the div style) from there? You need to do the latter (which adds a div around the selected content, then applies the div style you select), not the former, which takes what you've selected and tries to make them into a div. Depending on what you select, you may get errors if you do the former (and may lose formatting you want to keep too).
If you are doing it the first way, then, then next time you get an error, tell us what the tag types are that you are trying to surround with div.keeptogether
Last edited by Msquared on Wed Jul 23, 2014 7:02 am, edited 1 time in total.
Marjorie
My goal in life is to be as good a person as my dogs already think I am.
My goal in life is to be as good a person as my dogs already think I am.
Re: Grouping for Keeptogether
Ooh, this is a great idea. I sense many hours adding divs in my near future, but it will make my PDF output much happier I think.
I agree that from the little I know the page break before and after avoid attributes is going to result in some pretty odd behavior, though. I'll just use inside:avoid.
I agree that from the little I know the page break before and after avoid attributes is going to result in some pretty odd behavior, though. I'll just use inside:avoid.
-Dan, Propellerhead-in-training
Re: Grouping for Keeptogether
I actually use this very sparingly, as it's not the most efficient way of ensuring good pagination in PDFs. And I don't ever use it to force a particular pagination that would no longer be correct if the amount of content before that point changes.
I try to do most of my keeping together by setting the properties on the styles themselves. For example, my headings always have a page-break-after: avoid.
But sometimes you find some particular content splits in a less than optimal place. For example, it's often nice to keep the first bullet point after a sentence with the sentence that precedes it. If you set page-break-after: avoid on the sentence style, then sentences with that style would always be glued together if at all possible. Similarly if you set page-break-before: avoid on the bullet style, all bullets with that style would stick together. That's the kind of scenario when I occasionally use this div.
I do use it to keep figures and captions together (it seems the easiest way to do that) but otherwise, I only use it when I spot some particular layout problem. I think life is too short to spend it creating 100% perfect PDFs with absolutely no sub-optimal pagination. I'm happy to let Flare worry about it most of the time, as it does a really good job, and just tweak any issues I spot. Then I can concentrate on the quality of the content.
I try to do most of my keeping together by setting the properties on the styles themselves. For example, my headings always have a page-break-after: avoid.
But sometimes you find some particular content splits in a less than optimal place. For example, it's often nice to keep the first bullet point after a sentence with the sentence that precedes it. If you set page-break-after: avoid on the sentence style, then sentences with that style would always be glued together if at all possible. Similarly if you set page-break-before: avoid on the bullet style, all bullets with that style would stick together. That's the kind of scenario when I occasionally use this div.
I do use it to keep figures and captions together (it seems the easiest way to do that) but otherwise, I only use it when I spot some particular layout problem. I think life is too short to spend it creating 100% perfect PDFs with absolutely no sub-optimal pagination. I'm happy to let Flare worry about it most of the time, as it does a really good job, and just tweak any issues I spot. Then I can concentrate on the quality of the content.
Marjorie
My goal in life is to be as good a person as my dogs already think I am.
My goal in life is to be as good a person as my dogs already think I am.
Re: Grouping for Keeptogether
In my experience, Flare gives this message a lot when you try to apply a div using the Group button, and not for any good reason that I can see. I get around it by going to the text editor and manually adding the div around the elements that I want to group. I've never had it not work (of course this doesn't mean that there aren't any cases where it wouldn't, just that I haven't found any).Obviously, I don't fully understand when and how the Group button works because sometimes when I click it it opens and allows me to select the DIV, and sometimes I get the message "Current selection cannot be grouped, i.e. found no tag type that can be contain the selected items"
Re: Grouping for Keeptogether
Thank you, all. This has been a great discussion and I learned something from each of you.
I do use the Group button to apply the DIV. I changed the DIV to only page-break-avoid: inside.
I will also adjust my styles to help avoid the need to use the DIVs, although I will still sometimes have to use the DIV to set things straight.
I was hoping that there would be a logical explanation for the "Current selection cannot be grouped" error - it is a bit frustrating. I don't mind diving into the Text tab, but I think some other writers in my group might not be so comfortable doing so.
In any case, there is work to be done!
Thanks again for your help,
Yossi Karp
I do use the Group button to apply the DIV. I changed the DIV to only page-break-avoid: inside.
I will also adjust my styles to help avoid the need to use the DIVs, although I will still sometimes have to use the DIV to set things straight.
I was hoping that there would be a logical explanation for the "Current selection cannot be grouped" error - it is a bit frustrating. I don't mind diving into the Text tab, but I think some other writers in my group might not be so comfortable doing so.
In any case, there is work to be done!
Thanks again for your help,
Yossi Karp