Skip to content

Commit

Permalink
feat: make ctheorems works correctly with touying
Browse files Browse the repository at this point in the history
  • Loading branch information
OrangeX4 committed Apr 5, 2024
1 parent a7f3f7b commit 5ddaec9
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
12 changes: 7 additions & 5 deletions slide.typ
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion themes/university.typ
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
3 changes: 2 additions & 1 deletion typst.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
exclude = ["examples"]
compiler = "0.11.0"

0 comments on commit 5ddaec9

Please sign in to comment.