tabularray icon indicating copy to clipboard operation
tabularray copied to clipboard

Clear floats before building long tables

Open lvjr opened this issue 3 years ago • 4 comments

Although I haven't done enough tests, I think floats will interfere with longtblr in some situations. Also floats in the middle of a long tables look weird.

Maybe it is a good choice to clear all floats (but not create a new page) before building long tables? Or could we disable floats temporarily in the building process of long tables? Need decision.

lvjr avatar Aug 09 '21 10:08 lvjr

well, they sure interfere but they tell you so if you look at @colroom to figure out how much space is left when floats have been placed.

As to deferred floats that end up being allocated to following pages that hold a multipage table in the main galley that is indeed a thorny problem and not quite sure which solution there is the best. For example what to do in the case that there is a deferred table (that already has a number and so should come out before the longtblr)? That may ask for loooking into the deferred list to determine what on there.

What about other float types that could (in theory come before, during or after)? Those one could typeset even while a longtblr is going on or one could defer them until after the whole table is output --- might be a user/design/layout decision.

FrankMittelbach avatar Aug 09 '21 10:08 FrankMittelbach

Thanks. Floats are complicated. I think I need to learn more first.

lvjr avatar Aug 09 '21 11:08 lvjr

Although I haven't done enough tests, I think floats will interfere with longtblr in some situations. Also floats in the middle of a long tables look weird.

for most situations I would agree with you on that point (though I'm not sure it holds generally). So for an approach you could

  • check the deferred list for table floats, also check the allocated bottomlist for table floats (as that would also be weird to have a longtblr start on top of such a table but with a later number
  • if there are tables in that list make sure that they get placed before the longtblr starts (possibly by reallocating a bottom float back and by producing float pages focussing on tables (or on all deferred floats) until the tables are done
  • or more generally by adding them to the top area with relaxed ! conditions --- based on the actual float situation
  • then take the remaining deferlist aside so that the next pages do not try to add them while the longtblr is processed (we know that no new floats can show up while that processing happens so it is safe to disable the whole mechanism by temporarily clearing the deferlist)
  • then restore the deferlist after the longtablr ends
  • for bonus processing one could try to allocate floats to the bottom area of that last page if there is enough space

I'm aware that I'm doing handwaving but that is roughly the algorithm that I would be looking to get implemented.

FrankMittelbach avatar Aug 09 '21 12:08 FrankMittelbach

Very nice! Now it is much clearer.

lvjr avatar Aug 09 '21 12:08 lvjr