Place bottom tables at the page bottom

This commit is contained in:
gloamxun committed 2026-10-19 14:43:33 +08:00
1 parent 6658a155fc
commit e7bcdf6c53
5 files changed
+117 -12

No files matched your search

+33
View File
@@ -845,6 +845,39 @@ After table.
);
}
#[test]
fn bottom_table_sits_at_the_page_bottom() {
let source = r#"\documentclass{article}
\begin{document}
Before table.
\begin{table}[b]
\caption{Bottom table}
\begin{tabular}{ll}
Alpha & Beta \\
Gamma & Delta \\
\end{tabular}
\end{table}
After table.
\end{document}
"#;
let value = fresh_preview(source, "table-bottom.tex");
assert_eq!(value["status"], "ok", "{}", value["message"]);
assert_eq!(pages(&value).len(), 2, "bottom table should end page 1");
let first = page_svg(&value, 0);
assert!(first.contains(">Alpha</text>"), "bottom table missing");
let alpha_y = text_y(&first, "Alpha");
assert!(
alpha_y > 220.0,
"bottom table was not pushed to the page bottom: {alpha_y}"
);
assert!(
page_svg(&value, 1).contains("After"),
"text after a bottom table should continue on the next page"
);
}
#[test]
fn table_of_contents_lists_numbered_sections_and_pages() {
let source = r"\documentclass{article}