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

+2
View File
@@ -37,6 +37,8 @@ use self::layout::{
// from the article class's 14.4pt setting to 14pt.
fn article_heading_font_size(level: u8, base: u8) -> u8 {
match (base, level) {
(12, 0) => 24,
(_, 0) => 20,
(12, 1) => 17,
(_, 1) => 14,
(12, 2) => 14,
+11
View File
@@ -5832,6 +5832,13 @@ fn heading_start_primitive(
Ok(())
}
fn chapter_primitive(
token: token::Token,
input: &mut vm::ExecutionInput<CompilerState>,
) -> texlang::prelude::Result<()> {
heading_primitive(token, input, 0)
}
fn section_primitive(
token: token::Token,
input: &mut vm::ExecutionInput<CompilerState>,
@@ -7203,6 +7210,10 @@ fn built_in_commands() -> HashMap<&'static str, texlang::command::BuiltIn<Compil
"texrraend",
texlang::command::BuiltIn::new_execution(end_environment_primitive),
);
built_ins.insert(
"chapter",
texlang::command::BuiltIn::new_execution(chapter_primitive),
);
built_ins.insert(
"section",
texlang::command::BuiltIn::new_execution(section_primitive),