refactor: prepare to support customizing figure numbering

This commit is contained in:
2026-09-03 16:28:26 +03:00
parent 05da5ad1bf
commit f5835937db
2 changed files with 25 additions and 2 deletions
+8
View File
@@ -1,3 +1,11 @@
/// Whether to number figures per section or not.
/// If true, figures will be numbered like "1.1", "1.2", "2.1", etc.
/// If false, figures will be numbered like "1", "2", "3", etc.
///
/// TODO: figure out how to deal with numbering on sections such as
/// Appendix and other non-standard sections.
#let __FIG_PER_SECTION = state("svetikas.lt/ktu-paper/figure-numbering-per-section", false)
#let __DEBUG_AUTHOR_TABLE = state("$ktu-template-DEBUG_AUTHOR_TABLE", false) #let __DEBUG_AUTHOR_TABLE = state("$ktu-template-DEBUG_AUTHOR_TABLE", false)
#let debug-author-table() = { #let debug-author-table() = {
__DEBUG_AUTHOR_TABLE.update(true) __DEBUG_AUTHOR_TABLE.update(true)
+17 -2
View File
@@ -1,5 +1,5 @@
#import "@preview/codly:1.3.0": codly, codly-init #import "@preview/codly:1.3.0": codly, codly-init
#import "config.typ": debug-author-table, enable-heading-experiment, __HEADING_EXPERIMENT #import "config.typ": debug-author-table, enable-heading-experiment, __HEADING_EXPERIMENT, __FIG_PER_SECTION
#import "fragments.typ": ( #import "fragments.typ": (
ktu-table, ktu-table,
ktu-heading-page-centered, ktu-heading-page-normal, ktu-academic-honestly-declaration-page ktu-heading-page-centered, ktu-heading-page-normal, ktu-academic-honestly-declaration-page
@@ -391,7 +391,10 @@
body body
} }
#let setup-page(font: "Times New Roman", body) = { #let setup-page(
font: "Times New Roman",
body
) = {
show: __page_rules.with(font: font) show: __page_rules.with(font: font)
// Pagal formaliuosius rašto darbų reikalavimus // Pagal formaliuosius rašto darbų reikalavimus
@@ -537,3 +540,15 @@
body body
} }
/// Configure the template for a KTU paper.
/// - font (str): Font to use for the paper.
/// - figureNumberingPerSection (bool): Whether to number figures per section rather than globally.
#let ktu-paper(
font: "Times New Roman",
figureNumberingPerSection: false,
body
) = context {
show: setup-page.with(font: font)
__FIG_PER_SECTION.update(true)
body
}