-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathextra.typ
119 lines (98 loc) · 2.22 KB
/
extra.typ
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
#import "@preview/great-theorems:0.1.1": *
#import "@preview/rich-counters:0.2.2": *
#import "@preview/mitex:0.2.5": *
#import "@preview/cetz:0.3.2"
#import "@preview/tablex:0.0.9": tablex, rowspanx, colspanx, hlinex
#import "@preview/tablem:0.1.0": tablem
#show: great-theorems-init
#let _treemap(is-root: false, max-columns: 3, is-child-of-root: false, tree) = {
if is-root {
table(
inset: (x: 0.2em, y: 0.6em),
columns: calc.min(tree.children.len(), max-columns),
..tree.children.map(_treemap.with(is-child-of-root: true)),
)
} else {
if tree.children == () {
box(inset: (x: 0.2em, y: 0em), rect(tree.title))
} else {
let res = stack(
{
set align(center)
set text(size: 1.25em, weight: "bold")
tree.title
},
v(0.8em),
{
tree.children.map(_treemap).sum()
},
)
if is-child-of-root {
res
} else {
box(
inset: (x: 0.2em, y: 0em),
rect(
width: 100%,
inset: (x: 0.2em, y: 0.6em),
res,
),
)
}
}
}
}
#let _list-title(cont) = {
let res = ([],)
for child in cont.children {
if child.func() != list.item {
res.push(child)
} else {
break
}
}
res.sum()
}
#let _treemap-converter(cont) = {
if not cont.has("children") {
if cont.func() == list.item {
(title: cont.body, children: ())
} else {
(title: cont, children: ())
}
} else {
(
title: _list-title(cont),
children: cont.children
.filter(it => it.func() == list.item)
.map(it => _treemap-converter(it.body))
)
}
}
#let treemap(cont) = _treemap(is-root: true, _treemap-converter(cont))
#let mathcounter = rich-counter(
identifier: "mathblocks",
inherited_levels: 1
)
#let theorem = mathblock(
blocktitle: "Theorem",
counter: mathcounter,
)
#let lemma = mathblock(
blocktitle: "Lemma",
counter: mathcounter,
)
#let remark = mathblock(
blocktitle: "Remark",
prefix: [_Remark._],
inset: 5pt,
fill: lime,
radius: 5pt,
)
#let proof = proofblock()
#let eq(content) = math.equation(
block: true,
numbering: none,
supplement: auto,
content,
)