-
Notifications
You must be signed in to change notification settings - Fork 0
/
typst-prepa.typ
179 lines (130 loc) · 3.34 KB
/
typst-prepa.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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
#import "@preview/ctheorems:1.0.0": *
#import "@preview/big-todo:0.2.0": *
#import "@preview/lovelace:0.1.0": *
// Mise en page
#set page(width: 16cm, height: auto, margin: 1.5cm)
#set heading(numbering: "1.1.")
#let last_num = (..nums) => nums.pos().last()
#let theorem = thmbox("théorème", "Théorème", fill: rgb("#eeffee"), base_level: 0)
#let corollary = thmbox(
"corollaire",
"Corrolaire",
fill: rgb("#efe6ff")
)
#let definition = thmbox("définition", "Défintion", stroke: rgb("#68ff68") + 1pt, base_level: 1).with(numbering: last_num)
#let example = thmplain(
"exemple",
"Exemple",
inset: 0.8em,
fill: luma(245),
breakable: false,
).with(numbering: last_num)
#let proof = thmplain(
"preuve",
"Preuve",
base: "theorem",
bodyfmt: body => [#body #h(1fr) $square$],
).with(numbering: none)
#let remark = thmplain(
"remarque",
"Remarque"
).with(numbering: none)
#let property = thmbox(
"propriété",
"Propriété",
stroke: blue + 1pt,
base_level: 1
).with(numbering: last_num)
#let usuel = thmplain(
"résultat usuel",
"Résultat usuel",
inset: 0.8em,
stroke: black + 0.5pt,
breakable: false,
).with(numbering: none)
#let method = thmbox(
"méthode",
"Méthode",
stroke: 1pt,
base_level: 1
).with(numbering: last_num)
#let exercice(num, fait, exo) = {
import emoji: checkmark, crossmark
let mark = if fait {checkmark} else {crossmark}
counter(heading).update(num -1)
{
set heading(numbering: nums => "Exercice "+ numbering("1", nums))
[= #mark ]
}
[#exo]
}
// Mathématiques
#let fun(ED, EA, i, o) = $ inline(#ED) & --> #EA \ #i & arrow.bar.long #o $
#let Union = $op(union.big,
limits: #true)$
#let ii = $upright(i)$
#let ee = $upright(e)$
#let Re = $ op("Re") $
#let Im = $ op("Im") $
#let result(r) = align(center, rect(r, stroke: rgb("#fd8a8a"), radius: 5pt))
#let sgn = $op("sgn")$
#let lna(x) = $ln abs(#x)$
#let interval(e1,e2, lo: false, ro: false) = {
let l = if lo {$bracket.l$} else {$bracket.r$}
let r = if ro {$bracket.r$} else {$bracket.l$}
$lr(#l #e1, #e2 #r)$
}
#let cosh = $op("ch")$
#let sinh = $op("sh")$
#let tanh = $op("th")$
#let arccos = $op("Arccos")$
#let arcsin = $op("Arcsin")$
#let arctan = $op("Arctan")$
#let argsh = $op("Argsh")$
#let conjug(z) = $accent(#z, -)$
#let pm =$plus.minus$
#let va(u) = $accent(#u, ->)$
// Templates
#let template(title, doc) = {
set text(lang: "fr")
// set document(title: title)
set par(justify: true)
set page(
header: align(right, title),
numbering: "1/1"
)
show: thmrules
show: setup-lovelace
align(center, text(title, style: "italic", 24pt))
doc
}
#let chapter(num, name, doc) = {
let title = "Chapitre " + str(num) + " - " + str(name)
show: doc => template(title, doc)
set heading(
numbering :(..nums) => {
let lenght = nums.pos().len()
if lenght != 1 {
nums.pos()
.slice(if lenght==2 {-1} else {-2})
.map(str)
.join(".")
} else {numbering("I", nums.pos().last())}
}
)
outline()
doc
}
#let devoir(type, num, doc) = {
let title = "Devoir " + str(type) + " " + str(num)
show: doc => template(title, doc)
set enum(numbering: "(1.a)")
doc
}
#let td(num, name, doc) = {
let title = "TD" + str(num) + " - " + name
show: doc => template(title, doc)
set enum(numbering: "(1.a)")
outline()
doc
}