-
-
Notifications
You must be signed in to change notification settings - Fork 101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pagebuilder prefers an overfull frame with worse badness over an underfull one #1404
Comments
Over the course of my current project, I had noticed too, without such a detailed analysis, that overfull frames were apparently "preferred" to underfull ones, but I had not reported it (yet). Of course a small bit of overflow (vs. huge underfull pages) could be acceptable, so whatever the fix would be, perhaps it would also need some setting for fine-tuning (e.g. I have tables with pictures in one cell, overflowing vertically by a few pt only... I'd be ok with some of them as long as they do not overwrite the folio space / page bottom content ;) |
I think there are at least two bugs here, but I'm having trouble putting my finger on either. In the mean time I'll note that the main way of combating this problem is giving the typesetter some vertical flexibility. This can be leading that has some stretch/shrink (even 1pt across each line on a page can give it enough to fit or not fit one more line cleanly) or of course parskip or other places. |
Hi! Thanks for making SILE :) Sorry if I'm being silly—I'm not very familiar with the SILE codebase—but it looks like this is a problem in the rateBadness function? Because there's no stretch, it decides that all of the breaking opportunities are infinitely bad: in other words, each opportunity is so bad that there's no point deciding between them, so it's okay to just choose the last one. I think the idea behind infinite badness is that in practise, there should almost never be a case where a break worse than inf_bad is actually the best one; however, that's not what's happening here: the best break is worse than inf_bad, and it isn't even a rare occurence—it happens frequently when working without shrinkable glue. If we change rateBadness, so that it rates the badness as (I think) we would expect, it seems to behave sensibly? utilities.rateBadness = function(inf_bad, shortfall, spring)
local bad = math.floor(100 * math.abs(shortfall / (spring + 50) ^ 3)
return math.min(inf_bad, bad)
end (This function seemed more theoretically optimal, and worked for this mwe; it hasn't been properly investigated.) Again, sorry if I'm missing something/alot, and/or stating the obvious :) |
SILE v0.12.5 (Lua 5.2)
Running sile:
Output:
The reason why this exceeds the content frame is because none of the other possible breaks meet the minimum
leastC
that would trigger settingbestBreak
. As a result, the pagebuilder waits until it goes over the target before settingbestBreak
to the worst break.Note that a naive attempt at fixing it (keep updating bestBreak if it's badness is <= the best break so far) seems to break the current pagebuilder in another way.
The text was updated successfully, but these errors were encountered: