Use arxiv.sty display skips in Times math

arxiv.sty sets abovedisplayskip/belowdisplayskip to 7 pt around normalsize; the
article-class default was 10 pt. Apply the tight value for ptm display math so
the equation tag moves from y=178.49 to y=175.49 (TeX y=174.9). Add a unit test
for the skip tuple; workspace tests are now 1089.
This commit is contained in:
gloamxun committed 2026-10-28 14:07:06 +08:00
1 parent e262bc0091
commit d28e21e3d4
7 files changed
+41 -9

No files matched your search

+30
View File
@@ -14405,6 +14405,16 @@ fn build_document_with_labels(
// builder reserves room for them on the page that mentions them.
let (default_above_display, default_below_display) =
display_skip_defaults(geometry.base_font_size.unwrap_or(655_360));
let times_displays = (
(7 * SCALE, 2 * SCALE, 5 * SCALE),
(7 * SCALE, 2 * SCALE, 5 * SCALE),
);
let (default_above_display, default_below_display) =
if geometry.roman_family.as_deref() == Some("ptm") {
times_displays
} else {
(default_above_display, default_below_display)
};
let above_display = geometry.above_display_skip.unwrap_or(default_above_display);
let below_display = geometry.below_display_skip.unwrap_or(default_below_display);
for index in 0..base_units.len().min(paragraphs.len()) {
@@ -20043,6 +20053,26 @@ left & right \\
assert_eq!(after.space_shrink, 5 * SCALE);
}
#[test]
fn times_display_math_uses_arxiv_skips() {
let source = "\\documentclass{article}\n\\renewcommand{\\rmdefault}{ptm}\n\\begin{document}\n\nBefore.\n\n\\[ x \\]\n\nAfter.\n\n\\end{document}\n";
let (body, geometry) = geometry_and_body(source);
let paragraphs = paragraphs(&body).expect("paragraphs");
let document = build_document(&paragraphs, &geometry);
let math = document
.units
.iter()
.find(|unit| {
unit.items
.iter()
.any(|item| matches!(item, VerticalItem::Math { .. }))
})
.expect("display math unit");
assert_eq!(math.space_before, 7 * SCALE);
assert_eq!(math.space_stretch, 2 * SCALE);
assert_eq!(math.space_shrink, 5 * SCALE);
}
#[test]
fn block_environment_after_text_starts_a_new_block() {
let blocks = paragraphs("The link is at\n\\begin{center}\nCentered\n\\end{center}\n")