Footnotes working!

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

Footnotes working!

Luca Furini

Footnotes should be working now.

At the moment the page breaking algorithm is quite "strict": it tries to
insert every footnote in the same page where their citation is (the last
footnote body could be split, and partially deferred to the next page).

The recommendation seems to suggest that it could defer one or more
*whole* footnotes, if there is not enough space in the page where their
citations are, even if this is not very usual to happen in books; anyway,
this could be fixed later.

Two annotations concerning the footnote separator:

- is it correct to assume that the footnote separator is the same on each
page containing footnotes, or it could have some page-dependant content?
At the moment, its areas are obtained only once, and repeated in each page
where a footnote is inserted.

- I had to add a new StaticContentLM constructor with a Block area
paremeter; maybe someone sees a better way to do this? The problem is that
"normal" StaticContentLM add their areas to a Region, while the SCLM
handling the footnote separator adds them to a block area (this is related
to the previous point); another difference, non depending on the current
implementation, is that the SCLM handling the footnote separator does not
perform any breaking algorithm: it is quite similar to a BlockLM.

Regards
    Luca



Reply | Threaded
Open this post in threaded view
|

Re: Footnotes working!

Simon Pepping
On Tue, May 17, 2005 at 04:48:07PM +0200, Luca Furini wrote:
>
> Footnotes should be working now.

Great.
 
> At the moment the page breaking algorithm is quite "strict": it tries to
> insert every footnote in the same page where their citation is (the last
> footnote body could be split, and partially deferred to the next page).
>
> The recommendation seems to suggest that it could defer one or more
> *whole* footnotes, if there is not enough space in the page where their
> citations are, even if this is not very usual to happen in books; anyway,
> this could be fixed later.

In linguistic or theological works you may see many and long footnotes.

Regards, Simon

--
Simon Pepping
home page: http://www.leverkruid.nl

Reply | Threaded
Open this post in threaded view
|

Re: Footnotes working!

J.Pietschmann
In reply to this post by Luca Furini
Luca Furini wrote:
> The recommendation seems to suggest that it could defer one or more
> *whole* footnotes, if there is not enough space in the page where their
> citations are, even if this is not very usual to happen in books;

Actually, this is *very* unusual, and can only happen if there is
only a single line of content and all the footnote space is already
eaten up, either by footnotes deferred from previous pages or because
there are lots and/or very long footnotes in the same line.

The common convention is that only a footnote cited in the last content
line of the bage may be broken across pages, and no further footnote
content will be deferred to the next page. In fact, breaking footnotes
should be avoided if the content line citating the footnote can be put
onto the next page withouth leaving an ugly white area below the
content, either by distributing surplus bpd space to before/after
block spaces or by fiddling with line heigths (or both).

Duh, an example in the Wiki would be in order...

J.Pietschmann
Reply | Threaded
Open this post in threaded view
|

RE: Footnotes working!

Andreas L Delmelle
In reply to this post by Luca Furini
> -----Original Message-----
> From: Luca Furini [mailto:[hidden email]]
>

Hi Luca,

First of all: compliments on yet another Nice Job!

> At the moment the page breaking algorithm is quite "strict": it tries to
> insert every footnote in the same page where their citation is (the last
> footnote body could be split, and partially deferred to the next page).

Well, that fits the largest part of the requirements...

>
> The recommendation seems to suggest that it could defer one or more
> *whole* footnotes, if there is not enough space in the page where their
> citations are, even if this is not very usual to happen in books; anyway,
> this could be fixed later.

Optimistic interpretation:
I think that is meant to refer to the cases where a footnote citation
appears in the last block on a page, so it is not necessary to move the
whole block to the next page just because a few of its footnotes don't fit.

<snip />
> - is it correct to assume that the footnote separator is the same on each
> page containing footnotes, or it could have some page-dependant content?
> At the moment, its areas are obtained only once, and repeated in each page
> where a footnote is inserted.

AFAICT 'xsl-footnote-separator' is meant to be specified as the flow-name
property on an fo:static-content, so in essence they are meant to be mostly
the same for an entire fo:flow (~ fo:page-sequence), BUT...

One thing I wonder about: Is it allowed to have sth like

<fo:static-content flow-name="xsl-footnote-separator">
  <fo:retrieve-marker .../>
</fo:static-content>

In which case the content of the separator *would* be page-specific...?

<snip />


Cheers,

Andreas

Reply | Threaded
Open this post in threaded view
|

Re: Footnotes working!

gmazza
In reply to this post by Luca Furini
Luca Furini wrote:

>Footnotes should be working now.
>
>  
>

Excellent--Very impressive work!!!

>Two annotations concerning the footnote separator:
>
>- is it correct to assume that the footnote separator is the same on each
>page containing footnotes, or it could have some page-dependant content?
>At the moment, its areas are obtained only once, and repeated in each page
>where a footnote is inserted.
>  
>

