forked from typst/packages
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlib.typ
More file actions
54 lines (49 loc) · 1.63 KB
/
lib.typ
File metadata and controls
54 lines (49 loc) · 1.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#import "imports.typ": tntt
#import tntt: cuti, use-size
#let define-config(
info: (:),
fonts: (:),
twoside: false,
bibliography: none,
) = {
import "font.typ": _use-fonts
import tntt.exports: *
import "pages/cover.typ": cover
import "pages/preface.typ": preface
if type(info.title) == str { info.title = info.title.split("\n") } else {
assert(type(info.title) == array, message: "标题(info.title)必须是字符串或字符串数组")
}
return (
/// ------ ///
/// config ///
/// ------ ///
info: info,
fonts: fonts,
twoside: twoside,
/// --------- ///
/// utilities ///
/// --------- ///
use-fonts: _use-fonts.with(fonts),
/// ------- ///
/// layouts ///
/// ------- ///
meta: meta.with(info: (..info, author: info.authors.map(a => a.name))),
doc: doc.with(default-fonts: fonts),
front-matter: front-matter,
main-matter: main-matter.with(twoside: twoside),
back-matter: back-matter.with(twoside: twoside),
/// ----- ///
/// pages ///
/// ----- ///
fonts-display: fonts-display.with(fonts: fonts),
cover: cover.with(info: info, default-fonts: fonts),
preface: preface.with(twoside: twoside, default-fonts: fonts),
outline-wrapper: outline-wrapper.with(twoside: twoside, default-fonts: fonts),
notation: notation.with(twoside: twoside),
master-list: master-list.with(twoside: twoside),
figure-list: figure-list.with(twoside: twoside),
table-list: table-list.with(twoside: twoside),
equation-list: equation-list.with(twoside: twoside),
bilingual-bibliography: bilingual-bibliography.with(bibliography),
)
}