Skip to content
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

Poor page breaking with figures #114

Open
davidchisnall opened this issue Dec 22, 2024 · 4 comments
Open

Poor page breaking with figures #114

davidchisnall opened this issue Dec 22, 2024 · 4 comments

Comments

@davidchisnall
Copy link

Using the figure environment, I am seeing two rendering issues:

image

First, the caption begins too low, overlapping the end of the page. Second, the caption itself is split across two pages. I believe part of this is an artefact of the fact that figures are not floats (which is sad, given that SILE was specifically designed to make floats easier to support with good placement than TeX), but I think the rest of it is that the figure is not being treated as a complete box for the purpose of layout and so line breaking is allowed in the middle.

@Omikhleia
Copy link
Owner

Omikhleia commented Dec 22, 2024

On the underlying SILE issues:

... given that SILE was specifically designed to make floats easier to support with good placement than TeX

I don't think this was ever true, unfortunately... A mere claim not backed up by any serious attempt. ^^

Regarding our options, well, it's not that obvious. One could rewrite these environments to use some grouping logic as done in my ptable package (or, as a mere workaround, wrap them in a 1x1 ptable - it's an overkill but it somewhat works). That's not fully satisfying though, as the overfull page issue can still ticks in and lead to even worse issues.

My feelings are that, in order to make any progress, lots of internal things have to change. It's opinionated, and I am pessimistic by nature, but IMHO, the typesetter is still highly problematic, the pagebuilder is an utter mess, the frame logic is totally broken (ouch! another claim that does not live to the expectations...), the footnote and "insertion" logic is just insane (and likely wrong, sile-typesetter/sile#619)....

So I could be tempted to say that this is not an issue for re·sil·ient...

But at the same time, I made so many attempts in 2023 at experimenting with a new typesetter and pagebuilder (I briefly alluded to it here: sile-typesetter/sile#2166 (comment)), that... well, who knows, perhaps something might came out of it... It's a deep rewriting, however, compatibility-breaking with many core packages,1 which I might end up throwing away: Such a "fork" (there's no better word...) is inherently hard, and a single developer cannot do much in these areas...

Footnotes

  1. I don't understand why SILE just keeps those broken packages, hardly maintained and impending on the capability to move forward, such as "linespacing", "gutenberg", "grid" (ouch! Another one bites the dust... but it never worked https://github.com/sile-typesetter/sile/issues/1720), etc. Sometimes one has to cut old branches of a tree.

@davidchisnall
Copy link
Author

Thanks for the detailed response. I think my requirements for figures are simpler than the general case for floats for two reasons:

  • I'm using a single-column layout with full-width figures, so the only degrees of freedom are move-down and move-up.
  • I am following the conventional rule that figures must appear after the first reference to them, which means that the only degree of freedom for the figure is to move it down.

I think this should allow a simple greedy LaTeX-like approach to get good(ish) results, where figures appear in one of two places:

  • Their original location.
  • The top of the next page, if the current location would result in an overfull page, with paragraphs moved up to fill in the space.

Ideally, floats would not be reordered, so if moving a figure down required moving it past another float then they'd move together and, as a last resort, produce a page of figures ( / listings / tables).

I am not familiar with the internals of SILE's page layout engine though, so I don't have a good intuition of how hard this would be to implement: is it a simple 'move and redraw' call or a complete rewrite of some core logic?

@Omikhleia
Copy link
Owner

Omikhleia commented Dec 28, 2024

The top of the next page, if the current location would result in an overfull page, with paragraphs moved up to fill in the space.

But what if the "moved up" content is a table, which is page-split, and with headers repeated? The devil is always in the details ;)

(Not all tables can be considered as float, especially those spanning multiple pages anyway)

@davidchisnall
Copy link
Author

But what if the "moved up" content is a table, which is page-split, and with headers repeated?

I consider tables that need to be split across pages bad style for anything that isn't a datasheet, so this would not be a problem for me. If I have tables that need splitting, they get split into something more concise.

(Not all tables can be considered as float, especially those spanning multiple pages anyway)

This is why LaTeX has \table and \tabular, one for the table that has a caption and floats, the other for the table data itself, which may be used outside of \table and split.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants