Place top floats on the page they appear on
This commit is contained in:
1 parent
a78e0c1d0d
commit
db1cc98338
6 files changed
+101
-21
No files matched your search
@@ -323,13 +323,11 @@ impl PageBuilder {
|
||||
height: float_height,
|
||||
} => {
|
||||
if height > 0
|
||||
&& (has_body
|
||||
|| top_count >= self.top_number
|
||||
|| float_total >= self.total_number)
|
||||
&& (top_count >= self.top_number || float_total >= self.total_number)
|
||||
{
|
||||
// TeX never places a top float below body material,
|
||||
// nor above the `\topnumber`/`\totalnumber` limits:
|
||||
// the float starts the next page instead.
|
||||
// TeX never puts more top floats on one page than
|
||||
// `\topnumber`/`\totalnumber` allow: the float starts
|
||||
// the next page instead.
|
||||
let end = index.max(start);
|
||||
let badness =
|
||||
self.badness(height, reserved, stretch, shrink, stretch_order);
|
||||
@@ -354,7 +352,21 @@ impl PageBuilder {
|
||||
self.insertion_overflow(nodes, start, end, held),
|
||||
));
|
||||
}
|
||||
height += (*float_height).max(0);
|
||||
// TeX installs a `[t]` float at the top of the page it is
|
||||
// seen on, pushing the body down by its height plus
|
||||
// `\textfloatsep` (or `\floatsep` between stacked
|
||||
// floats). Only a page that breaks before the float moves
|
||||
// it to the next page.
|
||||
if height > 0 {
|
||||
height += (*float_height).max(0)
|
||||
+ if has_float {
|
||||
self.float_sep.max(0)
|
||||
} else {
|
||||
self.text_float_sep.max(0)
|
||||
};
|
||||
} else {
|
||||
height += (*float_height).max(0);
|
||||
}
|
||||
has_float = true;
|
||||
top_count += 1;
|
||||
float_total += 1;
|
||||
|
||||
Reference in new issue
Block a user