Compact display-to-heading gaps in Times math
This commit is contained in:
1 parent
13b85b542a
commit
eabebfa687
6 files changed
+52
-12
No files matched your search
+27
-6
@@ -13855,6 +13855,14 @@ fn build_document_with_labels(
|
||||
}
|
||||
});
|
||||
let mut paragraphs = expand_maketitle(paragraphs, geometry);
|
||||
if geometry.roman_family.as_deref() == Some("ptm") {
|
||||
for index in 1..paragraphs.len() {
|
||||
if paragraphs[index].heading_level.is_some() && paragraphs[index - 1].math {
|
||||
paragraphs[index].space_before =
|
||||
(paragraphs[index].space_before - 15 * SCALE).max(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
if let Some(name) = geometry.abstract_name.as_deref() {
|
||||
rename_abstract_heading(&mut paragraphs, name);
|
||||
}
|
||||
@@ -14429,10 +14437,7 @@ 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 times_displays = ((7 * SCALE, 2 * SCALE, 5 * SCALE), (0, 0, 0));
|
||||
let (default_above_display, default_below_display) =
|
||||
if geometry.roman_family.as_deref() == Some("ptm") {
|
||||
times_displays
|
||||
@@ -20127,18 +20132,34 @@ left & right \\
|
||||
let (body, geometry) = geometry_and_body(source);
|
||||
let paragraphs = paragraphs(&body).expect("paragraphs");
|
||||
let document = build_document(¶graphs, &geometry);
|
||||
let math = document
|
||||
let math_index = document
|
||||
.units
|
||||
.iter()
|
||||
.find(|unit| {
|
||||
.position(|unit| {
|
||||
unit.items
|
||||
.iter()
|
||||
.any(|item| matches!(item, VerticalItem::Math { .. }))
|
||||
})
|
||||
.expect("display math unit");
|
||||
let math = &document.units[math_index];
|
||||
assert_eq!(math.space_before, 7 * SCALE);
|
||||
assert_eq!(math.space_stretch, 2 * SCALE);
|
||||
assert_eq!(math.space_shrink, 5 * SCALE);
|
||||
assert_eq!(document.units[math_index + 1].space_before, 0);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn times_heading_after_display_math_is_compacted() {
|
||||
let source = "\\renewcommand{\\rmdefault}{ptm}\n\\section{One}\n\nText.\n\n\\[ x \\]\n\n\\subsection{Two}\n\nBody.";
|
||||
let (body, geometry) = geometry_and_body(source);
|
||||
let paragraphs = paragraphs(&body).expect("paragraphs");
|
||||
let document = build_document(¶graphs, &geometry);
|
||||
let heading = document
|
||||
.units
|
||||
.iter()
|
||||
.find(|unit| unit.source.contains("Two"))
|
||||
.expect("subsection unit");
|
||||
assert_eq!(heading.space_before, 0);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in new issue
Block a user