Skip to content

Commit 85131fe

Browse files
committed
feat: Enhances math environments and heading sizes
1 parent d02c36b commit 85131fe

2 files changed

Lines changed: 27 additions & 6 deletions

File tree

templates/math-macros.typ

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,26 @@
11
#import "@preview/theorion:0.3.3": *
22
#import cosmos.fancy: *
33

4-
// 基于 note-box 创建 question-box
4+
// 数学环境
55
#let question-box = note-box.with(
66
fill: rgb("#0f766e"),
77
title: (
88
en: "Question",
99
zh: "问题"
1010
),
1111
icon-name: "question", // icon to display from octicons set
12+
) // 基于 note-box 创建 question-box
13+
14+
#let definition = definition.with(
15+
breakable: true
16+
)
17+
18+
#let theorem = theorem.with(
19+
breakable: true
20+
)
21+
22+
#let corollary = corollary.with(
23+
breakable: true
1224
)
1325

1426
#let claim(
@@ -23,4 +35,6 @@
2335
#let card = math.op("card")
2436
#let dist = math.op("dist")
2537
#let span = math.op("span")
26-
#let codim = math.op("codim")
38+
#let codim = math.op("codim")
39+
40+
#let interior = math.circle

templates/page.typ

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@
7676

7777
// 尺寸配置
7878
#let main-size = if is-web-target { 16pt } else { 12.5pt }
79-
#let heading-sizes = (34pt, 30pt, 22pt, 20pt, main-size)
79+
// #let heading-sizes = (34pt, 30pt, 22pt, 20pt, main-size)
80+
#let heading-sizes = (34pt, 30pt, 22pt, main-size, main-size)
8081
#let list-indent = 0.5em
8182

8283

@@ -206,7 +207,7 @@
206207
#line(length: 100%, stroke: 0.6pt + dash-color)
207208
#v(0.1cm)
208209
#set align(left)
209-
#set text(heading-sizes.at(it.level))
210+
#set text(heading-sizes.at(it.level - 1))
210211
#text(dash-color)[Chapter
211212
#counter(heading).display(
212213
"1:" + it.numbering
@@ -222,7 +223,7 @@
222223
#line(length: 100%, stroke: 0.6pt + dash-color)
223224
#v(0.1cm)
224225
#set align(left)
225-
#set text(heading-sizes.at(it.level))
226+
#set text(heading-sizes.at(it.level - 1))
226227
#it.body
227228
#v(-0.5cm)
228229
#line(length: 100%, stroke: 0.6pt + dash-color)
@@ -238,7 +239,7 @@
238239

239240
show heading: it => {
240241
let it = {
241-
set text(size: heading-sizes.at(it.level))
242+
set text(size: heading-sizes.at(it.level - 1))
242243
if is-web-target {
243244
heading-hash(it, hash-color: dash-color)
244245
} else {
@@ -252,10 +253,16 @@
252253
it,
253254
)
254255
}
256+
// 章节开始于奇数页
255257
show heading.where(level: 1): it => {
256258
pagebreak(to: "odd", weak: true)
257259
it
258260
}
261+
// 四级标题不换行
262+
show heading.where(level: 4): it => {
263+
set text(heading-sizes.at(3))
264+
box(it)
265+
}
259266

260267
// ==========================================
261268
// 代码块渲染 (根据目标和主题设置)

0 commit comments

Comments
 (0)