Lock the first-page page break

Add a regression test for the arXiv page flow: page 1 ends with the final
section-2 line (porta vehicula. See Section 2.) and page 2 starts at
2.1 Headings. This protects the Times baselineskip/glue fix.

Test count is 1081.
This commit is contained in:
gloamxun committed 2026-10-28 08:47:03 +08:00
1 parent 423b202c54
commit 0f23eb4a83
5 files changed
+36 -6

No files matched your search

+30
View File
@@ -19872,6 +19872,36 @@ left & right \\
assert_eq!(author_orcid_marker(r"\orcidlink{0000-0002} Ada"), "iD Ada");
}
#[test]
fn arxiv_first_page_ends_at_section_two() {
let root = std::path::Path::new(env!("CARGO_MANIFEST_DIR"));
let template = std::fs::read_to_string(root.join("fixtures/arxiv-template/template.tex"))
.expect("template");
let sty =
std::fs::read_to_string(root.join("fixtures/arxiv-template/arxiv.sty")).expect("sty");
let assembled = template.replace("\\usepackage{arxiv}", &sty);
let json = preview_json(&assembled).expect("preview");
let value: serde_json::Value = serde_json::from_str(&json).expect("JSON");
assert_eq!(value["status"], "ok");
let page_text = |index: usize| {
let page = &value["pages"][index];
let mut text = String::new();
if let Some(svg) = page["svg"].as_str() {
for fragment in svg.split("<text ").skip(1) {
if let Some(content) = fragment.split('>').nth(1) {
text.push_str(content.split("</text").next().unwrap_or(content));
}
}
}
text
};
let first = page_text(0);
let second = page_text(1);
assert!(first.contains("portavehicula"), "first page: {first}");
assert!(!first.contains("2.1Headings"), "first page: {first}");
assert!(second.contains("2.1Headings"), "second page: {second}");
}
#[test]
fn arxiv_equation_tag_sits_at_the_right_margin() {
let root = std::path::Path::new(env!("CARGO_MANIFEST_DIR"));