tingerrr / hydra

A typst package for displaying the active section in the page header or footer.
MIT License
27 stars 3 forks source link

Wrong heading with `figure(placement: auto)` #17

Open St0wy opened 5 months ago

St0wy commented 5 months ago

Without placement auto, hydra correctly does not display Heading 1 in the header : image

But when using placement auto, the image is placed at the top and hydra interprets this as being part of section 1 : image

Maybe it's related to #16.

tingerrr commented 5 months ago

This is actually expected behavior at the moment, hydra has no knowledge of the actual first element, as Typst doesn't expose a mechanism to inspect pages like that yet. Currently, hydra does some elaborate measuring to detect pages that start with headings.

It's very similar to #8, where the underlying issue is the same.

I wonder, though, in this particular case, is the floating behavior desired? With typst#4141 one could prevent both the incorrect heading in hydra and the image floating past its encompassing section heading. If not, hydra would need to do the same kind of detection it would need to do in #8 for placed elements too.

St0wy commented 5 months ago

Yeah I thought it might be a problem with what hydra can know about the document.

As for the figure with placement auto, I don't think the placement is really wrong, having it under the title would look wierd maybe ? Usually figures are considered "outside" of the text when floating like that, but I do agree that it would be nice to have a way to flush figures before the end of the section, but not sure about the begining.

Feel free to close this issue if you think that it's too redundant with #16 :)

tingerrr commented 5 months ago

I'll keep this open, because hydra doesn't consider any floating elements yet, while it arguably should.

I'll just have to see how much of that can be done reasonably.