Add chapter headings and chapter-prefixed numbering

This commit is contained in:
gloamxun committed 2026-10-19 14:23:53 +08:00
1 parent 6d4aa37189
commit a798221817
7 files changed
+68 -11

No files matched your search

+26
View File
@@ -951,3 +951,29 @@ fn centering_declaration_centers_a_paragraph() {
"centering leaked into the following paragraph: centered={plain_alpha}, left={left_plain}"
);
}
#[test]
fn chapter_headings_number_sections_and_enter_contents() {
let source = r#"\documentclass{book}
\begin{document}
\tableofcontents
\chapter{First Chapter}
\section{Alpha}
\subsection{Beta}
\chapter{Second Chapter}
\section{Gamma}
\end{document}
"#;
let value = fresh_preview(source, "chapters.tex");
assert_eq!(value["status"], "ok", "{}", value["message"]);
let svg = page_svg(&value, 0);
for needle in [
"Contents", "First", "Chapter", "Alpha", "Beta", "Gamma", "1.1", "1.1.1", "2.1",
] {
assert!(svg.contains(needle), "chapter numbering is missing : {svg}");
}
assert!(
!svg.contains("0.1"),
"section was numbered under chapter zero: {svg}"
);
}