Use the proof optional argument as its heading
This commit is contained in:
1 parent
697d84aab3
commit
51e039f9bf
4 files changed
+20
-6
No files matched your search
+16
-2
@@ -2801,11 +2801,16 @@ fn theorem_block(raw: &str, definitions: &[TheoremDefinition]) -> Option<Vec<Sou
|
||||
if body.is_empty() {
|
||||
return None;
|
||||
}
|
||||
let heading_text = match (name.as_str(), title.as_deref()) {
|
||||
("proof", Some(title)) => format!("{title}."),
|
||||
_ => format!("{display}."),
|
||||
};
|
||||
let theorem_title = if name == "proof" { None } else { title.clone() };
|
||||
let heading = SourceParagraph {
|
||||
list_depth: None,
|
||||
list_label: 0,
|
||||
right_skip: 0,
|
||||
text: format!("{display}."),
|
||||
text: heading_text,
|
||||
font: ParagraphFont::Bold,
|
||||
line_height: 14,
|
||||
math: false,
|
||||
@@ -2828,7 +2833,7 @@ fn theorem_block(raw: &str, definitions: &[TheoremDefinition]) -> Option<Vec<Sou
|
||||
theorem: Some(TheoremSpec {
|
||||
name: name.clone(),
|
||||
display,
|
||||
title,
|
||||
title: theorem_title,
|
||||
starred,
|
||||
number: None,
|
||||
labels,
|
||||
@@ -7412,6 +7417,15 @@ Body.
|
||||
assert_eq!(document.units[0].source, "Theorem 1 (Main result).");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn proof_headings_use_their_optional_title() {
|
||||
let source = "\\begin{proof}[Proof of the claim]\nBecause it follows.\n\\end{proof}";
|
||||
let blocks = paragraphs(&source).expect("paragraphs");
|
||||
assert_eq!(blocks.len(), 2);
|
||||
assert_eq!(blocks[0].text, "Proof of the claim.");
|
||||
assert_eq!(blocks[1].font, ParagraphFont::Italic);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn proof_is_unnumbered_and_definitions_stay_roman() {
|
||||
let source = r"\begin{proof}
|
||||
|
||||
Reference in new issue
Block a user