<nudge>, <nudge>, <wink>, <wink>

FOP can get confused and do stupid things. Giving it a nudge in the right direction fixes it. For example, when a table is going to fill the page right up from where it starts to the end of the region available for it, it does ok. But add a footnote onto that table, and the footnote ends up dangling at the top of the next page.

I thought a bit about why this is happening, and I thought about what if you added a keep to the footnote, etc. What I ended up wanting to do is to nudge down something higher on the page so that it created a bit of whitespace in a place where the reader wouldn’t notice. That made the table not fit, which made the table break, which put the table footnote where I expected it to be, instead of hanging in space.

Here’s how you do it. Add this to your customization layer:

  <!-- a hack to let us push down the next section when we know it
       is going to leave a badly formatted table (or whatever)
       where it lies as-is. -->
  <xsl:template match="nudge">
      <xsl:attribute name="space-after">
        <xsl:value-of select="@how-much"/>

Then add this to your DocBook document: <nudge how-much=”2cm”/>

Note: no space between the 2 and the cm, or else it thinks you mean 2 points and 0 centimeters or something. Whatever. It doesn’t work with the space, so don’t put it in.

Problem solved… but understand that if anything moves, you’ll have to go re-nudge it. Think very carefully before liberally sprinkling these hither and yon. I did it because I have a hard page break a few paragraphs before, and I knew my table was basically always going to have this problem.


Leave a Reply

Your email address will not be published. Required fields are marked *