Add an unnumbered heading for the abstract environment
This commit is contained in:
1 parent
b4ee4c1330
commit
c7b7660049
2 files changed
+34
No files matched your search
@@ -1842,6 +1842,15 @@ impl Parser {
|
||||
self.table_active = false;
|
||||
self.current_table_block = None;
|
||||
}
|
||||
(true, "abstract") => {
|
||||
self.flush_paragraph();
|
||||
let mut heading = Run::plain("Abstract".to_string());
|
||||
heading.bold = true;
|
||||
self.push_block(Block::Centered {
|
||||
runs: vec![heading],
|
||||
});
|
||||
}
|
||||
(false, "abstract") => self.flush_paragraph(),
|
||||
(true, "center") => {
|
||||
self.flush_paragraph();
|
||||
if self.centered.is_none() {
|
||||
|
||||
@@ -871,3 +871,28 @@ After.
|
||||
"rules should not be painted as image XObjects"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn abstract_environment_gets_an_unumbered_heading() {
|
||||
let source = r"\documentclass{article}
|
||||
\begin{document}
|
||||
\begin{abstract}
|
||||
This is the abstract body.
|
||||
\end{abstract}
|
||||
\section{Introduction}
|
||||
Body.
|
||||
\end{document}";
|
||||
let preview = CompilerSession::default()
|
||||
.preview_json(source, "abstract.tex")
|
||||
.expect("abstract preview");
|
||||
let value: serde_json::Value = serde_json::from_str(&preview).expect("preview JSON");
|
||||
let svg = value["pages"][0]["svg"].as_str().expect("svg");
|
||||
assert!(
|
||||
svg.contains(">Abstract</text>"),
|
||||
"missing abstract heading: {svg}"
|
||||
);
|
||||
assert!(
|
||||
svg.contains(">1</text>"),
|
||||
"section numbering changed: {svg}"
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user