It is fo:page-sequence specific.  Within the fo:page-sequence, you may
define one fo:static-content with a flow-name of
"xsl-footnote-separator."  All pages with a footnote will share that
separator.  (See:  
http://www.w3.org/TR/2001/REC-xsl-20011015/slice7.html#flow-name.)

>- I had to add a new StaticContentLM constructor with a Block area
>paremeter; maybe someone sees a better way to do this? The problem is that
>"normal" StaticContentLM add their areas to a Region, while the SCLM
>handling the footnote separator adds them to a block area (this is related
>to the previous point); another difference, non depending on the current
>implementation, is that the SCLM handling the footnote separator does not
>perform any breaking algorithm: it is quite similar to a BlockLM.
>
>  
>

I don't mind the code as it is.  But if you'd like we can go back to a
two-argument constructor (just the PSLM and SC object), and then provide
separate methods to set the Region or Block.  BTW, since the only thing
these two usages appear to have in common is that both they work with
fo:static-content, would you rather have separate
SideRegionLayoutManager and a FootnoteSeparatorLayoutManager?  (Possibly
having FSLM extend BlockLM?)  Another possibility to think about, and
perhaps for Andreas and others to chime in on.

Thanks,
Glen

Reply | Threaded
Open this post in threaded view
|

Re: Footnotes working!

Jeremias Maerki
In reply to this post by Andreas L Delmelle

On 17.05.2005 22:54:31 Andreas L. Delmelle wrote:
> > -----Original Message-----
> > From: Luca Furini [mailto:[hidden email]]
> >
>
> Hi Luca,
>
> First of all: compliments on yet another Nice Job!

I second that!

> > At the moment the page breaking algorithm is quite "strict": it tries to
> > insert every footnote in the same page where their citation is (the last
> > footnote body could be split, and partially deferred to the next page).
>
> Well, that fits the largest part of the requirements...

I agree. More can be done later if necessary.

> > The recommendation seems to suggest that it could defer one or more
> > *whole* footnotes, if there is not enough space in the page where their
> > citations are, even if this is not very usual to happen in books; anyway,
> > this could be fixed later.
>
> Optimistic interpretation:
> I think that is meant to refer to the cases where a footnote citation
> appears in the last block on a page, so it is not necessary to move the
> whole block to the next page just because a few of its footnotes don't fit.
>
> <snip />
> > - is it correct to assume that the footnote separator is the same on each
> > page containing footnotes, or it could have some page-dependant content?
> > At the moment, its areas are obtained only once, and repeated in each page
> > where a footnote is inserted.
>
> AFAICT 'xsl-footnote-separator' is meant to be specified as the flow-name
> property on an fo:static-content, so in essence they are meant to be mostly
> the same for an entire fo:flow (~ fo:page-sequence), BUT...
>
> One thing I wonder about: Is it allowed to have sth like
>
> <fo:static-content flow-name="xsl-footnote-separator">
>   <fo:retrieve-marker .../>
> </fo:static-content>

AFAICS, this is perfectly legal. The spec says in 6.10.3:

"An fo:footnote is not permitted to have an fo:float, fo:footnote, or
fo:marker as a descendant.
Additionally, an fo:footnote is not permitted to have as a descendant an fo:block-container that generates
an absolutely positioned area."

I've added a mean example (footnotes2.xml) that uses fo:page-number in
the separator. :-) Perfectly legal I think even though far-fetched.

BTW, am I really still the only one working with the testcases I started?
:-O

> In which case the content of the separator *would* be page-specific...?

Yep.



Jeremias Maerki

Reply | Threaded
Open this post in threaded view
|

Re: Footnotes working!

Luca Furini
In reply to this post by Luca Furini
J.Pietschmann wrote:

> The common convention is that only a footnote cited in the last content
> line of the bage may be broken across pages, and no further footnote
> content will be deferred to the next page. In fact, breaking footnotes
> should be avoided if the content line citating the footnote can be put
> onto the next page withouth leaving an ugly white area below the
> content, either by distributing surplus bpd space to before/after
> block spaces or by fiddling with line heigths (or both).

Ok, thanks for your detailed answer.

I'm going to fix the implementation: at the moment, the algorithm could
decide to break a footnote and add some more content line instead.

After that, I'd like to take some time to work on my extensions, that are
exactly devised to avoid empty areas ... my wiki page is still quite
incomplete!


Andreas L. Delmelle wrote:

> AFAICT 'xsl-footnote-separator' is meant to be specified as the flow-name
> property on an fo:static-content, so in essence they are meant to be mostly
> the same for an entire fo:flow (~ fo:page-sequence), BUT...
>
> One thing I wonder about: Is it allowed to have sth like
>
> <fo:static-content flow-name="xsl-footnote-separator">
>  <fo:retrieve-marker .../>
> </fo:static-content>
>
> In which case the content of the separator *would* be page-specific...?

I think you could be right ... the recommendation (6.11.4.
fo:retrieve-marker) states that "An fo:retrieve-marker is only permitted
as the descendant of an fo:static-content".

So, even if it is quite unlikely, we should be ready to handle the case of
a footnote separator changing from page to page.


Glen Mazza wrote:

> I don't mind the code as it is.  But if you'd like we can go back to a
> two-argument constructor (just the PSLM and SC object), and then provide
> separate methods to set the Region or Block.  BTW, since the only thing
> these two usages appear to have in common is that both they work with
> fo:static-content, would you rather have separate
> SideRegionLayoutManager and a FootnoteSeparatorLayoutManager?  (Possibly
> having FSLM extend BlockLM?)  Another possibility to think about, and
> perhaps for Andreas and others to chime in on.

The latter seems very interesting, but if it is really true that the
separator could have some retrieve-marker descendant, this is no more
possible (or not?).

Thank you all for your feedback!

Regards
    Luca



Reply | Threaded
Open this post in threaded view
|

Re: Footnotes working!

GlenMazza
----- Original Message -----
From: "Luca Furini" <[hidden email]>
To: <[hidden email]>
Sent: Wednesday, May 18, 2005 12:58 PM
Subject: Re: Footnotes working!


>
> Glen Mazza wrote:
>
> > I don't mind the code as it is.  But if you'd like we can go back to a
> > two-argument constructor (just the PSLM and SC object), and then provide
> > separate methods to set the Region or Block.  BTW, since the only thing
> > these two usages appear to have in common is that both they work with
> > fo:static-content, would you rather have separate
> > SideRegionLayoutManager and a FootnoteSeparatorLayoutManager?  (Possibly
> > having FSLM extend BlockLM?)  Another possibility to think about, and
> > perhaps for Andreas and others to chime in on.
>
> The latter seems very interesting, but if it is really true that the
> separator could have some retrieve-marker descendant, this is no more
> possible (or not?).
>

Yes, it apparently is true (I didn't know that.)  But I don't think this
will have much effect in terms of whether or not to break this up into two
classes, because retrieve-marker is currently handled in either event via
resolveRetrieveMarker() in PSLM.

Thanks,
Glen

Reply | Threaded
Open this post in threaded view
|

RE: Footnotes working!

AttikDwella
In reply to this post by Simon Pepping
> -----Original Message-----
> From: Simon Pepping [mailto:[hidden email]]
>
> On Tue, May 17, 2005 at 04:48:07PM +0200, Luca Furini wrote:
> >
<snip />
> > The recommendation seems to suggest that it could defer one or more
> > *whole* footnotes, if there is not enough space in the page where their
> > citations are, even if this is not very usual to happen in books;
anyway,
> > this could be fixed later.
>
> In linguistic or theological works you may see many and long footnotes.

Yeah, as an example: try reading some Postmodern Philosophy... Many pages
that are filled for 75% with footnotes offering comments/notes on the ideas
that appear on the other 25% (even pages containing nothing *but* footnotes,
continued from a previous page). I guess it's not as much fun to read as it
is to write layout code for handling those situations... :-)


Greetz,

Andreas

Reply | Threaded
Open this post in threaded view
|

Re: Footnotes working!

Luca Furini
In reply to this post by Luca Furini
I wrote:

> I'm going to fix the implementation: at the moment, the algorithm could
> decide to break a footnote and add some more content line instead.

Ok, now the page breaking algorithm behaves this way (this piece of code
is in PageBreakingAlgorithm.computeDifference()):

    if (there is enough space for all not-yet-inserted footnotes) {
        insert all footnotes
    } else if (the last content line has footnotes
        && there is enough space for at least a piece of the last one) {
        insert as many footnote lines as possible
    } else {
        this is not a good break and will not create any new node
    }

So:
- each footnote body will be placed (at least partially) in the same page
  where its citation is;
- only the last footnote cited in last content line can be broken.

AFAIK, and if I did not misunderstand what Joerg Pietschmann wrote, this
is what normally happens in printed books.

But there are a few extreme cases the algorithm cannot handle at the
moment:

<1> a footnote citation in the last content line of a page sequence (or
before a forced break): if the footnote body is long, or there is not
enough free space, it will be broken and there will be a page (or several
ones) containing only footnotes; ATM the footnote is truncated.

<2> a footnote with a huge body, which is long more than a page viewport
BPD: it needs to be broken at least twice; ATM, the footnote is placed in
the first page, overlapping the content lines and the top margin.

The first situation is not so unlikely, but it should be quite simple to fix.

The second one (although quite unlikely) is much more tricky.
The page after the footnote citation, in which must be placed the second
part of the footnote body, must contain at least a content line too: this
line could be, for example, the 4th out of 6, and it would be alone in the
page; it is not affected by widows or orphans properties, so this is not
an "error", nevertheless it is not very beatiful to see.
More than this: what if this content line contains some footnotes? They
should be necessarily deferred to the next page.

So, after all, it seems that we cannot assume that a footnote body will
always be placed in the same page where its citation is.

I'm creating some test files showing these situations: I started looking
at the testcases only recently, but I found out that they are really a
powerful tool to check for regressions, discover new bugs and keep in mind
unsolved problems!

Regards
    Luca