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