Put floats back above footnotes instead of below (#5204)

This commit is contained in:
Laurenz 2024-10-14 17:36:29 +02:00 committed by GitHub
parent 6a8e29b2e5
commit 03a766444a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 17 additions and 9 deletions

View File

@ -634,6 +634,23 @@ impl<'a, 'b> Insertions<'a, 'b> {
output.push_frame(Point::with_y(self.top_size), inner);
// We put floats first and then footnotes. This differs from what LaTeX
// does and is a little inconsistent w.r.t column vs page floats (page
// floats are below footnotes because footnotes are per column), but
// it's what most people (including myself) seem to intuitively expect.
// We experimented with the LaTeX ordering in 0.12.0-rc1, but folks were
// surprised and considered this strange. In LaTeX, it can be changed
// with `\usepackage[bottom]{footmisc}`. We could also consider adding
// configuration in the future.
for (placed, frame) in self.bottom_floats {
offset_bottom += placed.clearance;
let x = placed.align_x.position(size.x - frame.width());
let y = offset_bottom;
let delta = placed.delta.zip_map(size, Rel::relative_to).to_point();
offset_bottom += frame.height();
output.push_frame(Point::new(x, y) + delta, frame);
}
if let Some(frame) = self.footnote_separator {
offset_bottom += config.footnote.clearance;
let y = offset_bottom;
@ -648,15 +665,6 @@ impl<'a, 'b> Insertions<'a, 'b> {
output.push_frame(Point::with_y(y), frame);
}
for (placed, frame) in self.bottom_floats {
offset_bottom += placed.clearance;
let x = placed.align_x.position(size.x - frame.width());
let y = offset_bottom;
let delta = placed.delta.zip_map(size, Rel::relative_to).to_point();
offset_bottom += frame.height();
output.push_frame(Point::new(x, y) + delta, frame);
}
output
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB