@@ -634,6 +634,23 @@ impl<'a, 'b> Insertions<'a, 'b> {
634634
635635 output. push_frame ( Point :: with_y ( self . top_size ) , inner) ;
636636
637+ // We put floats first and then footnotes. This differs from what LaTeX
638+ // does and is a little inconsistent w.r.t column vs page floats (page
639+ // floats are below footnotes because footnotes are per column), but
640+ // it's what most people (including myself) seem to intuitively expect.
641+ // We experimented with the LaTeX ordering in 0.12.0-rc1, but folks were
642+ // surprised and considered this strange. In LaTeX, it can be changed
643+ // with `\usepackage[bottom]{footmisc}`. We could also consider adding
644+ // configuration in the future.
645+ for ( placed, frame) in self . bottom_floats {
646+ offset_bottom += placed. clearance ;
647+ let x = placed. align_x . position ( size. x - frame. width ( ) ) ;
648+ let y = offset_bottom;
649+ let delta = placed. delta . zip_map ( size, Rel :: relative_to) . to_point ( ) ;
650+ offset_bottom += frame. height ( ) ;
651+ output. push_frame ( Point :: new ( x, y) + delta, frame) ;
652+ }
653+
637654 if let Some ( frame) = self . footnote_separator {
638655 offset_bottom += config. footnote . clearance ;
639656 let y = offset_bottom;
@@ -648,15 +665,6 @@ impl<'a, 'b> Insertions<'a, 'b> {
648665 output. push_frame ( Point :: with_y ( y) , frame) ;
649666 }
650667
651- for ( placed, frame) in self . bottom_floats {
652- offset_bottom += placed. clearance ;
653- let x = placed. align_x . position ( size. x - frame. width ( ) ) ;
654- let y = offset_bottom;
655- let delta = placed. delta . zip_map ( size, Rel :: relative_to) . to_point ( ) ;
656- offset_bottom += frame. height ( ) ;
657- output. push_frame ( Point :: new ( x, y) + delta, frame) ;
658- }
659-
660668 output
661669 }
662670}
0 commit comments