From 5ddaec9cd06b60b03aef00073f0f5c245c0db0fc Mon Sep 17 00:00:00 2001 From: OrangeX4 <318483724@qq.com> Date: Sat, 6 Apr 2024 01:13:21 +0800 Subject: [PATCH] feat: make ctheorems works correctly with touying --- slide.typ | 12 +++++++----- themes/university.typ | 2 +- typst.toml | 3 ++- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/slide.typ b/slide.typ index 1757f7850..8fd3f9beb 100644 --- a/slide.typ +++ b/slide.typ @@ -407,11 +407,13 @@ let section = utils.unify-section(section) if section != none { states._new-section(short-title: section.short-title, section.title) + counter(heading).step() } // if subsection is not none, then create a new subsection let subsection = utils.unify-section(subsection) if subsection != none { states._new-subsection(short-title: subsection.short-title, subsection.title) + counter(heading).step(level: 2) } } // if appendix is false, then update the last-slide-counter and sections step @@ -516,17 +518,17 @@ (child.value.at("fn"))(..child.value.at("args")) } (section, subsection, title, slide) = (none, none, none, ()) - } else if type(child) == content and child.func() == heading and utils.heading-depth(child) <= slide-level + 1 { + } else if type(child) == content and child.func() == heading and child.depth <= slide-level + 1 { slide = utils.trim(slide) - if (utils.heading-depth(child) == 1 and section != none) or (utils.heading-depth(child) == 2 and subsection != none) or (utils.heading-depth(child) > slide-level and title != none) or slide != () { + if (child.depth == 1 and section != none) or (child.depth == 2 and subsection != none) or (child.depth > slide-level and title != none) or slide != () { (self.methods.slide)(self: self, section: section, subsection: subsection, ..(if last-title != none { (title: last-title) }), slide.sum(default: [])) (section, subsection, title, slide) = (none, none, none, ()) - if utils.heading-depth(child) <= slide-level { + if child.depth <= slide-level { last-title = none } } let child-body = if child.body != [] { child.body } else { none } - if utils.heading-depth(child) == 1 { + if child.depth == 1 { if slide-level >= 1 { if type(self.methods.at("touying-new-section-slide", default: none)) == function { (self.methods.touying-new-section-slide)(self: self, child-body) @@ -538,7 +540,7 @@ title = child.body last-title = child-body } - } else if utils.heading-depth(child) == 2 { + } else if child.depth == 2 { if slide-level >= 2 { if type(self.methods.at("touying-new-subsection-slide", default: none)) == function { (self.methods.touying-new-subsection-slide)(self: self, child-body) diff --git a/themes/university.typ b/themes/university.typ index 6e759f3fd..f798b8b3c 100644 --- a/themes/university.typ +++ b/themes/university.typ @@ -227,7 +227,7 @@ gutter: .3em, grid( columns: (auto, 1fr, auto), - align(top + left, heading(level: 2, text(fill: self.colors.primary, self.uni-title))), + align(top + left, text(fill: self.colors.primary, weight: "bold", size: 1.2em, self.uni-title)), [], if self.uni-display-current-section { align(top + right, text(fill: self.colors.primary.lighten(65%), states.current-section-title)) diff --git a/typst.toml b/typst.toml index 9c9947df1..5ed7cdd47 100644 --- a/typst.toml +++ b/typst.toml @@ -8,4 +8,5 @@ description = "A powerful package for creating presentation slides in Typst." repository = "https://github.com/touying-typ/touying" keywords = ["presentation", "slides", "lecture", "touying"] categories = ["presentation"] -exclude = ["examples"] \ No newline at end of file +exclude = ["examples"] +compiler = "0.11.0" \ No newline at end of file