repo
stringlengths 26
115
| file
stringlengths 54
212
| language
stringclasses 2
values | license
stringclasses 16
values | content
stringlengths 19
1.07M
|
---|---|---|---|---|
https://github.com/fuchs-fabian/typst-template-aio-studi-and-thesis | https://raw.githubusercontent.com/fuchs-fabian/typst-template-aio-studi-and-thesis/main/template/chapters/introduction.typ | typst | MIT License | #let introduction() = [
#lorem(20)
] |
https://github.com/jgm/typst-hs | https://raw.githubusercontent.com/jgm/typst-hs/main/test/typ/layout/par-justify-cjk-01.typ | typst | Other | // Japanese typography is more complex, make sure it is at least a bit sensible.
#set page(width: auto)
#set par(justify: true)
#set text(lang: "jp")
#rect(inset: 0pt, width: 80pt, fill: rgb("eee"))[
ウィキペディア(英: Wikipedia)は、世界中のボランティアの共同作業によって執筆及び作成されるフリーの多言語インターネット百科事典である。主に寄付に依って活動している非営利団体「ウィキメディア財団」が所有・運営している。
専門家によるオンライン百科事典プロジェクトNupedia(ヌーペディア)を前身として、2001年1月、ラリー・サンガーとジミー・ウェールズ(英: <NAME> "Jimbo" Wales)により英語でプロジェクトが開始された。
]
|
https://github.com/Godalin/Typst-Notations | https://raw.githubusercontent.com/Godalin/Typst-Notations/main/CatT.typ | typst | // category
#let ob = $upright("Ob")$
#let mor = $upright("Mor")$
#let dom = $sans("dom")$
#let cod = $sans("cod")$
#let id = $sans("id")$ // identity arrow
#let after = sym.compose // TODO deprecated
#let aft = after
#let op = $sans("op")$ // opposite category
#let Hom = $upright("Hom")$
#let sim = $tilde$
// Concrete Categories
#let Cat = $bold("Cat")$
#let CAT = $bold("CAT")$
#let Set = $bold("Set")$
#let Setp = $bold("Set")_star$
#let FinSet = $bold("FinSet")$
#let Rel = $bold("Rel")$
#let Pos = $bold("Pos")$
#let Ord = $bold("Ord")$
#let FinOrd = $bold("FinOrd")$
#let Bool = $bold("Bool")$
#let Prop = $bold("Prop")$
#let Mon = $bold("Mon")$
#let Grp = $bold("Grp")$
#let Ab = $bold("Ab")$
#let Ring = $bold("Ring")$
#let Vect = $bold("Vect")$
#let Gph = $bold("Gph")$
#let Top = $bold("Top")$
#let oCPO = $bold(omega"-CPO")$
// category variables
#let cA = $cal(A)$
#let cB = $cal(B)$
#let cC = $cal(C)$
#let cD = $cal(D)$
#let cE = $cal(E)$
#let cI = $cal(I)$
#let cJ = $cal(J)$
#let cCop = $cC^op$
#let cat(x) = ({
let ci = $circle.filled$
if x == "0" {$bold(0)$}
else if x == "1" {$ci arrow.ccw id_ci$}
else if x == "2" {$ci -> ci$}
})
// small cats
#let cat0 = $bold(bb(0))$
#let cat1 = $bold(bb(1))$
#let cat1ob = $circle.filled.small$
#let ob1 = cat1ob
#let cat2 = $bold(bb(2))$
// arrows
#let to = $->$
#let gets = $<-$
#let monic = [monic]
#let smonic = [split monic]
#let epic = [epic]
#let sepic = [split epic]
// in Set
#let mapto = $|->$
#let restrict = $harpoon.tr$
#let singleton = ${*}$
#let inclusion = $sans(i)$
#let inj = [injective]
#let surj = [surjective]
// isomorphisms
#let isom = [iso]
#let iso = sym.tilde.equiv
#let inv = $-1$
// functors
#let Fct(x, y) = $bold("Fct")[#x, #y]$
#let Id = $sans("Id")$ // identity functor
#let comma = $arrow.b$
#let slice = $\/$
// placeholders
#let sq(x) = $square_#x$
#let sq1 = sq($1$)
#let sq2 = sq($2$)
// concrete functors
#let Free = $sans("Free")$
#let Forget = $sans("Forget")$
// Natural Transformations
#let Nat = $upright("Nat")$
#let nt = $=>$
#let natiso = $==>^tilde$
// object
#let term = $excl$
#let init = $excl.inv$
#let null = $"null"$
#let elem = math.arrow
// product
#let pair(..things) = $angle.l lr(#things.pos().join($,$)) angle.r$
#let p1 = $pi_1$
#let p2 = $pi_2$
#let proj(n) = $pi_#n$
// coproduct
#let inl = $sans("inl")$
#let inr = $sans("inr")$
// exponential
#let ev = $sans("eval")$
#let curry = $sans(upright(lambda))$
// limits
#let limit = $limits(lim)_arrow.long.l$
#let colimit = $limits(lim)_arrow.long.r$
#let Cone = $sans("Cone")$
#let Cocone = $sans("Cocone")$
// Yoneda Lemma
#let yo = $bold("よ")$ // yoneda embedding
#let yy = $bold(cal(Y))$
#let xx = $bold(cal(X))$
#let Eval = $sans("Eval")$
// representable and universal element
#let Elem = $sans("Elem")$
#let uc(x) = $overline(#x)^upright(sans(u))$
// adjoints
#let ladj = $tack.l$
#let radj = $tack$
#let adj = ladj
#let adjars = $arrows.rl$
// Kan
#let Lan = $sans("Lan")$
#let Ran = $sans("Ran")$
// topo
#let pow = $cal(P)$
#let subrel = $lt.eq.curly$
#let subeqv = $equiv$
#let Sub = $sans("Sub")$
// natural-numbers object
#let zero = $sans("zero")$
#let succ = $sans("succ")$
|
|
https://github.com/yhtq/Notes | https://raw.githubusercontent.com/yhtq/Notes/main/抽象代数/作业/hw5.typ | typst | #import "../../template.typ": *
// Take a look at the file `template.typ` in the file panel
// to customize this template and discover how it works.
#show: note.with(
title: "作业5",
author: "YHTQ ",
date: none,
logo: none,
withOutlined: false
)
= 10.19
= P58
20.
#answer[
任取 $x in G$,若 $exists g in G - C_G (z)$,则:
$
[x | x -> g x Inv(g)]
$
将是不同于平凡自同构的自同构,进而它是唯一的非平凡自同构。\
这将意味着共轭作用 $Ad_y: [x | x -> y x Inv(y)]$只能为恒等映射或 $[x | x -> g x Inv(g)]$,进而以下两者有且只有一个成立:
- $Ad_y = I => y in Z(G)$
- $Ad_y = [x | x -> g x Inv(g)] => forall x: y x Inv(y) = g x Inv(g) => Inv(g)y in Z(G)$
这表明:
$
G = Z(G) union Inv(g) Z(G)
$
进而 $exists y in Z(G): x = Inv(g) y =>g x Inv(g) = y Inv(g) = Inv(g) y = x$,矛盾!
]
21.
#answer[
显然非交换群至少有两个自同构,恒等映射和某个共轭作用。\
从而可设 $G$ 是交换群。\
- 若 $G$ 中所有元素阶均为二,显然至少有两个二阶元素 $x, y$,从而 $generatedBy(x\, y) tilde.eq ZZ_2 times ZZ_2$,后者有非平凡自同构。又结合 $generatedBy(x\, y)$ 是正规子群,考虑商结构容易得到 $G$ 的非平凡自同构。
- 若 $G$ 中存在阶大于 $2$ 的元素 $x$,记 $ord(x) = m$。显然 $generatedBy(x) tilde.eq ZZ_m$,后者显然有非平凡自同构,类似可证明原结论。
]
= P64
1.
#answer[
考虑 $G$ 在 $G : H$ 上的作用:
$
g -> [x H | x H ->(g x) H]
$
显然它自然诱导出 $G -> S_n$ 的同态 $phi$,从而由第一同构定理:
$
quotient(G, ker phi) tilde.eq im(phi) <= S_n
$
另一方面,不难发现:
$
ker(phi) <= H(phi(g) = I => phi(g)H = H => g H = H)\
normalSub(ker(phi), G)
$
另一方面,有:
$
|G : ker(phi)| = |quotient(G, ker phi)| = |im(phi)| | n!
$
从而要么 $ker(phi) = {1} => |G| | n!$,要么 $ker(phi)$ 是非平凡正规子群。
]
7.
#answer[
设 $h in H, k in K$,注意到:
$
Inv(k) (h k Inv(h)) in Inv(k) K = K\
(Inv(k) h k) Inv(h) in H Inv(h) = H
$
这表明:
$
Inv(k) h k Inv(h) in H sect K = {1} => h k Inv(h) = k => h k = k h
$
]
= 补充题
1.
#proof[
#set enum(numbering: "(1)")
+ 显然 $M_1 subset M_2 => quotient(M_1, N) subset quotient(M_2, N)$\
另一方面,设 $quotient(M_1, N) subset quotient(M_2, N)$,则对 $m_1 N in quotient(M_1, N) subset quotient(M_2, N) => m_1 N = m_2 N$\
进而 $m_1 Inv(m_2) in N <= M_2 => m_1 in M_2$,证毕。
+ 断言 $M_2 = union_(m_i) m_i M_1$ 是左陪集分解当且仅当 $quotient(M_2, N) = union_(m_i) (m_i N) quotient(M_1, N)$也是陪集分解,这是因为:
$
(m_i N) quotient(M_1, N) = (m_j N) quotient(M_1, N) \
<=> m_i Inv(m_j) N in quotient(M_1, N) <=> m_i Inv(m_j) in M_1 <=> m_i M_1 = m_j M_1
$
这表明其中一个是无交并当且仅当另一个也是。\
这足以说明两者同时为陪集分解。事实上,假设 $M_2 = union_(m_i) m_i M_1$ 是左陪集分解,那么
$union_(m_i) (m_i N) quotient(M_1, N) subset quotient(M_2, N)$ (运用结论 1)且是无交并,这就给出 $|overline(M_2) : overline(M_1)| >= |M_2 : M_1|$\
反之同理,因此 $|overline(M_2) : overline(M_1)| = |M_2 : M_1|$,且上面给出的两者同时为陪集分解。
+ 注意到(由性质 1):
- $M_1, M_2 <= generatedBy(M_1\,M_2) => overline(M_1), overline(M_2) <= overline(generatedBy(M_1\,M_2))$
- $overline(M_1), overline(M_2) <= generatedBy(overline(M_1)\, overline(M_2)) => M_1, M_2 <= Inv(pi)(generatedBy(overline(M_1)\, overline(M_2)))$
结合生成子集的定义,便有:
$
generatedBy(overline(M_1)\, overline(M_2)) <= overline(generatedBy(M_1\,M_2))\
generatedBy(M_1\,M_2) <= Inv(pi)(generatedBy(overline(M_1)\, overline(M_2))) => overline(generatedBy(M_1\,M_2)) <= generatedBy(overline(M_1)\, overline(M_2))
$
这就证明了原命题。
+ 类似上一命题可以证明
+ 对 $g in G$,断言:
$
g M Inv(g) = M <=> (g H) (quotient(M, H)) (Inv(g) H) = quotient( (g M Inv(g)), H) = quotient(M, H)
$
注意到性质 1 蕴含了 $M_1 = M_2 <=> quotient(M_1, H) = quotient(M_2, H)$,因此以上结论是显然的。\
此性质足以说明 $normalSub(M, G) <=> normalSub(overline(M), overline(G))$,后半句性质就是第三同构定理。
]
2.
#answer[
设 $normalSub(M, G), |M| = n$。\
注意到我们有:
$
|M N| | |M| |N| = n^2\
M N <= G => |M N| | |G| = m n
$
以上两式结合 $gcd(m, n) = 1$,立得:
$
|M N| = n => M N = N => M subset N => M = N
$
证毕
]
3.
#answer[
对 $forall g in G$,注意到:
$
sigma(g N Inv(g)) = sigma(g) sigma(N) Inv(sigma(g)) = sigma(g) Inv(sigma(g)) sigma(N) = sigma(N)
$
这表明 $g N Inv(g) subset N ker(sigma) = N$\
由 $g$ 的任意性知 $Inv(g) N g subset N$,也即 $N subset g N Inv(g)$,进而 $g N Inv(g) = N$,这就证明了原命题。
]
4. 由 $G$ 是单群知 $ker(phi) = {1}\/G$,进而有第一同构定理:
$
G tilde.eq H
$
或
$
quotient(G, G) tilde.eq {1} tilde.eq H
$
5. 与 P64 1 重复
6.
#answer[
设 $G$ 是 $p-$群,$P = {G"的所有子群"}$。
//#lemma[][
// $p | |P| - 1$
//]
//#proof[
// 考虑 $G$ 在 $P$ 上的左平移作用:
// $
// g -> [H <= G | H -> g H]
// $
// 注意到:
// $
// Stab_G (H) = {g | g H = H} = H
// $
// 进而在所有轨道对应的 $G:Stab_G (H)$ 中,有且仅有 $G$ 一个使得:
// $
// |G:Stab_G (H)| = 1
// $
// 其他项均有:
// $
// p | |G:Stab_G (H)|
// $
// 从而由:
// $
// |P| = sum_H |G : Stab_G (H)|
// $
// 立得原结论
//]
考虑 $G$ 在 $P$ 上的共轭作用:
$
g -> [H <= G | H -> g H Inv(g)]
$
注意到:
$
G = Stab_G (H) <=> forall g in G: g H Inv(g) = H <=> H "是正规子群"
$
同样在:
$
|P| = sum_(H in I) |G : Stab_G (H)|
$
中,设正规子群的个数为 $m$,将有:
$
|P| = m + sum_(H in I "不是正规子群") |G : Stab_G (H)|
$
从而将有:
$
p | |P| - m
$
这就给出了原命题
]
7.
#answer[
由 $G$ 在自身的左平移作用,自然导出 $G -> S_(2n)$ 的群同态 $phi$
- 注意到:
$
phi(g) = I <=> forall x in G: g x = x <=> g = 1
$
表明 $phi$ 是单同态
- 记 $"sgn" : S_(2n) -> {-1, 1}$ 表示置换的奇偶性,将有:
$
pi := "sgn" compose phi: G -> {-1, 1}
$
显然 $normalSub(ker("sgn" compose phi), G)$。\
+ 若 $im(phi)$ 中有奇置换 $phi(x)$:
断言:
$
f := [g in Inv(pi)(1) | g -> x g]\
g := [g in Inv(pi)(-1) | g -> Inv(x) g]\
$
是 $Inv(pi)(1) <-> Inv(pi)(-1)$ 的一一映射。\
- 容易发现 $f compose g = I, g compose f = I$,从而结论是成立的。
这就说明 $|Inv(pi)(-1)| = |Inv(pi)(1)| = (2n)/2 = n$,从而本题结论成立
+ 我们证明 $im(phi)$ 中必有奇置换。事实上,取 $x$ 为 $G$ 中的二阶元,显然它是若干不相交对换的乘积,又注意到:
$
phi(x) = [g in G | g -> x g]
$
在 $G$ 中没有不动点,因此 $phi(x)$ 将由 $n$ 个不相交对换构成,从而是奇置换。
]
8.
(1). #answer[
- 注意到若 $x, y, x y in I$,则 $alpha(x y) = Inv((x y)) = Inv(x) Inv(y) => x y = y x$
- 对任意 $x in I$,对 $y_i in I$,考虑共计 $|I|$ 个 $x y_i$:\
由于 $|G| - |I| < 1/4 |G|, |I| - (|G| - |I|) > 1/2 |G|$,进而可以断言 $x$ 至少与 $1/2 |G| + 1$ 个元素可交换
- 上式意味着 $|C_G (x)| >= 1/2 |G| + 1$,由拉格朗日定理,这给出 $C_G (x) = |G|$
- 这就证明了 $I subset Z(G) => |Z(G)| > 3/4 |G| => Z(G) = G$
(2). #answer[
仿照上式证明,我们有 $|C_G (x)| >= 1/2 |G|$
- 若 $exists x : |C_G (x)| = 1/2 |G|$
此时 $C_G (x)$ 是指数为 2 的子群,自然成为正规子群。\
只需证明 $C_G (x)$ 交换,在上面的证明中取等当且仅当恰有 $1/2 |G|$ 个元素在 $x I sect I$ 中,且这些元素都与 $x$ 可交换,进而 $C_G (x) = x I sect I$。
另一方面,$C_G (x)$ 是子群,自然对乘法封闭。这意味着:
$
forall y_1, y_2 in C_G(x) subset I: y_1 y_2 in C_G (x) subset I
$
进而 $y_1, y_2, y_1 y_2 in I$,足以说明 $y_1, y_2$ 可交换
- 反之,若对所有 $x in I$ 均有 $|C_G (x)| >= 1/2 |G| + 1$,按照上式证明将有 $G$ 交换,此时 $I$ 将成为 $G$ 的子群,与拉格朗日定理矛盾!
]
]
= 10.23
= P27
44.
#answer[
- 对任意 $(a, b) in Z(A) times Z(B)$,显有 $(a, b)$ 与 $A times B$ 中任意元素可交换,因此 $Z(A) times Z(B) subset Z(A times B)$
- 对任意 $(a, b) in Z(A times B)$,取 $pi$ 是投影同态,显然有 $pi((a, b)) in Z(pi(A times B))$,继而可得 $Z(A times B) subset Z(A) times Z(B)$
]
45. 与之前作业重复了
= P57
9.
#answer[
在 $Z_3 times Z_9 times Z_9 times Z_(3 times 9 times 9)$ 中:
+ 注意到 $ord((a, b, c, d)) = 9 <=> "lcm"(ord(a), ord(b), ord(c), ord(d)) = 9$,分别考虑 $(ord(a), ord(b), ord(c), ord(d)) = *$ 的元素个数:
- 显然 $"lcm"(ord(a), ord(b), ord(c), ord(d)) | 9$ 的元素共有 $3 dot 9 dot 9 dot 9$ 个,而 $"lcm"(ord(a), ord(b), ord(c), ord(d)) | 6$ 的元素共有 $3^4$ 个,因此九阶元素恰有:
$
3 dot 9^3 - 3^4
$
注意到每个 $9$ 阶循环群中共有 $6$ 个 $9$ 阶元素,每两个 $9$ 阶循环群中不会有相同的 $9$ 阶元素,因此 $9$ 阶循环群共有:
$
(3 dot 9^3 - 3^4) / 6 = 351
$
个
+ 注意到 $9$ 阶非循环群只有 $ZZ_3 times ZZ_3$,因此我们只需找到两个不相关(相乘不为 $1$)的三阶元素即可确定一个 $9$ 阶非循环群
- $3$ 阶元素共有:
$
3^4 - 1 = 80
$
- 选出两个的选法为:
$
C_80^2 = 40 dot 79
$
- 选到相关的三阶元素的个数为:($x, x^2$ 构成一个相关选法)
$
80/2=40
$
- 在 $ZZ_3 times ZZ_3$ 中,除 $1$ 外所有元素都是 $3$ 阶元素,每两个不相关元素都可唯一确定一个子群,因此每个子群可由:
$
C_8^2 - 4 = 24
$
种选法确定
- 综上,总非循环子群个数为:
$
(40 dot 79 - 40)/24 = 130
$
]
22.
#answer[
在 $ZZ_2 times ZZ_2$ 中,除 $e$ 外的三个二阶元素地位是完全相同的,任意调换其中元素仍为 $ZZ_2 times ZZ_2$。因此 $Aut(ZZ_2 times ZZ_2)$ 就是三个二阶元素的全置换,自然有 $Aut(ZZ_2 times ZZ_2) tilde.eq S_3$
]
= 补充题
1.
#answer[
- 设 $x$ 是 $G_1 times G_2$ 的生成元,易知 $pi_A (x), pi_B (x)$ 分别是 $G_1, G_2$ 的生成元,这就表明两者都是循环群。\
- 注意到:
$
|G_1| |G_2| = ord(x) = ord((a, b)) = "lcm"(ord(a), ord(b)) = "lcm"(|G_1|, |G_2|)
$
这表明 $|G_1|, |G_2|$ 互素
]
2.
#answer[
不妨设 $G_1$ 是无限循环群。任取 $x = (a, b) in G_1 times G_2, a, b != e$,注意到:
$
(a, b^2) in.not generatedBy(x)
$
否则 $a^k = a, k!=1$ 或 $b^2 = b, b = 1$,无论哪个都将导致矛盾\
上式足以说明这样的 $x$ 不能为生成元,而显然生成元(若有)的分量不能为 $e$,因此 $G_1 times G_2$ 不是循环群
]
3.
#answer[
注意到 $G_1 times G_2$ 中任意元素可被写作 $g_1 g_2$,其中 $g_1 in G_1 times {1}, g_2 in {1} times G_2$。\
- (1):
$
g_1 g_2 N_1 times N_2 Inv(g_2) Inv(g_1)\
= pi_A (g_1 g_2 N_1 times N_2 Inv(g_2) Inv(g_1)) times pi_B (g_1 g_2 N_1 times N_2 Inv(g_2) Inv(g_1))\
= (g_1 N_1 Inv(g_1)) times (g_2 N_2 Inv(g_2))\
= N_1 times N_2\
$
- (2):构造映射 $phi$:
$
G_1 times G_2 -> quotient(G_1, N_1) times quotient(G_2, N_2)\
x -> (pi_1 compose pi_A (x), pi_2 compose pi_B (x))) :
$
其中 $pi_1, pi_2$ 分别是 $G_1 -> quotient(G_1, N_1)$, $G_2 -> quotient(G_2, N_2)$ 的自然同态。\
不难验证 $ker(phi) = N_1 times N_2$,因此由第一同构定理结论成立
]
4.
#answer[
+ 注意到 $K sect L subset K sect (H L) = {e}$,从而由熟知定理知 $K L tilde.eq K times L$
+ $normalSub(K L, H K L)$
注意到 $K, L$ 元素之间可换,从而:
$
h k l K L Inv(l) Inv(k) Inv(h) = h k K L Inv(k) Inv(h) = h K L Inv(h) = K L
$
+ 又结合 $H sect (K L) = {e}$,我们有:
$
H (K L) tilde.eq H times (K L) tilde.eq H times (K times L) tilde.eq H times K times L
$
]
5.
#answer[
显有 $H sect L = {e}$,由熟知定理知:
$
G tilde.eq H times K
$
且 $H times K$ 的每一个子群都形如 $H_1 times K_1$\
对任意 $G$ 的子群 $L$,将 $L$ 映射到 $H times K$ 之后设其形式为 $H_1 times K_1$,显然有:
$
H_1 = H sect L, K_1 = K sect L\
L = H_1 K_1 = (H sect L) (K sect L)
$
]
6.
#answer[
任取 $a in H, b in K, a, b != e$\
由题设知 $generatedBy((a, b))$ 形如 $H_1 times K_1$,并且易得 $H_1 = generatedBy(a), K_1 = generatedBy(b)$,进而 $generatedBy((a, b)) = generatedBy(a) times generatedBy(b)$\
这就意味着:
$
exists k != 1: (a, b)^k = (a^k, b^k) = (a, e)
$
这表明 $ord(a) | k-1, ord(b) | k$\
由 $gcd(k-1, k) = 1$,这就给出了全部结论。
]
7.
只需证明:
$
ZZ_2 times (ZZ_n times.r ZZ_2) tilde.eq (ZZ_2 times ZZ_n) times.r ZZ_2 tilde.eq ZZ_(2n) times.r ZZ_2
$
其中两个半直积均由 $phi_(-1) (x) = Inv(x)$ 给出\
后一个同构由 $n$ 是奇数容易得到,只需证明前者。\
事实上,两者的元素均形如 $(a, b, c)$,前者的乘法法则为:
$
(a_1, b_1, c_1)(a_2, b_2, c_2) = (a_1 a_2, b_1 phi_(c_1) (b_2), c_1 c_2)
$
后者则为:
$
(a_1, b_1, c_1)(a_2, b_2, c_2) = ((a_1, b_1)phi_(c_1) (a_2, b_2), c_1 c_2) = (a_1 phi_(c_1) (a_2), b_1 phi_(c_1) (b_2), c_1 c_2)
$
由于 $ZZ_2$ 中所有元素均有 $Inv(x) = x$,因此 $phi_(-1) (a_2) = a_2$,这就验证了两者确实同构。 |
|
https://github.com/heychhavi/resume-template | https://raw.githubusercontent.com/heychhavi/resume-template/main/template.typ | typst | #let justified(lbody, rbody) = {
block[
#lbody
#box(width: 1fr)[
#align(right)[#rbody]
]
]
}
#let resume(author: (:), body) = {
set document(
author: author.name,
title: "Resume",
)
set text(
font: ("New Computer Modern"),
lang: "en",
size: 11pt,
fill: rgb("#131A28"),
fallback: false
)
set page(paper: "a4", margin: 0.25in)
show par: set block(above: 0.1em, below: 0.1em)
set par(justify: true)
set heading(numbering: none, outlined: false)
let name = {
align(center)[
#block[
#set text(size: 16pt, style: "normal")
#text(weight: "light")[#author.name]
]
]
}
let contacts = {
set box(height: 13pt)
set text(size: 11pt)
let separator = box(width: 24pt)
align(center)[
#block[
#align(horizon)[
#box(image("assets/icons/phone.svg"))
#box[#text(author.phone)]
#separator
#box(image("assets/icons/email.svg"))
#box[#link("mailto:" + author.email)[#author.email]]
#separator
#box(image("assets/icons/linkedin.svg"))
#box[#link("www.linkedin.com/in/" + author.linkedin)[#author.linkedin]]
]
]
]
}
name
contacts
body
}
#let section(title) = {
set text(size: 15pt)
set block(above: 12pt, below: 9pt)
set pad(rest: 0em)
pad[
#align(left)[
#smallcaps[#title]
#box(width: 1fr, line(length: 100%))
]
]
}
#let content(body) = {
set text(size: 10pt, style: "normal", weight: "light")
set par(leading: 0.65em)
body
}
#let timeframe(body) = {
set text(size: 11pt, weight: "light", style: "normal")
body
}
#let organization(body) = {
set text(size: 13pt, style: "normal", weight: "bold")
set block(above: 14pt, below: 0pt)
block[#body]
}
#let position(body) = {
set text(size: 11pt, weight: "regular", ligatures: false)
smallcaps[#body]
}
#let category(body) = {
set text(size: 11pt, weight: "bold")
body
}
#let role(
title,
daterange
) = {
set block(above: 12pt, below: 0pt)
block[
#justified[#position[#title]][
#timeframe[#daterange]
]
]
}
#let skills(name, items) = {
set block(below: 0.1em)
set pad(top: 5pt)
pad[
#grid(
columns: (18fr, 82fr),
gutter: 10pt,
align(right)[
#category[#name]
],
align(left)[
#set text(size: 11pt, style: "normal", weight: "light")
#items.join(", ")
],
)
]
}
|
|
https://github.com/OCamlPro/ppaqse-lang | https://raw.githubusercontent.com/OCamlPro/ppaqse-lang/master/src/étude/formalisation.typ | typst | #import "defs.typ": *
#import "links.typ": *
= Meta formalisation
Pour certains langages, il est possible d'utiliser des outils de formalisation
pour spécifier des programmes et prouver que des propriétés.
Il existe globalement trois stratégies pour développement formel pour les
langages cibles:
- l'extraction de code;
- la génération de code;
- la vérification de code.
L'extraction de code consiste à écrire un programme dans un langage de
spécification (comme #coq ou #isabelle par exemple) et à extraire un programme
exécutable dans un langage cible. Ce dernier peut être soit le langage voulu
soit un langage compatible avec le langage voulu. Par exemple, on peut
extraire un programme #ocaml de #coq et compiler ce programme en un fichier
objet pouvant être lié à un programme C. C'est l'approche la plus simple pour
faire des développements formels intégrables dans des systèmes existants mais
elle a plusieurs inconvénients :
- elle suppose que l'extraction de programme est correcte;
- le langage cible n'est pas forcément agréé pour le développement critique.
La génération de code consiste à injecter le langage cible dans le langage
formel (qui devient un langage hôte). Cette injection se fait en
1. décrivant le langage cible dans le langage hôte ;
2. programmant dans le langage hôte le programme du langage cible ;
3. imprimer le programme cible dans un fichier ou plusieurs fichiers.
Les fichiers obtenus reprensent alors un programme valide du langage cible mais
qui a été formalisé dans le langage hôte.
Au final, cette approche permet
de décrire des programmes idiomatique au langage cible dans une syntaxe
plus ou moins proche de celui-ci suivant les capacités du langage hôte et de
démontrer des propriétés sur ces programmes. L'inconvénient
réside essentiellement dans le travail nécessaire pour décrire une injection
complète du langage cible dans le langage hôte qui peut se compter en années de
travail.
La vérification de code consiste partir du programme à vérifier dans le
langage cible et à décrire
des propriétés sur ce programme par le biais d'annotations (la plupart du
temps dans les commentaires). Ces propriétés sont ensuite vérifiées par un
outil de vérification tiers. Cette approche est la plus pratique d'un point de
vue opérationnel car elle ne nécessite pas de manipuler des langages formels
directement. Les équipes de développement peuvent continuer à travailler
dans leur langage habituel et l'ajout des annotations peut se faire par d'autres
personnes. Toutefois, cette approche est limitée par les capacités de l'outil
de vérification et les annotations
doivent être suffisamment précises pour être utiles. Cela demande souvent une
connaissance assez fine de l'outil de vérification pour être efficace. Par
ailleurs, et comme pour la solution précédente, l'outil doit avoir un modèle
sémantique du langage cible qui nécessite beaucoup de travail. C'est
l'approche des outils de vérification de code comme #framac avec par exemple
let code annoté suivant:
```c
/*@
requires \valid(a) && \valid(b);
assigns *a, *b;
ensures *a == \old(*b);
ensures *b == \old(*a);
*/
void swap(int* a, int* b){
int tmp = *a;
*a = *b;
*b = tmp;
}
int main(){
int a = 42;
int b = 37;
swap(&a, &b);
//@ assert a == 37 && b == 42;
return 0;
}
```
où l'assertion sera vérfiée par l'outil et les solveurs sous-jacents à l'aide
des propriétés spécifiées dans le commentaire de la fonction `swap`.
|
|
https://github.com/liuguangxi/fractusist | https://raw.githubusercontent.com/liuguangxi/fractusist/main/src/koch.typ | typst | MIT License | //==============================================================================
// The Koch curve
//
// Public functions:
// koch-curve, koch-snowflake
//==============================================================================
#import "util.typ": gen-svg
//----------------------------------------------------------
// Public functions
//----------------------------------------------------------
// Generate Koch curve
//
// iterations: [0, 6]
// axiom: "F"
// rule set:
// "F" -> "F-F++F-F"
// angle: 60 deg
//
// Arguments:
// n: the number of iterations
// step-size: step size (in pt), optional
// stroke-style: stroke style, can be none or color or gradient or stroke object, optional
// width: the width of the image, optional
// height: the height of the image, optional
// fit: how the image should adjust itself to a given area, "cover" / "contain" / "stretch", optional
//
// Returns:
// content: generated vector graphic
#let koch-curve(n, step-size: 10, stroke-style: black + 1pt, width: auto, height: auto, fit: "cover") = {
assert(type(n) == int and n >= 0 and n <= 6, message: "`n` should be in range [0, 6]")
assert(step-size > 0, message: "`step-size` should be positive")
if stroke-style != none {stroke-style = stroke(stroke-style)}
let stroke-width = if (stroke-style == none) {0} else if (stroke-style.thickness == auto) {1} else {calc.abs(stroke-style.thickness.pt())}
let axiom = "F"
let rule-set = ("F": "F-F++F-F")
let dx = (step-size, step-size/2, -step-size/2, -step-size, -step-size/2, step-size/2)
let dy = (0, step-size/2*calc.sqrt(3), step-size/2*calc.sqrt(3), 0, -step-size/2*calc.sqrt(3), -step-size/2*calc.sqrt(3))
let dx-str = dx.map(i => repr(i))
let dy-str = dy.map(i => repr(i))
let s = axiom
for i in range(n) {s = s.replace("F", rule-set.at("F"))}
let dir = 0
let path-d = "M0 0 "
for c in s {
if c == "-" {
dir -= 1
if dir < 0 {dir = 5}
} else if c == "+" {
dir += 1
if (dir == 6) {dir = 0}
} else if c == "F" {
path-d += "l" + dx-str.at(dir) + " " + dy-str.at(dir) + " "
}
}
let margin = calc.max(5, stroke-width * 1.5)
let x-min = 0
let x-max = calc.pow(3, n) * step-size
let y-min = -calc.pow(3, n - 1) * calc.sqrt(3)/2 * step-size
let y-max = 0
x-min = calc.floor(x-min - margin)
x-max = calc.ceil(x-max + margin)
y-min = calc.floor(y-min - margin)
y-max = calc.ceil(y-max + margin)
let svg-code = gen-svg(path-d, (x-min, x-max, y-min, y-max), none, stroke-style)
return image.decode(svg-code, width: width, height: height, fit: fit)
}
// Generate Koch snowflake
//
// iterations: [0, 6]
// axiom: "F++F++F"
// rule set:
// "F" -> "F-F++F-F"
// angle: 60 deg
//
// Arguments:
// n: the number of iterations
// step-size: step size (in pt), optional
// fill-style: fill style, can be none or color or gradient, optional
// stroke-style: stroke style, can be none or color or gradient or stroke object, optional
// width: the width of the image, optional
// height: the height of the image, optional
// fit: how the image should adjust itself to a given area, "cover" / "contain" / "stretch", optional
//
// Returns:
// content: generated vector graphic
#let koch-snowflake(n, step-size: 10, fill-style: none, stroke-style: black + 1pt, width: auto, height: auto, fit: "cover") = {
assert(type(n) == int and n >= 0 and n <= 6, message: "`n` should be in range [0, 6]")
assert(step-size > 0, message: "`step-size` should be positive")
assert((fill-style == none) or (type(fill-style) == color) or (type(fill-style) == gradient and (repr(fill-style.kind()) == "linear" or repr(fill-style.kind()) == "radial")), message: "`fill-style` should be none / color / gradient.linear / gradient.radial")
if stroke-style != none {stroke-style = stroke(stroke-style)}
let stroke-width = if (stroke-style == none) {0} else if (stroke-style.thickness == auto) {1} else {calc.abs(stroke-style.thickness.pt())}
let axiom = "F++F++F"
let rule-set = ("F": "F-F++F-F")
let dx = (step-size, step-size/2, -step-size/2, -step-size, -step-size/2, step-size/2)
let dy = (0, step-size/2*calc.sqrt(3), step-size/2*calc.sqrt(3), 0, -step-size/2*calc.sqrt(3), -step-size/2*calc.sqrt(3))
let dx-str = dx.map(i => repr(i))
let dy-str = dy.map(i => repr(i))
let s = axiom
for i in range(n) {s = s.replace("F", rule-set.at("F"))}
let dir = 0
let path-d = "M0 0 "
for c in s {
if c == "-" {
dir -= 1
if dir < 0 {dir = 5}
} else if c == "+" {
dir += 1
if (dir == 6) {dir = 0}
} else if c == "F" {
path-d += "l" + dx-str.at(dir) + " " + dy-str.at(dir) + " "
}
}
path-d += "Z"
let margin = calc.max(5, stroke-width * 1.5)
let x-min = 0
let x-max = calc.pow(3, n) * step-size
let y-min = -calc.pow(3, n - 1) * calc.sqrt(3)/2 * step-size
let y-max = calc.pow(3, n - 1) * calc.sqrt(3)*3/2 * step-size
x-min = calc.floor(x-min - margin)
x-max = calc.ceil(x-max + margin)
y-min = calc.floor(y-min - margin)
y-max = calc.ceil(y-max + margin)
let svg-code = gen-svg(path-d, (x-min, x-max, y-min, y-max), fill-style, stroke-style)
return image.decode(svg-code, width: width, height: height, fit: fit)
}
|
https://github.com/LDemetrios/Typst4k | https://raw.githubusercontent.com/LDemetrios/Typst4k/master/src/test/resources/suite/layout/page.typ | typst | // Test the page class.
--- page-call-empty ---
// Just empty page.
// Should result in auto-sized page, just like nothing.
#page[]
--- page-call-styled-empty ---
// Just empty page with styles.
// Should result in one conifer-colored A11 page.
#page("a11", flipped: true, fill: conifer)[]
--- page-call-followed-by-pagebreak ---
// Just page followed by pagebreak.
// Should result in one forest-colored A11 page and one auto-sized page.
#page("a11", flipped: true, fill: forest)[]
#pagebreak()
--- page-set-forces-break ---
// Set width and height.
// Should result in one high and one wide page.
#set page(width: 80pt, height: 80pt)
#[#set page(width: 40pt);High]
#[#set page(height: 40pt);Wide]
// Flipped predefined paper.
#[#set page(paper: "a11", flipped: true);Flipped A11]
--- page-set-in-container ---
#box[
// Error: 4-18 page configuration is not allowed inside of containers
#set page("a4")
]
--- page-set-empty ---
// Empty with styles
// Should result in one conifer-colored A11 page.
#set page("a11", flipped: true, fill: conifer)
--- page-set-only-pagebreak ---
// Empty with styles and then pagebreak
// Should result in two forest-colored pages.
#set page(fill: forest)
#pagebreak()
--- page-set-override-thrice ---
// Empty with multiple page styles.
// Should result in a small white page.
#set page("a4")
#set page("a5")
#set page(width: 1cm, height: 1cm)
--- page-set-override-and-mix ---
// Empty with multiple page styles.
// Should result in one eastern-colored A11 page.
#set page("a4")
#set page("a5")
#set page("a11", flipped: true, fill: eastern)
#set text(font: "Roboto", white)
#smallcaps[Typst]
--- page-large ---
#set page("a4")
--- page-fill ---
// Test page fill.
#set page(width: 80pt, height: 40pt, fill: eastern)
#text(15pt, font: "Roboto", fill: white, smallcaps[Typst])
#page(width: 40pt, fill: auto, margin: (top: 10pt, rest: auto))[Hi]
--- page-fill-none ---
// Test disabling page fill.
// The PNG is filled with black anyway due to the test runner.
#set page(fill: none)
#rect(fill: green)
--- page-margin-uniform ---
// Set all margins at once.
#[
#set page(height: 20pt, margin: 5pt)
#place(top + left)[TL]
#place(bottom + right)[BR]
]
--- page-margin-individual ---
// Set individual margins.
#set page(height: 40pt)
#[#set page(margin: (left: 0pt)); #align(left)[Left]]
#[#set page(margin: (right: 0pt)); #align(right)[Right]]
#[#set page(margin: (top: 0pt)); #align(top)[Top]]
#[#set page(margin: (bottom: 0pt)); #align(bottom)[Bottom]]
// Ensure that specific margins override general margins.
#[#set page(margin: (rest: 0pt, left: 20pt)); Overridden]
--- page-margin-inside-outside-override ---
#set page(height: 100pt, margin: (inside: 30pt, outside: 20pt))
#set par(justify: true)
#set text(size: 8pt)
#page(margin: (x: 20pt), {
set align(center + horizon)
text(20pt, strong[Title])
v(2em, weak: true)
text(15pt)[Author]
})
= Introduction
#lorem(35)
--- page-margin-inside ---
#set page(margin: (inside: 30pt))
#rect(width: 100%)[Bound]
#pagebreak()
#rect(width: 100%)[Left]
--- page-margin-inside-with-binding ---
// Test setting the binding explicitly.
#set page(binding: right, margin: (inside: 30pt))
#rect(width: 100%)[Bound]
#pagebreak()
#rect(width: 100%)[Right]
--- page-margin-binding-from-text-lang ---
// Test setting the binding implicitly.
#set page(margin: (inside: 30pt))
#set text(lang: "he")
#rect(width: 100%)[Bound]
#pagebreak()
#rect(width: 100%)[Right]
--- page-margin-left-and-outside ---
// Error: 19-44 `inside` and `outside` are mutually exclusive with `left` and `right`
#set page(margin: (left: 1cm, outside: 2cm))
--- page-margin-binding-bad ---
// Error: 20-23 must be `left` or `right`
#set page(binding: top)
--- page-marginals ---
#set page(
paper: "a8",
margin: (x: 15pt, y: 30pt),
header: {
text(eastern)[*Typst*]
h(1fr)
text(0.8em)[_Chapter 1_]
},
footer: context align(center)[\~ #counter(page).display() \~],
background: context if counter(page).get().first() <= 2 {
place(center + horizon, circle(radius: 1cm, fill: luma(90%)))
}
)
#align(center, lines(20))
#set page(header: none, height: auto, margin: (top: 15pt, bottom: 25pt))
Z
--- page-number-align-top-right ---
#set page(
height: 100pt,
margin: 30pt,
numbering: "(1)",
number-align: top + right,
)
#block(width: 100%, height: 100%, fill: aqua.lighten(50%))
--- page-number-align-bottom-left ---
#set page(
height: 100pt,
margin: 30pt,
numbering: "[1]",
number-align: bottom + left,
)
#block(width: 100%, height: 100%, fill: aqua.lighten(50%))
--- page-number-align-left-horizon ---
// Error: 25-39 expected `top` or `bottom`, found horizon
#set page(number-align: left + horizon)
--- page-numbering-pdf-label ---
#set page(margin: (bottom: 20pt, rest: 10pt))
#let filler = lines(7)
// (i) - (ii). No style opt. because of suffix.
#set page(numbering: "(i)")
#filler
#pagebreak()
#filler
// 3 - 4. Style opt. Page Label should use /D style.
#set page(numbering: "1")
#filler
#pagebreak()
#filler
// I - IV. Style opt. Page Label should use /R style and start at 1 again.
#set page(numbering: "I / I")
#counter(page).update(1)
#filler
#pagebreak()
#filler
#pagebreak()
#filler
#pagebreak()
#filler
// Pre: ほ, Pre: ろ, Pre: は, Pre: に. No style opt. Uses prefix field entirely.
// Counter update without numbering change.
#set page(numbering: "Pre: い")
#filler
#pagebreak()
#filler
#counter(page).update(2)
#filler
#pagebreak()
#filler
#pagebreak()
#filler
// aa & ba. Style opt only for values <= 26. Page Label uses lower alphabet style.
// Repeats letter each 26 pages or uses numbering directly as prefix.
#set page(numbering: "a")
#counter(page).update(27)
#filler
#pagebreak()
#counter(page).update(53)
#filler
--- page-suppress-headers-and-footers ---
#set page(header: none, footer: none, numbering: "1")
Look, ma, no page numbers!
#pagebreak()
#set page(header: auto, footer: auto)
Default page numbers now.
--- page-marginal-style-text-set ---
#set page(numbering: "1", margin: (bottom: 20pt))
#set text(red)
Red
--- page-marginal-style-text-set-first ---
#set text(red)
#set page(numbering: "1", margin: (bottom: 20pt))
Red
--- page-marginal-style-text-call ---
#set page(numbering: "1", margin: (bottom: 20pt))
#text(red)[Red]
--- page-marginal-style-text-call-code ---
#{
set page(numbering: "1", margin: (bottom: 20pt))
text(red)[Red]
}
--- page-marginal-style-text-call-around-page-call ---
#text(red, page(numbering: "1", margin: (bottom: 20pt))[Hello])
--- page-marginal-style-text-call-around-set-page ---
#text(red, {
set page(numbering: "1", margin: (bottom: 20pt))
text(style: "italic")[Hello]
})
--- page-marginal-style-text-call-around-pagebreak ---
#set page(numbering: "1", margin: (bottom: 20pt))
A
#text(red)[
#pagebreak(weak: true)
B
]
--- page-marginal-style-show-rule ---
#set page(numbering: "1", margin: (bottom: 20pt))
= Introduction
--- page-marginal-style-show-rule-with-set-page ---
#show heading: it => {
set page(numbering: "1", margin: (bottom: 20pt))
it
}
= Introduction
--- page-marginal-style-show-rule-with-page-call ---
#show heading: page.with(fill: aqua)
A
= Introduction
B
--- page-marginal-style-show-rule-with-pagebreak ---
#set page(numbering: "1", margin: (bottom: 20pt))
#show heading: it => {
pagebreak(weak: true)
it
}
= Introduction
--- page-marginal-style-context ---
#set page(numbering: "1", margin: (bottom: 20pt))
#show: it => context {
set text(red)
it
}
Hi
--- page-marginal-style-shared-initial-interaction ---
#set page(numbering: "1", margin: (bottom: 20pt))
A
#{
set text(fill: red)
pagebreak()
}
#text(fill: blue)[B]
--- page-marginal-style-empty ---
#set text(red)
#set page(numbering: "1", margin: (bottom: 20pt))
--- page-marginal-style-page-call ---
#page(numbering: "1", margin: (bottom: 20pt))[
#set text(red)
A
]
--- issue-2631-page-header-ordering ---
#set text(6pt)
#show heading: set text(6pt, weight: "regular")
#set page(
margin: (x: 10pt, top: 20pt, bottom: 10pt),
height: 50pt,
header: context {
let prev = query(selector(heading).before(here()))
let next = query(selector(heading).after(here()))
let prev = if prev != () { prev.last().body }
let next = if next != () { next.first().body }
(prev: prev, next: next)
}
)
= First
Hi
#pagebreak()
= Second
--- issue-4340-set-document-and-page ---
// Test custom page fields being applied on the last page
// if the document has custom fields.
#set document(author: "")
#set page(fill: gray)
text
#pagebreak()
--- issue-2326-context-set-page ---
#context [
#set page(fill: aqua)
On page #here().page()
]
--- issue-3671-get-from-page-call ---
#set page(margin: 5pt)
#context test(page.margin, 5pt)
#page(margin: 10pt, context test(page.margin, 10pt))
--- issue-4363-set-page-after-tag ---
#set page(fill: aqua)
1
#pagebreak()
#metadata(none)
#set page(fill: red)
2
|
|
https://github.com/fyuniv/typstModernCV | https://raw.githubusercontent.com/fyuniv/typstModernCV/main/example.typ | typst | MIT License | #import "lib.typ": *
#show: resume.with(
title: "Curriculum Vitae",
author: (
firstname: "John",
lastname: "Doe",
email: "<EMAIL>",
address: [Dept. of Math\ home number, street name,\ city, zipcode],
positions: (
"Mathematician",
),
phone: "(000) 123 4567",
github: "abcd",
orcid: "0000-0000-0000-0000",
web: "https://..."
),
date: datetime.today().display(),
theme: (
color: "orange",
font: "Inter"
)
)
// #set text(font: "Comic Neue")
#show link: set text(fill: blue)
= Education
#resume_entry(
date: "August 2019 - May 2024",
title: "Ph.D. in Mathematics",
university: "University of ABC",
location: "City A, USA",
description: "Advisor: Prof. "
)
= Experience
#resume_entry(
title: "Teaching Assistance",
university: "University of ABC",
date: "2019 - Present",
department: "Dept. of Math.",
location: "City A, USA",
description: "Teach math courses..."
)
= Research Interests
#resume_content[
All fields of Mathematics
]
= Papers
#resume_list[
+ #lorem(15)
+ #lorem(20)
]
= Talks
#resume_list[
#reverse[
+ #lorem(15)
+ #lorem(20)
]
]
= Grant Awards
#resume_list[
- #lorem(5)
]
= Teaching
== Certificates
#resume_list[
- #lorem(6)
]
|
https://github.com/not-matthias/typst-jku | https://raw.githubusercontent.com/not-matthias/typst-jku/main/jku.typ | typst | /*
Based of the work of <NAME>, Mai 2023
Continued by <NAME>, October 2024
*/
// Save heading and body font families in variables.
#let font = (
roman: "New Computer Modern",
sans: "New Computer Modern Sans",
mono: "New Computer Modern Mono",
)
#let font-base-size = 11pt
#let font-sizes = (
footnote: font-base-size * 0.818,
body: font-base-size,
large: font-base-size * 1.091,
Large: font-base-size * 1.2727,
)
#let heading-sizes = (
h1: font-base-size * 1.8818,
h2: font-base-size * 1.4181,
h3: font-base-size * 1.2363,
)
#let _abbreviations = state("abbreviations", (:))
#let abbreviate(long, abbr, desc: "", showAbbr: true) = {
_abbreviations.update(d => { d.insert(abbr, (long: long, abbr: abbr, desc: desc)); d })
if showAbbr [#long \(#abbr\)]
else [#long]
}
// custom numbering definitions
#let _definitionCounter = counter(figure.where(kind: "definition"))
#let definition(lbl, title: "", content) = {
[
#figure(kind: "definition", supplement: [Definition], numbering: "1")[]
#label("def-" + lbl)
]
if title.len() == 0 [
/ #[_Definition #_definitionCounter.display():_]: #content
] else [
/ #[_Definition #_definitionCounter.display() (#title):_]: #content
]
}
/**
* Coverpage
*/
#let coverpage(
title: "",
submitters: (),
department: "",
supervisors: (),
date: "",
// 0 ... Dissertation TODO
// 1 ... Diplomarbeit / Masterarbeit f. Lehramt TODO
// 2 ... Masterarbeit
// 3 ... Bachelorarbeit
typeOfWork: 3,
// 0 ... final
// 1 ... for review
state: 0,
version: "",
degree: "",
study: "",
body
) = {
let title-size = 29.86pt
let body-size = 11pt
let large-size = 12pt
let vSpace = 4mm
// Set the document's basic properties.
set document(author: submitters, title: title)
set page(header: "")
// Set body font family.
set text(font: font.sans, lang: "en", size: body-size)
set page("a4", margin: (left: 2.9cm, right: 1.5cm, top: 1cm, bottom: 0cm))
// JKU Logo
align(top + right, image("img/jkuen.png", width: 5cm))
v(1cm)
let mainSupervisor = ""
let coSupervisors = ()
if supervisors.len() <= 1 {
mainSupervisor = supervisors.first()
} else {
(mainSupervisor, ..coSupervisors) = supervisors
}
grid(
columns: (1fr, 3.89cm),
gutter: 12pt,
box(height: 9.38cm)[
#set par(justify: true)
#align(bottom + left,
text(size: title-size, weight: 700, hyphenate: false)[#title]
)
],
text(size: 9pt)[
Submitted by\
#submitters.map(s => strong(s)).join(", ")
#v(vSpace)
Submitted at\
*#department*
#v(vSpace)
Supervisor\
*#mainSupervisor*
#coSupervisors.map(supervisor => [
#v(vSpace)
Co-Supervisor\
*#supervisor*
]).join("\n")
#v(vSpace)
#{
if state == 0 {
date
} else if state == 1 {
text(fill: red)[To-do: #date]
v(vSpace)
text(fill: red, size: 12pt, weight: 600)[
For review
Version: #version
]
}
}
],
)
v(.8cm)
image("img/arr.png", width: 4.4cm)
v(0.5cm)
let large(txt) = {
text(size: large-size)[#txt]
v(-1mm)
}
let small(txt) = {
text(size: body-size)[#txt]
v(-1mm)
}
let type-thesis = if typeOfWork == 3 [Bachelor] else if typeOfWork == 2 [Master]
let type-program = if typeOfWork == 3 [Bachelor's] else if typeOfWork == 2 [Master's]
large[#type-thesis Thesis]
small[to obtain the academic degree of]
large[#degree]
small[in the #type-program Program]
large[#study]
v(1.7cm)
align(right, box(width: 4cm, align(left)[
#set par(leading: .4em)
#text(size: 9pt, weight: 700, "<NAME>ER UNIVERSITY LINZ")
#v(-2mm)
#text(size: 9pt)[
Altenbergerstraße 69\
4040 Linz, Österreich
#v(-2.68mm)
www.jku.at
#v(-2mm)
DVR 0093696
]
]))
set page(
footer: align(center + horizon, text(fill: rgb(100,100,100))[
\[For review\]
#sym.circle.filled.tiny
Version: #version
#sym.circle.filled.tiny
Created at: #datetime.today().display()
]),
footer-descent: 2cm, // make extra page appear empty
) if state == 1
set page(
footer: [],
footer-descent: 0cm,
) if state == 0
if state == 1 {
pagebreak(weak: true)
align(center + horizon,
text(fill: gray)[intentionally blank])
}
body
}
/**
* Preface
*/
#let preface(
statutoryDeclaration: true,
tableOfContents: true,
tableOfFigures: true,
listDefinitions: true,
zusammenfassung: [],
abstract: [],
body-size: 11pt,
heading-sizes: heading-sizes,
page-margin: (left: 2.9cm, right: 2.9cm, top: 3cm, bottom: 3cm),
body
) = {
counter(page).update(0)
set page(
"a4",
margin: page-margin,
numbering: "i",
footer-descent: 0cm,
header: context {
// reset footnote counter
counter(footnote).update(0)
let priorElems = query(
selector(heading.where(level: 1)).before(here())
)
let laterElems = query(
selector(heading.where(level: 1)).after(here())
)
let num = here().page-numbering()
if num == none {
num = "1"
}
let page = numbering(num, counter(page).at(here()).first())
if laterElems != () and laterElems.first().location().page() == here().page() {
let elm = laterElems.first()
let c = counter(heading.where(level: 1)).at(elm.location()).first()
if c != 0 {
num = elm.numbering
if num == none {
num = "1."
}
let n = numbering(num, c)
emph(n) + " " + emph(elm.body) + h(1fr) + page
} else {
emph(elm.body) + h(1fr) + page
}
line(length: 100%, stroke: .5pt)
} else if priorElems != () {
let elm = priorElems.last()
let c = counter(heading.where(level: 1)).at(elm.location()).first()
if c != 0 {
num = elm.numbering
if num == none {
num = "1."
}
let n = numbering(num, c)
emph(n + " " + elm.body) + h(1fr) + page
} else {
emph(elm.body) + h(1fr) + page
}
line(length: 100%, stroke: .5pt)
} else {
align(right, page)
line(length: 100%, stroke: .5pt)
}
}
)
set text(font: font.roman)
set par(justify: true)
set footnote(numbering: "*")
show heading: set text(font: font.sans)
show heading.where(level: 1): set text(size: heading-sizes.h1)
show heading.where(level: 2): set text(size: heading-sizes.h2)
show heading.where(level: 3): set text(size: heading-sizes.h3)
show heading.where(level: 1): it => {
v(.9cm)
it
v(.6cm)
}
if statutoryDeclaration {
heading(outlined: false)[Statutory declaration]
text(size: body-size)[
I hereby declare that the thesis submitted is my own unaided work, that I have
not used other than the sources indicated, and that all direct and indirect sources
are acknowledged as references. This printed thesis is identical with the electronic
version submitted.
]
v(2cm)
grid(
columns: (1fr, 1fr),
gutter: 6cm,
box[
#line(length: 100%)
#v(-2mm)
#text(size: 9pt)[Place, Date]
],
box[
#line(length: 100%)
#v(-2mm)
#text(size: 9pt)[Signature]
]
)
}
if zusammenfassung != [] {
pagebreak()
heading(outlined: false)[Zusammenfassung]
zusammenfassung
}
if abstract != [] {
pagebreak()
heading(outlined: false)[Abstract]
abstract
}
pagebreak()
if tableOfContents {
outline(target: heading, depth: 2, indent: 2em)
}
if tableOfFigures {
outline(
target: figure.where(kind: image).or(figure.where(kind: "table")),
title: "Figures and Tables")
}
if listDefinitions {
// pagebreak(weak: true)
heading(outlined: false)[Abbreviations]
context _abbreviations.final()
.values()
.map(def => [/ #def.long (#def.abbr): #def.desc])
.fold([], (sum, it) => sum + it)
}
body
}
/**
* Main content
*/
#let mainContent(
body-size: 11pt,
heading-sizes: heading-sizes,
page-margin: (left: 3.2cm, right: 3.2cm, top: 3.8cm, bottom: 2.5cm),
body
) = {
counter(page).update(0)
// Page setup
set page(
"a4",
margin: page-margin,
numbering: "1"
)
set text(font: font.roman)
set par(leading: 0.55em, first-line-indent: 1.3em)
show terms: set par(first-line-indent: 0em)
show raw: set text(font: font.mono)
set math.equation(numbering: "(1)")
// Headings
set heading(numbering: "1.")
show heading: set text(font: font.sans)
show heading.where(level: 1): set text(size: heading-sizes.h1)
show heading.where(level: 2): set text(size: heading-sizes.h2)
show heading.where(level: 3): set text(size: heading-sizes.h3)
show heading.where(level: 2): it => {
v(.1cm)
it
v(.1cm)
}
body
} |
|
https://github.com/kdog3682/2024-typst | https://raw.githubusercontent.com/kdog3682/2024-typst/main/src/math-stylers.typ | typst |
#import "base-utils.typ": *
#let styled-exponent(mc, fill: blue) = {
let runner(body) = {
let t = body.t
let top = text(fill: fill, t)
return math.attach(body.base, t: top)
}
let fields = mc.fields()
if "body" in fields {
if "base" in fields.body.fields() {
return runner(mc.body)
} else {
return mc
}
} else {
if "base" not in fields {
return mc
} else {
return runner(mc)
}
}
}
#let style-all-exponents(mc, ..sink) = {
let transform = styled-exponent.with(..sink.named())
if has-children(mc) {
let children = mc.body.children
return children.map(transform).join()
}
return transform(mc, style: style)
}
#let styled-fraction(mc, top: none, bottom: none) = {
let runner(body) = {
let num = xblue(body.num)
let denom = xred(body.denom)
return math.display(math.frac(num, denom))
}
let fields = mc.fields()
// panic(fields)
// fields
if "body" in fields {
if "num" in fields.body.fields() {
return runner(mc.body)
} else {
return mc
}
} else {
if "num" in fields {
return runner(mc)
} else {
return mc
}
}
}
#let style-all-fractions(mc, ..sink) = {
let transform = styled-fraction.with(..sink.named())
if has-children(mc) {
let children = mc.body.children
return children.map(transform).join()
}
return transform(mc)
}
#let works() = {
let a = $2^3 + 2^(3/4)$
style-all-exponents(a)
}
#let works() = {
let a = $5/6 + 5/6$
style-all-fractions(a)
}
|
|
https://github.com/typst/packages | https://raw.githubusercontent.com/typst/packages/main/packages/preview/grotesk-cv/0.1.0/content/languages.typ | typst | Apache License 2.0 | #import "../lib.typ": *
#import "@preview/fontawesome:0.2.1": *
== #fa-icon("language") #h(5pt) #get-header-by-language("Languages", "Idiomas")
#v(5pt)
#if is-english() {
language-entry(language: "English", proficiency: "Native")
language-entry(language: "Spanish", proficiency: "Fluent")
language-entry(language: "Machine Code", proficiency: "Fluent")
} else if is-spanish() {
language-entry(language: "Inglés", proficiency: "Nativo")
language-entry(language: "Español", proficiency: "Fluido")
language-entry(language: "Código de Máquina", proficiency: "Fluido")
}
|
https://github.com/hitszosa/universal-hit-thesis | https://raw.githubusercontent.com/hitszosa/universal-hit-thesis/main/harbin/bachelor/pages/declaration-of-originality.typ | typst | MIT License | #import "../config/constants.typ": special-chapter-titles
#import "../../../common/theme/type.typ": 字体, 字号
#import "../utils/states.typ": thesis-info-state
#let declaration-of-originality() = {
set par(leading: 1.25em)
v(0.25em)
align(center)[
#text(font: 字体.黑体, size: 字号.小二)[
哈尔滨工业大学本科毕业论文(设计)
]
]
v(-1.75em)
heading(special-chapter-titles.原创性声明, level: 1, numbering: none)
align(center)[
#text(font: 字体.黑体, size: 字号.小三)[
#v(0.5em)
本科毕业论文(设计)原创性声明
#v(0.5em)
]
]
context {
let thesis-info = thesis-info-state.get()
let title = thesis-info.at("title-cn")
if type(title) == str {
title = title.split("\n").sum()
}
text()[
本人郑重声明:此处所提交的本科毕业论文(设计)《#title》,是本人在导师指导下,在哈尔滨工业大学攻读学士学位期间独立进行研究工作所取得的成果,且毕业论文(设计)中除已标注引用文献的部分外不包含他人完成或已发表的研究成果。对本毕业论文(设计)的研究工作做出重要贡献的个人和集体,均已在文中以明确方式注明。
#v(1em)
]
}
grid(
columns: (1fr, 1fr),
rows: (auto),
pad(left: 8em)[
#text[作者签名:]
],
align(right)[
#text[日期:#h(4em) 年 #h(2em) 月 #h(2em) 日]
],
)
v(2em)
align(center)[
#text(font: 字体.黑体, size: 字号.小三)[
#v(0.5em)
本科毕业论文(设计)使用权限
#v(0.5em)
]
]
text()[
本科毕业论文(设计)是本科生在哈尔滨工业大学攻读学士学位期间完成的成果,知识产权归属哈尔滨工业大学。本科毕业论文(设计)的使用权限如下:
(1)学校可以采用影印、缩印或其他复制手段保存本科生上交的毕业论文(设计),并向有关部门报送本科毕业论文(设计);(2)根据需要,学校可以将本科毕业论文(设计)部分或全部内容编入有关数据库进行检索和提供相应阅览服务;(3)本科生毕业后发表与此毕业论文(设计)研究成果相关的学术论文和其他成果时,应征得导师同意,且第一署名单位为哈尔滨工业大学。
保密论文在保密期内遵守有关保密规定,解密后适用于此使用权限规定。
本人知悉本科毕业论文(设计)的使用权限,并将遵守有关规定。
]
v(2em)
grid(
columns: (1fr, 1fr),
rows: (auto),
pad(left: 8em)[
#text[作者签名:]
],
align(right)[
#text[日期:#h(4em) 年 #h(2em) 月 #h(2em) 日]
],
)
v(1em)
grid(
columns: (1fr, 1fr),
rows: (auto),
pad(left: 8em)[
#text[导师签名:]
],
align(right)[
#text[日期:#h(4em) 年 #h(2em) 月 #h(2em) 日]
],
)
} |
https://github.com/typst/packages | https://raw.githubusercontent.com/typst/packages/main/packages/preview/wrap-indent/0.1.0/README.md | markdown | Apache License 2.0 |
# wrap-indent
`wrap-indent` is a package for wrapping content in custom functions
with just indentation. This lets you avoid using trailing square brackets
to wrap content, instead you just indent it!
This system works by re-purposing Typst's existing
[term-list](https://typst.app/docs/reference/model/terms/) syntax via a
custom show rule on `terms.item`. We give it our custom function
within [state](https://typst.app/docs/reference/introspection/state/)
via a new `wrap-in()` function.
## Here's a minimal example!
<img src="example_page1.png" alt="A minimal example" style="max-width: 500px;">
```typ
#set page(height: auto, width: 3.5in, margin: 0.25in)
#import "@preview/wrap-indent:0.1.0": wrap-in, allow-wrapping
#show terms.item: allow-wrapping
/ First --:
A normal term list
with multiple paragraphs
But this text is separated
#line(length: 100%)
#let custom-block(content) = rect(content,
fill: orange.lighten(90%),
stroke: 1.5pt + gradient.linear(..color.map.flare)
)
/ #wrap-in(custom-block):
A *custom block* using the `wrap-in` function
with indented text \
over multiple lines
And this text is _still_ separated!
```
And in its own code block, here's the required initialization:
```typ
#import "@preview/wrap-indent:0.1.0": wrap-in, allow-wrapping
#show terms.item: allow-wrapping
```
## And here's a more complicated example!
<img src="example_page2.png" alt="A more complicated example" style="max-width: 500px;">
```typ
#set page(height: auto, width: 4.1in, margin: 0.25in)
#show heading: set text(size: 0.75em)
#show heading: set block(below: 1em)
#set heading(numbering: "1) ")
= Normal function call:
// A function for wrapping some text:
#let custom-quote(body) = rect(
body,
width: 100%,
fill: luma(95%),
stroke: (left: 2pt + luma(30%))
)
#custom-quote[
Some text in a _custom quote_ spread over multiple lines
so it actually looks like it was typed in a document.
]
This text is outside the quote box
= Wrappped function call!
/ #wrap-in(custom-quote):
Some text in a _custom quote_ spread over multiple lines
so it actually looks like it was typed in a document.
This text is _still_ outside the quote box!
= Arbitrary functions should _just work#emoji.tm;_
/ #wrap-in(x => ellipse(align(center, x),
stroke: 3pt + gradient.conic(..color.map.rainbow)
)):
Some text in a _rainbow ellipse_ spread
over multiple lines so it actually looks
like it was typed in a document.
= One-liners look great!
/ #wrap-in(underline): Here's one line underlined
= Let's do some math:
#let named-thm(name) = (content) => {
pad(left: 2em, par(hanging-indent: -2em)[
*Theorem* (#name) #emph(content)
])
}
/ #wrap-in(named-thm("Operational Soundness")):
If $med tack e : tau$ and $e$ reduces to $e'$
by zero or more steps and $"Irred"(e')$,
then $e' in "Val"$ and $med tack e' : tau$.
= In-line styling doesn't create blocks:
/ #wrap-in(highlight):
This text is highlighted.
This text isn't.
Notice how there was *no* paragraph break between the
two sentences? This is a useful result that makes
`wrap-indent` really flexible!
(if you want separate blocks, use `block` in your function)
= Does it work with nesting?
/ #wrap-in(custom-quote):
Testing...
/ #wrap-in(align.with(center)):
/ #wrap-in(rect):
/ #wrap-in(emph):
Signs point to yes!
= Final thoughts
/ Note --:
Regular term lists still work!
/ Disclaimer --:
You may run into issues with other term list
show rules conflicting with this rule. \
(although set rules should be unaffected)
If you run into issues, _let me know!_ I'd love to hear
about it to make this package as robust as possible.
= And
#let big-statement(content) = {
align(center, text(
underline(stroke: 1.5pt, content),
size: 32pt,
weight: "bold",
style: "italic",
fill: eastern,
))
}
/ #wrap-in(big-statement):
That's a wrap!
```
## References
You can find my original writeup here for more context: \
<https://typst.app/project/r5ogFas7lj7E48iHw_M4yh>
And also see the GitHub issue that prompted me to make this: \
<https://github.com/typst/typst/issues/1921>
|
https://github.com/flavio20002/typst-kaobook-template | https://raw.githubusercontent.com/flavio20002/typst-kaobook-template/main/typst-kaobook.typ | typst | Apache License 2.0 | #let project(title: "", subtitle: "", date: "", author: (), logo: none, cover: none, imageIndex:none, body, mainColor: blue,copyright: [], lang: "en", listOfFigureTitle: none, listOfTableTitle: none, supplementChapter: "Chapter", supplementPart: "PART", fontSize: 10pt, part_style: 0) = {
set document(author: author, title: title)
set text(size: fontSize, lang: lang)
body
}
|
https://github.com/An-314/Note-of-Quantum_Mechanics | https://raw.githubusercontent.com/An-314/Note-of-Quantum_Mechanics/main/chap1.typ | typst | #import "@preview/physica:0.9.2": *
= 量子力学的基本观念和历史简介
== 量子力学的基本观念(波动力学)
基本描述:波函数
系统的行为由薛定谔方程描述,薛定谔方程的解称为波函数
系统的完整信息用它的波函数表述,通过波函数可以计算任意可观察量的可能值
在空间给定体积内找到一个粒子的概率正比于波函数的模方
对于同样制备的相同系统进行同样的量不一定给出同一结果,相反,结果分布在波函数描述的范围内
=== 波的干涉
波相长干涉还是相消干涉取决于它们的相位,振幅同相时相长干涉,反相时相消干涉。当波沿着几条路径从波源到达接收器,比如光的双缝干涉,一般会产生干涉图样。
$
&A_1 cos(k x - omega t + phi_1) + A_2 cos(k x - omega t + phi_2) \
=& A_1 cos(phi_1) cos(k x - omega t) - A_1 sin(phi_1) sin(k x - omega t) + A_2 cos(phi_2) cos(k x - omega t) - A_2 sin(phi_2) sin(k x - omega t) \
=& (A_1 cos(phi_1) + A_2 cos(phi_2)) cos(k x - omega t) - (A_1 sin(phi_1) + A_2 sin(phi_2)) sin(k x - omega t)\
=& A cos(k x - omega t + phi)
$
其中$A$是干涉后的振幅,满足
$
A = sqrt(A_1^2 + A_2^2 + 2 A_1 A_2 cos(phi_1 - phi_2))
$
这就证明了,两个波长与角频率相同的波,可以发生干涉,干涉的结果取决于两个波的相位差。
=== 电子的双缝干涉实验
*子弹的双缝干涉实验*:子弹穿过双缝,不会产生干涉现象,因为子弹是粒子,不是波
*声波的双缝干涉实验*:声波穿过双缝,会产生干涉现象,因为声波是波
*电子的双缝干涉实验*:与声波的双缝干涉实验类似,电子穿过双缝,会产生干涉现象
实验现象与经典波的干涉现象类似,但是两者间存在本质的不同,经典波有强度概念,电子的干涉条纹代表探测器接收到电子的概率的大小。
- 电子单独射入:结果不变
- 利用光探测:变成子弹的结果
电子的波动性是它本身的性质与其它电子无关。由于这种性质使得单个电子具有“分身之术
=== avisson-Germer 电子衍射实验
利用 Laue X 射线衍射的方法,将具有一定能量(波长)的电子注射到晶体表面,观察散射电子束的强度与散射角之间的关系。
衍射的极大值出现在:
$
n lambda = d sin theta
$
#figure(
image("pic/2024-02-28-14-31-40.png", width: 40%),
caption: [
电子干涉实验
],
)
== 微观量子性质的宏观统计表现
- 晶体的热容在低温时减少,偏离经典统计预期
- 黑体辐射能量密度与辐射频率之间的关系
=== 晶体热容
每一个晶格格点就是一个 3 维谐振子,每个自由度的振子能量只能取一个最小值($epsilon$)整数倍$n epsilon$
振子能量处于 $n epsilon$ 的几率(波尔兹曼分布): $P(n) = e^((-n epsilon) / (k T)) / Z$
其中$Z$是配分函数:
$
Z = sum_(n=0)^(oo) e^(-n epsilon / k T) = 1 / (1 - e^(-epsilon / (k T)))
$
振子的平均能量为:
$
<E> &= sum_(n=0)^(oo) n epsilon e^((-n epsilon) / (k T)) / Z \=^(beta = 1/(k T)) 1/Z sum_(n=0)^(oo) n epsilon e^(-n epsilon beta)\= 1/Z sum_(n=0)^(oo) (- diff / (diff beta)) e^(-n epsilon beta) \= -1/Z diff / (diff beta) sum_(n=0)^(oo) e^(-n epsilon beta) \
&= -1/Z diff / (diff beta) Z = - diff / (diff beta) ln Z = diff / (diff beta) ln 1/Z = diff / (diff beta) ln (1 - e^(-epsilon / (k T))) = epsilon / (e^(epsilon / (k T)) - 1) -> k T
$
高温与经典结果一致,符合能量均分定理。
*能量均分定理*:热平衡下每个运动自由度的独立平方项的平均能量为 $1/2 k T$
_证明_:如果振子能量是连续(经典力学)的,那么
$
Z = integral_0^(oo) e^(-epsilon / (k T)) d epsilon = k T
$
从而
$
<E> = 1/(k T) integral_0^(oo) epsilon e^(-epsilon / (k T)) d epsilon = k T
$
1 mol晶格总能量为:
$
U = 3 N_A <E> = 3 N_A epsilon/(e^(epsilon / (k T)) - 1)
$
这是Einstein模型的结果。可以计算到晶体摩尔热容:
$
C = (diff U) / (diff T) = 3 N_A epsilon^2 e^(epsilon / (k T)) / (k T^2 (e^(epsilon / (k T)) - 1)^2)
$
在$T -> oo$时,$C -> 3 N_A k$,符合经典结果。但是在低温时,$C -> 0$,与实验不符。
=== 热辐射
*热辐射*:所有物体都有热辐射,这种热辐射是一定波长范围内的电磁波。而物体也能反射和吸收外来的辐射。温度升高时,辐射的颜色(频率)会随之发生变化。
*辐射本领$r(nu, T)$*:在温度 $T$ 下,物体单位表面上、单位时间内、频率在$nu -> nu+"d "nu$范围内向外辐射的能量。
*吸收本领$a(nu, T)$*:在温度 $T$ 下,入射频率在$nu -> nu+"d "nu$范围内被物体吸收的辐射能和总入射能量的比值。
*基尔霍夫定律 (Kirchhoff) *:在热力学平衡的条件下,物体的辐射本领和吸收本领之比$F(nu, T) = r(nu, T)/a(nu, T)$是一个只与频率和温度有关的函数,与物体的材料和形状无关。_一个物体的辐射本领越强,它的吸收本领也越强,反之亦然。_
*黑体*:$a = 1$,吸收所有入射的辐射。黑体的辐射本领称为*黑体辐射*。
*黑体辐射的能量分布*:黑体辐射(或称“空腔辐射”)的特征可以用“空腔辐射”的空间能量密度(即单位体积中的辐射场能量)按频率(或波长)的分布来描写:
$
rho(nu) "d "nu = "空腔辐射的单位体积中频率在"nu -> nu+"d "nu"范围内的能量密度"
$
根据经典统计和电磁学,热平衡时空腔内电磁场以驻波形式存在,单位体积在$nu -> nu+"d "nu$范围内的驻波模式个数(简并度)为:
$
n(nu) "d "nu = (8 pi nu^2) / c^3 "d "nu
$
再根据经典力学中每个振子平均能量为$k T$,得到
$
rho(nu) "d "nu = (8 pi k T) / c^3 nu^2 "d "nu
$
这就是*Rayleigh-Jeans(瑞利-金斯)公式*。
_证明:_下面计算驻波模式
_三维驻波形式:$cos(k_x x + phi_x)cos(k_y y + pi_y)cos(k_z z + phi_z)cos(omega t)$,其中$k_x = n_x pi / L_x$,$k_y = n_y pi / L_y$,$k_z = n_z pi / L_z$,$n_x, n_y, n_z$为正整数。_
_驻波模式个数:考虑边长为$L$的立方体内的电磁驻波,处于某一波矢$k$的电磁波在波矢空间中表示为一个状态点,相邻点的距离为$pi/L$_
$
k_i = n_i pi / L
$
这样可以得到波矢空间中离散分布的合法状态点,每个状态点对应一个驻波模式。现在求$nu -> nu + "d "nu$范围内的驻波模式个数。
而
$
k = 2 pi nu / c
$
我们认为这些状态点被立方体包裹,这些立方体中心的距离是$pi/L$,所以在$nu -> nu + "d "nu$范围内的驻波模式个数为($k_i>0$):
$
N(nu) "d "nu = 1/8 (4 pi k^2) / (pi/L)^3 "d "k = L^3 (4 pi nu^2 "d "nu)/c^3
$
从而单位体积内的驻波模式个数为:
$
n(nu) "d "nu = (4 pi nu^2) / c^3 "d "nu
$
再乘上*$B,H$*矢量两个偏振的自由度,才是真正的驻波模式个数:
$
n(nu) "d "nu = (8 pi nu^2) / c^3 "d "nu
$
#figure(
image("pic/2024-03-01-14-22-00.png", width: 40%),
caption: [
Rayleigh-Jeans公式在频率很高时趋于无穷大,这显然与现实不符,这在历史上被称为“紫外灾难”。
],
)
*Wien公式*(1894,依据高温试验数据的经验规律):不同温度下黑体辐射的能量密度与频率的关系
$
rho(nu) "d "nu = c_1 nu^3 e^((-c_2 nu )/ T) "d "nu
$
其中$c_1$和$c_2$是常数。
*Wien位移定律*:单位体积辐射能量密度$rho(nu)$的最大值所对应的波长$lambda_m$与温度有如下关系:
$
lambda_m T = b
$
其中$b = 2.898 times 10^(-3) "m·K"$。
#figure(
image("pic/2024-03-01-14-26-21.png", width: 80%),
caption: [
短波部分与实验相符,长波部分则与实验显著不一致
],
)
*Planck假说*(1900):假定*物质与辐射间的能量交换不是连续的,而是以一系列分立的*,不可再分的能量单元(即能*量子*)来进行。
谐振子的能量只能是$h nu$的整数倍($h$为Planck常数),谐振子能级分立情况下,平均能量为(参见晶体热容):
$
<E> = h nu / (e^((h nu )/ (k T)) - 1)
$
用这个振子平均能量代替Rayleigh-Jeans公式中的$k T$得
$
rho(nu) "d "nu = (8 pi nu^2) / c^3 (h nu) / (e^((h nu )/ (k_B T)) - 1) "d "nu
$
这就是*Planck辐射公式*。其中$c$是光速,$h$是Planck常数,$k_B$是玻尔兹曼常数。
$
h = 6.626 * 10^(-34) "J s"\
h c approx 5/4 e"V "mu"m"
$
Planck公式与实验完全符合,在高频和低频极限下分别过渡到Wien公式和Rayleigh-Jeans公式。
#figure(
image("pic/2024-03-01-14-34-13.png", width: 70%),
caption: [
Planck辐射公式与实验结果符合得很好
],
)
*光电效应和Einstein的光量子(1905)*:光照射到金属上时,有电子从金属中逸出——光电子。
提出光量子(light quantum)的概念,辐射场是由光量子组成,每个光量子能量与辐射频率的关系为:
$
E = h nu
$
光量子的能量是分立的,与频率有关,与辐射场的强度无关。
当光照射到金属表面时,光量子的能量立刻被金属中的自由电子所吸收,但只有当光的频率足够大时,电子才能克服脱出功而逸出金属表面,逸出的光电子的能量为:
$
E_e = h nu - W_0
$
其中$W_0$是金属的逸出功。
这证明电磁场的能量子$h nu$可以和单个的电子相互作用,从而它本身也可以看成是一种粒子,称为光子。
光子的静止质量是零,它的能量-动量关系是:
$
E = p c
$
而光子的能量是
$
E = h nu
$
由相对论关系:
$
E^2 = (p c)^2 + (m c^2)^2
$
得到光子的动量为:
$
p = (h nu) / c = h / lambda
$
其中$lambda = c / nu$是光子的波长。这被称为*Planck - Einstein关系*,连接了粒子性和波动性。
*Compton效应*:Compton实验 (1923) 是观察光在自由电子上的散射,或者说是光子和自由电子的碰撞。
实验现象:在散射角不为零的时候,散射后的光子*波长变长(也就是能量变小)*,同时出现反冲电子。
_依据经典理论,在频率为$ω$的电磁场下,原来静止的电子将做同一频率的受迫振荡,这种受迫振荡会产生同一频率的交变电磁场。因此散射的辐射频率和入射的辐射频率相同,不会产生波长的改变。实质上,经典理论所预言的电磁场和电子的能量和动量的交换过程是连续的。_
#figure(
image("pic/2024-03-01-14-52-28.png", width: 40%),
caption: [
Compton效应
],
)
根据动量守恒,$"入射光子的动量"="散射光子的动量"+"反冲电子的动量"$,矢量合成三角形的余弦定理给出:
$
p_e^2 = (h/c)^2(nu^2 + nu'^2 - 2 nu nu' cos theta)
$
其中$nu$是入射光子的频率,$nu'$是散射光子的频率,$theta$是散射角,$p_e$是反冲电子的动量。由能量守恒:
$
h nu + m_e c^2 = h nu' + sqrt(m_e^2 c^4 + p_e^2 c^2)
$
其中$m_e$是电子的静止质量。这两个方程可以得到:
$
lambda' - lambda = h / m_e c (1 - cos theta)
$
与实验结果符合。
Compton实验的意义:
- 证明了在光子和电子(或其它粒子)相互作用的单个事件中(不仅仅是平均值),能量守恒和动量守恒是被严格遵守的。
- 实验证明了光是一种既具有波动性又具有粒子性的物质,这称为光的波粒二象性。
- 证明了Planck-Einstein关系在定量上是正确的。
这就证明了在Compton散射中,光子和电子的碰撞是一种粒子性的过程,而不是波动性的过程。
*瑞利散射*:光子与气体分子的弹性散射——入射和出射光子能量一样。
但高频光子散射截面更大$(σ~λ^(-4))$——天空是蓝色的。
*光与物质的相互作用*#footnote[低能时波动性为主,高能时粒子性为主]:
#align(center)[
#table(
columns: (auto, auto, auto),
inset: 10pt,
align: horizon,
[低能 (< 1 keV) ],[中能 (0 keV - 1 MeV)],[高能 (> 1 MeV)],
[瑞利散射、光电效应],[康普顿散射],[产生正负电子对]
)
]
== 微观量子特性的体现
- 电子绕原子核转动却不辐射电磁波能量(直至最后落入原子核中)
- 原子核磁矩在均匀磁场中进行拉莫进动却不辐射电磁波能量(直至最后磁矩与磁场同向)
- 低能粒子在半径为$a$的$3$维无限高球势垒上散射的横截面积为$4π a^2$(经典为$π a^2$)
这些现象都不能用经典力学解释。
*氢原子光谱*:
氢原子的光谱由许多分立的谱线组成,特征谱线的频率为(Rydberg, 1890):
$
nu = R_H c (1/n_1^2 - 1/n_2^2), n_1<n_2 = 1, 2, 3, ...
$
其中$R_H = 1.097 * 10^7 m^(-1)$是Rydberg常数。
它满足“并合规则”:若$nu_1$和$nu_2$在特征光谱中,则有时$nu_1 + nu_2$ 和 $|nu_1 -nu_2|$也在特征光谱中。
“光谱项”:$nu_n = R_H c 1/n^2$可以认为每个光谱项对应着氢原子的一种能量状态。
氢原子的能量就是不连续地变化的,其可能的值为:
$
E_n = -R_H h c / n^2
$
这称为氢原子的能谱
*Franck-Hertz实验* (1914):直接证明了原子能量的不连续性
汞原子能够精确地从与之碰撞的电子中吸取能量,证实汞原子中存在分立能级(能量的量子化)
*Bohr模型* (1913):
Bohr模型的基本假设:
1. 电子在原子中只能沿某些特殊的轨道运动,当电子在这些轨道上时,既不发出也不吸收光辐射(定态假设)
2. 当电子由一个定态“跳”(跃迁)到另一个定态时会发出或吸收光辐射,其频率为(跃迁假设) :
$
nu = (|E_2 - E_1|) / h
$
3. 电子在原子中的允许轨道满足下面的条件:它的轨道角动量是
$
L = h / (2 pi) =: hbar
$
的整数倍(量子化条件)
经典力学加Bohr假设可以导致氢原子能级为:
$
E_n = -(mu k_1^2 e^4) / (2 h^2 n^2) ,n = 1, 2, 3, ...
$
其中$mu$是电子质量,$k_1= 1/(4 pi epsilon_0)$是库伦常数。
*Sommerfeld的量子化条件* (1915):
为处理多自由度体系的周期运动的分立能级问题,Sommerfeld提出了推广的量子化条件
对于周期运动的自由度 $(q, p)$,
$
integral.cont p dot" d"q = n h
$
其中$q$是广义坐标,$p$是与之共轭的广义动量,积分对一个周期进行。
_例:$x$方向的振动$x=A cos omega t$,$p_x = m v_x$,$q_x = x$,则_
$
integral.cont p_x dot" d"q_x &= integral.cont m v_x dot" d"x \
&= m integral.cont ((diff x) /( diff t)) dot" d"x \
&= 1/2 m omega^2 A^2 T\
&= 1/2 k A^2 T\
&= E T\
&= n_r h
$
可以得到
$
E = n h / T = n h nu
$
和氢原子的严格结果
$
E = (n + 1/2) h nu
$
很接近。
*de Broglie的物质波假说*
Planck-Einstain“光量子假说”:
$
cases(
E &= h nu,
p &= h / lambda
)
" "
cases(
E &= hbar omega,
p &= hbar k
)
$
建立了波动性-粒子性之间的关系,de Broglie假设:
$
cases(
E &= h nu = p^2 / (2 m),
p &= h / lambda
)
" "
cases(
E &= hbar omega = p^2 / (2 m),
arrow(p) &= hbar arrow(k)
)
$
由粒子性决定波动性。
*波函数*:
$
psi(arrow(r), t) = A e^(i (arrow(k) dot arrow(r) - omega t))
$
代入de Broglie关系成为
$
psi(arrow(r), t) = A e^(i/hbar (arrow(p) dot arrow(r) - E t))
$
波函数虚部#footnote[后面在多粒子量子纠缠实验中也证实了,波函数的虚部不可或缺。]的意义体现在计算概率密度时,我们不是取波函数的实部的平方,而是求实部、虚部的平方之和(模方)。 |
|
https://github.com/quarto-ext/typst-templates | https://raw.githubusercontent.com/quarto-ext/typst-templates/main/ieee/README.md | markdown | Creative Commons Zero v1.0 Universal | # Typst IEEE Format
Based on the IEE template published by the Typst team at <https://github.com/typst/templates/tree/main/ieee>.
**NOTE**: This format requires the pre-release version of Quarto v1.4, which you can download here: <https://quarto.org/docs/download/prerelease>.
## Installing
```bash
quarto use template quarto-ext/typst-templates/ieee
```
This will install the extension and create an example qmd file that you can use as a starting place for your document.
## Using
The example qmd demonstrates the document options supported by the IEE format (`title`, `authorsgit p`, `abstract`, `index-terms`, etc.). For example, your document options might look something like this:
```yaml
---
title: "A typesetting system to untangle the scientific writing process"
authors:
- name: <NAME>
email: "<EMAIL>"
affiliations:
- name: Typst GmbH
department: Co-Founder
city: Berlin
country: Germany
- name: <NAME>
email: "<EMAIL>"
affiliations:
- name: Typst GmbH
department: Co-Founder
city: Berlin
country: Germany
abstract: |
(Abstract Contents)
format:
ieee-typst: default
bibliography: refs.bib
---
```
This document would be rendered as:

|
https://github.com/devraza/warehouse | https://raw.githubusercontent.com/devraza/warehouse/main/blog/selfhost-tailscale.typ | typst | MIT License | #import "template.typ": conf
#show: doc => conf(
title: [ Host your own private search engine with SearXNG ],
doc,
)
= Tailscale
#link("https://tailscale.com/")[Tailscale] is a modern tunnel VPN
service based on #link("https://www.wireguard.com/")[WireGuard®] which
provides a 'free' and secure means of communication between devices
within a #link("https://tailscale.com/kb/1136/tailnet")[tailnet] - a
private network which Tailscale provides its users.
Essentially, it provides a private and secure way of accessing any of
your devices, no matter where you are in the world - a personal WAN
encompassing the entire world.
And on top of this, Tailscale is completely free and open-source! At
least, on the surface…
== Not FOSS? What do you mean?
There’s a quite popular saying within the free and open-source software
community, which goes along the lines of:
#quote(block: true)[
If you aren’t paying for the product, then you are the product.
]
Which makes perfect sense. It’s the #emph[modern] era so anything
significant is powered by some form of #emph[modern] technology, data is
the new oil, and so on. In exchange for offering you 'free' services,
companies collect and use your data; while there supposedly are laws in
place preventing the inconcensual collection of data in most countries
around the world, #emph[your] personal data may #emph[still] be traded
unethically and inconsensually.
I personally am of the opinion that these laws are worth absolutely
nothing if people aren’t educated in how their data is being used, and
what specifically is being collected. But I digress, and that’s a blog
post for another time.
I also think it’s quite unfortunate that users of paid services
#emph[still] have their personal data collected in the unethical manner
outlined above, despite the fact that they are #emph[paying] for the
service…
In the context of Tailscale: while their clients are all open-source,
their control server - the thing that’s managing and rerouting
#emph[everything] going through what they advertise as #emph[your]
'secure' VPN, isn’t. You’ve got no idea what this thing is doing with
the traffic it recieves.
= Headscale
For every problem, there’s probably a solution somewhere. And luckily
for this one \(which may or may not actually be a problem for you),
we’ve got #link("https://headscale.net/")[Headscale] as our solution.
Headscale’s a self-hostable, open-source alternative to the Tailscale
control server, and aims to 'provide self-hosters and hobbyists with an
open-source server they can use for their projects and labs'.
== Installing on NixOS
Moving on to installing and setting up Headscale on NixOS.
```nix
# ...
{
# ...
services.headscale = {
enable = true;
address = "0.0.0.0";
port = 7070;
settings = {
logtail.enabled = false;
server_url = "https://headscale.devraza.duckdns.org";
dns_config.base_domain = "devraza.duckdns.org";
};
};
# ...
}
```
This starts up the `headscale` systemd service on our host machine at
port `7070`. After that, we make Headscale available over the clearnet
with an NGINX reverse proxy, per the usual:
```nix
{
services.nginx = {
enable = true;
virtualHosts = {
"headscale" = {
addSSL = true;
serverName = "headscale.devraza.duckdns.org";
sslCertificate = ./services/nginx/certs/subdomains/fullchain.pem;
sslCertificateKey = ./services/nginx/certs/subdomains/privkey.pem;
# Headscale proxy
locations."/" = {
proxyPass = "http://127.0.0.1:${toString config.services.headscale.port}";
proxyWebsockets = true;
};
};
};
};
}
```
And that’s it. A self-hosted, #emph[truly] open-source Wireguard®-based
VPN is now at your fingertips. Enjoy! Oh, but please read the conclusion
before doing that:
= Conclusion
For those of you who wish to have access to something like Tailscale but
value your privacy above all, you would genuinely be greatful for
Headscale. However, I’ve found that some are fine with what Tailscale
#emph[does] provide in regards to FOSS, and are satisfied by the raw
convenience and simplicity of a non-selfhosted Tailscale control server - exactly what it hopes to provide, as shown by their self-description on their website: 'a zero-config, no-fuss VPN \[provider\]'.
Or you could just settle with bare Wireguard®.
|
https://github.com/jasmerri/tsumo | https://raw.githubusercontent.com/jasmerri/tsumo/main/src/display.typ | typst | MIT License | #import "@preview/cetz:0.2.2"
#import "./image-sets.typ"
#import "./tile.typ": ids, tiles, types
// Default style used by the default drawer.
#let _style = (
height: 4em,
padding: 4pt,
spacing: 0pt
)
// The default drawer.
// Draws a tile given a specification.
// Arguments:
// x, y: The position to draw the tile.
// style: The style given to the function by the user.
// image-set: The image set given to resolve images for tiles.
// Returns: a dictionary (
// element: The Cetz element drawing the tile.
// width: The width of the tile.
// )
#let drawer(x, y, spec, style: (:), image-set: image-sets.riichi) = {
import cetz.draw: *
let front = (image-set.front)(height: style.height)
let size = measure(front)
let backdrop = front
let image = (image-set.resolve-tile)(spec.tile, width: size.width - 2 * style.padding)
if spec.tile == tiles.other.nothing {
backdrop = none
image = none
} else if spec.tile == tiles.other.back {
backdrop = (image-set.back)(height: style.height)
image = none
}
let img-size = none
if image != none {
img-size = measure(image)
}
let rotated = false
if spec.attributes.at("rotated", default: false) {
rotated = true
}
let stack = spec.attributes.at("stack", default: 1)
let gr = group(ctx => {
for i in array.range(stack) {
group(ctx => {
let offset = i * if rotated {size.width} else {size.height}
translate((x, y, 0))
translate((0, offset, 0))
if rotated {
rotate(90deg)
// A 90-deg rotation of the content will cause it to be offset. This fixes that.
translate((0, -size.height, 0))
}
let anchor = "south-west"
let angle = if rotated {90deg} else {0deg}
if backdrop != none {
content((0, 0), backdrop, anchor: anchor, angle: angle)
}
if image != none {
content((style.padding, (size.height - img-size.height) / 2), image, anchor: anchor, angle: angle)
}
})
}
})
return (
element: gr,
width: if rotated {size.height} else {size.width}
)
}
// Given an array of tile specs, draw it onto a Cetz canvas.
#let display(specs, style: (:), image-set: image-sets.riichi, drawer: drawer) = {
let style = _style + style
context {
cetz.canvas({
import cetz.draw: *
let a = 0pt
let first = true
for spec in specs {
if not first { a += style.spacing }
first = false
let res = drawer(a, 0pt, spec, style: style, image-set: image-set)
res.element
a += res.width
}
})
}
}
|
https://github.com/rlpundit/typst | https://raw.githubusercontent.com/rlpundit/typst/main/Typst/en-Report/chaps/intro.typ | typst | MIT License | /* --------------------------------- DO NOT EDIT -------------------------------- */
#import "../Class.typ": *
#show: report.with(isAbstract: false)
#chap("General Introduction") // GI
#set page(header: smallcaps(title) + h(1fr) + emph("General Introduction") + line(length: 100%))
/* ------------------------------------------------------------------------------ */
// Provide an introduction to your capstone project, including its objectives and significance.
*Context & Motivations*
#lorem(64)
*Detailed Description*
#lorem(64)
/ @chp:chap1: #lorem(16)
/ @chp:chap2: #lorem(16)
/ @chp:chap3: #lorem(16)
|
https://github.com/harrellbm/Bookletic | https://raw.githubusercontent.com/harrellbm/Bookletic/main/src/lib.typ | typst | Apache License 2.0 | // Page number layout config.
#let num-layout(
p-num-start: 1, // Starting page number
p-num-alt-start: none, // Alternative starting page number (e.g., for chapters)
p-num-pattern: "1", // Pattern for page numbering (e.g., "1", "i", "a", "A")
p-num-placement: bottom, // Placement of page numbers (top or bottom)
p-num-align-horizontal: center, // Horizontal alignment of page numbers
p-num-align-vertical: horizon, // Vertical alignment of page numbers
p-num-pad-left: 0pt, // Extra padding added to the left of the page number
p-num-pad-horizontal: 1pt, // Horizontal padding for page numbers
p-num-size: 12pt, // Size of page numbers
p-num-border: none, // Border color for page numbers. eg: luma(0)
p-num-halign-alternate: true, // Alternate horizontal alignment between left and right pages.
) = {
// TODO: add ability to set a shape behind page number
let layout = (
p-num-start: p-num-start,
p-num-alt-start: p-num-alt-start,
p-num-pattern: p-num-pattern,
p-num-placement: p-num-placement,
p-num-align-horizontal: p-num-align-horizontal,
p-num-align-vertical: p-num-align-vertical,
p-num-pad-left: p-num-pad-left,
p-num-pad-horizontal: p-num-pad-horizontal,
p-num-size: p-num-size,
p-num-border: p-num-border,
p-num-halign-alternate: p-num-halign-alternate,
)
return layout
}
// This function creates a signature (booklet) layout for printing.
// It takes various parameters to configure the layout, such as
// binding margins, page numbering styles, content padding, and the content to be laid out.
#let sig(
page-margin-binding: 0in, // Binding margin for each page (space between pages)
page-border: none, // Color for the border around each page (set to none for no border)
draft: false, // Whether to output draft or final layout
p-num-layout: (), // The layout of the page number
pad-content: 5pt, // Padding around page content
contents: (), // Content to be laid out in the booklet (an array of content blocks)
) = {
// Begin processing given content into booklet format
let wrapped-cont = () // Array to hold wrapped content
let p-num = 1 // Initialize page number
// Loop through the provided content and package for placement in the booklet
// We will insert a page number for each page before we reorder things
for value in contents {
let page
let p-num-placement
let p-num-height
let p-num-value
let page-number-box
// Compose a page number box for this page if it falls within a defined layout
for layout in p-num-layout {
// Check if this is the right layout or not
if layout.at("p-num-start") <= p-num {
// If it is check whether we need to build a box or not
if layout.at("p-num-pattern") == none {
page-number-box = none
continue
}
// Substitute alternative starting number if specified for this page number layout
if layout.at("p-num-alt-start") != none {
p-num-value = (p-num - layout.at("p-num-start")) + layout.at("p-num-alt-start")
} else {
p-num-value = p-num
}
// Build dimensions of box from layout definition
p-num-height = layout.at("p-num-size") + layout.at("p-num-pad-horizontal")
// Hold on to placment for use when building pages
p-num-placement = layout.at("p-num-placement")
let align-h = layout.at("p-num-align-horizontal")
if calc.even(p-num) and layout.at("p-num-halign-alternate") {
if (align-h == left) {
align-h = right
} else if (align-h == right) {
align-h = left
}
}
// Compose page number box
page-number-box = box(
width: 1fr,
height: p-num-height,
stroke: layout.at("p-num-border"),
align(align-h + layout.at("p-num-align-vertical"),
pad(left: layout.at("p-num-pad-left"), text(size: layout.at("p-num-size"),
numbering(layout.at("p-num-pattern"), p-num-value))))
)
}
}
// Compose the page based on page number box placement
if page-number-box == none {
page = pad(pad-content, value) // Page without any page numbers
} else if p-num-placement == top {
page = stack(page-number-box, pad(pad-content, value)) // Placing the page number on top explicit is necessary so that the page content does not overlap the page number box
} else {
page = {
pad(pad-content, value)
place(p-num-placement, page-number-box)
}
}
// Wrap the finished page content to the specified page size
wrapped-cont.push(
block(
width: 100%,
height: 100%,
spacing: 0em,
page
)
)
p-num += 1 // Increment page number
}
let reordered-pages = () // Prepare to collect reordered pages
let num-pages = wrapped-cont.len() // Total number of pages
let half-num = int(num-pages / 2) // Number of pages in each half
// Round half-num up to account for odd page numbers
if calc.odd(num-pages) {
half-num += 1
}
// We need a multiple of 4 half-pages to prevent the blank pages from being in the middle
// This is because there are 4 half-pages per sheet.
if calc.odd(half-num) {
half-num += 1
}
// To reorder the pages we put a front page side by side with a back page.
// And iterate until we reach the middle of the booklet.
// We alternate between left an right.
// The index of front pages will increase, while the index of back pages will decrease.
// For example, 8 pages will give 2 sheets.
// Sheet 1:
// 8 | 1
// 2 | 7
// Sheet 2:
// 6 | 3
// 4 | 5
let front-index = 0;
let back-index = half-num * 2 - 1;
// Reorder pages into booklet signature
for num in range(half-num) {
let front-content = wrapped-cont.at(front-index);
let back-content = if back-index < num-pages { wrapped-cont.at(back-index) } else { block() };
// even pages indices => BACK | FRONT
// odd pages indices => FRONT | BACK
if calc.even(num) {
(front-content, back-content) = (back-content, front-content)
}
reordered-pages.push(front-content)
reordered-pages.push(back-content)
front-index += 1
back-index -= 1
}
// Create grid to place booklet pages
let sig-grid = grid.with(
columns: (1fr, 1fr),
column-gutter: page-margin-binding * 2,
)
// Draw border if not set to none
if page-border != none {
sig-grid = sig-grid.with(
stroke: page-border
)
}
// Output draft or final layout
if draft {
sig-grid(..wrapped-cont)
} else {
sig-grid(..reordered-pages)
}
}
// This function is a placeholder for automatically breaking content into pages
#let booklet() = {
// TODO: Take in single block of content and calculate how to break it into pages automatically
// Then feed resulting pages to sig function will offer trade off of convenience for less control
} |
https://github.com/yonatanmgr/summaries-template | https://raw.githubusercontent.com/yonatanmgr/summaries-template/main/template/thm-custom.typ | typst | // Store theorem environment numbering
#import "@preview/showybox:2.0.1": *
#let cmeta = yaml("/config.yaml")
#let thmcounters = state("thm",
(
"counters": ("heading": ()),
"latest": ()
)
)
#let thmenv(identifier, base, base_level, fmt, ..args) = {
let global_numbering = numbering
return (
..args,
body,
number: auto,
numbering: "1.1",
refnumbering: auto,
supplement: identifier,
supplement-display: args.named().id-display,
base: base,
base_level: base_level
) => {
let name = none
if args != none and args.pos().len() > 0 {
name = args.pos().first()
}
if refnumbering == auto {
refnumbering = numbering
}
let result = none
if number == auto and numbering == none {
number = none
}
if number == auto and numbering != none {
result = locate(loc => {
return thmcounters.update(thmpair => {
let counters = thmpair.at("counters")
// Manually update heading counter
counters.at("heading") = counter(heading).at(loc)
if not identifier in counters.keys() {
counters.insert(identifier, (0, ))
}
let tc = counters.at(identifier)
if base != none {
let bc = counters.at(base)
// Pad or chop the base count
if base_level != none {
if bc.len() < base_level {
bc = bc + (0,) * (base_level - bc.len())
} else if bc.len() > base_level{
bc = bc.slice(0, base_level)
}
}
// Reset counter if the base counter has updated
if tc.slice(0, -1) == bc {
counters.at(identifier) = (..bc, tc.last() + 1)
} else {
counters.at(identifier) = (..bc, 1)
}
} else {
// If we have no base counter, just count one level
counters.at(identifier) = (tc.last() + 1,)
let latest = counters.at(identifier)
}
let latest = counters.at(identifier)
return (
"counters": counters,
"latest": latest
)
})
})
number = thmcounters.display(x => {
return global_numbering(numbering, ..x.at("latest"))
})
}
return figure(
result + // hacky!
fmt(name, number, body, ..args.named()) +
[#metadata(identifier) <meta:thmenvcounter>],
kind: "thmenv",
outlined: false,
caption: name,
supplement: supplement-display,
numbering: refnumbering,
)
}
}
#let thmrules(qed-symbol: $qed$, doc) = {
show figure.where(kind: "thmenv"): it => it.body
show ref: it => {
if it.element == none {
return it
}
if it.element.func() != figure {
return it
}
if it.element.kind != "thmenv" {
return it
}
let supplement = it.element.supplement
if it.citation.supplement != none {
supplement = it.citation.supplement
}
let loc = it.element.location()
let thms = query(selector(<meta:thmenvcounter>).after(loc), loc)
let number = thmcounters.at(thms.first().location()).at("latest")
return link(
it.target,
[#supplement~#numbering(it.element.numbering, ..number)]
)
}
doc
}
#let QED = place(left, dy: 0cm, dx: -0.37cm, $qed$)
#let boxargs(head, number, name, color, alt: false, centered: false, breakable: false) = {
let style = none
let sep-style = none
if alt == true {
style = (
boxed-style: (anchor: (x: if centered {center} else {start}), radius: 2pt),
radius: 2pt,
thickness: (right: 0.8pt, top: 0.8pt, left: 0.8pt, bottom: 0.8pt)
)
}
if cmeta.block-style == "classic" {
style = (
color: black,
title-color: white,
footer-color: white,
thickness: (0pt),
align: right,
title-inset: (right: 0pt, top: 8pt, bottom: 8pt, left: 0pt),
body-inset: (right: 0pt, top: 8pt, bottom: 8pt, left: 0pt),
footer-inset: (right: 0pt, top: 8pt, bottom: 8pt, left: 0pt)
)
sep-style = (
thickness: 0pt
)
}
let args = (
title: [#head #number#if name != [] {[ (#name)]} else {[]}:],
title-style: (
align: if centered {center} else {start},
weight: 900,
sep-thickness: 0pt,
color: color.darken(50%),
..style
),
body-style: (align: right),
footer-style: (align: right, sep-thickness: 0pt, color: luma(20%)),
breakable: breakable,
sep: (
thickness: 0.8pt,
dash: "densely-dotted",
gutter: 1em,
..sep-style
),
frame: (
radius: 0pt,
thickness: (right: 0.8pt),
title-color: color.lighten(90%),
footer-color: luma(88%),
border-color: color.darken(50%),
inset: 8pt,
body-inset: 10pt,
footer-inset: 10pt,
..style,
),
)
return args
}
#let newenv(id, head, color, addon: none, numbering: none, qed: false, alt: false, centered: false, breakable: false) = {
return (title, ..body) => {
let t = thmenv(id, "heading", id-display: head, numbering, (name, number, _) => [
#let args = boxargs(head, number, name, color, alt: alt, centered: centered, breakable: breakable)
#if body.pos().len() == 1 {
showybox(..args)[#body.pos().at(0)]
} else if body.pos().len() == 2 {
if body.pos().at(1) == [] {
showybox(..args)[#body.pos().at(0)]
} else {
showybox(..args)[#body.pos().at(0)][
#if addon != none {[#emph[#addon]:]} #body.pos().at(1)
#if qed {QED}
]
}
} else if body.pos().len() == 3 {
if body.pos().at(1) == [] {
if body.pos().at(2) == [] {
showybox(..args)[#body.pos().at(0)]
} else {
showybox(..args, footer: emph[#body.pos().at(2)])[#body.pos().at(0)]
}
} else {
if body.pos().at(2) == [] {
showybox(..args)[#body.pos().at(0)][
#if addon != none {[#emph[#addon]:]} #body.pos().at(1)
#if qed {QED}
]
} else {
showybox(..args, footer: emph[#body.pos().at(2)])[#body.pos().at(0)][
#if addon != none {[#emph[#addon]:]} #body.pos().at(1)
#if qed {QED}
]
}
}
}
])
t(title, ..body)
}
}
} |
|
https://github.com/v411e/optimal-ovgu-thesis | https://raw.githubusercontent.com/v411e/optimal-ovgu-thesis/main/template/metadata.typ | typst | MIT License | // Enter your thesis data here:
#let title = "Optimierung von neuronalen Netzwerkarchitekturen für die echtzeitfähige Bilderkennung auf energiesparenden Geräten"
#let international-title = "Optimizing Neural Network Architectures for Real-Time Image Recognition on Low-Power Devices"
#let document-type = "Masterarbeit"
#let supervisor = "Prof. Dr. <NAME>"
#let second-supervisor = "Prof. Dr. <NAME>"
#let advisors = ("Dipl.-Inf. <NAME>",)
#let author = (
name: "David",
surname: "Weber",
date-of-birth: "15.10.1995",
matriculation-no: "000001",
)
#let city = "Magdeburg"
#let date = "04.04.2024"
#let lang = "de"
#let organisation = [
Otto-von-Guericke-Universität Magdeburg\
Magdeburg Research and Competence Cluster\
Fakultät Informatik\
Institut für Technische und Betriebliche Informationssysteme\
Very Large Business Applications Lab\
]
#let organisation-logo = image("assets/figure/optimal-ovgu-thesis/ucc.svg", width: 2cm)
#let header-logo = image("assets/figure/optimal-ovgu-thesis/fin-de.svg", width: 100%)
#let is-doublesided = false |
https://github.com/OverflowCat/sigfig | https://raw.githubusercontent.com/OverflowCat/sigfig/neko/test.typ | typst | MIT License | #{
import "lib.typ": round
let shouldBeEqualTo(x, y) = assert(x == y);
shouldBeEqualTo(round(0.0, 4), "0.000");
shouldBeEqualTo(round(-0.0, 4), "0.000");
shouldBeEqualTo(round(1234.567, 8), "1234.5670");
shouldBeEqualTo(round(1234.567, 1), "1e3");
shouldBeEqualTo(round(1234.567, "1"), "1e3"); // just like 1
shouldBeEqualTo(round(1234.567, 2), "1.2e3");
shouldBeEqualTo(round(1234.567, 2.9), "1.2e3");
shouldBeEqualTo(round(1234.567, 5), "1234.6");
// shouldBeEqualTo(round(1234.567, 21), "1234.56700000000000728"); // integer overflow
}
|
https://github.com/levinion/typst-dlut-templates | https://raw.githubusercontent.com/levinion/typst-dlut-templates/main/templates/thesis/index.typ | typst | MIT License | #import "../util/style.typ":font_family,font_size
#let index = [
#set align(center)
#set text(font: font_family.heiti, size: font_size.xiao_san)
#set block(spacing: 0.9em)
目#h(2em)录\
#set text(font: font_family.songti, size: font_size.xiao_si)
#set par(leading: 0.9em)
#outline(title: none, indent: auto)
#pagebreak(weak: true)
]
|
https://github.com/kitashimauni/report-tools | https://raw.githubusercontent.com/kitashimauni/report-tools/main/README.md | markdown | # Typstでレポートを書くときに使う関数をまとめたパッケージ
```lib.typ```を任意の位置に置くことで使用可能
必要なファイルを用意して```@loacl/foo```で使えるようにしたい
## 関数の説明
詳細は```example.typ```を参照
### ```#showCode```
指定されたプログラムファイルを表示する
現状```Python```のみ関数やクラスを指定して表示可能
引数に```read(file)```と```file```の2つが必要なのは, 相対パスが渡されたときにパッケージのあるパスからの相対パスとして認識されてしまうため
#### 依存
```@preview/codelst:2.0.1```
### ```itembox```
LaTeXのアイテムボックス風のブロックを作る
最低限引数にcaptionとbodyがあればよい
|
|
https://github.com/SWATEngineering/Docs | https://raw.githubusercontent.com/SWATEngineering/Docs/main/src/2_RTB/PianoDiProgetto/sections/PianificazioneSprint/SettimoSprint.typ | typst | MIT License | #import "../../functions.typ": glossary
=== Settimo #glossary[sprint]
*Inizio*: Venerdì 05/01/2024
*Fine*: Giovedì 11/01/2024
*Obiettivi dello #glossary[sprint]*:
- Proseguire la revisione in stile #glossary[walkthrough] delle _Norme di Progetto v1.0_;
- Proseguire la stesura del _Piano di Progetto_, con:
- Aggiornamento di pianificazione e preventivo pertinenti allo #glossary[sprint] 7 e l'inserimento del consuntivo pertinente allo #glossary[sprint] 6;
- Reinserimento pianificazione a priori ma a breve termine (2 #glossary[sprint] in avanti) con pianificazione e preventivo degli #glossary[sprint] 8 e 9;
- Aggiornamento del preventivo dei periodi che precedono ciascuna revisione con nuova ripartizione delle ore per ruolo e nuovo costo.
- Inizio revisione in stile #glossary[walkthrough] del _Piano di Qualifica_:
- Inserimento nuovo BAC (Budget At Completion) e sottolineatura del cambiamento avvenuto nel corso dello #glossary[sprint] 7 all'interno dei grafici.
- Ripresa revisione in stile #glossary[walkthrough] dell'_Analisi dei Requisiti_;
- Ripresa preparazione della presentazione per la prima revisione #glossary[RTB] in vista dell'apertura dello sportello. |
https://github.com/Area-53-Robotics/53E-Notebook-Over-Under-2023-2024 | https://raw.githubusercontent.com/Area-53-Robotics/53E-Notebook-Over-Under-2023-2024/giga-notebook/entries/post-reveal.typ | typst | Creative Commons Attribution Share Alike 4.0 International | #import "/packages.typ": notebookinator
#import notebookinator: *
#import themes.radial.components: *
#show: create-body-entry.with(
title: "Post Reveal Thoughts",
type: "brainstorm",
date: datetime(year: 2023, month: 4, day: 27),
author: "<NAME>",
witness: "Violet Ridge",
)
After the game reveal each member of the team independently wrote down their
thoughts on what the coming season will look like, and ideas for our robot.\
\
#admonition(
type: "note",
[
These were recorded before the rules were released, so they are made without key
information, like expansion limits, or how the autonomous win point will be
scored.
],
)
= Felix
== Scoring Mechanisms
My first thought for a mechanism to move the triballs is something similar to
the bots we see for FRC's #footnote("See glossary") Charged Up. A long arm with
flex wheels that spin to grab the triballs. The climbing mechanism is much more
difficult. The real question is whether we use the same mechanism as the triball
collector for this, and whether that's feasible to build. The hardest part to me
seems like getting a consistent hold on the PVC pipe. It is very inconvenient
that the pole is vertical, which will make it very hard to maintain a grip.
== Drivetrain
Our drivetrain is the core of our robot, and is easily the most important part
to get right. Due to the lack of heavy objects, torque is much less important
than speed. We can use a similar gear ratio to our robot during the Spin Up
Season, or maybe even higher. The real question is whether we can get a six
motor drive. If we can get the triball grabbing and bot lifting on two motors
that would be amazing, but I'm not sure if it's possible.
The weight of the drive (and the bot overall) is also very important. If we were
considering a steel drivetrain before, we certainly should not be now. We need
to be as light as possible to make lifting our robot as easy as possible.
The ability of our bot to cross the middle line is also very important due to
the ramification of having a bot of our alliance on our side of the field. If we
can quickly switch sides, it will mean that we can quickly shut down our
opponents defense without even interacting with their robot.
== Programming
As always, consistent chassis movement is the key to a perfect autonomous. Using
an absolute positioning system like GPS or Odometry #footnote(<nb_gl>) can make
this much easier, because it allows the robot to correct for past error, or even
external interference. There are also many different motion control algorithms
we can use, like PID #footnote(<nb_gl>) and/or motion profiling. Overall,
tracking wheels and an IMU will be a must, but these sensors might have some
difficulty when we cross the center line, due to the bot leaving the ground. In
addition, if our robot is high off the ground, we may have some trouble getting
the tracking wheels to touch the ground.
= John
I think that the best intake for this season would easily be one with horizontal
flex wheels. This would allow the bot to reach under the goal easier and also
could be easier to build. We will most definitely need a shooting mechanism (a
catapult would work best, and we have more experience with such building). We
will also need some sort of scissor lift to lift the bot. All of these systems
will require a motor, so we will need a four motor drive. This means that we can
spare a motor on the claw for lifting the bot. We will want a fast drive with
the center locked omni.
= Alan
At first I was very surprised by this game as it seemed that the results of a
match would be decided in the first few seconds. However, upon further review I
noticed the heavily weighted importance on match loads (22 match loads with only
12 game pieces on the field). This makes an intake that is able to get match
loads necessary. I also began thinking of ways to climb the pole, as that makes
up a big amount of points. My initial idea is a claw with two flex wheels on the
inside, so the claw could clamp on to the pole and the wheels could rotate and
drag the robot upwards. A lot of torque will be necessary but it may be doable.
= Meghana
#admonition(
type: "note",
[
Meghana joined the team after the season started, so her thoughts may be
influenced by the ideas of other teammates.
],
)
After watching the video, I believe that we could create a strong claw mechanism
which can grip the pole firmly, as it gets the most amount of points. It should
be able to hold the weight as well. For the robots, they should be faster in
speed but have flexible and firm wheels which can improve the accuracy of
movements. Autonomous points and the winner of the autonomous period is a large
head start in the game and would also be helped by the wheels and speed.
|
https://github.com/LDemetrios/Typst4k | https://raw.githubusercontent.com/LDemetrios/Typst4k/master/src/test/resources/suite/foundations/plugin.typ | typst | // Test WebAssembly plugins.
--- plugin-basic ---
#let p = plugin("/assets/plugins/hello.wasm")
#test(p.hello(), bytes("Hello from wasm!!!"))
#test(p.double_it(bytes("hey!")), bytes("hey!.hey!"))
#test(
p.shuffle(bytes("value1"), bytes("value2"), bytes("value3")),
bytes("value3-value1-value2"),
)
--- plugin-wrong-number-of-arguments ---
#let p = plugin("/assets/plugins/hello.wasm")
// Error: 2-20 plugin function takes 0 arguments, but 1 was given
#p.hello(bytes(""))
--- plugin-wrong-argument-type ---
#let p = plugin("/assets/plugins/hello.wasm")
// Error: 10-14 expected bytes, found boolean
// Error: 27-29 expected bytes, found integer
#p.hello(true, bytes(()), 10)
--- plugin-error ---
#let p = plugin("/assets/plugins/hello.wasm")
// Error: 2-17 plugin errored with: This is an `Err`
#p.returns_err()
--- plugin-panic ---
#let p = plugin("/assets/plugins/hello.wasm")
// Error: 2-16 plugin panicked: wasm `unreachable` instruction executed
#p.will_panic()
--- plugin-out-of-bounds-read ---
#let p = plugin("/assets/plugins/plugin-oob.wasm")
// Error: 2-14 plugin tried to read out of bounds: pointer 0x40000000 is out of bounds for read of length 1
#p.read_oob()
--- plugin-out-of-bounds-write ---
#let p = plugin("/assets/plugins/plugin-oob.wasm")
// Error: 2-27 plugin tried to write out of bounds: pointer 0x40000000 is out of bounds for write of length 3
#p.write_oob(bytes("xyz"))
|
|
https://github.com/typst/packages | https://raw.githubusercontent.com/typst/packages/main/packages/preview/ttt-exam/0.1.0/lib/i18n.typ | typst | Apache License 2.0 | #import "@preview/linguify:0.3.1": *
// load linguify database file
#let ling_db = toml("assets/lang.toml")
|
https://github.com/suspenss/Undergraduate-mathematics | https://raw.githubusercontent.com/suspenss/Undergraduate-mathematics/main/Linear%20Algebra/main.typ | typst | #import "./../setup/templates.typ": *
#import "./../setup/theorem.typ": *
#show: thmrules
// #show math.equation: set text(font: "New Computer Modern Math")
// #show math.equation: set text(font: "Libertinus Math")
#show: project.with(
title: "Linear Algebra", authors: ("epoche",), language: "ch", outl: [
#outline(indent: true, title: "目录", depth: 2)
],
)
#show math.ast: math.thin
#let obey = math.tilde
#let vb = $bold(beta)$
#let va = $bold(alpha)$
#let ve = $bold(e)$
= Vector
== How to prove Two-vector collinear theorem
#definition("scalar multiplication of vectors")[
A real number $lambda$ times a vector $bold(a)$ is equal to a vector $lambda bold(a)$:
- In the direction: when $lambda > 0$, they are in the same direction, when $lambda = 0, lambda bold(a) = bold(0)$, when $lambda < 0$, they are in the opposite direction.
- $abs(lambda bold(a)) = abs(lambda) abs(bold(a))$
]
#theorem("Two-vector collinear theorem")[
There are two non-zero vector $bold(a), bold(b)$. If it exists a real number $lambda$, such that:
$ bold(a) parallel bold(b) <==> bold(b) = lambda bold(a) $
]
/*
#proof()[
Set vectors $bold(a), bold(b)$, since $bold(a) parallel bold(b)$, exists a real number $lambda$ $
abs(lambda) = abs(bold(b)) / abs(bold(a))
$
Since Definition 1.1 $
bold(b) = lambda bold(a)
$
Reversely, if
$ lambda bold(a) = bold(b) $
Then
$ bold(a) parallel bold(b) $
]
*/
=== Three-point collinear decision theorem
#theorem("Three-point collinear decision theorem")[
If $A, B, C$ are collinear, then:
$ accent(O B, ->) = lambda accent(O A, ->) + (1 - lambda) accent(O C, ->) $
]
// *Proof*
#proof()[
Since $A, B, C$ are collinear, we have $
accent(C\B, ->) parallel accent(A\C, ->) \
accent(C B, ->) = lambda accent(A C, ->)
$
So $
accent(O B, ->) - accent(O C, ->) = lambda (accent(O A, ->) - accent(O C, ->)) \
$
Hence $
accent(O B, ->) = lambda accent(O A, ->) + (1 - lambda) accent(O C, ->)
$
]
=== Expand to triangle
#theorem("Three-point collinear decision theorem in triangle")[
In $triangle_(A B C)$, $D$ is the $n$ equal component of $B\C : n B\D = k D\C = B\C$. \
$ accent(A\D, ->) = n/(n + k) accent(A\B, ->) + k/(n + k) accent(A\C, ->) $
]
#proof()[
We have $
accent(A\B, ->) + accent(B\D, ->) = accent(A\D, ->) \
accent(A\D, ->) + accent(D\C, ->) = accent(A\C, ->) \
$
Since $n B\D = k D\C = B\C$, We can have $
accent(B\C, ->) = n accent(A\D, ->) - n accent(A\B, ->) \
accent(B\C, ->) = k accent(A\C, ->) - k accent(A\D, ->) \
$
So $
k accent(A\C, ->) - k accent(A\D, ->) = n accent(A\D, ->) - n accent(A\B, ->) $
Hence $
accent(A\D, ->) = n/(n + k) accent(A\B, ->) + k/(n + k) accent(A\C, ->)
$
]
== In three dimensions space
#lemma("Fundamental theorem of space vectors")[
In three dimensions, we have three noncoplanar vectors $bold(e_1), bold(e_2), bold(e_3)$, for arbitrary vector $bold(P)$, exist a unique tuple $(x, y, z)$, hence:
$ bold(P) = x bold(e_1) + y bold(e_2) + z bold(e_3) $
]
Hence, we can define:
#definition()[
Let the three cross-perpendicular vector $bold(e_1), bold(e_2), bold(e_3)$ as orthogonal bases in three dimensions space, and let $(x, y, z)$ represent vector's coordinates.
]
#theorem("Fundamental theorem of cooriented quantities")[
If threr are two non-collinear vector $bold(x), bold(y)$, the sufficient and necessary condition that vector $bold(P)$ is coplanar with $bold(x), bold(y)$ is exists the unique real pair $(lambda, mu)$ such that:
$ bold(P) = lambda bold(x) + mu bold(y) $
]
== Expand
=== Rotation of vector
#theorem()[
In two-dimensions space, set the angle of vector $bold(a)$ is $theta$, the cordinate of $bold(a)$ is $(x, y)$, the length of $bold(a)$ is $l = sqrt(x^2 + y^2)$, then the cordinate of $bold(a)$ can be represent as $(l cos theta, l sin theta)$, set a vector $bold(b)$ have angle $alpha$ respect to $bold(a)$, such that: $
bold(b) = (x cos alpha - y sin alpha, y cos alpha + x sin alpha)
$
]
#proof()[
We have angle $alpha$ respect to $bold(a)$, so that $
bold(b) = (l cos (theta + alpha), l sin (theta + alpha))
$
According to Triangle identity transformation $
bold(b) = (l cos theta cos alpha - l sin theta sin alpha, l sin theta cos alpha + l cos theta sin alpha)
$
According to $bold(a) = (l cos theta, l sin theta)$, hence $
bold(b) = (x cos alpha - y sin alpha, y cos alpha + x sin alpha)
$
]
== Inner product
#definition()[
* Inner product *
$ va dot vb = abs(va) abs(vb) cos accent( \( va \, vb\), hat ) $
]
#lemma()[
* Cordinate representation *
$ va dot vb = x_1 x_2 + y_1 y_2 + z_1 z_2 $
]
#proof()[
Set orthogonal bases $bold(i), bold(j), bold(k)$, we can have $
bold(i)^2 = bold(j)^2 = bold(k)^2 = 1 \
bold(i) dot bold(j) = bold(j) dot bold(k) = bold(i) dot bold(k) = 0
$
Let $va = (x_1, y_1, z_1), vb = (x_2, y_2, z_2)$ since $
va dot vb = (x_1 bold(i) + y_1 bold(j) + z_1 bold(k)) dot (x_2 bold(i) + y_2 bold(j) + z_2 bold(k))
$
Simplify it $
va dot vb =
(x_1 x_2) space bold(i)^2 + (x_1 y_2) space bold(i) dot bold(j) + (x_1 z_2) space bold(i) dot bold(k) \
+ space (y_1 y_2) space bold(j)^2 + (y_1 x_2) space bold(j) dot bold(i) + (y_1 z_2) space bold(j) dot bold(k) \
+ space (z_1 z_2) bold(k)^2 + (z_1 x_2) space bold(k) dot bold(i) +(z_1 y_2) space bold(k) dot bold(j) \
= x_1 x_2 + y_1 y_2 + z_1 z_2
$
Hence $
va dot vb = x_1 x_2 + y_1 y_2 + z_1 z_2
$
]
== Outer product
#definition()[
* Outer product *
$va times vb$ is a vector. \
$va times vb, va, vb$ allows right hand rule.
$
abs(va times vb) = abs(va) abs(vb) sin accent( paren.l va comma vb paren.r, hat ) \
va times vb bot va bot vb \
$
]
#lemma()[
* Reverse-exchange law *
$
va times vb = - vb times va
$
]
* Outer product matrix representation in three dimensions*
$
va times vb = mat(delim: "|" , bold(i), bold(j), bold(k) ; x_1, y_1, z_1; x_2, y_2, z_2) = mat(delim: "|", y_1, z_1; y_2, z_2) bold(i) - mat(delim: "|", x_1, z_1; x_2, z_2) bold(j) + mat(delim: "|", x_1, y_1; x_2, y_2) bold(k)
$
= Matrix
Normally, $bold(I)$ represent the unit matrix: main diagonal all equal to $1$, rest all equal to $0$.
#definition()[
Set the number of rows of a matrix $X$ is $r_X$, column of it is $c_X$, $X$ is arbitrary.
* Homomorphic matrix : *
There are two matrix $A, B$, $r_A = r_B and c_A = c_B$.
* Square : *
There is a matrix $A$, $r_A = c_A$.
* Main diagonal : *
There is a square A have $n$ factorial, the set of the main diagonal element is $ {A_(i j) | i = j in [1, n]} $
* symmetric matrix : *
There is a square matrix of n factorials $A : A_(i j) = A_(j i) space (i in [1, n], j in [1, n])$.
* Diagonal matrix : *
A matrix have nonzero element only on the main diagonal, with the rest of the elements are being $0$, It can represented as $ op("diag") {lambda_1, dots.h.c , lambda_n} space (lambda_n = A_(n n)) $
* Triangle matrix : *
]
|
|
https://github.com/mcarifio/explore.typst | https://raw.githubusercontent.com/mcarifio/explore.typst/main/src/README.typ | typst | = Notes
== Refs
- #link("https://typst.app/docs/tutorial/")[tutorial] especially #link("https://typst.app/docs/tutorial/writing-in-typst/")[writing] and
#link("https://typst.app/docs/tutorial/making-a-template/")[making templates].
- background: https://www.user.tu-berlin.de/laurmaedje/programmable-markup-language-for-typesetting.pdf
- announcement + commentary: https://news.ycombinator.com/item?id=34423590
- srcs: https://github.com/typst/
- online app: https://typst.app/, https://mike%[email protected]/
- #link("https://djot.net/")[djot] with #link("https://github.com/jgm/djot/blob/main/doc/quickstart-for-markdown-users.md")[quickstart] and
#link("https://johnmacfarlane.net/beyond-markdown.html")[beyond markdown]. _Inside baseball_.
|
|
https://github.com/typst/packages | https://raw.githubusercontent.com/typst/packages/main/packages/preview/tgm-hit-thesis/0.1.2/template/lib.typ | typst | Apache License 2.0 | // #import "@preview/tgm-hit-thesis:0.1.2": *
#import "../src/lib.typ": *
#import "assets.typ"
|
https://github.com/lucifer1004/leetcode.typ | https://raw.githubusercontent.com/lucifer1004/leetcode.typ/main/solutions/s0016.typ | typst | #import "../helpers.typ": *
#let _3sum-closest-ref(nums, target) = {
let nums = nums.sorted()
let n = nums.len()
let ans = 2147483647
for i in range(n) {
if i > 0 and nums.at(i) == nums.at(i - 1) {
continue
}
let l = i + 1
let r = n - 1
while l < r {
let sum = nums.at(i) + nums.at(l) + nums.at(r)
if sum < target {
l += 1
} else if sum > target {
r -= 1
} else {
return target
}
if calc.abs(sum - target) < calc.abs(ans - target) {
ans = sum
}
}
}
ans
}
|
|
https://github.com/Ngan-Ngoc-Dang-Nguyen/thesis | https://raw.githubusercontent.com/Ngan-Ngoc-Dang-Nguyen/thesis/main/docs/inverse%201-median.typ | typst | // The inverse 1-median problem on a tree and on a path (Galavii)
// Thêm ý nghĩa của bài toán vào luận văn
#include "../tools/multi-section-ref.typ"
#import "../tools/macros.typ": eqref
#import "../typst-orange.typ": theorem, proof
#include "../tools/multi-section-ref.typ"
#import "../tools/macros.typ": eqref
#import "../typst-orange.typ": theorem, proof, lemma, proposition, corollary, example
#import "@preview/cetz:0.1.2": canvas, plot
#import "@preview/cetz:0.1.2"
== BÀI TOÁN INVERSE 1-MEDIAN TRÊN CÂY
Trong mục này, chúng ta sẽ xem xét một bài toán khác cũng có nhiều ứng dụng thực tiễn rộng rãi trong cuộc sống, đặc biệt là trong các lĩnh vực như quy hoạch đô thị, logistics và quản lý hệ thống hạ tầng. Một ví dụ điển hình là trong quy hoạch đô thị, chính phủ thường có nhu cầu cố định vị trí của các công trình công cộng quan trọng như trường học, bệnh viện, hoặc các cơ sở y tế khác để đảm bảo người dân có thể dễ dàng tiếp cận các dịch vụ thiết yếu. Tuy nhiên, việc lựa chọn các vị trí này đôi khi chưa phải là tối ưu nhất so với sự phân bố dân cư và hệ thống giao thông hiện có.
Để giải quyết vấn đề này, chính phủ có thể trích ra một khoản ngân sách dành cho các cơ quan chức năng thực hiện việc điều chỉnh hệ thống đường sá, cơ sở hạ tầng hoặc thậm chí là phân bố lại dân cư. Mục tiêu là làm cho các điểm cố định như trường học, bệnh viện, hoặc các công trình quan trọng khác trở thành "1-median" của toàn bộ khu vực, tức là các vị trí này sẽ có tổng khoảng cách di chuyển đến các điểm khác trong khu vực là tối thiểu nhất.
Việc tối ưu hóa này không chỉ giúp giảm chi phí và thời gian di chuyển của người dân khi tiếp cận các dịch vụ công cộng, mà còn tạo điều kiện thuận lợi cho việc quản lý và vận hành các hệ thống hạ tầng đô thị. Chính vì vậy, bài toán này đóng vai trò quan trọng trong nhiều khía cạnh của quy hoạch đô thị, đặc biệt trong bối cảnh các thành phố đang phát triển nhanh chóng và dân số ngày càng đông đúc.
Lớp bài toán này được gọi là bài toán inverse 1-median trên cây.
=== Định nghĩa bài toán
#let wt = $tilde(w)$
Cho đồ thị cây $T=(V,E)$ với tập đỉnh $V={v_1,v_2,...,v_n}$ và tập cạnh $E$. Mỗi đỉnh trên đồ thị được gán một trọng số không âm, kí hiệu là $w_i, i=1,2,...,n$ và mỗi cạnh cũng có một độ dài không âm. Đặt $d(x,v_i)$ là độ dài đường đi ngắn nhất giữa $x$ và $v_i$. Ta cố định một nút $s in V$ và muốn thay đổi các trọng số đỉnh với chi phí tối thiểu sao cho $s$ trở thành 1-median. Giả sử rằng chúng ta phải chịu chi phí không âm $c_i$ nếu trọng số $w_i$ được tăng hoặc giảm một đơn vị. Ta giả định rằng không thể tăng hoặc giảm các trọng số đỉnh một cách tùy ý. Cụ thể, các trọng số đỉnh phải tuân theo các giới hạn $underline(w_i) <= w_i <= overline(w_i)$ cho tất cả $i= 1,2,...,n$. Gọi $p_i$ là lượng mà trọng số $w_i$ được tăng lên. Tương tự, gọi $q_i$ là lượng mà trọng số $w_i$ được giảm đi.
Bây giờ, bài toán inverse 1-median trên cây có thể được phát biểu như sau: Tìm các trọng số đỉnh mới $w^*_i = w_i + p_i - q_i, i=1,2,...,n$ sao cho điểm $s in V $ là 1-median đối với các trọng số mới $w^*_i$, các trọng số mới nằm trong các giới hạn cho trước $underline(w_i) <= w^*_i <= overline(w_i)$ với tất cả $i=1,2,...,n$ và tổng chi phí $ sum_(i=1)^n c_i (p_i + q_i) $ cho việc thay đổi các trọng số nên được tối thiểu.
=== Điều kiện tối ưu
Giả sử $ W= sum_(i=1)^n w_i $ là tổng của tất cả các trọng số đỉnh của cây.
Giả sử $t$ là một 1-median và $s (s != t)$, không phải là một 1-median của cây với các trọng số cho trước. Đặt gốc của cây tại $s$ và xem xét các cây con $T_1, T_2, ..., T_k$, trong đó $k$ là bậc của đỉnh $s$. Giả sử rằng $T_k$ chứa đỉnh $t$, $tilde(w_i)$ là tổng trọng số của tất cả các đỉnh của cây con $T_i$ và $tilde(w_0) = w(s)$. Nếu $s$ không phải là một 1-median, thì chúng ta biết rằng $tilde(w_i) < W/2$ với tất cả $i=1,2,...,k-1$ và $tilde(w_k) > W/2$. Giả sử rằng ${v_1,..,v_(s-1)}$ và
$
R= tilde(w_k) - sum_(i=0)^k (tilde(w_k))/2
$.
Định lý sau đây được chứng minh trong @burkard2004inverse
#lemma(name: "Điều kiện tối ưu")[
Giả sử $tilde(w)_1 <= W/2,...,tilde(w)_(k-1)<= W/2$. Đỉnh $s$ là 1-median nếu và chỉ nếu $R=0$.
]
Phương trình $R=0$ nghĩa là
$
sum_(i=s)^n (p_i - q_i) - sum_(i=1)^(s-1) (p_i - q_i) = 2tilde(w)_k - W
$ <eq:29>.
Do đó, bài toán inverse 1-median trên một cây với các trọng số dương có thể được viết dưới dạng tuyến tính như sau:
$
("LP")\
min quad & sum_(i=1)^n c_i (p_i + q_i)\
"s.t." quad & sum_(i=s)^n (p_i - q_i) - sum_(i=1)^(s-1) (p_i - q_i) = 2 wt_k - W\
& p_i <= overline(w)_i - w_i quad quad quad quad quad quad quad quad quad quad quad i=1,2...,n\
& q_i <= w_i -underline(w)_i quad quad quad quad quad quad quad quad quad quad quad i=1,2...,n \
& p_i, q_i >= 0quad quad quad quad quad quad quad quad quad quad quad quad quad i=1,2...,n
$
=== Giải thuật cho bài toán inverse 1-median trên cây
Ý tưởng chính để giải quyết bài toán này là chuyển đổi nó thành dạng tương đương với _bài toán xếp ba lô liên tục_. Bằng cách này, ta có thể tận dụng các đặc điểm và phương pháp giải hiệu quả của bài toán ba lô liên tục để tìm lời giải tối ưu một cách nhanh chóng và chính xác.
Như đã được @burkard2004inverse chỉ ra, giá trị $R$ sẽ giảm nếu: Trọng số của $s$(hoặc của một đỉnh trong $T_i, i=1,2,...,k-1$) tăng lên hoặc trọng lượng của một đỉnh trong $T_k$ giảm đi.
Từ nhận xét trên, chúng ta có thể định nghĩa biến mới $x_i$ như sau:
$ x_i := q_i, quad quad i=1,...,s-1 $
$ x_i := p_i, quad quad i=s,...,n. $
Lưu ý rằng $q_i = 0 $ với mọi $i= s,...,n$ và $p_i = 0$ với mọi $i=1,...,s-1$. Vì vậy phương trình #eqref(<eq:29>) có thể viết lại như sau:
$ sum_(i=1)^n x_i = 2tilde(w)_k - W. $
Ngoài ra, ta cũng có:
$ 0 <= x_i <= cases( overline(w)_i - w_i "nếu" x_i = p_i, w_i - underline(w)_i "nếu" x_i = q_i )
$ <eq:34>
Tiếp theo, ta đặt:
$ u_i := cases(overline(w)_i - w_i "nếu" x_i = p_i, w_i - underline(w)_i "nếu" x_i = q_i) $ <eq:35>
Từ đây, ta có:
$ 0<=x_i<=u_i quad quad forall i=1,2,...,n. $
Tóm lại, từ #eqref(<eq:34>) và #eqref(<eq:35>), ta được:
$
("LKP") \
min quad & sum_(i=1)^n c_i x_i\
"s.t." quad & sum_(i=1)^n x_i = b\
& x_i <= u_i quad quad quad quad quad quad quad quad quad quad quad i=1,2...,n\
& x_i >= 0 quad quad quad quad quad quad quad quad quad quad quad i=1,2...,n
$ <eq:37>
Trong đó $c_i$ và $b= 2tilde(w)_k - W$ không âm.
Từ #eqref(<eq:37>), ta thấy rằng (LKP) là bài toán xếp ba lô liên tục. Như đã trình bày ở phần trước, bài toán trên có thể được giải trong thời gian tuyến tính. Vì vậy, bài toán inverse 1-median trên cây với trọng số dương có thể được giải trong thời gian $O(n).$
#theorem[ Bài toán inverse 1-median trên cây với trọng số không âm có thể được giải trong thời gian đa thức.]
Bây giờ, ta sẽ xét ví dụ sau.
*Ví dụ* Cho cây $T(V,E)$ có trọng số như hình bên dưới. Điểm $v_2$ đang là điểm 1-median. Ta cần phải chỉnh $w_i, i=1,...,6$ sao cho $v_4$ trở thành điểm 1-median, đồng thời vẫn thỏa mãn các giới hạn cho trước. Cụ thể:
$c_1=1, c_2 = 6, c_3 = 4, c_4 =5, c_5=7, c_6 = 8 $
$
4 <= w_1 <= 8,
4 <= w_2 <= 6,
5 <= w_3 <= 9,
3 <= w_4 <= 5,
2 <= w_5 <= 6,
2 <= w_6 <= 4.
$
#align(center)[#canvas(length: 7%, {
import cetz.draw: *
let y = 2
let x = 4
let y-space = 1
let h=1.4
circle((0*h,3), radius: 0.05,fill:black, name: "v2")
content("v2.left", $v_2 (5)$, anchor: "left", padding: 0.2)
circle((-3,0), radius: 0.05,fill:black, name: "v1")
content("v1.left", $v_1 (6)$, anchor: "left", padding: 0.2)
circle((-3,6), radius: 0.05,fill:black, name: "v3")
content("v3.left", $v_3 (7)$, anchor: "left", padding: 0.2)
circle((4,3), radius: 0.05,fill:black, name: "v4")
content("v4.left", $v_4 (4)$, anchor: "left", padding: 0.2)
circle((7,6), radius: 0.05,fill:black, name: "v5")
content("v5.left", $v_5 (3)$, anchor: "left", padding: 0.2)
circle((7,0), radius: 0.05,fill:black, name: "v6")
content("v6.left", $v_6 (3)$, anchor: "left", padding: 0.2)
line("v1","v2")
line("v3","v2")
line("v4","v2")
line("v4","v5")
line("v4","v6")
}
)]
$b = 2 tilde(w)_k - W = 2.18 - 28 = 8 $
Thế vào #eqref(<eq:37>), ta được:
$
("LKP") \
min quad & sum_(i=1)^6 c_i x_i\
"s.t." quad & sum_(i=1)^6 x_i = 8\
& 0 <= x_1 <= 2\
& 0 <= x_2 <= 1 \
& 0 <= x_3 <= 2 \
& 0 <= x_4 <= 1 \
& 0 <= x_5 <= 3 \
& 0 <= x_6 <= 1 \
$ <eq:39>
Vậy là ta đã hoàn thành bước viết lại bài toán inverse 1-median thành bài toán xếp ba lô liên tục, như đã trình bày ở phần trước ta sẽ tiến hành giải bài toán <eq:39> bằng thuật toán tham lam.
Sau khi giải ta thu được kết quả sau $x_1 = 2, x_2 = 1, x_3 = 2, x_4 =1, x_5 = 2, x_6 = 0.$
Khi đó, ta thu được các trọng số mới của mỗi đỉnh như sau:
$
w^*_1 = w_1 + p_1 - q_1 = 6 - 2 = 4 \
w^*_2 = w_2 + p_2 - q_2 = 5 - 1 = 4 \
w^*_3 = w_3 + p_3 - q_3 = 7 - 2 = 5 \
w^*_4 = w_4 + p_4 - q_4 = 4 + 1 = 5 \
w^*_5 = w_5 + p_5 - q_5 = 3 + 2 = 5 \
w^*_6 = w_6 + p_6 - q_6 = 3 + 0 = 3 \
$
Ta được đồ thị cây $T=(V,E)$ với trọng số mới được biểu diễn ở hình bên dưới.
#align(center)[#canvas(length: 7%, {
import cetz.draw: *
let y = 2
let x = 4
let y-space = 1
let h=1.4
circle((0*h,3), radius: 0.05,fill:black, name: "v2")
content("v2.left", $v_2 (4)$, anchor: "left", padding: 0.2)
circle((-3,0), radius: 0.05,fill:black, name: "v1")
content("v1.left", $v_1 (4)$, anchor: "left", padding: 0.2)
circle((-3,6), radius: 0.05,fill:black, name: "v3")
content("v3.left", $v_3 (5)$, anchor: "left", padding: 0.2)
circle((4,3), radius: 0.05,fill:black, name: "v4")
content("v4.left", $v_4 (5)$, anchor: "left", padding: 0.2)
circle((7,6), radius: 0.05,fill:black, name: "v5")
content("v5.left", $v_5 (5)$, anchor: "left", padding: 0.2)
circle((7,0), radius: 0.05,fill:black, name: "v6")
content("v6.left", $v_6 (3)$, anchor: "left", padding: 0.2)
line("v1","v2")
line("v3","v2")
line("v4","v2")
line("v4","v5")
line("v4","v6")
}
)]
|
|
https://github.com/andreasKroepelin/lovelace | https://raw.githubusercontent.com/andreasKroepelin/lovelace/main/examples/long.typ | typst | MIT License | #import "../lib.typ": *
#set page(width: auto, height: 50em, margin: 1em)
#set text(font: "TeX Gyre Pagella")
#show math.equation: set text(font: "TeX Gyre Pagella Math")
#pseudocode(
booktabs: true,
// title: [My title],
..(([a line], ) * 100)
)
|
https://github.com/Error-418-SWE/Documenti | https://raw.githubusercontent.com/Error-418-SWE/Documenti/src/2%20-%20RTB/Documentazione%20interna/Verbali/24-02-11/24-02-11.typ | typst | #import "/template.typ": *
#show: project.with(
date: "11/02/24",
subTitle: "Meeting di retrospettiva e pianificazione",
docType: "verbale",
authors: (
"<NAME>",
),
timeStart: "15:00",
timeEnd: "16:15",
);
= Ordine del giorno
- Valutazione del progresso generale;
- Analisi di retrospettiva;
- Seconda parte RTB con il #vardanega;
- Pianificazione.
== Valutazione del progresso generale
Il meeting si avvia con con l'analisi dello sprint concluso. Nonostante si trattasse del primo sprint a seguito della sessione degli esami, la ripresa dei lavori è stata rapida (warm start), grazie anche alla scelta di non interrompere i lavori negli sprint precedenti ma di ridimensionare il carico di lavoro per far fronte agli impegni universitari. Il corretto andamento dello sprint è supportato anche dalle metriche esposte sul cruscotto di qualità realizzato in Grafana.
=== Revisione #ndp
Sono stati revisionati la maggior parte dei capitoli del documento, anche se il lavoro non è ancora del tutto ultimato.\
Rimangono le task relative a:
- Rimuovere capitolo Processi di supporto/Documentazione (capitolo obsoleto non conforme allo standard ISO adottato);
- Revisione ultimi capitoli rimasti.
=== Revisione #adr
Il gruppo si è impegnato a risolvere tutte le criticità riscontrate dal #cardin durante la prima parte di revisione RTB, precisamente la valutazione è stata:
- Il glossario va riferito anche con il numero di versione del documento;
- UC2: quali sono le informazioni che possono essere modificate?
- UC3.1: quali sono i dati necessari alla creazione dello scaffale?
- UC3.2: cosa può essere modificato di uno scaffale?
- UC4.1: quali sono i dati necessari alla creazione di un bin?
- UC4.2: cosa può essere modificato di un bin?
- UC6: il database è interno all'applicazione o è possibile collegarsi a database esterni? Se siì, quali? Se invece è interno, allora il database non può essere un attore secondario (in ogni caso, la primitiva grafica scelta non esiste in UML 2);
- UC6.1 è precondizione di UC6, non sua inclusione;
- UC6.1 cosa si intende con "configurazione"? Quali informazioni?
- UC7: cosa sono le API? Se sono API interne, allora non possono essere attore secondario. Inoltre, perché la funzionalità è una "richiesta"?
- UC8 e seguenti: modificare "interrogazione" con "visualizzazione". Quali informazioni sono visualizzate?
- UC11 va analizzato più in dettaglio. I requisiti di qualità mancano della creazione dei manuali richiesti;
- VM1 e VM2 sono funzionali;
- VM3 non è chiaro e quindi non verificabile;
- Non è presente il tracciamento casi d'uso / requisiti.
Il documento abbozza una struttura corretta, ma il livello di analisi raggiunto è spesso poco dettagliato e lacunoso. Inoltre, sono presenti alcuni errori di modellazione.
Tutti queste criticità sono state corrette durante lo sprint appena concluso e il documento è ora pronto per essere revisionato prima dell'ingresso in PB.
=== Revisione #pdp e #pdq
Il lavoro sul #pdp segue dal big bang attuato durante gli sprint precedenti e viene concluso. Vengono inoltre redatti:
- preventivo sprint 12;
- preventivo sprint 13;
- consuntivo sprint 13;
- preventivo sprint 14.
segue un generale refactoring del documento.
Il #pdq invece è stato esteso e aggiornato con le metriche del periodo e la loro analisi. Vengono inoltre inseriti i grafici generati con Grafana.
=== Candidatura seconda parte RTB
Il gruppo ha concordato l'invio della mail per sostenere la seconda parte della revisione esterna RTB con il #vardanega in data 14/02/2024.
== Analisi di retrospettiva
=== Keep doing
In merito al successo dello sprint 14 ha contribuito un'efficace pianificazione delle task e il rispetto della modalità di lavoro asincrona.
=== Improvements
Basso utilizzo di Miro per i meeting di retrospettiva, segnalare anche piccole criticità contribuisce al continuo miglioramento del gruppo.
Ritardi nelle correzioni delle pr, se un solo verificatore non risulta sufficiente a causa di un numero consistente di pull request aperte, il gruppo si impegnerà a scegliere un ulteriore membro che, in qualità di verificatore provvederà alle review. Tale soluzione permette inoltre di ridimensionare il numero di branch aperti e ridurre conseguentemente la probabilità di merge conflict.
Struttura dei verbali non sempre conforme,richiesta maggiore attenzione nella struttra dei verbali da parte dei redattori e dei revisori.
== Seconda parte RTB con #vardanega
Il gruppo di comune accordo ha deciso di inviare al #vardanega la mail di candidatura per la seconda parte della revisione RTB mercoledì 14/02/24. Il Responsabile ha il compito di redigere la mail e inviarla.
Viene inoltre pianificata una riunione a seguito della risposta del professore per creare le slide della presentazione e stilare un discorso ripartendo i vari argomenti tra i membri del gruppo.
== Pianificazione sprint
Per lo sprint 15 sono stati programmati i seguenti compiti:
- completare le ultime task necessarie per la candidatura;
- inviare la mail per la candidatura al secondo sportello di valutazione RTB;
- definire un meeting inerente alla presentazione RTB a seguito della risposta del professore;
- discutere delle azioni da intraprendere per la parte di PB in modo da evitare la sospensione delle attività aspettando il responso del professore.
|
|
https://github.com/Shuenhoy/modern-zju-thesis | https://raw.githubusercontent.com/Shuenhoy/modern-zju-thesis/master/lib.typ | typst | MIT License | #import "documentclass/undergraduate-cs.typ"
#import "documentclass/graduate-general.typ"
#import "utils/fonts.typ"
#import "utils/part.typ"
#import "utils/appendix.typ": appendix
#import "utils/structure.typ": frontmatter, mainmatter |
https://github.com/realcomplex0/icpc-pipari | https://raw.githubusercontent.com/realcomplex0/icpc-pipari/main/notebook.typ | typst | #set page(flipped: true, numbering: "1",
margin: (
left: 0.5cm,
right: 0.5cm,
top: 0.5cm,
bottom: 1cm
))
#set heading(numbering: "1.")
#set align(center)
#set text(
size: 10pt,
font: "New Computer Modern"
)
#block(
spacing: 2em
)[
LU ICPC komanda "Mazmazītiņ<NAME>i"
- <NAME>
- <NAME>
- <NAME>
]
#set text(
size: 8pt,
font: "New Computer Modern"
)
#set align(left)
#columns(3, gutter: 2em)[
#outline()
= C++
== Optimizations
```cpp
#pragma GCC optimize("Ofast, unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt,tune=native")
```
== Hash function
```cpp
static uint64_t splitmix64(uint64_t x)
{x+=0x9e3779b97f4a7c15;x=(x^(x>>30))*0xbf58476d1ce4e5b9;
x=(x^(x>>27))*0x94d049bb133111eb;
return x^(x>>31);}
struct custom_hash {size_t operator()(uint64_t x) const {
static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();return splitmix64(x+FIXED_RANDOM);}};
const long long mod=998244353;
//1000000007
long long modpow(long long n, long long m){long long res=1;while(m){if(m&1)res=res*n%mod;n=n*n%mod;m>>=1;}return res;}
```
= Algebra
$ sum_(i=1)^n k^2=(n(n+1)(2n+1))/6 $
$ sum_(i=1)^n k^3=(n(n+1)/2)^2 $
= Number Theory
== Extended GCD
```cpp
int gcd(int a, int b, int& x, int& y) {
if (b == 0) {
x = 1;
y = 0;
return a;
}
int x1, y1;
int d = gcd(b, a % b, x1, y1);
x = y1;
y = x1 - y1 * (a / b);
return d;
}
```
= Data Structures
== Treap
```cpp
struct Node{
int value, cnt, pri; Node *left, *right;
Node(int p) : value(p), cnt(1), pri(gen()),
left(NULL), right(NULL) {};
};
typedef Node* pnode;
int get(pnode q){if(!q) return 0; return q->cnt;}
void update_cnt(pnode &q){
if(!q) return; q->cnt=get(q->left)+get(q->right)+1;
}
void merge(pnode &T, pnode lef, pnode rig){
if(!lef){T=rig;return;} if(!rig){T=lef;return;}
if(lef->pri>rig->pri){merge(lef->right,lef->right,rig);T=lef;
}else{merge(rig->left, lef, rig->left); T = rig;}
update_cnt(T);
}
void split(pnode cur, pnode &lef, pnode &rig, int key){
if(!cur){lef=rig=NULL;return;} int id=get(cur->left)+1;
if(id<=key){split(cur->right,cur->right,rig,key-id);lef=cur;}
else {split(cur->left, lef, cur->left, key); rig = cur;}
update_cnt(cur);
}
```
= Algoritms
== Kuhn's algorithm
```cpp
// node matching indexed 1-n with 1-m
const int N = ansus;
vector<int> g[N];
int mt[N], ind[N];
bool used[N];
bool kuhn(int u)
{
if(used[u])
return 0;
used[u]=1;
for(auto v:g[u])
{
if(mt[v]==-1||kuhn(mt[v]))
{
mt[v]=u;
ind[u]=v;
return 1;
}
}
return 0;
}
int main()
{
for(int i = 0;i<m;i++)
mt[i]=-1;
for(int i = 0;i<n;i++)
ind[i]=-1;
for(int run = 1;run;)
{
run=0;
for(int i = 0;i<n;i++)
used[i]=0;
for(int i = 0;i<n;i++)
if(ind[i]==-1&&kuhn(i))
run=1;
}
// ind[u] = -1, ja nav matchots, citadi ind[u] = indekss no otras komponentes
}
```
== Flows
=== Dinitz
```cpp
struct FlowEdge {
int v, u;
ll cap, flow = 0;
FlowEdge(int v, int u, ll cap) : v(v), u(u), cap(cap) {}
};
struct Dinic {
const long long flow_inf = 1e18;
vector<FlowEdge> edges;
vector<vector<int>> adj;
int n, m = 0;
int s, t;
vector<int> level, ptr;
queue<int> q;
Dinic(int n, int s, int t) : n(n), s(s), t(t) {
adj.resize(n);
level.resize(n);
ptr.resize(n);
}
void add_edge(int v, int u, ll cap) {
edges.push_back(v, u, cap);
edges.push_back(u, v, 0);
adj[v].push_back(m);
adj[u].push_back(m + 1);
m += 2;
}
bool bfs() {
while (!q.empty()) {
int v = q.front();
q.pop();
for (int id : adj[v]) {
if (edges[id].cap - edges[id].flow < 1)
continue;
if (level[edges[id].u] != -1)
continue;
level[edges[id].u] = level[v] + 1;
q.push(edges[id].u);
}
}
return level[t] != -1;
}
ll dfs(int v, ll pushed) {
if (pushed == 0)
return 0;
if (v == t)
return pushed;
for (int& cid = ptr[v]; cid < (int)adj[v].size(); cid++) {
int id = adj[v][cid];
int u = edges[id].u;
if (level[v] + 1 != level[u] || edges[id].cap - edges[id].flow < 1)
continue;
ll tr = dfs(u, min(pushed, edges[id].cap - edges[id].flow));
if (tr == 0)
continue;
edges[id].flow += tr;
edges[id ^ 1].flow -= tr;
return tr;
}
return 0;
}
ll flow() {
ll f = 0;
while (true) {
fill(level.begin(), level.end(), -1);
level[s] = 0;
q.push(s);
if (!bfs())
break;
fill(ptr.begin(), ptr.end(), 0);
while (ll pushed = dfs(s, flow_inf)) {
f += pushed;
}
}
return f;
}
};
```
= Strings
== Manacher's algorithm longest palindromic substring
```cpp
int manacher(string s){
int n = s.size(); string p = "^#";
rep(i,0,n) p += string(1, s[i]) + "#";
p += "$"; n = p.size(); vector<int> lps(n, 0);
int C=0, R=0, m=0;
rep(i,1,n-1){
int mirr = 2*C - i;
if(i < R) lps[i] = min(R-i, lps[mirr]);
while(p[i + 1 + lps[i]] == p[i - 1 - lps[i]]) lps[i]++;
if(i + lps[i] > R){ C = i; R = i + lps[i]; }
m = max(m, lps[i]);
}
return m;
}
```
== Suffix Array
```cpp
const int M = 26;
void count_sort(vector<int> &p, vector<int> &c)
{
int n = p.size();
vector<int> pos(M+1);
for(auto x:c)
pos[x+1]++;
for(int i = 1;i<=M;i++)
pos[i]+=pos[i-1];
vector<int> p_new(n);
for(int i = 0;i<n;i++)
p_new[pos[c[p[i]]]++]=p[i];
swap(p,p_new);
}
int main()
{
fio
//ifstream cin("in.in");
int n, m;
cin >> n >> m;
vector<int> str(n);
for(auto &x:str)
cin >> x;
str.pb(-1);
n++;
vector<int> p(n), c(n);
{
vector<pair<char,int> > ve(n);
for(int i = 0;i<n;i++)
ve[i]={str[i],i};
sort(ve.begin(),ve.end());
for(int i = 0;i<n;i++)
p[i]=ve[i].se;
for(int i = 1;i<n;i++)
c[p[i]]=c[p[i-1]]+(ve[i].fi!=ve[i-1].fi);
}
for(int k = 0;(1<<k)<n;k++)
{
for(int i = 0;i<n;i++)
p[i]=(p[i]-(1<<k)+n)%n;
count_sort(p,c);
vector<int> c_new(n);
for(int i = 1;i<n;i++)
c_new[p[i]]=c_new[p[i-1]]+(c[p[i]]!=c[p[i-1]]||c[(p[i]+(1<<k))%n]!=c[(p[i-1]+(1<<k))%n]);
swap(c,c_new);
}
vector<int> lcp(n);
int k = 0;
for(int i = 0;i<n-1;i++)
{
int j = p[c[i]-1];
while(str[i+k]==str[j+k])
k++;
lcp[c[i]]=k;
k=max(k-1,0);
}
return 0;
}
```
= Geometry
== Online Convex Hull trick
```cpp
// KTH notebook
struct Line {
mutable ll k, m, p;
bool operator<(const Line& o) const { return k < o.k; }
bool operator<(ll x) const { return p < x; }
};
struct LineContainer : multiset<Line, less<>> {
// (for doubles, use inf = 1/.0, div(a,b) = a/b)
static const ll inf = LLONG_MAX;
ll div(ll a, ll b) { // floored division
return a / b - ((a ^ b) < 0 && a % b); }
bool isect(iterator x, iterator y) {
if (y == end()) return x->p = inf, 0;
if (x->k == y->k) x->p = x->m > y->m ? inf : -inf;
else x->p = div(y->m - x->m, x->k - y->k);
return x->p >= y->p;
}
void add(ll k, ll m) {
auto z = insert({k, m, 0}), y = z++, x = y;
while (isect(y, z)) z = erase(z);
if (x != begin() && isect(--x, y)) isect(x, y = erase(y));
while ((y = x) != begin() && (--x)->p >= y->p)
isect(x, erase(y));
}
ll query(ll x) {
assert(!empty());
auto l = *lower_bound(x);
return l.k * x + l.m;
}
};
```
== Maximum points in a circle of radius R
```cpp
typedef pair<double,bool> pdb;
#define START 0
#define END 1
struct PT
{
double x, y;
PT() {}
PT(double x, double y) : x(x), y(y) {}
PT(const PT &p) : x(p.x), y(p.y) {}
PT operator + (const PT &p) const { return PT(x+p.x, y+p.y); }
PT operator - (const PT &p) const { return PT(x-p.x, y-p.y); }
PT operator * (double c) const { return PT(x*c, y*c ); }
PT operator / (double c) const { return PT(x/c, y/c ); }
};
PT p[505];
double dist[505][505];
int n, m;
void calcDist()
{
FOR(i,0,n)
{
FOR(j,i+1,n)
dist[i][j]=dist[j][i]=sqrt((p[i].x-p[j].x)*(p[i].x-p[j].x)
+(p[i].y-p[j].y)*(p[i].y-p[j].y));
}
}
int intelInside(int point, double radius)
{
vector<pdb> ranges;
FOR(j,0,n)
{
if(j==point || dist[j][point]>2*radius) continue;
double a1=atan2(p[point].y-p[j].y,p[point].x-p[j].x);
double a2=acos(dist[point][j]/(2*radius));
ranges.pb({a1-a2,START});
ranges.pb({a1+a2,END});
}
sort(ALL(ranges));
int cnt=1, ret=cnt;
for(auto it: ranges)
{
if(it.second) cnt--;
else cnt++;
ret=max(ret,cnt);
}
return ret;
}
int go(double r)
{
int cnt=0;
FOR(i,0,n)
{
cnt=max(cnt,intelInside(i,r));
}
return cnt;
}
```
== Point in polygon
```cpp
int sideOf(const PT &s, const PT &e, const PT &p)
{
ll a = cross(e-s,p-s);
return (a > 0) - (a < 0);
}
bool onSegment(const PT &s, const PT &e, const PT &p)
{
PT ds = p-s, de = p-e;
return cross(ds,de) == 0 && dot(ds,de) <= 0;
}
/*
Main routine
Description: Determine whether a point t lies inside a given polygon (counter-clockwise order).
The polygon must be such that every point on the circumference is visible from the first point in the vector.
It returns 0 for points outside, 1 for points on the circumference, and 2 for points inside.
*/
int insideHull2(const vector<PT> &H, int L, int R, const PT &p) {
int len = R - L;
if (len == 2) {
int sa = sideOf(H[0], H[L], p);
int sb = sideOf(H[L], H[L+1], p);
int sc = sideOf(H[L+1], H[0], p);
if (sa < 0 || sb < 0 || sc < 0) return 0;
if (sb==0 || (sa==0 && L == 1) || (sc == 0 && R == (int)H.size()))
return 1;
return 2;
}
int mid = L + len / 2;
if (sideOf(H[0], H[mid], p) >= 0)
return insideHull2(H, mid, R, p);
return insideHull2(H, L, mid+1, p);
}
int insideHull(const vector<PT> &hull, const PT &p) {
if ((int)hull.size() < 3) return onSegment(hull[0], hull.back(), p);
else return insideHull2(hull, 1, (int)hull.size(), p);
}
```
= Numerical
== FFT
```cpp
using cd = complex<double>;
const double PI = acos(-1);
void fft(vector<cd> & a, bool invert) {
int n = a.size();
for (int i = 1, j = 0; i < n; i++) {
int bit = n >> 1;
for (; j & bit; bit >>= 1)
j ^= bit;
j ^= bit;
if (i < j)
swap(a[i], a[j]);
}
for (int len = 2; len <= n; len <<= 1) {
double ang = 2 * PI / len * (invert ? -1 : 1);
cd wlen(cos(ang), sin(ang));
for (int i = 0; i < n; i += len) {
cd w(1);
for (int j = 0; j < len / 2; j++) {
cd u = a[i+j], v = a[i+j+len/2] * w;
a[i+j] = u + v;
a[i+j+len/2] = u - v;
w *= wlen;
}
}
}
if (invert) {
for (cd & x : a)
x /= n;
}
}
vector<int> multiply(vector<int> const& a, vector<int> const& b) {
vector<cd> fa(a.begin(), a.end()), fb(b.begin(), b.end());
int n = 1;
while (n < a.size() + b.size())
n <<= 1;
fa.resize(n);
fb.resize(n);
fft(fa, false);
fft(fb, false);
for (int i = 0; i < n; i++)
fa[i] *= fb[i];
fft(fa, true);
vector<int> result(n);
for (int i = 0; i < n; i++)
result[i] = round(fa[i].real());
return result;
}
```
#block(breakable: false)[
== NTT
```cpp
const ll mod = (119 << 23) + 1, root = 62; // 998244353
typedef vector<ll> vl;
int modpow(int n, int k);
void ntt(vl &a) {
int n = a.size(), L = 31 - __builtin_clz(n);
static vl rt(2, 1);
for (static int k = 2, s = 2; k < n; k *= 2, s++) {
rt.resize(n);
ll z[] = {1, modpow(root, mod >> s)};
for(int i=k;i<2*k;i++) rt[i] = rt[i / 2] * z[i & 1] % mod;
}
vl rev(n);
for(int i = 0 ; i < n; i ++ ) rev[i] = (rev[i / 2] | (i & 1) << L) / 2;
for(int i = 0 ; i < n; i ++ ) if (i < rev[i]) swap(a[i], a[rev[i]]);
for (int k = 1; k < n; k *= 2)
for (int i = 0; i < n; i += 2 * k) for(int j=0;j<k;j++) {
ll z = rt[j + k] * a[i + j + k] % mod, &ai = a[i + j];
a[i + j + k] = ai - z + (z > ai ? mod : 0);
ai += (ai + z >= mod ? z - mod : z);
}
}
vl conv(const vl &a, const vl &b) {
if (a.empty() || b.empty()) return {};
int s = a.size() + b.size() - 1, B = 32 - __builtin_clz(s),
n = 1 << B;
int inv = modpow(n, mod - 2);
vl L(a), R(b), out(n);
L.resize(n), R.resize(n);
ntt(L), ntt(R);
for(int i = 0 ; i < n;i ++ )
out[-i & (n - 1)] = (ll)L[i] * R[i] % mod * inv % mod;
ntt(out);
return {out.begin(), out.begin() + s};
}
```
]
== Sum of $n^k$ in $O(k^2)$
```cpp
LL mod;
LL S[105][105];
void solve() {
LL n, k;
scanf("%lld %lld %lld", &n, &k, &mod);
S[0][0] = 1 % mod;
for (int i = 1; i <= k; i++) {
for (int j = 1; j <= i; j++) {
if (i == j) S[i][j] = 1 % mod;
else S[i][j] = (j * S[i - 1][j] + S[i - 1][j - 1]) % mod;
}
}
LL ans = 0;
for (int i = 0; i <= k; i++) {
LL fact = 1, z = i + 1;
for (LL j = n - i + 1; j <= n + 1; j++) {
LL mul = j;
if (mul % z == 0) {
mul /= z;
z /= z;
}
fact = (fact * mul) % mod;
}
ans = (ans + S[k][i] * fact) % mod;
}
printf("%lld\n", ans);
}
```
== Gauss method
```cpp
const double EPS = 1e-9;
const int INF = 2; // it doesn't actually have to be infinity or a big number
int gauss (vector < vector<double> > a, vector<double> & ans) {
int n = (int) a.size();
int m = (int) a[0].size() - 1;
vector<int> where (m, -1);
for (int col=0, row=0; col<m && row<n; ++col) {
int sel = row;
for (int i=row; i<n; ++i)
if (abs (a[i][col]) > abs (a[sel][col]))
sel = i;
if (abs (a[sel][col]) < EPS)
continue;
for (int i=col; i<=m; ++i)
swap (a[sel][i], a[row][i]);
where[col] = row;
for (int i=0; i<n; ++i)
if (i != row) {
double c = a[i][col] / a[row][col];
for (int j=col; j<=m; ++j)
a[i][j] -= a[row][j] * c;
}
++row;
}
ans.assign (m, 0);
for (int i=0; i<m; ++i)
if (where[i] != -1)
ans[i] = a[where[i]][m] / a[where[i]][i];
for (int i=0; i<n; ++i) {
double sum = 0;
for (int j=0; j<m; ++j)
sum += ans[j] * a[i][j];
if (abs (sum - a[i][m]) > EPS)
return 0;
}
for (int i=0; i<m; ++i)
if (where[i] == -1)
return INF;
return 1;
}
```
= General
== Simulated Annealing
```cpp
const ld T = (ld)2000;
const ld alpha = 0.999999;
// (new_score - old_score) / (temperature_final) ~ 10 works well
const ld L = (ld)1e6;
ld small_rand(){
return ((ld)gen(L))/L;
}
ld P(ld old, ld nw, ld temp){
if(nw > old)
return 1.0;
return exp((nw-old)/temp);
}
{
auto start = chrono::steady_clock::now();
ld time_limit = 2000;
ld temperature = T;
ld max_score = -1;
while(elapsed_time < time_limit){
auto cur = chrono::steady_clock::now();
elapsed_time = chrono::duration_cast<chrono::milliseconds>(cur - start).count();
temperature *= alpha;
// try a neighboring state
// ....
// ....
old_score = score(old_state);
new_score = score(new_state);
if(P(old_score, new_score, temperature) >= small_rand()){
old_state = new_state;
old_score = new_score;
}
if(old_score > max_score){
max_score = old_score;
max_state = old_state;
}
}
}
```
]
#pagebreak()
= Organization
#table(
columns: (20fr, 10fr, 10fr, 10fr, 10fr, 10fr, 10fr, 10fr, 10fr, 10fr, 10fr, 10fr, 10fr, 10fr),
rows: (2cm, 2cm, 2cm, 2cm, 2cm),
[], [A], [B], [C], [D], [E], [F], [G], [H], [I], [J], [K], [L], [M],
[Read], [], [], [], [], [], [], [], [], [], [], [], [], [],
[Attempted], [], [], [], [], [], [], [], [], [], [], [], [], [],
[Estimate], [], [], [], [], [], [], [], [], [], [], [], [], [],
[\#], [], [], [], [], [], [], [], [], [], [], [], [], []
)
#pagebreak()
#image("hex.png")
#image("hex.png")
#image("hex.png") |
|
https://github.com/frectonz/the-pg-book | https://raw.githubusercontent.com/frectonz/the-pg-book/main/book/137.%20hubs.html.typ | typst | hubs.html
Why Startup Hubs Work
Want to start a startup? Get funded by
Y Combinator.
October 2011If you look at a list of US cities sorted by population, the number
of successful startups per capita varies by orders of magnitude.
Somehow it's as if most places were sprayed with startupicide.I wondered about this for years. I could see the average town was
like a roach motel for startup ambitions: smart, ambitious people
went in, but no startups came out. But I was never able to figure
out exactly what happened inside the motel—exactly what was
killing all the potential startups.
[1]A couple weeks ago I finally figured it out. I was framing the
question wrong. The problem is not that most towns kill startups.
It's that death is the default for startups,
and most towns don't save them. Instead of thinking of most places
as being sprayed with startupicide, it's more accurate to think of
startups as all being poisoned, and a few places being sprayed with
the antidote.Startups in other places are just doing what startups naturally do:
fail. The real question is, what's saving startups in places
like Silicon Valley?
[2]EnvironmentI think there are two components to the antidote: being in a place
where startups are the cool thing to do, and chance meetings with
people who can help you. And what drives them both is the number
of startup people around you.The first component is particularly helpful in the first stage of
a startup's life, when you go from merely having an interest in
starting a company to actually doing it. It's quite a leap to start
a startup. It's an unusual thing to do. But in Silicon Valley it
seems normal.
[3]In most places, if you start a startup, people treat you as if
you're unemployed. People in the Valley aren't automatically
impressed with you just because you're starting a company, but they
pay attention. Anyone who's been here any amount of time knows not
to default to skepticism, no matter how inexperienced you seem or
how unpromising your idea sounds at first, because they've all seen
inexperienced founders with unpromising sounding ideas who a few
years later were billionaires.Having people around you care about what you're doing is an
extraordinarily powerful force. Even the
most willful people are susceptible to it. About a year after we
started Y Combinator I said something to a partner at a well known
VC firm that gave him the (mistaken) impression I was considering
starting another startup. He responded so eagerly that for about
half a second I found myself considering doing it.In most other cities, the prospect of starting a startup just doesn't
seem real. In the Valley it's not only real but fashionable. That
no doubt causes a lot of people to start startups who shouldn't.
But I think that's ok. Few people are suited to running a startup,
and it's very hard to predict beforehand which are (as I know all
too well from being in the business of trying to predict beforehand),
so lots of people starting startups who shouldn't is probably the
optimal state of affairs. As long as you're at a point in your
life when you can bear the risk of failure, the best way to find
out if you're suited to running a startup is to try
it.ChanceThe second component of the antidote is chance meetings with people
who can help you. This force works in both phases: both in the
transition from the desire to start a startup to starting one, and
the transition from starting a company to succeeding. The power
of chance meetings is more variable than people around you caring
about startups, which is like a sort of background radiation that
affects everyone equally, but at its strongest it is far stronger.Chance meetings produce miracles to compensate for the disasters
that characteristically befall startups. In the Valley, terrible
things happen to startups all the time, just like they do to startups
everywhere. The reason startups are more likely to make it here
is that great things happen to them too. In the Valley, lightning
has a sign bit.For example, you start a site for college students and you decide
to move to the Valley for the summer to work on it. And then on a
random suburban street in Palo Alto you happen to run into Sean
Parker, who understands the domain really well because he started
a similar startup himself, and also knows all the investors. And
moreover has advanced views, for 2004, on founders retaining control of their companies.You can't say precisely what the miracle will be, or even for sure
that one will happen. The best one can say is: if you're in a
startup hub, unexpected good things will probably happen to you,
especially if you deserve them.I bet this is true even for startups we fund. Even with us working
to make things happen for them on purpose rather than by accident,
the frequency of helpful chance meetings in the Valley is so high
that it's still a significant increment on what we can deliver.Chance meetings play a role like the role relaxation plays in having
ideas. Most people have had the experience of working hard on some
problem, not being able to solve it, giving up and going to bed,
and then thinking of the answer in the shower in the morning. What
makes the answer appear is letting your thoughts drift a bit—and thus drift off the wrong
path you'd been pursuing last night and onto the right one adjacent
to it.Chance meetings let your acquaintance drift in the same way taking
a shower lets your thoughts drift. The critical thing in both cases
is that they drift just the right amount. The meeting between Larry
Page and <NAME> was a good example. They let their acquaintance
drift, but only a little; they were both meeting someone they had
a lot in common with.For <NAME> the most important component of the antidote was
<NAME>, and vice versa. The antidote is
people. It's not the
physical infrastructure of Silicon Valley that makes it work, or
the weather, or anything like that. Those helped get it started,
but now that the reaction is self-sustaining what drives it is the
people.Many observers have noticed that one of the most distinctive things
about startup hubs is the degree to which people help one another
out, with no expectation of getting anything in return. I'm not
sure why this is so. Perhaps it's because startups are less of a
zero sum game than most types of business; they are rarely killed
by competitors. Or perhaps it's because so many startup founders
have backgrounds in the sciences, where collaboration is encouraged.A large part of YC's function is to accelerate that process. We're
a sort of Valley within the Valley, where the density of people
working on startups and their willingness to help one another are
both artificially amplified.NumbersBoth components of the antidote—an environment that encourages
startups, and chance meetings with people who help you—are
driven by the same underlying cause: the number of startup people
around you. To make a startup hub, you need a lot of people
interested in startups.There are three reasons. The first, obviously, is that if you don't
have enough density, the chance meetings don't happen.
[4]
The second is that different startups need such different things, so
you need a lot of people to supply each startup with what they need
most. <NAME> was exactly what Facebook needed in 2004. Another
startup might have needed a database guy, or someone with connections
in the movie business.This is one of the reasons we fund such a large number of companies,
incidentally. The bigger the community, the greater the chance it
will contain the person who has that one thing you need most.The third reason you need a lot of people to make a startup hub is
that once you have enough people interested in the same problem,
they start to set the social norms. And it is a particularly
valuable thing when the atmosphere around you encourages you to do
something that would otherwise seem too ambitious. In most places
the atmosphere pulls you back toward the mean.I flew into the Bay Area a few days ago. I notice this every time
I fly over the Valley: somehow you can sense something is going on.
Obviously you can sense prosperity in how well kept a
place looks. But there are different kinds of prosperity. Silicon
Valley doesn't look like Boston, or New York, or LA, or DC. I tried
asking myself what word I'd use to describe the feeling the Valley
radiated, and the word that came to mind was optimism.Notes[1]
I'm not saying it's impossible to succeed in a city with few
other startups, just harder. If you're sufficiently good at
generating your own morale, you can survive without external
encouragement. Wufoo was based in Tampa and they succeeded. But
the Wufoos are exceptionally disciplined.[2]
Incidentally, this phenomenon is not limited to startups. Most
unusual ambitions fail, unless the person who has them manages to
find the right sort of community.[3]
Starting a company is common, but starting a startup is rare.
I've talked about the distinction between the two elsewhere, but
essentially a startup is a new business designed for scale. Most
new businesses are service businesses and except in rare cases those
don't scale.[4]
As I was writing this, I had a demonstration of the density of
startup people in the Valley. Jessica and I bicycled to University
Ave in Palo Alto to have lunch at the fabulous Oren's Hummus. As
we walked in, we met <NAME> sitting near the door. Selina
Tobaccowala stopped to say hello on her way out. Then <NAME>
came in to pick up a take out order. After lunch we went to get
frozen yogurt. On the way we met <NAME>. When we got to the
yogurt place, we found <NAME> there, and as we walked out we ran
into <NAME>ov. We walked with him for a block or so and we ran
into Muzzammil Zaveri, and then a block later we met <NAME>.
This is everyday life in Palo Alto. I wasn't trying to meet people;
I was just having lunch. And I'm sure for every startup founder
or investor I saw that I knew, there were 5 more I didn't. If Ron
Conway had been with us he would have met 30 people he knew.Thanks to <NAME>, <NAME>, <NAME>, and
<NAME> for reading drafts of this.
|
|
https://github.com/VZkxr/Typst | https://raw.githubusercontent.com/VZkxr/Typst/master/Seminario/Solucion%20propuesta/solucion.typ | typst | #import "codly-0.2.1/codly.typ": *
#show: codly-init.with()
#let icon(codepoint) = {
box(
height: 0.8em,
baseline: 0.05em,
image(codepoint)
)
h(0.1em)
}
#codly(languages: (
rust: (name: "Rust", icon: icon("brand-rust.svg"), color: rgb("#CE412B")),
python: (name: "Python", icon: icon("brand-python.svg"), color: rgb("#3572A5")),
))
#align(center, text(font: "Times New Roman", size: 15pt)[
*El problema*
])
Durante la pandemia del 2019, se construyó un software para los hospitales que asignaba una habitación al azar a los pacientes para mantenerlos en cuarentena. En uno de esos hospitales con seis habitaciones, se presentó la situación de que a dos pacientes se les asignó la misma habitación. Se tuvo qué reiniciar el sorteo cuatro veces más para por fin asignarles una habitación distinta. ¿Qué tan común es que suceda esta cantidad de iguales asignaciones? ¿Cómo podría visualizarse qué tan común es?. \ \
_Solución propuesta._ \
Notemos que sólo se puede empatar o desempatar, entonces lo que estamos considerando son cuatro ensayos de Bernoulli independientes, así que se trata de un problema con distribución binomial, donde el espacio muestral denotado por $S$ son cuatro sorteos consecutivos de dos personas y la variable aleatoria $X$ es el número de empates en cada $s in S$. \
Hay 36 formas posibles de asignar las dos habitaciones, de las cuales sólo hay 6 formas de asignar la misma, entonces hay una probabilidad $p = 6/36 = 1/6$ de quedar en una misma habitación y $1-p = 5/6$ de probabilidad de no quedar en la misma habitación. \
Así, la probabilidad que de 4 reinicios en el software, los 4 reinicios asignen la misma habitación es
$ P(X=4)= mat(4; 4)p^4 (1-p)^0 = (1/6)^4 = 1/1296 $
Para saber qué tan común es este suceso, usaremos su esperanza y veremos que tan alejado está con la desviación estándar.
Se tiene que
$
EE[X]=n p = 4(1/6) = 2/3 \
sigma = sqrt(n p (1-p)) = sqrt(4(1/6)(5/6))=sqrt(5)/3
$
Ahora, veamos a cuántas "sigmas" se encuentra el evento:
$
EE[X] + k sigma &= 4 \
arrow.l.r.double.long k &= (4-EE[X])/sigma \
arrow.l.r.double.long k &= frac(4-2/3, sqrt(5)/3) \
arrow.l.r.double.long k &= 10/sqrt(5) \
& approx 4.47
$
El evento se encuentra aproximadamente a $4.5 sigma$, es decir, es bastante raro.
Metiendo los datos a Python, podemos mostrar la siguiente gráfica:
#pagebreak()
#set page(header: [
Problema de las habitaciones
#h(1fr)
Demo 2])
#figure(
image("Recursos/gr_1.png", width: 80%),
caption: [
Visualización del problema.
],
supplement: [Figura]
)
Código:
```python
#Importar paqueterías
import numpy as np
import matplotlib.pyplot as plt
from scipy.stats import binom
# Parámetros
n = 4 # ensayos
p = 1/6 # éxito
mu = n * p # media
sigma = np.sqrt(mu * (1 - p)) # varianza
# Valor objetivo
target = 4
# Calcular k
k = (target - mu) / sigma
# x (números de éxitos)
x = np.arange(0, 5)
# Probabilidad para cada valor x
probabilidades = binom.pmf(x, n, p)
# Graficar
plt.bar(x, probabilidades, align='center', alpha=0.5)
plt.title('Distribución Binomial')
plt.xlabel('Número de Éxitos')
plt.ylabel('Probabilidad')
# Graficar línea vertical en k*sigma desde la media
k_sigma_value = mu + k * sigma
plt.axvline(x=k_sigma_value, color='red', linestyle='--', label=f'μ + k*σ, (k={k:.2f})')
plt.legend()
plt.show()
# Imprimir valores
print(f"El valor de σ es: {sigma}")
print(f"El valor de k es: {k}")
print(f"El valor de kσ es: {k*sigma}")
print(f"El valor de μ + kσ es: {mu + k*sigma}")
``` |
|
https://github.com/KireinaHoro/research-plan | https://raw.githubusercontent.com/KireinaHoro/research-plan/master/infk-doctoral-plan/infk-doctoral-plan.typ | typst | /// Draws a horizontal rule; useful for creating signature fields.
///
/// *Example:*
/// #example(```
/// table(
/// columns: (auto, 4cm),
/// stroke: none,
/// row-gutter: 1em,
/// [First Person], rule(100%),
/// [Second Person], rule(100%),
/// )
/// ```)
///
/// - length (length): Length of the rule to draw.
/// -> content
#let rule(length) = line(start: (0pt, 1em), end: (length, 1em))
/// Extract all text from a piece of content.
/// - content (content): input content to extract from
/// -> str
#let to-string(content) = {
if content.has("text") {
content.text
} else if content.has("children") {
content.children.map(to-string).join("")
} else if content.has("body") {
to-string(content.body)
} else if content == [ ] {
" "
} else {
""
}
}
/// Find the name of previous heading of a given label.
/// - it (label): Position to search backwards from.
/// -> str
#let prev-heading(it) = {
to-string(query(selector(heading).before(it)).last())
}
/// Check if a given element is inside the glossary section.
/// - it (any): Element to check for.
/// - glossary-name (str): Name of the glossary section.
/// -> boolean
#let is-glossary(it, glossary-name: "Glossary") = {
if type(it) == label {
prev-heading(it).match(glossary-name) != none
} else { false }
}
/// Create a work package header. Can be further stylized with a show rule.
///
/// *Example:*
///
/// #example(```
/// show figure.where(kind: "work-package"): it => [
/// #let c = counter(figure.where(kind: "work-package"))
/// #let num = locate(loc => {
/// numbering(it.numbering, ..c.at(loc))
/// })
/// #set text(style: "italic")
/// WP #num: #it.body #parbreak()
/// ]
///
/// work-package([Implement a demo system], [3 months])
/// work-package([Test the system], [6 months])
/// ```, dir: ttb)
///
/// - name (content): Name of the work package.
/// - duration (content): Duration of the work package.
/// -> content
#let work-package(name, duration) = figure(
[#name (#duration)],
kind: "work-package", supplement: "WP", numbering: "1",
)
/// Generate a TODO message. You can use `fill` and `prefix` to create comment
/// functions for other authors.
///
/// *Example:*
///
/// #example(`todo[Specify exact system requirements here!]`)
/// #example(```
/// let commenter-a = todo.with(fill: blue, prefix: [Commenter A])
/// let commenter-b = todo.with(fill: orange, prefix: [Commenter B])
///
/// commenter-a[Looks a bit messy.]
/// commenter-b[I agree!]
/// ```)
///
/// - fill (color): Color of the output text.
/// - prefix (content): Prefix of the printed message.
/// - inline (boolean):
/// Insert TODO message inline. If `false`, inserts paragraph breaks
/// around the message.
///
/// Example inline message:
/// #example(`[We have a paragraph here. #todo(inline: true)[Where?] This is a great paragraph.]`, dir: ttb)
/// - msg (content): Content of the TODO message.
/// -> content
#let todo(fill: red, prefix: [TODO], inline: false, msg) = {
if (not inline) { parbreak() }
text(fill, [*#prefix*: #msg])
if (not inline) { parbreak() }
}
/// Template for the doctoral plan.
/// - student-name (content): Name of the student.
/// - student-number (content): Legi number of the student.
/// - supervisor-name (content): Name of the supervisor.
/// - second-advisor-name (content): Name of the second advisor.
/// - start-date (datetime): Start date of the doctoral studies.
/// - title (content): Title of the doctoral thesis.
/// - doc (content): Body of the doctoral plan.
#let document(
student-name: [Happy Student],
student-number: [00-000-000],
supervisor-name: [Prof. Dr. <NAME>],
second-advisor-name: [Prof. Dr. <NAME>],
start-date: datetime.today(),
title: [Awesome PhD Research],
doc
) = [
// try to mimic the look and feel of the latex template
#set text(
size: 11pt,
lang: "en",
region: "us",
)
#set par(
leading: 0.55em,
justify: true
)
#show raw: set text(font: "Inconsolata")
#show par: set block(spacing: 0.55em, above: 1.4em)
#show heading: set block(above: 1.4em, below: 1em)
// make links visible (do not highlight glossary labels)
#show link: it => {
if is-glossary(it.dest) {
it
} else {
box(stroke: aqua, it)
}
}
#show ref: it => {
if query(it.target).len() != 0 {
let t = query(it.target).first()
// use name of section instead of number, unless it's a work package
let is-wp = t.has("kind") and t.kind == "work-package"
if t.numbering == none or not is-wp {
link(it.target, emph(t.body))
} else {
link(it.target, it)
}
} else {
// no target: must be a citation
box(stroke: lime, it)
}
}
// D-INFK doctoral administration header & footer
#set page(
paper: "a4",
margin: (x: 1in, top: 0.75in + 11em, bottom: 0.75in + 1em),
header: grid(
columns: (6fr, 4fr),
align: top,
image("logos/eth.svg", width: 60%),
[
#set text(size: 8pt)
*Department of Camputer Science* \
*Doctoral administration*
ETH Zurich \
CAB H 37.1 \
Universitätstrasse 6 \
CH-8092 Zurich
#link("mailto:<EMAIL>")[<EMAIL>] \
#link("https://www.inf.ethz.ch")[inf.ethz.ch]
]
),
footer: grid(
columns: (1fr, auto, 1fr),
align: (left, center, right),
[Doctoral Plan #student-name],
counter(page).display("1"),
datetime.today().display("[month repr:long] [year]")
),
)
= Doctoral Plan
== Basic Information
#table(
columns: (auto, 1fr),
stroke: none,
[Name Doctoral Student], student-name,
[Student Number], student-number,
[Name Supervisor], supervisor-name,
[Name Second Advisor], second-advisor-name,
[Start of Doctorate], start-date.display("[day] [month repr:long] [year]"),
)
Title Research Proposal
#rect(
width: 100%,
height: 6em,
title
)
#{
// XXX: redefining numbering affects @ syntax
show heading.where(level: 2): set heading(numbering: (_, lvl) => [Part #lvl #h(.5em)])
show heading.where(level: 3): set heading(numbering: (_, _, lvl) => [#lvl. #h(.5em)])
// show rules for work packages
show figure.where(kind: "work-package"): it => [
#let c = counter(figure.where(kind: "work-package"))
#let num = locate(loc => {
numbering(it.numbering, ..c.at(loc))
})
#set text(style: "italic")
#h(-1em) WP #num: #it.body #parbreak()
]
set heading(offset: 1)
doc
}
#pagebreak(weak: true)
= Signatures
#let signature-blank = { v(1.5cm); rule(70%) }
#let date-blank = { v(1.5cm); rule(80%) }
#table(
columns: (6fr, 4fr),
stroke: none,
signature-blank, date-blank,
[Doctoral Student: #student-name], [Date],
signature-blank, date-blank,
[Supervisor: #supervisor-name], [Date],
signature-blank, date-blank,
[Second Advisor: #second-advisor-name], [Date],
)
]
|
|
https://github.com/1sSay/USPTU_conspects | https://raw.githubusercontent.com/1sSay/USPTU_conspects/main/src/math/QuadraticCurves.typ | typst | // Global settings and templates
#set text(14pt)
#let def(term, color: black) = {
box(stroke: color, inset: 7pt, text()[ #term ])
}
// Header
#align(center, heading(level: 1)[Математика \ Аналитическая геометрия])
#align(center, text(weight: "thin")[21.09.2024])
#align(center, text(weight: "thin")[Конспект Сайфуллина Искандара БПО09-01-24])
// Content
== Кривые второго порядка
=== Окружность
#def[$x^2 + y^2 = R^2$, где центр окружности в (0, 0) и радиус $R$ \
Альтернативная форма записи:
$
cases(
x = R * cos(phi) \
y = R * sin(phi)
)
$
]
=== Эллипс
#def[*Каноническое уравнение эллипса*: $ frac(x^2, a^2) + frac(y^2, b^2) = 1 $
$arrow(F_1 F_2) = 2c$ \ $F_1(-c, 0), F_2(c, 0)$ -- *фокусы* эллипса \
*Эксцентриситет*:
$ epsilon = frac(c, a) $
*Оптические свойства*: \
#def()[#text(red)[*TODO*]]
]
=== Гипербола
#def[*Каноническое уравнение гиперболы*: $ frac(x^2, a^2) - frac(y^2, b^2) = 1 $
$arrow(F_1 F_2) = 2c$ \ $F_1(-c, 0), F_2(c, 0)$ -- *фокусы* эллипса \
*Эксцентриситет*:
$ epsilon = frac(c, a) $
*Асимптоты*:
$ y = plus.minus frac(b, a) * x $
*Оптические свойства*: \
#def()[#text(red)[*TODO*]]
]
=== Парабола
#def[
*Фокус:*
$ F(frac(p, 2), 0) $ \
*Директрисса:*
$ x = - frac(p, 2) $\
*Оптические свойства*: \
#def()[#text(red)[*TODO*]]
]
=== Общее уравнение уравнения кривой второго порядка
$
A x^2 + B x y + C y^2 + D x + E y + Q = 0
$
|
|
https://github.com/ludwig-austermann/typst-funarray | https://raw.githubusercontent.com/ludwig-austermann/typst-funarray/main/README.md | markdown | MIT License | # FunArray Package
This package provides some convinient functional functions for [typst](https://typst.app/) to use on arrays.
## Usage
To use this package simply `#import "@preview/funarray:0.3.0"`. To import all functions use `: *` and for specific ones, use either the module or as described in the [typst docs](https://typst.app/docs/reference/scripting#modules).
## Important note
Almost all functions are one-liners, which could, instead of being loaded via a package import, also be just copied directly into your source files.
## Dokumentation
A prettier und easier to read version of the documentation exists in the example folder, which is done in typst and exported to pdf. Otherwise, bellow is the markdown version.
## Functions
Let us define
`a = (1, "not prime", 2, "prime", 3, "prime", 4, "not prime", 5, "prime")`
### chunks
The chunks function translates the array to an array of array. It groups the elements to chunks of a given size and collects them in an bigger array.
`chunks(a, 2) = (
(1, "not prime"),
(2, "prime"),
(3, "prime"),
(4, "not prime"),
(5, "prime")
)`
### unzip
The unzip function is the inverse of the zip method, it transforms an array of pairs to a pair of vectors. You can also give input an array of `n`-tuples resulting in in `n` arrays.
`unzip(b) = (
(1, 2, 3, 4, 5),
(
"not prime",
"prime",
"prime",
"not prime",
"prime"
)
)`
### cycle
The cycle function concatenates the array to itself until it has a given size.
```typst
let c = cycle(range(5), 8)
c = (0, 1, 2, 3, 4, 0, 1, 2)
```
Note that there is also the functionality to concatenate with `+` and `*` in typst.
### windows and circular-windows
This function provides a running window
`windows(c, 5) = (
(0, 1, 2, 3, 4),
(1, 2, 3, 4, 0),
(2, 3, 4, 0, 1),
(3, 4, 0, 1, 2)
)`
whereas the circular version wraps over.
`circular-windows(c, 5) = (
(0, 1, 2, 3, 4),
(1, 2, 3, 4, 0),
(2, 3, 4, 0, 1),
(3, 4, 0, 1, 2),
(4, 0, 1, 2, 4),
(0, 1, 2, 4, 0),
(1, 2, 4, 0, 1),
(2, 4, 0, 1, 2)
)`
### partition and partition-map
The partition function seperates the array in two according to a predicate function. The result is an array with all elements, where the predicate returned true followed by an array with all elements, where the predicate returned false.
```typst
let (primesp, nonprimesp) = partition(b, x => x.at(1) == "prime")
primesp = ((2, "prime"), (3, "prime"), (5, "prime"))
nonprimesp = ((1, "not prime"), (4, "not prime"))
```
There is also a partition-map function, which after partition also applies a second function on both collections.
```typst
let (primes, nonprimes) = partition-map(b, x => x.at(1) == "prime", x => x.at(0))
primes = (2, 3, 5)
nonprimes = (1, 4)
```
### group-by
This functions groups according to a predicate into maximally sized chunks, where all elements have the same predicate value.
```typst
let f = (0,0,1,1,1,0,0,1)
let g = group-by(f, x => x == 0)
g = ((0, 0), (1, 1, 1), (0, 0), (1,))
```
### flatten
Typst has a `flatten` method for arrays, however that method acts recursively. For instance
`(((1,2,3), (2,3)), ((1,2,3), (1,2))).flatten() = (1, 2, 3, 2, 3, 1, 2, 3, 1, 2)`
Normally, one would only have flattened one level. To do this, we can use the typst array concatenation method +, or by folding, the sum method for arrays:
`(((1,2,3), (2,3)), ((1,2,3), (1,2))).sum() = ((1, 2, 3), (2, 3), (1, 2, 3), (1, 2))`
To handle further depth, one can use flatten again, so that in our example:
`(((1,2,3), (2,3)), ((1,2,3), (1,2))).sum().sum() = (((1,2,3), (2,3)), ((1,2,3), (1,2))).flatten()`
### intersperse
This function has been removed in version 0.3, as typst 0.8 provides such functionality by default.
### take-while and skip-while
These functions do exactly as they say.
```typst
take-while(h, x => x < 1) = (0, 0, 0.25, 0.5, 0.75)
skip-while(h, x => x < 1) = (1, 1, 1, 0.25, 0.5, 0.75, 0, 0, 0.25, 0.5, 0.75, 1)
```
## Unsafe Functions
The core functions are defined in `funarray-unsafe.typ`. However, assertions (error checking) are not there and it is generally not being advised to use these directly. Still, if being cautious, one can use the imported `funarray-unsafe` module in `funarray(.typ)`. All function names are the same.
To do this from the package, do as follows:
```
#import @preview/funarray:0.3.0
#funarray.funarray-unsafe.chunks(range(10), 3)
``` |
https://github.com/Myriad-Dreamin/tinymist | https://raw.githubusercontent.com/Myriad-Dreamin/tinymist/main/crates/tinymist-query/src/fixtures/post_type_check/text_font2.typ | typst | Apache License 2.0 | #let y = /* position after */ ("Test",)
#text(font: y)[] |
https://github.com/Servostar/dhbw-abb-typst-template | https://raw.githubusercontent.com/Servostar/dhbw-abb-typst-template/main/tests/invalid-config/test-case-1.typ | typst | MIT License |
#import "../../src/lib.typ": dhbw-template
#show: dhbw-template.with((
lang: none,
region: "en",
author: (
name: "<NAME>",
semester: 4,
program: "Informationtechnology",
course: "TINF19IT1",
faculty: "Technik",
university: "DHBW Mannheim",
company: "ABB AG",
supervisor: "<NAME>",
matriculation-number: 123456789),
thesis: (
title: "Unofficial ABB/DHBW Typst template",
subtitle: "for reports and thesises",
submission-date: "23rd march 2020",
timeframe: "1st january 2020 - 20th march 2020",
kind: "T2000",
summary: none,
abstract: none,
keywords: ( "IT", "other stuff" ),
bibliography: none,
glossary: none,
appendices: none)))
|
https://github.com/typst/packages | https://raw.githubusercontent.com/typst/packages/main/packages/preview/fh-joanneum-iit-thesis/1.2.3/template/chapters/5-implementation.typ | typst | Apache License 2.0 | #import "global.typ": *
= Implementation <implementation>
#lorem(35)#v(0.3cm)
#todo(
[ Describe what is relevant and special about your working prototype. State how
single features help to solve problem(s) at hand. You might implement only the
most relevant features. Features you select from your prioritised feature list
assembled in Chapter 4. Focus novel, difficult, or innovative aspects of your
prototype. Add visuals such as architectures, diagrams, flows, tables,
screenshots to illustrate your work. Select interesting code snippets, e.g. of
somewhat complicated algorithms, to present them as source code listings.
#v(1.4cm)
*For example*, you might explain your overall system, then the details of
the backend and frontend development in subsections as shown here:
== Overall System <architecture>
#lorem(35)#v(0.5cm)
*Hints for images in Typst*
Use vector graphic formats such as #gls("svg") for drawings and png for screenshots.
Using jpeg is only ok, if you need to show photographic images, such as a picture of a sunset.
For example, the following shows how an #gls("svg") image is references using the `image` Typst macro.
The image is furthermore embedded in a `figure` macro. The `flex-caption` allows to
include a full sentence as caption below the image and a short caption for the list of figures.
Also note the use of a label `<fig:companylogo>` which is later referenced with `@fig:companylogo`:
])
#figure(
box(stroke: gray, inset: 1em,
image("/figures/logo.svg", width: 25%)
),
caption: flex-caption(
[The logo of the FH JOANNEUM, the University of Applied Sciences.],
[Company icon provides _Home_ navigation]
)
)<fig:companylogo>
#todo([
The application uses the logo of the company, see @fig:companylogo, in
the navigation bar to provide _home_ functionality.
])
#todo([
== Backend <backend>
#lorem(35)#v(1.3cm)
*Hints for code listings in Typst*:
The way to include source code in your document is
discussed and shown in #link("https://typst.app/docs/reference/text/raw/").
For this template we provide a custom macro/function _fhjcode_ to support listings with
code pulled in from external files and with line numbering. For example:
*For example:* We implemented a minimal #emph[script] in Python to manage a secure `Message`s
in object oriented ways. See @lst:Message and @lst:SecureMessage for a minimal `SecureMessage` class.
])
#figure(
align(
left,
// we use a custom template (style), defined in fh.typ
// the files are expected in subfolder "source"
// optionally, specify firstline/lastline
fhjcode(code: read("/code-snippets/msg.py"), lastline: 5),
),
// we use a custom flex-caption), to allow long and short captions
// (the short one appears in the outline List of Figures).
// This is defined in `lib.typ`.
caption: flex-caption(
[Defining a base class in Python. Here, the base class is named _Message_.], [Base class _Message_.],
),
) <lst:Message>
#figure(
align(
left, fhjcode(code: read("/code-snippets/msg.py"), firstline: 7, lastline: 17),
), caption: flex-caption(
[For inheritance we might define a specialised class based on another class.
Here, the specialised class _SecureMessage_ is based on the class _Message_.],
[Specialised class _SecureMessage_.],
),
) <lst:SecureMessage>
#todo([
*For example:* As shown in @lst:SecureMessage the secure version of the class is just a
stub where further improvements and extensions have to be applied.
])
#todo([
== Frontend <frontend>
#lorem(35)#v(1.3cm)
*Hints for abbreviations and glossary entries _gls(key)_ in Typst*:
Abbreviations should be written in full length on the first occurrence. Later
the short version can be used. Therefore, define glossary entries with a _key_ and
a _short_ as well as a _long_ description first (see file _glossary.typ_). In
the text you might use `#gls(<key>)` (and `#glspl(<key>)` for plural) usage of
an abbreviation. For example:
The system is using #gls("cow") for optimisation. The implementation of #gls("cow") can
be changed by ... Note the usage of the special configured #gls("gc"). We
compared many #glspl("gc") to find out .. ],
)
|
https://github.com/RazaMM/resume | https://raw.githubusercontent.com/RazaMM/resume/main/resume.typ | typst | #import "template.typ": template, education_entry, work_entry, skill_entry, project_entry
#set text(font: "Roboto")
#let color = rgb(0, 0, 0)
#let name = "<NAME>"
#let contact_data = (
(
"service": "email",
"display": "<EMAIL>",
"link": "mailto://<EMAIL>"
),
(
"service": "phone",
"display": "647 988 8229",
"link": "tel:+1 647 988 8229"
),
(
"service": "website",
"display": "razamahmood.com",
"link": "https://razamahmood.com"
),
)
#show: doc => template(name, contact_data, color, doc)
= Education
#education_entry(
"Computer Science (Co-op)",
"University of Guelph",
degree_title: "B.Comp.",
start_date: "September 2017",
end_date: "August 2023",
description: "Specialization in Mathematics", location: "Ontario, Canada"
)
= Experience
#work_entry(
"Front End Web Developer (Co-op)",
"University of Guelph - Communications & Public Affairs",
start_date: "September 2019",
end_date: "August 2021 (Total 16 months)",
tasks: (
"Led a self-managed project to revamp the University campus map using the Google Maps JavaScript API, resulting in an improved user experience.",
"Developed and implemented several responsive Web Components (using JavaScript), streamlining the development process across several university departments.",
"Maintained and updated various PHP-based web pages (Apache and Wordpress) and conceptualized and developed server-side scripts to enhance page functionality and performance."
),
)
#work_entry(
"Freelance Web Developer/Designer",
"Inspectech Services",
start_date: "January 2023",
end_date: "February 2023",
tasks: (
"Utilized SvelteKit and TailwindCSS to build a website for a home inspection company.",
"Implemented a simple email booking form using EmailJS, allowing users to book appointments with the company through the website.",
),
)
#work_entry(
"Web Intern",
"University of Guelph - Communications & Marketing",
start_date: "May 2023",
end_date: "Current",
tasks: (
"Assisted with the revamp of the University's home page developed with GatsbyJS and Bootstrap",
"Implemented and maintained a web components library created with StencilJS simplifying developer experience across the University",
),
)
= Projects
#project_entry(
"planttime.ca",
tasks: (
"Developed and designed the front-end of a plant recommendation web application utilizing Next.js and TailwindCSS",
"Created a GitHub Action using JavaScript to upload a statically generated site to an Amazon Web Services S3 Bucket"
),
start_date: "October 2023",
end_date: "Current",
)
= Skills
#skill_entry(
"Programming Languages",
(
"JavaScript",
"TypeScript",
"PHP",
"C#",
"C",
"Python",
"Java"
)
)
#skill_entry(
"Technologies",
(
"Git",
"Node.js",
"React",
"Gatsby",
"Bootstrap",
"StencilJS",
"Next.js",
"Svelte",
"Drupal",
"Sass",
"SvelteKit",
"TailwindCSS",
"WordPress",
"Apache",
)
) |
|
https://github.com/pawarherschel/typst | https://raw.githubusercontent.com/pawarherschel/typst/main/modules/education.typ | typst | Apache License 2.0 | #import "../template/template.typ": *
#import "../helpers/helpers.typ": *
#let SOT = yaml("../SOT.yaml")
#let education = ()
#if SOT.keys().contains("education") {
education = SOT.education
}
#if education.len() != 0 {
cvSection("Education")
set block(spacing: 0em)
for entry in education {
let title = entry.title
let society = entry.society
let date = entry.date
let location = entry.location
let logo = ""
if entry.keys().contains("logo") {
logo = "../" + entry.logo
}
let description = join-as-bullet-list(entry.description)
cvEntry(
title: title,
society: society,
date: date,
location: location,
logo: logo,
description: description
)
}
} |
https://github.com/Pablo-Gonzalez-Calderon/chic-header-package | https://raw.githubusercontent.com/Pablo-Gonzalez-Calderon/chic-header-package/main/lib/layout.typ | typst | MIT License | /*
* Chic-header - A package for Typst
* <NAME> (c) 2023
*
* layout.typ -- The package's file for handling header and
* footer layouts properly
*
* This file is under the MIT license. For more
* information see LICENSE on the package's main folder.
*/
/*
* chic-distribute-layout
*
* Generates the proper layout for the header and
* footer sides.
*
* Parameters:
* - left-side: Content that goes at the left side
* - center-side: Content that goes at the center
* - right-side: Content that goes at the right side
*/
#let chic-distribute-layout(left-side, center-side, right-side) = {
let sides = (left-side, center-side, right-side)
let not-none-sides = sides.filter(side => {
if side != none {
return true
} else {
return false
}
})
// If only is one side, allow it to use all space
if not-none-sides.len() == 1 {
return sides.map(side => {
if side == none { 0fr } else { 1fr }
})
// If only center is none, divide the width into two
} else if sides.at(1) == none {
return (1fr, 0fr, 1fr)
// Otherwise, give the same width to all sides
} else {
return (1fr, 1fr, 1fr)
}
}
/*
* chic-grid
*
* Creates a grid element with the corresponding
* format needed to be used as a header or a footer
*
* Parameters:
* - v-center: Whether to vertically align the header content, or not
* - side-width: Custom width for sides (can be an array or length)
* - left-side: Content that goes at the left side
* - center-side: Content that goes at the center
* - right-side: Content that goes at the right side
*/
#let chic-grid(v-center: false, side-width, left-side, center-side, right-side) = block(
spacing: 0pt,
grid(
columns: if side-width == none {
// If the user didn't give a custom side-width, then distribute the layout
// using fraction values
chic-distribute-layout(left-side, center-side, right-side)
} else {
// If an unidimensional value is given, use it to all columns
if type(side-width) in (fraction, relative, length) {
(side-width, side-width, side-width)
// If a 3-item-length array is given, use it as the columns dimensions
} else if type(side-width) == array and side-width.len() == 3 {
side-width
// Otherwise, just distribute the layout using default fraction values
} else {
chic-distribute-layout(left-side, center-side, right-side)
}
},
column-gutter: 11pt,
align(if v-center {horizon + left} else {left}, left-side),
align(if v-center {horizon + center} else {center}, center-side),
align(if v-center {horizon + right} else {right}, right-side)
)
) |
https://github.com/jgm/typst-hs | https://raw.githubusercontent.com/jgm/typst-hs/main/test/typ/layout/pad-00.typ | typst | Other | // Use for indentation.
#pad(left: 10pt, [Indented!])
// All sides together.
#set rect(inset: 0pt)
#rect(fill: green,
pad(10pt, right: 20pt,
rect(width: 20pt, height: 20pt, fill: rgb("eb5278"))
)
)
Hi #box(pad(left: 10pt)[A]) there
|
https://github.com/jamesrswift/ionio-illustrate | https://raw.githubusercontent.com/jamesrswift/ionio-illustrate/main/gallery/linalool.typ | typst | MIT License | #set par(justify: true)
#set page(width: auto, height: auto, margin:1em)
#set text(size: 7pt)
#import "../src/lib.typ": *
#let data = csv("../assets/linalool.csv")
#let massspec = data.slice(1)
#let ms = mass-spectrum(massspec, args: (
range: (0,150),
plot-extras: (this) => {
(this.callout-above)(136, content: MolecularIon())
(this.callout-above)(121)
(this.callout-above)(93)
(this.callout-above)(80)
(this.callout-above)(71)
(this.callipers)(41, 55, content: [-CH#sub[2]])
(this.title)([Linalool, +70eV])
},
linestyle: (this, mz)=>{
if mz in (93,) { return (stroke: red) }
if mz in (71,) { return (stroke: blue) }
},
))
#(ms.display)() |
https://github.com/ENIB-Community/ENIB_Typst_Internship_Template | https://raw.githubusercontent.com/ENIB-Community/ENIB_Typst_Internship_Template/main/main.typ | typst | MIT License | // Importing the "enib-template" function from "template.typ"
#import "template.typ": *
// Applying the enib-template to the whole document using a #show rule
// Fill in this function call with your informations
#show: body => enib-template(
title: "Titre du stage",
sous-titre: "Conversion d'une base de code monolithique vers une architecture distribuée sous forme de services indépendants.",
type_stage: "Stage Ingénieur S10",
maitre_de_stage: "Maitre de stage",
tuteur_academique: "Tuteur académique",
nom: "<NAME>",
dates: [
28 Août 2023 au 12 Janvier 2024
],
mail: "<EMAIL>",
logo_company: image("assets/logoentreprise.png"),
logo_enib: image("assets/logoenib.png"),
img_illustration: none,
body,
)
#v(6em)
= Remerciements
#lorem(80)
#pagebreak()
= Résumé
Le résumé de votre stage en français.
#heading(level: 2, outlined: false)[Summary]
Le résumé de votre stage en anglais
#pagebreak()
#outline(indent: 2%, depth: 3)
#pagebreak()
#outline(
title: [Liste des figures],
target: figure.where(kind: image),
)
#pagebreak()
#outline(
title: [Liste des Tables],
target: figure.where(kind: table),
)
#v(3em)
#outline(
title: [Liste des Codes],
target: figure.where(kind: raw),
)
// Style heading of level 1.
#show heading.where(level: 1): it => {
pagebreak(weak: true)
set block(below: 20pt, above: 10pt)
set text(font: "QTPalatine", weight: "black")
set align(center)
underline(smallcaps(it), offset: 4pt)
}
= Glossaire
// Import glossary from gls.typ
#import "./gls.typ": enib-gloss
// Print glossary
#print-glossary(enib-gloss)
= Présentation de l'entreprise
#lorem(150)
== Politique RSE
Description des résultat de votre enquête RSE:
#lorem(250)
#pagebreak()
= Introduction
Ici un exemple de plan, n'hésitez pas à adapter à votre situation.
== Environnement de travail
#lorem(50)
=== Méthodologie de travail
#lorem(50)
== Environnement technique
#lorem(50)
= Sujet de stage
Ici un rappel de votre sujet de stage.
#lorem(60)
Ensuite le coeur du rapport avec une structure qui vous est propre.
== Section 1
#lorem(89)
== Section 2
== Section 3
== Section 4
== Section 5
= Bilan
== Bilan pour la société
#lorem(45)
== Bilan Personnel
#lorem(50)
== Bilan de compétences personnelles
#lorem(50)
#bibliography("biblio.bib", title: [Bibliographie])
= Annexes
Ici vos éventuelles annexes |
https://github.com/HollowNumber/DDU-Rapport-Template | https://raw.githubusercontent.com/HollowNumber/DDU-Rapport-Template/main/src/main.typ | typst | #import "format.typ": *
// sidehoved
// INDSÆT NAVN, FAG, OG DATO
#set page(
"a4",
)
// to customize this template and discover how it works.
#show: rapport.with(
// indsæt Titel
titel: "TITEL",
undertitel: "UNDERTITEL",
sidehoved: [
#set text(8pt)
Author names
#h(1fr) Digital Design og Udvkilking
#h(1fr) School name \
affiliation
#h(2fr) Dato til dato
],
forfatter: (
// Dit navn og Klasse
(name: "<NAME>", affiliation: "Author affiliation", affiliation_short: "affiliation short"),
(name: "<NAME>", affiliation: "Author affiliation", affiliation_short: "affiliation short"),
),
vejleder: (
(name: "Name", affiliation: "affiliation", lectio: "nme"),
(name: "name", affiliation: "affiliation", lectio: "name"),
),
// indsæt dit forside billede (eller fjern)
periode: "7. november til 12. december",
// Indsæt dit resumé efter kolonet, omsluttet af parenteser.
// Eksempel: `abstract: [Her er min abstract]`
abstract: lorem(300),
tof: true,
acknowledgements: [
],
tot: false,
logo: "out.jpg"
)
#include "chapters/projektbeskrivelse.typ"
#include "chapters/hovedafsnit.typ"
#include "chapters/diskussion.typ"
#include "chapters/konklusion.typ"
#pagebreak()
#set page(columns: 1)
#bibliography("bibliografi.yml")
#pagebreak()
#include "chapters/appendix.typ"
|
|
https://github.com/xiongyaohua/typst-template-swjtu-thesis | https://raw.githubusercontent.com/xiongyaohua/typst-template-swjtu-thesis/main/modules/pages.typ | typst | #import "common.typ": 字号, 字体, 全局样式, 格式化日期
// 附页
#let 扉页(..信息) = {
let 信息 = 信息.named()
set align(center)
[
#v(1cm)
#text(font: 字体.黑体, size: 字号.小二)[
西#h(0.5em)南#h(0.5em)交#h(0.5em)通#h(0.5em)大#h(0.5em)学\
本科毕业设计(论文)
]
#v(2cm)
#text(font: 字体.黑体, size: 字号.二号)[
#信息.题目
]
#v(4cm)
#text(font: 字体.黑体, size: 字号.小四)[
#box[
#set align(left)
#grid(columns: 2, row-gutter: 0.5em,
column-gutter: 1em,
[年#h(2em)级:], [#信息.年级],
[学#h(2em)号:], [#信息.学号],
[姓#h(2em)名:], [#信息.姓名],
[专#h(2em)业:], [#信息.专业],
[指导教师:], [#信息.指导教师],
)
]
]
#v(1fr)
#格式化日期(信息.完成日期, "[year] 年 [month] 月")
#v(2cm)
]
pagebreak(weak: true)
}
#let 诚信声明() = {
[
#set align(center)
#v(1cm)
#text(font: 字体.黑体, size: 字号.小二, weight: "bold")[
西南交通大学\
本科毕业设计(论文)学术诚信声明
]
#v(1cm)
#set align(left)
#set text(font: 字体.宋体, size: 字号.四号)
#par(leading: 1.5em)[#h(2em)本人郑重声明:所呈交的毕业设计(论文),是本人在导师的指导下,独立进行研究工作所取得的成果。除文中已经注明引用的内容外,本论文不包含任何其他个人或集体已经发表或撰写过的作品成果。对本文的研究做出重要贡献的个人和集体,均已在文中以明确方式标明。本人完全意识到本声明的法律结果由本人承担。]
#v(4cm)
#set align(right)
#box(width:10cm)[
作者签名:#h(1fr)
#v(1cm)
#repeat[.]
#v(0.5cm)
日期:#h(2.5cm)年#h(1.5cm)月#h(1.5cm)日
]
]
pagebreak(weak: true)
}
#let 授权书() = {
[
#set align(center)
#v(1cm)
#text(font: 字体.黑体, size: 字号.小二, weight: "bold")[
西南交通大学\
本科毕业设计(论文)版权使用授权书
]
#v(1cm)
#set align(left)
#set text(font: 字体.宋体, size: 字号.四号)
#par(leading: 1.5em)[#h(2em)本毕业设计(论文)作者同意学校保留并向国家有关部门或机构送交论文的复印件和电子版,允许论文被查阅和借阅。本人授权西南交通大学可以将本毕业设计(论文)的全部或部分内容编入有关数据库进行检索,可以采用影印、缩印或扫描等复制手段保存和汇编本毕业设计(论文)。]
#box[
#grid(
columns: 2,
row-gutter: 1.5em, column-gutter: 2em,
[#h(2em)本论文属于:#hide(sym.ballot)],
[不保密 #sym.ballot],
[],
[保密 #sym.ballot,在#box(width: 2em, repeat[.])年解密后适用本授权书。]
)
]
#v(5cm)
#grid(
columns: 2,
column-gutter: 1em,
box(width:100%)[
作者签名:#h(1fr)
#v(1cm)
#repeat[.]
#v(0.5cm)
日期:#h(2cm)年#h(1cm)月#h(1cm)日
],
box(width:100%)[
指导教师签名:#h(1fr)
#v(1cm)
#repeat[.]
#v(0.5cm)
日期:#h(2cm)年#h(1cm)月#h(1cm)日
]
)
]
pagebreak(weak: true)
}
#let 任务书(..信息) = {
let 信息 = 信息.named()
[
#set align(center)
#text(font: 字体.黑体, size: 字号.三号, weight: "bold")[
毕业设计(论文)任务书
]
#v(1cm)
#set text(size: 字号.小四)
#set list(indent: 2em)
班#h(2em)级:#underline(信息.专业)
#h(1fr)
学生姓名:#underline(信息.姓名)
#h(1fr)
学#h(2em)号:#underline(信息.学号)
发题日期:#underline(格式化日期(信息.发题日期, "[year] 年 [month] 月 [day] 日"))
#h(1fr)
完成日期:#underline(格式化日期(信息.完成日期, "[year] 年 [month] 月 [day] 日"))
题#h(2em)目:#underline[#信息.题目]#h(1fr)
#set align(left)
1. 本设计(论文)的目的、意义:
#underline([#h(2em)#信息.目的意义])
2. 学生应完成的任务:\
#underline([#h(2em)#信息.任务])
3. 本设计(论文)与本专业的毕业要求达成度如何?(如在知识结构、能力结构、素质结构等方面有哪些有效的训练。):\
#underline([#h(2em)#信息.达成度])
4. 本设计(论文)各部分内容及时间分配(共 17 周):\
#{[
#set par(first-line-indent: 0pt)
#set terms(indent: 2em, separator: [:])
#show terms.item: item => {
h(2em)
item.term
[:]
underline(item.description)
parbreak()
}
#信息.时间分配
]}
#v(1cm)
备#h(2em)注:#underline(信息.备注)
#v(1cm)
#par[
指导教师:#box(width:4cm, repeat([.]))
#h(3cm)年
#h(1cm)月
#h(1cm)日
]
]
pagebreak(weak: true)
}
#let 摘要(英文: false, 关键词: [], 内容) = {
[
#let title = if 英文 {
[Abstract]
} else {
[摘#h(1em)要]
}
#let keywords = if 英文 {
[Key words: ]
} else {
[关键词:]
}
#set align(center)
#v(1em)
#text(font: 字体.黑体, size: 字号.小二, weight: "bold")[#title]
#v(1em)
#set align(left)
#set text(font: 字体.宋体, size: 字号.小四)
#[
#set par(first-line-indent: 2em)
#内容
]
#v(1cm)
#text(font: 字体.黑体)[#keywords#关键词]
#pagebreak(weak: true)
]
}
|
|
https://github.com/jxpeng98/Typst-CV-Resume | https://raw.githubusercontent.com/jxpeng98/Typst-CV-Resume/main/legacy/coverletter-legacy.typ | typst | MIT License | #import "modernpro-cv-legacy.typ": *
// Remember to set the fonttype in `modernpro-cv-legacy.typ`
#show: mainbody => coverletter-legacy(
name: [#lorem(2)], //name:"" or name:[]
address: [#lorem(4)],
contacts: (
(text: "08856", link: ""),
(text: "example.com", link: "https://www.example.com"),
(text: "github.com", link: "https://www.github.com"),
(text: "<EMAIL>", link: "mailto:<EMAIL>"),
),
recipient: (
starttitle: "Dear",
jobtitle: "Hiring Manager",
date: "",
department: [#lorem(2)],
university: [#lorem(2)],
address: [#lorem(4)],
postcode: [#lorem(1)],
),
mainbody,
)
#lorem(300)
#lorem(100) |
https://github.com/oldrev/tids | https://raw.githubusercontent.com/oldrev/tids/master/tids.typ | typst | Apache License 2.0 | #import "@preview/cetz:0.1.2": canvas, plot
#let company_info = (
name: "<NAME>iconductors Inc.",
logo: "./assets/demo-logo.svg",
website_url: "https://github.com/oldrev",
)
#let tids(ds_metadata: (
title: [YourDSTitle],
product: [YourProductName],
product_url: "https://github.com/oldrev/tids",
revision: [CurrentRevision],
publish_date: [PublishedOn]
), features: [], applications: [], desc: [], rev_list: [], doc: []) = {
let fonts = (
serif: ("Times New Roman", "Source Serif", "Liberation Serif"),
sans: ("Dejavu Sans", "Arial", "Helvetica Neue", "Helvetica", "Source Sans"),
mono: ("Consolas", "Source Mono"),
text: ("Arial", "Dejavu Sans"),
text_strong: ("Arial", "Dejavu Sans"),
headings: ("Arial", "Dejavu Sans", "Helvetica Neue", "Helvetica"),
code: ("Source Mono"),
)
set text(font: fonts.text, size: 11pt)
show link: it => text(fill: rgb("#0000FF"))[#it]
set page(paper: "a4")
// Figure styles
show figure.caption: set text(
weight: "semibold",
font: fonts.headings
)
// table styles
show figure.where(
kind: table
): set figure.caption(position: top)
set table(
stroke: 0.5pt,
fill: (_, y) => if y == 0 { gray.lighten(75%) },
align: (_, y) => if y == 0 { align(center) },
)
show table.header: strong
show table.cell.where(y: 0): set text(weight: "semibold")
let lastest_rev = rev_list.first()
let outline_page() = {
[
#block(height: 40%, [
#columns(2, gutter: 30pt)[
= Contents
<Directory>
#outline(title: none, depth: 3)
]
])
#line(length: 100%, stroke: 1pt)
= Revisions
<Revisions>
#v(1em)
#block({
for r in rev_list {
text(font: fonts.sans, weight: "semibold", [#r.rev - #r.date])
v(-0.65em)
line(length: 100%, stroke: 0.3pt)
v(-0.65em)
block(r.body)
v(-0.65em)
line(length: 100%, stroke: 0.65pt)
v(0.65em)
}
})
]
}
let page_footer() = {
line(length: 100%, stroke: 1pt)
v(-0.65em)
set text(10pt, baseline: 0pt)
locate(loc => if calc.odd(loc.page()) {
grid(
columns: (5fr, 1fr),
rows: (auto),
gutter: 0pt,
[Copyright © #link(company_info.website_url)[#company_info.name]],
[
#set align(right)
#counter(page).display("1 / 1", both: true)
],
)
} else {
grid(
columns: (1fr, 5fr),
rows: (auto),
gutter: 0pt,
[
#set align(left)
#counter(page).display("1 / 1", both: true)
],
[
#set align(right)
Copyright © #link(company_info.website_url)[#company_info.name]],
)
}
)
}
let current_chapter() = locate(loc => {
let elems = query(
heading.where(level:2).before(loc),
loc,
)
if elems != () {
let elem = elems.last()
h(1fr) + emph(counter(heading).at(loc).map(str).join(".") + h(.75em) + elem.body) + h(1fr)
}
})
let afterwords_page() = {
set page(numbering: none)
set heading(numbering: none)
[
= Indexing
#box(height: auto, [
#columns(2, gutter: 30pt)[
#outline(
title: [Figures],
target: figure.where(kind: image),
)
#colbreak()
#outline(
title: [Tables],
target: figure.where(kind: table),
)
]
#line(length: 100%, stroke: 1pt)
])
= Legal Disclaimer Notice
#lorem(30)
#lorem(50)
#lorem(30)
]
}
set par(leading: 0.75em)
set page(
numbering: "(1 / 1)",
footer-descent: 2em,
header: [
#set text(10pt)
#locate(loc => if calc.odd(loc.page()) {
grid(
columns: (1fr, 1fr),
rows: (100%),
gutter: 3pt,
[
#set align(left)
#link(company_info.website_url)[#image(company_info.logo, height: 28pt)]
],
[
#set align(right)
#link(ds_metadata.product_url)[#ds_metadata.product]
#linebreak()
#lastest_rev.rev - #lastest_rev.date
],
)
} else {
grid(
columns: (1fr, 1fr),
rows: (100%),
gutter: 3pt,
[
#set align(left)
#link(ds_metadata.product_url)[#ds_metadata.product]
#linebreak()
#lastest_rev.rev - #lastest_rev.date
],
[
#set align(right)
#link(company_info.website_url)[#image(company_info.logo, height: 28pt)]
],
)
}
)
#v(-0.65em)
#line(length: 100%, stroke: 1pt)
],
footer: page_footer(),
// background: rotate(45deg,
// text(80pt, fill: rgb("FFCBC4"))[
// *CONFIDENTIAL*
// ])
)
set heading(numbering: "1.")
show heading: it => block([
#v(0.3em)
#text(weight: "bold", font: fonts.headings, [#counter(heading).display() #it.body])
#v(0.8em)
])
show heading.where(level: 1): it => {
block([
#text( weight: "bold", font: fonts.headings, [#counter(heading).display() #it.body])
#v(0.3em)
])
}
v(-0.65em)
align(center, block({
set text(16pt, font: fonts.headings, weight: "medium")
ds_metadata.title
v(-0.5em)
line(length: 100%, stroke: 1pt)
v(0.3em)
}))
box(height: auto,
columns(2, gutter: 30pt)[
= Features
<TitlePageFeatures>
#features
= Applications
<TitlePageApplications>
#applications
#colbreak()
= Description
<Description>
#desc
#figure(rect(height: 30%,
canvas(length: 0.75cm, {
plot.plot(size: (8, 6),
x-tick-step: 1,
x-ticks: ((-calc.pi, $-pi$), (0, $0$), (calc.pi, $pi$)),
y-tick-step: 1,
{
plot.add(
domain: (-calc.pi, calc.pi), x => calc.sin(x * 1rad))
})
})
), caption: [Awesome Performance])
])
pagebreak()
outline_page()
pagebreak()
// document-body
doc
afterwords_page()
}
|
https://github.com/ningvin/typst-resume-template | https://raw.githubusercontent.com/ningvin/typst-resume-template/main/resume.typ | typst | Apache License 2.0 | // used to collect side sections
#let side-sections = state("side-sections", ())
// function that lets you create a fancy resume;
// the resume is divided into two parts:
// - the main content panel
// - a side panel to the left of it
#let resume(
// the title; not displayed anywhere, but put into the document's metadata
document-title: "Resume",
// your name
name: "",
// an optional image to show in the title of the side panel
image-path: none,
// a job title (or anything really) to display below your name (optional)
job-title: none,
// the font to use throughout the resume
font: "Roboto",
// various spacing/margin settings
margin-x: 1.3cm,
margin-y: 2cm,
side-panel-width: 6cm,
main-content-margin-left: 0.8cm,
// the primary color is used for the main content, as well as the
// background of the side panel
primary-color: rgb(40, 40, 40),
secondary-color: white,
// the actual resume content; filled automagically when using
// the show rule from the examples
body
) = {
// set metadata
set document(title: document-title, author: name)
// apply font
set text(font: font)
// setup page
set page(
margin: (
left: margin-x,
top: margin-y,
right: margin-x,
bottom: margin-y
),
// colored background for side panel
background: place(
dx: margin-x,
left + top,
rect(
fill: primary-color,
height: 100%,
width: side-panel-width
)
)
)
// helper function/hack to change the alpha value
// of a given color; as of me writing this, there
// is no such function in typst as far as I am
// aware
let change-opacity(
// the new alpha to apply; has to be passed as a hex string
alpha: "c8",
// the original color, expected to not have an alpha value yet,
// i.e. be of the form rgb("#......") and NOT rgb("#........")
color
) = {
// example: color = white
let to-str = repr(color)
// example: to-str is now equal to "rgb(\"#ffffff\")"
let trimmed = to-str.trim(at: start, "rgb(\"").trim(at: end, "\")")
// example: trimmed is now equal to "#ffffff"
return rgb(trimmed + alpha)
}
// build the title content, that is:
// - name (+ optinal job description/subtitle)
// (- optional image)
let title = {
let name-row-gutter = 1em
// adjust gutter in case no job title is given
// to avoid extra empty space
if job-title == none {
name-row-gutter = 0em
}
// helper function to construct the name content with
// variable background transparency
let make-name(
// background transparency of the block enclosing the name
background-alpha: "ff"
) = {
block(
inset: (x: 1em, y: 1em),
width: 100%,
fill: change-opacity(alpha: background-alpha, secondary-color),
{
// align the name and job title as a whole to the center
align(center + horizon,
grid(
columns: (auto,),
rows: (auto, auto),
row-gutter: name-row-gutter,
align(
left,
text(
size: 18pt,
weight: 800,
name
)
),
if job-title != none {
// again, the job title is optional
align(
left,
text(
size: 11pt,
weight: 500,
job-title
)
)
}
)
)
}
)
}
if image-path != none {
// an image has been supplied
let image-obj = image(width: side-panel-width, image-path)
// grab the current style...
style(styles => {
// ...to measure the image's height
let image-height = measure(image-obj, styles).height
box(
// seems to need explicit height for the absolut placement
// of the name content to work, otherwise the box takes up
// the entire height of the page when "bottom" is specified
// as placement for the name content
height: image-height,
{
// the image...
image(image-path)
// ...overlayed by the semi transparent name content
place(bottom, make-name(background-alpha:"c8"))
// NOTE: getting overlapping stuff to work can be
// a bit tricky; ensure that both objects are placed
// in a common container (a box in this case) as
// "place" works relative to the parent container
}
)
})
} else {
// no image supplied, no worries: simply emit the name content
// fully opaque
make-name(background-alpha: "ff")
}
}
// build the side panel content
let side-panel-content = {
block(
inset: (x: 1em),
// side sections are modelled as state, which I pretty much stole from
// the official newsletter template; you could probably do this way
// easier, but here goes...
locate(loc => {
// apply general font settings for all side sections
set text(weight: 400)
for element in side-sections.final(loc) {
// change the way headings are styled in side sections;
// each heading gets capitalized and an underline spanning
// the whole available width is placed below
show heading: it => {
text(weight: 400, upper(it))
v(0.5em)
}
// with the configuration and show rule for headings out of
// the way, now follows the actual side section content
element
// the underline
line(length: 100%)
// as well as some weak spacing so consecutive side sections
// are not all up and close to each other
v(40pt, weak: true)
}
})
)
}
// build the main content
let main-content = {
// again, style the headings in a fancy way
show heading: it => {
if it.level > 1 {
// but only the top level ones
it
} else {
grid(
row-gutter: 0.5em,
grid(
columns: (auto, 1fr),
column-gutter: 0.5em,
// basically an arrow/angle bracket...
align(horizon, image(height: 1.2em, "angle-right-solid.svg")),
// ...followed by the actual heading text...
align(horizon, text(weight: 400, upper(it)))
),
// ...and an underline spanning the whole width placed below
line(length: 100%)
)
// + some additional spacing
v(1em)
}
}
// the actual content
body
}
// the overall page is structured as a grid with two columns,
// one for the side panel on the left with a fixed width and
// one for the main content panel, which will take up the
// remaining space
grid(
columns: (side-panel-width, 1fr),
column-gutter: main-content-margin-left,
// for theming purposes, the different colors are applied
// via the corresponding "set" commands; this is not perfect,
// but I am not aware of a better way
{
// the side panel
set line(stroke: secondary-color)
set rect(fill: secondary-color, stroke: secondary-color)
set text(fill: primary-color)
// the title...
title
v(1em)
set text(fill: secondary-color)
// ...followed by the side panel content
side-panel-content
},
{
// the main content
set line(stroke: primary-color)
set rect(fill: primary-color)
set circle(fill: primary-color, stroke: primary-color)
set text(fill: primary-color)
main-content
}
)
}
// add a section to the side panel
#let side-section(body) = side-sections.update(it => it + (body,))
// a time line of events to showcase in your resume, e.g.
// your degrees or previous jobs
#let time-line(
// a list of events; each event is expected to be a dictionary
// with the following entries:
// - "date": when the event happened; can be any content, e.g.:
// - a timespan ("2019 - 2023")
// - a date ("01.01.2020")
// - something else entirely
// - "details": a description of the event, e.g.:
// - job title, company and description of responsibilities
// - degree, university and grades
// - something else entirely
// - "add-height": optional hacky parameter to adjust the length
// of the time line; only necessary if you supply
// some text in the event details that is long
// enough to be auto-wrapped; see the examples
// for more information
events: (),
) = {
// need to make some measurements later, so grab the styles now
style(styles => {
let event-bubble-size = 0.7em // somewhat arbitrary, but works
let index = 1
let content = () // this is populated with the actual content
// the time line is constructed as a grid of three columns:
// 1. the dots and lines for the nice visuals
// 2. the dates
// 3. the details
for event in events {
// iterate over the events, producing a "flattened" array
// of content that we can later pass to the "grid" function;
// i.e. this:
// ((date-1, detail-1), (date-2, detail-2))
// becomes this:
// (line-content-1, date-content-1, detail-content-1, line-content-2, date-content-2, detail-content-2)
let details = {
event.details
if (index != events.len()) {
// ajdust the spacing of consecutive events;
// NOTE: we cannot simply set a row-gutter later
// as that would result in gaps in the lines
v(1em)
}
}
// populate the content array
content.push(
// 1. the line content
grid(
rows: (event-bubble-size, auto),
// a dot...
circle(
stroke: 1pt // to avoid single pixel gaps
// NOTE: fill is derived from the top level "set" rules
),
// ...followed by a vertical line, except for the last event
// in the time line
if index != events.len() {
// specifying a size of 100% did not work for me, the height
// seems to have to be fixed; the details column takes up the
// most height in pretty much all the cases, so we need to match
// it in height; therefore we need to measure it...
let details-height = measure(details, styles).height
// ...but this does not use the correct styles/spacing in this
// context; this is problematic if the contents of the details
// column are long enough to be auto-wrapped when placed in the
// final three column grid, as the height measured above will
// not take the reduced width into account (manual line breaks
// will however not be a problem)
if "add-height" in event {
// therefore, the user can provide some additional height to
// add the the line as a workaround/hack
details-height += event.add-height
// it may be possible to do some fancy state/query stuff to
// calculate the height in the correct context, or there may
// be an even simpler solution altogether
}
grid(
// to center the line, we place it in a three column
// grid where the outer two columns take up as much
// space as possible
columns: (1fr, 1pt, 1fr),
none,
rect(
width: 1pt,
height: details-height,
stroke: none
),
none
)
}
)
)
// 2. the date content
content.push(event.date)
// 3. the details content
content.push(details)
index += 1
}
// now that the content has been flattened, place it in
// the final grid
grid(
columns: (event-bubble-size, auto, 1fr),
column-gutter: 1em,
..content
)
})
}
// display a "skill bar" showcasing your proficiency in a specific skill
#let skill-bar(
// the name of the skill (optional)
skill: none,
// a description of your proficiency (optional)
description: none,
// a value between 0.0 and 1.0 corresponding to your proficiency
value: 0.5,
// the color used for the "unfilled" part; ideally this would be
// derived from the theme colors automatically
empty-color: rgb(220, 220, 220),
// the height of the skill bar
height: 0.5em
) = {
if skill != none or description != none {
[#box(strong(skill)) #h(1fr) #box(text(description))]
// only adjust spacing if either skill or description are provided
v(-7pt)
}
grid(
// basically a single row grid with two columns that each containg a
// colored box, sized based on the value parameter
columns: (100% * value, 100% - (100% * value)),
rows: (height),
rect(width: 100%, height: 100%),
box(fill: empty-color, width: 100%, height: 100%)
)
}
// pretty much identical to the skill bar, but has an outline
// and the empty part is transparent
#let outline-skill-bar(
// the name of the skill (optional)
skill: none,
// a description of your proficiency (optional)
description: none,
// a value between 0.0 and 1.0 corresponding to your proficiency
value: 0.5,
// the height of the skill bar
height: 0.5em
) = {
if skill != none or description != none {
[#box(strong(skill)) #h(1fr) #box(text(description))]
v(-7pt)
}
block(
height: height,
{
rect(
width: 100%,
height: height,
fill: none
)
place(
top + left,
rect(
width: 100% * value,
height: height,
stroke: none
)
)
}
)
}
// show a list of items with icons as bullet points
#let icon-list(
// a list of items; each item is expected to be a dictionary
// with the following entries:
// - "icon": path to an image
// - "body": the item's content
items: (),
// bool indicating if the icons should be centered vertically
// relative to the body
center-icons: false
) = {
for item in items {
grid(
columns: (2em, 1fr),
// one column for the icon with fixed width
align(
if center-icons {
center + horizon
} else {
center
},
image(height: 1em, item.icon)
),
// one column for the actual content
align(
horizon,
[#h(5pt) #box(item.body)]
)
)
}
}
// dictionary to access the icons shipping with this template
// for convenience
#let icons = (
envelope: "envelope-solid-white.svg",
location: "location-dot-solid-white.svg",
mobile: "mobile-solid-white.svg",
phone: "phone-solid-white.svg"
)
|
https://github.com/csimide/SEU-Typst-Template | https://raw.githubusercontent.com/csimide/SEU-Typst-Template/master/seu-thesis/templates/bachelor.typ | typst | MIT License | #import "../utils/fonts.typ": 字体, 字号
#import "../utils/set-bachelor.typ": set-bachelor
#import "../utils/states.typ": part-state
#import "../pages/cover-bachelor-fn.typ": bachelor-cover-conf
#import "../parts/abstract-bachelor-fn.typ": abstract-conf
#import "../parts/main-body-bachelor-fn.typ": main-body-bachelor-conf
#import "../parts/outline-bachelor-fn.typ": outline-conf
#import "../utils/thanks.typ": thanks
#import "../utils/show-appendix.typ": show-appendix-bachelor
#let bachelor-utils = (thanks, show-appendix-bachelor)
#let bachelor-conf(
student-id: "00121001",
author: "王东南",
school: "示例学院",
major: "示例专业",
advisor: "湖牌桥",
thesis-name: "示例论文标题\n此行空白时下划线自动消失",
date: "某个起止日期",
cn-abstract: [示例摘要],
cn-keywords: ("关键词1", "关键词2"),
en-abstract: [#lorem(100)],
en-keywords: ("Keywords1", "Keywords2"),
outline-depth: 3,
bilingual-bib: true,
doc,
) = {
show: set-bachelor.with(bilingual-bib: bilingual-bib)
// 封面
bachelor-cover-conf(
student_id: student-id,
author: author,
school: school,
major: major,
advisor: advisor,
thesis-name: thesis-name,
date: date,
)
// 独创性声明
include "../pages/statement-bachelor-ic.typ"
// 摘要
abstract-conf(
cn-abstract: cn-abstract,
cn-keywords: cn-keywords,
en-abstract: en-abstract,
en-keywords: en-keywords,
)
// 目录
outline-conf(outline-depth: outline-depth)
// 正文
show: main-body-bachelor-conf
doc
}
#show: bachelor-conf.with(
student-id: "00121001",
author: "王东南",
school: "示例学院",
major: "示例专业",
advisor: "湖牌桥",
thesis-name: "示例论文标题\n此行空白时下划线自动消失",
date: "某个起止日期",
cn-abstract: [示例摘要],
cn-keywords: ("关键词1", "关键词2"),
en-abstract: [#lorem(100)],
en-keywords: ("Keywords1", "Keywords2"),
outline-depth: 3,
)
|
https://github.com/neeruuppalapati/MATH-Notes | https://raw.githubusercontent.com/neeruuppalapati/MATH-Notes/main/example.typ | typst |
#import "template.typ": *
#show: template.with(
title: [Quantum Mechanics, Brownian Motion,\ Ergodic Theory],
short_title: "Phys 123",
description: [
Notes based on lectures for Phys 123 (Statistical Mechanics II)\ at Bicol University by Professor <NAME>, Spring 2020
],
date: datetime(year: 2023, month: 10, day: 01),
authors: (
(
name: "<NAME>",
orcid: "0000-0002-3281-1292",
link: "https://jskherman.com",
affiliations: "1,2",
),
),
affiliations: (
(id: "1", name: "Bicol University"),
(id: "2", name: "JSK Inc."),
),
lof: false,
lot: false,
lol: false,
bibliography_file: "refs.bib",
paper_size: "a4",
cols: 1,
text_font: "XCharter",
code_font: "Cascadia Mono",
accent: "#DC143C", // blue
)
#import "notes.typ"
|
|
https://github.com/KXXH/YAYT | https://raw.githubusercontent.com/KXXH/YAYT/main/template.typ | typst | // The project function defines how your document looks.
// It takes your content and some metadata and formats it.
// Go ahead and customize it to your liking!
#import "@preview/tablex:0.0.8": tablex, rowspanx, colspanx
#let underline_block(
width: 100%,
height: auto,
content
) = {
block(
width: width,
height: height,
stroke: (bottom: 0.5pt),
inset: (bottom: 0.5em),
)[
#content
]
}
#let empty_par() = {
text()[#v(0em, weak: true)];text()[#h(0em)]
}
#let project(
title: "",
author: (),
date: datetime.today(),
logo: none,
body,
year: datetime.today().year(),
month: datetime.today().month(),
) = {
// Set the document's basic properties.
set document(author: author.name, title: title)
set page(numbering: none, number-align: center, header: locate(loc => {
let page-counter = counter(page)
let matches = query(<toc>, loc)
let current = page-counter.at(loc)
if current.first() > 2 [
#underline_block[
#align(center)[
#text(0.8em)[
#author.grade - #author.name: #month 月工作汇报
]
]
]
]
}))
set text(font: ("Times New Roman", "STSongti SC", "SimSun", "Source Han Serif SC", "Serif"), lang: "zh")
// Set paragraph spacing.
show par: set block(above: 1.5em, below: 1.5em)
show figure.where(kind: table): set figure.caption(position: top)
set heading(numbering: "1.1")
show outline.entry.where(
level: 1
): it => {
v(12pt, weak: true)
strong(it)
}
// set par(leading: 1em)
// Title page.
// The page can contain a logo if you pass one with `logo: "logo.png"`.
align(center)[
#v(0.6fr)
#image("figures/badge.png", width: 17%)
#v(0.1fr)
#image("figures/logo.png", width: 50%)
]
// if logo != none {
// align(right, image(logo, width: 26%))
// }
// v(9.6fr)
// text(1.1em, date.display("[year]年[month]月"))
v(5em, weak: true)
align(center)[
#text(2em, weight: 700, [计算机学院 #box(image("figures/favicon.png"), width: 5%) 视觉计算实验室])
]
v(4em, weak: true)
align(center)[
#text(2em, weight: 700, [
< #year 年 #month 月工作汇报 >
])
]
v(8em, weak: true)
// Author information.
text(1.1em)[
#align(center)[
#block(
width: 60%,
)[
#grid(
columns: (1fr, 2fr),
rows: auto,
gutter: 1em,
)[
#text(font: "SimHei")[#align(end)[作 #h(1fr) 者]]
][
#underline_block[#author.name]
][
#text(font: "SimHei")[#align(end)[提 #h(1fr) 交 #h(1fr) 日 #h(1fr) 期]]
][
#underline_block[#date.display("[year]年[month]月[day]日")]
][
#text(font: "SimHei")[#align(end)[专 #h(1fr) 业]]
][
#underline_block[#author.major]
][
#text(font: "SimHei")[#align(end)[研 #h(1fr) 究 #h(1fr) 方 #h(1fr) 向]]
][
#underline_block[#author.direction]
]
]
]
]
v(2.4fr)
pagebreak()
// Table of contents.
show outline.entry.where(
level: 1
): it => {
v(16pt, weak: true)
strong(it)
// it
}
outline(depth: 3, indent: true, title: [
#block(
width: 100%
)[
#align(center)[
#text(1.1em, weight: 700, [目 录])
]
]
])
pagebreak()
set page(numbering: "1", number-align: center)
counter(page).update(1)
// Main body.
set par(justify: true, leading: 1.1em, first-line-indent: 2em) // 两端对齐,段前缩进2字符
show heading: it => {it;text()[#v(0em, weak: true)];text()[#h(0em)]}
// 引用格式使用GB/T 7714-2015
set bibliography(style: "gb-7714-2015-numeric")
body
} |
|
https://github.com/Mc-Zen/quill | https://raw.githubusercontent.com/Mc-Zen/quill/main/tests/tequila/basic/test.typ | typst | MIT License | #set page(width: auto, height: auto, margin: 0pt)
#import "/src/quill.typ"
#import quill: tequila as tq
#quill.quantum-circuit(
..tq.build(
tq.h(0),
tq.cx(0, 1),
tq.cx(0, 2),
)
)
#pagebreak()
#quill.quantum-circuit(
..tq.build(
n: 3,
tq.h(0,1),
tq.gate(1, $Pi$, fill: orange),
tq.mqgate(0, "E", n: 2, fill: yellow)
)
)
#pagebreak()
#quill.quantum-circuit(..tq.build(
tq.x(0), tq.y(0), tq.z(0),
tq.h(0), tq.s(0), tq.sdg(0), tq.sx(0), tq.sxdg(0),
tq.t(0), tq.tdg(0), tq.p($theta$, 0),
))
#pagebreak()
#quill.quantum-circuit(..tq.build(
tq.rx($theta$, 0), tq.ry($theta$, 0), tq.rz($theta$, 0), tq.u($pi$, $0$, $lambda$, 0)
))
#pagebreak()
#quill.quantum-circuit(..tq.build(
tq.h(range(2)),
tq.t(3),
tq.h(0),
tq.h(5),
tq.barrier(),
tq.cx(2,1),
tq.cx(1,2),
tq.cz(1,2),
tq.swap(1,2),
))
#pagebreak()
#quill.quantum-circuit(..tq.build(
tq.h(range(5)),
tq.cz(1,2),
tq.cz(3,4),
tq.x(3),
tq.cz(0, range(1,5))
))
#pagebreak()
#quill.quantum-circuit(..tq.build(
tq.cz(0, 2),
tq.h(0, 1, 2)
))
#pagebreak()
#quill.quantum-circuit(..tq.build(
append-wire: false,
tq.s(0, 1, 2),
tq.meter(range(1,3)),
))
#pagebreak()
#quill.quantum-circuit(..tq.build(
tq.ccx((0, 1, 2, 1, 0, 2), (1, 0, 1, 2, 2, 0), (2, 2, 0, 0, 1, 1)),
tq.ccx(2, 4, 1),
tq.ccz(2, 3, 1),
tq.y(1),
tq.cca(1, 4, 2, $X$),
tq.h(range(5)),
tq.cccx(0, 1, 3, 2),
tq.multi-controlled-gate((0,1,4), 2, quill.mqgate.with(n:2, $K$))
))
|
https://github.com/Myriad-Dreamin/shiroa | https://raw.githubusercontent.com/Myriad-Dreamin/shiroa/main/packages/shiroa/xcommand.typ | typst | Apache License 2.0 |
/// HTML extension
#let xcommand(outer-width: 1024pt, outer-height: 768pt, inner-width: none, inner-height: none, content) = {
let content = if type(content) == str {
content
} else if content.func() == raw {
content.text
} else {
content
}
let inner-width = if inner-width == none {
outer-width
} else {
inner-width
}
let inner-height = if inner-height == none {
outer-height
} else {
inner-height
}
let html-embed = {
"<svg viewBox=\"0 0 "
str(inner-width.pt())
" "
str(inner-height.pt())
"\""
" width=\""
str(outer-width.pt())
"\" height=\""
str(outer-height.pt())
"\" xmlns=\"http://www.w3.org/2000/svg\">"
"<foreignObject width=\""
str(inner-width.pt())
"\" height=\""
str(inner-height.pt())
"\"><!-- embedded-content "
content
" embedded-content --></foreignObject>"
"</svg>"
}
image.decode(html-embed, alt: "!typst-embed-command")
}
|
https://github.com/mem-courses/discrete-mathmatics | https://raw.githubusercontent.com/mem-courses/discrete-mathmatics/main/homework/week3.typ | typst | MIT License | #import "../template.typ": *
#import "../functions.typ": *
#show: project.with(
course: "Discrete Mathmatics",
course_fullname: "Discrete Mathematics and Application",
course_code: "211B0010",
title: "Homework #3: Inference & Proofs & Sets",
authors: ((
name: "<NAME>",
email: "<EMAIL>",
id: "A10"
),),
semester: "Spring-Summer 2024",
date: "March 12, 2024",
)
#let T = math.upright("T")
#let TT = math.upright("T")
#let F = math.upright("F")
#let FF = math.upright("F")
#let PP = math.cal("P")
= Extra Homework on Normal Forms
#hw("1")[
Give the simplest DNF and CNF of the following statements:
1. $((p->q) <-> (not q -> not p)) and r$
2. $p or (not p or (q and not q))$
3. $(p and (q and s)) or (not p and (q and s))$
][
1. #[
Let's simplify by steps:
(1) $((p->q) <-> (not q -> not p)) and r$, the original statement.
(2) $equiv TT and r$, because $(p->q) <-> (not q -> not p)$ is a tautology by contrapositive law.
(3) $equiv r$, by identity laws.
Overall, the simplest DNF and CNF of the original statement are both $r$.
]
2. #[
Let's simplify by steps:
(1) $p or (not p or (q and not q))$ the original statement.
(2) $equiv p or (not p or FF)$, because $q and not q$ always holds false by negation laws.
(3) $equiv p or not p$, because negation laws.
Overall, the simplest DNF and CNF of the original statement are both $TT$.
]
3. #[
Let's simplify by steps:
(1) Let $r = q and s$.
(2) The original statement can be simplified as "$(p and r) or (not p and r)$".
(3) $equiv (p or not p) and (r or r) and (p or r) and (not p or r)$, by distributive laws.
(4) $equiv r$, because $r$ must be true, otherwise the hole statement is false.
(5) $equiv q and s$, by the definition of $r$.
Overall, the simplest DNF and CNF of the original statement are both $q and s$.
]
]
#hw("2")[
Give the full DNF of the following statements:
1. $(not p or not q) -> (p <-> not q)$
2. $(not r and (q -> p)) -> (p -> (q or r))$
3. $(p -> (q and r)) and (not p -> (not q and not r))$
][
1. #[
Get the full DNF by truth table:
#table3(
columns: (1fr, 1fr, 2fr, 2fr, 4fr),
$p$, $q$, $not p or not q$, $p<-> not q$, $(not p or not q) -> (p <-> not q)$,
T, T, F, F, T,
T, F, T, T, T,
F, T, T, T, T,
F, F, T, F, F,
)
Then, we can derive:
$
(not p or not q) -> (p <-> not q)
equiv (p and q) or (p and not q) or (not p and q)
$
]
2. #[
Get the full DNF by truth table:
#table3(
columns: (0.8fr, 0.8fr, 0.8fr, 2fr, 2fr, 3.5fr, 3fr, 7fr),
$p$, $q$, $r$, $q->p$, $q or r$, $not r and (q -> p)$, $p -> (q or r)$, $(not r and (q -> p)) -> (p -> (q or r))$,
[T], [T], [T], [T], [T], [F], [T], [T],
[T], [T], [F], [T], [T], [T], [T], [T],
[T], [F], [T], [T], [T], [F], [T], [T],
[T], [F], [F], [T], [F], [T], [F], [F],
[F], [T], [T], [F], [T], [F], [T], [T],
[F], [T], [F], [F], [T], [T], [T], [T],
[F], [F], [T], [T], [T], [F], [T], [T],
[F], [F], [F], [T], [F], [F], [T], [T],
)
Then, we can derive:
$
(not r and (q -> p)) -> (p -> (q or r)) equiv
& (p and q and r) or (p and q and not r) or (p and not q and r) or (not p and q and r)\
& quad (not p and q and not r) or (not p and not q and r) or (not p and not q and not r)
$
]
3. #[
Get the full DNF by truth table:
#table3(
columns: (1fr, 1fr, 1fr, 2fr, 3fr, 5fr),
$p$, $q$, $r$, $p -> (q and r)$, $not p -> (not q and not r)$, $(p -> (q and r)) and (not p -> (not q and not r))$,
[T], [T], [T], [T], [T], [T],
[T], [T], [F], [F], [T], [F],
[T], [F], [T], [F], [T], [F],
[T], [F], [F], [F], [T], [F],
[F], [T], [T], [T], [F], [F],
[F], [T], [F], [T], [F], [F],
[F], [F], [T], [T], [F], [F],
[F], [F], [F], [T], [T], [T],
)
Then, we can derive:
$
(p -> (q and r)) and (not p -> (not q and not r))
equiv (p and q and r) or (not p and not q and not r)
$
]
]
#hw("3")[
Give the prenex normal forms of the following statements:
1. $forall x (P(x) -> exists y Q(x,y))$
2. $forall x forall y ((exists z P(x,y,z) and exists u Q(x,u)) -> exists v Q(y,v))$
][
1. #[
$
forall x (P(x) -> exists y Q(x,y))
equiv& forall x (not P(x) or exists y Q(x, y))\
equiv& forall x exists y (not P(x) or Q(x,y))
$
]
2. #[
$
&forall x forall y ((exists z P(x,y,z) and exists u Q(x,u)) -> exists v Q(y,v))\
equiv& forall x forall y (not (exists z P(x,y,z) and exists u Q(x,u)) or exists v Q(y,v))\
equiv& forall x forall y (forall z not P(x,y,z) or forall u not Q(x,u) or exists v Q(y,v))\
equiv& forall x forall y forall z forall u exists v (not P(x,y,z) or not Q(x,u) or Q(y,v))\
$
]
]
#hw("4")[
Give the prenex DNF and CNF of the following statements:
1. $(exists x P(x) or exists x Q(x)) -> exists x (P(x) or Q(x))$
2. $forall x forall y (P(x) -> Q(x,y)) -> exists y (P(y) and exists z Q(y,z))$
][
1. #[
Let us obtain the prenex normal form firstly,
$
&(exists x P(x) or exists x Q(x)) -> exists x (P(x) or Q(x))\
equiv& not (exists x P(x) or exists x Q(x)) or exists x (P(x) or Q(x))\
equiv& (forall x not P(x) and forall y not Q(y)) or exists z (P(z) or Q(z))\
equiv& forall x forall y exists z ((not P(x) and not Q(y)) or P(z) or Q(z))
$
This statement satisfies the property of DNF. And then we can get its CNF by applying the distributive law:
$
&forall x forall y exists z ((not P(x) and not Q(y)) or P(z) or Q(z))\
equiv& forall x forall y exists z ((not P(x) or P(z) or Q(z)) and (not Q(y) or P(z) or Q(z)))
$
]
2. #[
Let us obtain the prenex normal form firstly,
$
& forall x forall y (P(x) -> Q(x,y)) -> exists y (P(y) and exists z Q(y,z))\
equiv& (forall x forall y (P(x) -> Q(x,y))) -> (exists u (P(u) and exists v Q(u,v)))\
equiv& not (forall x forall y (not P(x) or Q(x,y))) or (exists u (P(u) and exists v Q(u,v)))\
equiv& (exists x exists y (P(x) and not Q(x,y))) or (exists u (P(u) and exists v Q(u,v)))\
equiv& exists x exists y exists u exists v ((P(x) and not Q(x,y)) or (P(u) and Q(u,v)))\
$
Luckily, this statement satisfies the property of DNF again. Then, we can get its CNF by applying the distributive law:
$
& exists x exists y exists u exists v ((P(x) and not Q(x,y)) or (P(u) and Q(u,v)))\
equiv& exists x exists y exists u exists v ((P(x) or P(u)) and (P(x) or Q(u,v)) and (not Q(x,y) or P(u)) and (not Q(x,y) or Q(u,v)))
$
]
]
= 1.6 Rules of Inference
#hw("12")[
Show that the argument form with premises $(p ∧ t) → (r ∨ s)$, $q → (u ∧ t)$, $u → p$, and $¬s$ and conclusion $q → r$ is valid by first using Exercise 11 and then using rules of inference from Table 1.
_Exercises 11_: Show that the argument form with premises $p_1, p_2, dots, p_n$ and conclusion $q → r$ is valid if the argument form with premises $p_1, p_2, dots, p_n$, $q$, and conclusion $r$ is valid.
][
Proof:
(1) $(p and t) -> (r or s)$, premise.
(2) $q -> (u and t)$, premise.
(3) $u->p$, premise.
(4) $not s$, premise.
(5) $(p and t) -> r$, by simplification from (1) and (4).
(6) $not p or not t or r$, by implication law from (5).
(7) $not u or p$, by implication law from (6).
(8) $not u or not t or r$, by addiction from (6) and (7).
(9) $(u and t) -> r$, by implication law from (8).
(10) $q -> r$, by hypothetical syllogism from (9).
Overall, the conclusion is proved.
]
#hw("14")[
For each of these arguments, explain which rules of inference are used for each step.
(d) "There is someone in this class who has been to France. Everyone who goes to France visits the Louvre. Therefore, someone in this class has visited the Louvre."
][
Let $P(x)$: "$x$ has been to France". $Q(x)$: "$x$ has been to Louvre".
The steps of the argument are:
(1) $(exists x P(x)) and (forall x P(x) -> Q(x))$, the formalized premises.
(2) $P(c) and (P(c) -> Q(c))$ for some element $c$, by existential instantiation and universal instantiation.
(3) $Q(c)$ for some element $c$, by modus ponens.
(4) $exists x Q(x)$, by existential generalization. And this is the conclusion made by given statement.
]
#hw("18")[
What is wrong with this argument?
Let $S(x, y)$ be "$x$ is shorter than $y$." Given the premise $∃s S(s, "Max")$, it follows that $S("Max", "Max")$. Then by existential generalization it follows that $∃x S(x, x)$, so that someone is shorter than himself.
][
The argument is wrong. The step second is incorrect. The given premise should promise that $"Max"$ is not in the domain of $x$. Otherwise, "$x$ is shorten than $"Max"$" is not valid. Therefore, the total argument is invalid and leads to a wrong conclusion.
]
#hw("24")[
Identify the error or errors in this argument that supposedly shows that if $∀x(P(x) ∨ Q(x))$ is true then $∀x P(x) ∨ ∀x Q(x)$ is true.
(1) $∀x(P(x) ∨ Q(x))$ Premise
(2) $P(c) ∨ Q(c)$ Universal instantiation from (1)
(3) $P(c)$ Simplification from (2)
(4) $∀x P(x)$ Universal generalization from (3)
(5) $Q(c)$ Simplification from (2)
(6) $∀x Q(x)$ Universal generalization from (5)
(7) $∀x(P(x) ∨ ∀x Q(x))$ Conjunction from (4) and (6)
][
$P(c) or Q(c)$ holding true doesn't imply $P(c)$ and $Q(c)$ both holding true. Therefore, the step (3) and (5) are incorrect, and the conclusion (7) is also incorrect.
]
#hw("29")[
Use rules of inference to show that if $∀x(P(x) ∨ Q(x))$, $∀x(¬Q(x) ∨ S(x))$, $∀x(R(x) → ¬S(x))$, and $∃x¬P(x)$ are true, then $∃x¬R(x)$ is true.
][
Proof:
(1) $exists x not P(x)$: premise.
(2) $P(c)$ for some element $c$: existential instantiation from (1).
(3) $forall x (P(x) or Q(x))$, $forall x (not Q(x) or S(x))$, $forall x (R(x) -> not S(x))$: premise.
(4) $(P(c) or Q(c)) and (not Q(c) or S(c)) and (R(c) -> not S(c))$ for any element $c$: universal instantiation from (3)
(5) $P(c) and (P(c) or Q(c)) and (not Q(c) or S(c)) and (R(c) -> not S(c))$: conjunction from (2) and (4).
(6) $P(c) and Q(c) and (not Q(c) or S(c)) and (not R(c) or not S(c))$: simplification from (5)
(7) $P(c) and Q(c) and S(c) and not R(c)$: simplification from (6)
(8) $not R(c)$: simplification from (7)
(9) $exists x not R(x)$: existential generalization from (8)
Overall, the conclusion $exists x not R(x)$ is proved.
]
#hw("34(a)")[
The Logic Problem, taken from _WFF’N PROOF, The Game of Logic_, has these two assumptions:
1. "Logic is difficult or not many students like logic."
2. "If mathematics is easy, then logic is not difficult."
#fake_par
By translating these assumptions into statements involving propositional variables and logical connectives, determine whether each of the following are valid conclusions of this assumption: "That mathematics is not easy, if many students like logic."
][
Let $p$: "logic is difficult"; $q$: "many student like logic"; $r$: "mathematics is easy".
Then the assumption can be formalized as:
(1) $p or not q$
(2) $r -> not p$
The conclusion we want to prove is "$q -> not r$".
(3) $q -> p$: derived from (1)
(4) $p -> not r$: contrapositive from (2)
(5) $q -> not r$: hypothetical syllogism from (3) and (4)
Overall, the conclusion is proved.
]
= 1.7 Introduction to Proofs
#hw("7")[
Use a direct proof to show that every odd integer is the difference of two squares.
_Hint_: Find the difference of the squares of $k + 1$ and $k$ where $k$ is a positive integer.
][
Proof:
(1) For any odd integer $n$ is an odd integer, there exists a positive integer $k$ such that $n=2k-1$.
(2) $k^2-(k-1)^2=2k-1$ for any positive integer $k$.
(3) $n=2k-1=k^2-(k-1)^2$, obtained from (1) and (2), which means that for any odd integer $n$, it can be represented as the difference of two squares.
]
#hw("8")[
Prove that if $n$ is a perfect square, then $n + 2$ is not a perfect square.
][
Proof the given proposition by contradiction.
If both $n$ and $n+2$ are perfect squares, then there exists two positive integers $x$ and $y$ such that $n=x^2$ and $n+2=y^2$. Therefore, $(n+2)-n = 2 = y^2 - x^2 = (x+y) (x-y)$.
Since both $x$ and $y$ are integers, then $x+y$ and $x-y$ are also integers. Because the number $2$ is a prime, and can only equal to the product of $1$ and $2$, so that one element of ${x+y, x-y}$ is 2 and the other is 1.
Therefore, $display(x = ((x+y)+(x-y))/2)=1.5$, isn't an integer. This is a contradiction, so the assumption that both $n$ and $n+2$ are perfect squares is false. Thus, if $n$ is a perfect square, then $n+2$ is not a perfect square.
]
#hw("36")[
Is this reasoning for finding the solutions of the equation $sqrt(2 x^2 - 1) = x$ correct?
(1) $sqrt(2 x^2 - 1) = x$ is given;
(2) $2 x^2 - 1 = x^2$, obtained by squaring both sides of (1);
(3) $x^2-1 = 0$, obtained by subtracting $x^2$ from both sides of (2);
(4) $(x+1)(x-1)=0$, obtained by factoring the left-hand side of $x^2-1$.
(5) $x=1$ or $x=-1$; which follows because $a b = 0$ implies that $a=0$ or $b=0$.
][
No, the reasoning is incorrect.
In the given conditions, $x = sqrt(2 x^2 - 1)$, which implies that $x >= 0$ holds. But in the step (2), if we simply square both sides of equation, we will lose this restriction. Therefore, we should add $x>=0$ as a extra condition during the step (2). Thus, $x=-1$, the wrong solution, will be excluded.
]
= 1.8 Proof Methods and Strategy
#hw("24")[
Use forward reasoning to show that if $x$ is a nonzero real number, then $x^2+1"/"x^2>=2$.
_Hint_: Start with the inequality $(x − 1"∕"x)^2 >= 0$, which holds for all nonzero real numbers $x$.
][
Proof:
(1) $display((x-1/x)^2>=0)$, which holds for all nonzero real numbers $x$.
(2) $display(x^2-2+1/x^2 >= 0)$, by expanding the left-hand side of (1).
(3) $display(x^2+1/x^2 >= 2)$, by adding $2$ to both sides of (2).
Overall, The given proposition is proved.
]
#hw("26")[
The quadratic mean of two real numbers $x$ and $y$ equals $sqrt((x^2+y^2)"/"2)$. By computing the arithmetic and quadratic means of different pairs of positive real numbers, formulate a conjecture about their relative sizes and prove your conjecture.
][
For all pairs of positive real numbers, their quadratic mean if greater than or equal to their arithmetic mean.
Proof:
(1) $(x-y)^2 >= 0$ holds for all real numbers $x$ and $y$.
(2) $(x+y)^2 >= 0$ also holds for all real numbers $x$ and $y$.
(3) $x^2 - 2x y + y^2 >= 0$, by expanding the left-hand side of (1).
(4) $2x^2 + 2y^2 >= x^2 + 2 x y + y^2$, by adding $(x+y)^2$ to both side of (2).
(5) $display((x^2+y^2)/2 >= (x^2+2x y+y^2)/4)$, by dividing both sides of (3) by $4$.
(6) Since $(x+y)^2>=0$, $display((x^2+2x y+y^2)/2) >= 0$ also holds.
(7) $display(sqrt((x^2+y^2)/2)) >= display((x+y)/2)$, by taking square root of both sides of (5). So the proposition is proved.
]
= 2.1 Sets
#hw("13")[
Determine whether each of these statements is true or false.
(a) $x in {x}$
(b) ${x} subset.eq {x}$
(c) ${x} in {x}$
(d) ${x} in {{x}}$
(e) $emptyset subset.eq {x}$
(f) $emptyset in {x}$
][
The answer is TTFTTF.
]
#hw("20")[
Find two sets $A$ and $B$ such that $A in B$ and $A subset.eq B$.
][
Let $A = {1}$ and $B={1,{1}}$, so that $A in B$ and $A subset.eq B$ are both true.
]
#hw("24")[
Can you *conclude(v. 断定)* that $A = B$ if $A$ and $B$ are two sets with the same power set?
][
Let us proof by contraposition:
(1) Assume $A!=B$ and $PP(A) = PP(B)$.
(2) WLOG, assume that $abs(A) <= abs(B)$. So that there exists an element $x$ satisfying $x in B$ but $x in.not A$.
(3) Therefore, ${x} in PP(B)$ but ${x} in.not PP(A)$, which means $PP(A) != PP(B)$, that is a contradiction.
Overall, the conclusion $PP(A) = PP(B) -> A=B$ is proved.
]
#hw("26")[
Determine whether each of these sets is the power set of a set, where $a$ and $b$ are distinct elements.
(a) $emptyset$
(b) ${emptyset, {a}}$
(c) ${emptyset, {a}, {emptyset, a}}$
(d) ${emptyset, {a}, {b}, {a, b}}$
][
(a) F. The size of a power set is at least $2^0=1$, so that $emptyset$ must not be a power set.
(b) T. ${emptyset, {a}} = PP({a})$.
(c) F. The size of a power set is $2^k$, where $k$ is a non-negative integer representing the size of the original set. Since $|{emptyset, {a}, {emptyset, a}}| = 3$, so this set is not a power set.
(d) T. ${emptyset, {a}, {b}, {a, b}} = PP({a,b})$
]
#hw("34(a)(c)")[
Let $A = {a, b, c}$, $B = {x, y}$, and $C = {0, 1}$. Find
(a) $A times B times C$
(c) $C times A times B$
][
(a) $A times B times C = {a x 0, a x 1, a y 0, a y 1, b x 0, b x 1, b y 0, b y 1, c x 0, c x 1, c y 0, c y 1}$.
(c) $C times A times B = {0 a x, 1 a x, 0 a y, 1 a y, 0 b x, 1 b x, 0 b y, 1 b y, 0 c x, 1 c x, 0 c y, 1 c y}$.
]
= 2.2 Set Operations
#hw("19")[
Show that if $A$, $B$, and $C$ are sets, then $overline(A ∩ B ∩ C) = overline(A) ∪ overline(B) ∪ overline(C)$.
(a) by showing each side is a subset of the other side.
(b) using a membership table.
][
(a) First, we will show $overline(A ∩ B ∩ C) subset.eq overline(A) ∪ overline(B) ∪ overline(C)$ by the following steps:
#indent-box[
(a.1.1) Assume $x$ is in $overline(A ∩ B ∩ C)$
(a.1.2) $x$ is not in $A sect B sect C$, by defintion of sets' complement.
(a.1.3) $not (x in A and x in B and x in C)$ holds, by definition of intersection.
(a.1.4) $x in.not A or x in.not B or x in.not C$, by De Morgan's law.
(a.1.5) $x in overline(A) or x in overline(B) or x in overline(C)$, by definition of complement.
(a.1.6) $x in (overline(A) union overline(B) union overline(C))$, by definition of union.
(a.1.7) Therefore, $overline(A ∩ B ∩ C) subset.eq overline(A) ∪ overline(B) ∪ overline(C)$ is proved.
Second, we will show $overline(A) ∪ overline(B) ∪ overline(C) subset.eq overline(A ∩ B ∩ C)$ also holds by following steps:
(a.2.1) Assume $x$ is in $overline(A) ∪ overline(B) ∪ overline(C)$.
(a.2.2) $x in overline(A) or x in overline(B) or x in overline(C)$, by definition of union.
(a.2.3) $x in.not A or x in.not B or x in.not C$, by definition of complement.
(a.2.4) $not (x in A and x in B and x in C)$, by De Morgan's law.
(a.2.5) $x in.not (A sect B sect C)$, by definition of intersection.
(a.2.6) $x in (A sect B sect C)$, by definition of complement.
(a.2.7) Therefore, $overline(A) ∪ overline(B) ∪ overline(C) subset.eq overline(A ∩ B ∩ C)$ is proved.
Overall, both sides are the subset of each other, so the equality is proved.
]
(b) The membership table is as follows:
#indent-box[
#let T = math.upright("1")
#let F = math.upright("0")
#table3(
columns: (1fr, 1fr, 1fr, 3fr, 3fr, 3fr),
$A$, $B$, $C$, $A sect B sect C$, $overline(A sect B sect C)$, $overline(A) union overline(B) union overline(C)$,
T, T, T, T, F, F,
T, T, F, F, T, T,
T, F, T, F, T, T,
T, F, F, F, T, T,
F, T, T, F, T, T,
F, T, F, F, T, T,
F, F, T, F, T, T,
F, F, F, F, T, T,
)
From the membership table we can easily derive that $overline(A ∩ B ∩ C) = overline(A) ∪ overline(B) ∪ overline(C)$.
]
]
#hw("54")[
Let $A_i = {dots, -2, -1, 0, 1, dots, i}$. Find
#v(0.5em) (a) $display(union.big_(i=1)^n A_i)$#v(0.5em)
#v(0.5em) (b) $display(sect.big_(i=1)^n A_i)$ #v(0.5em)
][
(a) $display(union.big_(i=1)^n A_i) = A_n$. Since $A_i subset.eq A_(i+1)$, so that $A_i union A_(i+1) = A_(i+1)$.
#v(1em)
(b) $display(sect.big_(i=1)^n A_i) = A_1$. Since $A_i subset.eq A_(i+1)$, so that $A_i sect A_(i+1) = A_i$.
]
#hw("63(c)")[
Show how bitwise operations on bit strings can be used to find these combinations of $A = {a, b, c, d, e}$, $B = {b, c, d, g, p, t, v}$, $C = {c, e, i, o, u, x, y, z}$, and $D = {d, e, h, i, n, o, t, u, x, y}$.
(c) $(A union D) sect (B union C)$
][
Let $U$: the set of all lowercase English letters. So that the bitset of given sets are:
- $A$: 11111000000000000000000000
- $B$: 01110010000000010001010000
- $C$: 00101000100000100000100111
- $D$: 00011001100001100001100110
With the help of calculator, we can get the result bit string is 01111000100000100001100110, representing the set ${b,c,d,e,i,o,t,u,x,y}$.
] |
https://github.com/typst/packages | https://raw.githubusercontent.com/typst/packages/main/packages/preview/chuli-cv/0.1.0/modules/styles.typ | typst | Apache License 2.0 | #let colors = (
accent: rgb("#007fad"),
inactive: luma(170),
gradient-init: rgb("#001f3f"),
gradient-end: rgb("#7fdbff")
)
#let global-text-setting = (
weight: "regular",
size: 10pt,
)
#let vline() = [
#h(5pt)
]
#let hline() = [
#box(width: 1fr, line(stroke: 0.9pt, length: 100%))
]
#let dashed-line() = [
table.hline(
stroke: (
paint: colors.inactive,
thickness: 1pt,
dash: "dashed"
)
)
]
#let letter-signature-style = (
position: right,
dx: -65%,
dy: -4%,
)
#let letter-footer-style = (
position: bottom,
table: (
columns: (1fr, auto),
inset: 0pt,
)
)
#let page-style = (
paper: "a4",
margin: (
left: 1cm,
right: 1cm,
top: 0.8cm,
bottom: 0.4cm,
),
text: (
align: left,
weight: "regular",
size: global-text-setting.size,
)
)
#let body-style = (
fonts: ("Source Sans Pro", "Font Awesome 6 Brands", "Font Awesome 6 Free"),
size: global-text-setting.size,
weight: "regular",
fill: black,
)
#let list-style = (
indent: 1em
)
#let header-style = (
fonts: ("Source Sans Pro"),
table: (
inset: 0pt,
columns: (5fr, 1fr),
column-gutter: 30pt
),
full-name: (
size: 36pt,
weight: "bold"
),
job-title: (
size: 18pt,
weight: "bold"
),
profile-photo: (
width: 100pt,
height: 100pt,
stroke: none,
radius: 9999pt,
image-height: 10.0cm
),
margins: (
between-info-and-socials: 2.5mm,
bottom: 3pt
),
socials: (
column-gutter: 10pt
)
)
#let section-style = (
title: (
size: 16pt,
weight: "bold",
font-color: black
),
margins: (
top: 3pt,
right-to-hline: 2pt,
)
)
#let entry-style = (
table: (
columns: (5%, 1fr),
inset: 0pt,
align: horizon,
),
title: (
size: global-text-setting.size,
weight: "bold",
color: black
),
company-or-university: (
size: global-text-setting.size,
weight: "bold",
color: colors.accent
),
time-and-location: (
size: global-text-setting.size,
weight: "regular",
color: black
),
margins: (
top: 3pt,
between-logo-and-title: 8pt,
between-title-and-subtitle: 3pt,
between-time-and-location: 10pt,
between-icon-and-text: 5pt
)
)
// Skills
#let skills-style = (
columns: (18%, 1fr),
stroke: 1pt + colors.accent,
radius: 20%,
margins: (
between-skill-tags: 6pt,
between-categories: -4pt
)
)
// language
#let language-style = (
columns: (18%, 1fr),
stroke: 1pt + colors.accent,
radius: 5pt,
row-gutter: 2pt,
align: (horizon, right),
margins: (
top: 3pt,
between-tags: 3pt,
between-categories: -6pt,
between-icon-and-text: 5pt
)
)
#let freetime-style = (
columns: (18%, 1fr),
align: (horizon, right),
column-gutter: 1pt,
)
// Education with table style
#let education-entry-style = (
row-gutter: 4pt,
column-gutter: 4pt,
margins: (
top: 3pt,
between-logo-and-text: 5pt,
),
)
//Styles
#let footer-style(str) = {
text(
size: 8pt,
fill: colors.inactive,
smallcaps(str)
)
}
#let accent-subtopic-style(str) = {
text(
size: body-style.size,
weight: "bold",
fill: colors.accent,
str,
)
}
#let regular-text-style(str) = {
text(
font: body-style.fonts,
weight: body-style.weight,
size: body-style.size,
fill: body-style.fill,
str,
)
}
#let black-topic-style(str) = {
text(
size: body-style.size,
weight: "bold",
fill: black,
str,
)
}
#let inactive-ligth-style(str) = {
text(
font: body-style.fonts,
size: body-style.size,
fill: colors.inactive,
weight: "light",
str,
)
}
#let italic-text-style(str) = {
text(
font: body-style.fonts,
weight: body-style.weight,
size: body-style.size,
fill: body-style.fill,
style: "italic",
str
)
}
#let underline-accent-style(str) = {
text(
font: body-style.fonts,
size: body-style.size,
weight: "bold",
fill: colors.accent,
underline(str)
)
} |
https://github.com/levinion/typst-dlut-templates | https://raw.githubusercontent.com/levinion/typst-dlut-templates/main/templates/thesis/cover.typ | typst | MIT License | #import "../util/style.typ":font_size,font_family,vspacer
#let header = [
#vspacer(2)
#set align(center)
#set text(
font: font_family.songti_bold, size: font_size.xiao_yi, weight: "medium",
)
大连理工大学本科毕业论文(设计)\
#vspacer(1)
]
#let title(chinese_title, english_title)=[
#set align(center)
#set text(font: font_family.huawen_xihei, size: font_size.er, weight: "medium")
#set par(leading: 0.8em)
#chinese_title\
#set text(font: font_family.huawen_xihei, size: font_size.san, weight: "bold")
#english_title\
]
#let desc(faculty, major, name, id, sup, rev, date)=[
#set align(center)
#set text(font: font_family.songti, size: font_size.xiao_san)
#let grid_v(content)=[
#rect(width: 100%, inset: 2pt, stroke: (bottom: 0.5pt + black))[#content]
]
#grid(
columns: (100pt, 180pt), row-gutter: 1.1em, column-gutter: 0em, "学院(系):",
grid_v(faculty), "专 业:", grid_v(major), "学 生 姓名:",
grid_v(name), "学 号:", grid_v(id), "指 导 教 师:",
grid_v(sup), "评 阅 教 师:", grid_v(rev), "完 成 日 期:",
grid_v(date),
)
]
#let fonter = [
#set align(center)
#set text(font: font_family.huawen_xingkai, size: font_size.xiao_er)
大连理工大学\
#set text(font: font_family.huawen_xingkai, size: font_size.xiao_si)
Dalian University of Technology\
]
#let cover(chinese_title, english_title, faculty, major, name, id, sup, rev, date) = [
// #set page(margin: (top: 3.5cm, bottom: 2.5cm, left: 2.5cm, right: 2.5cm))
#header\
#title(chinese_title, english_title)\
#vspacer(8)
#desc(faculty, major, name, id, sup, rev, date)\
#vspacer(2, size: 18pt)
#fonter
#pagebreak(weak: true)
]
|
https://github.com/crystalmaterial/typst | https://raw.githubusercontent.com/crystalmaterial/typst/main/README.md | markdown | Creative Commons Zero v1.0 Universal | # typst
a typst repository with a templates and perhaps one day many more..
|
https://github.com/TypstApp-team/typst | https://raw.githubusercontent.com/TypstApp-team/typst/master/tests/typ/text/raw-align.typ | typst | Apache License 2.0 | // Test the alignment of text inside of raw blocks.
---
// Text inside raw block should be unaffected by outer alignment by default.
#set align(center)
#set page(width: 180pt)
#set text(6pt)
#lorem(20)
```py
def something(x):
return x
a = 342395823859823958329
b = 324923
```
#lorem(20)
---
// Text inside raw block should follow the specified alignment.
#set page(width: 180pt)
#set text(6pt)
#lorem(20)
#align(center, raw(
lang: "typ",
block: true,
align: right,
"#let f(x) = x\n#align(center, line(length: 1em))",
))
#lorem(20)
---
// Error: 17-20 expected `start`, `left`, `center`, `right`, or `end`, found top
#set raw(align: top)
|
https://github.com/quarto-ext/typst-templates | https://raw.githubusercontent.com/quarto-ext/typst-templates/main/fiction/_extensions/fiction/typst-show.typ | typst | Creative Commons Zero v1.0 Universal | #show: book.with(
$if(title)$
title: "$title$",
$endif$
$if(author)$
author: "$author$",
$endif$
$if(dedication)$
dedication: [$dedication$],
$endif$
$if(publishing-info)$
publishing-info: [$publishing-info$],
$endif$
)
|
https://github.com/typst/packages | https://raw.githubusercontent.com/typst/packages/main/packages/preview/unichar/0.1.0/ucd/block-1E00.typ | typst | Apache License 2.0 | #let data = (
("LATIN CAPITAL LETTER A WITH RING BELOW", "Lu", 0),
("LATIN SMALL LETTER A WITH RING BELOW", "Ll", 0),
("LATIN CAPITAL LETTER B WITH DOT ABOVE", "Lu", 0),
("LATIN SMALL LETTER B WITH DOT ABOVE", "Ll", 0),
("LATIN CAPITAL LETTER B WITH DOT BELOW", "Lu", 0),
("LATIN SMALL LETTER B WITH DOT BELOW", "Ll", 0),
("LATIN CAPITAL LETTER B WITH LINE BELOW", "Lu", 0),
("LATIN SMALL LETTER B WITH LINE BELOW", "Ll", 0),
("LATIN CAPITAL LETTER C WITH CEDILLA AND ACUTE", "Lu", 0),
("LATIN SMALL LETTER C WITH CEDILLA AND ACUTE", "Ll", 0),
("LATIN CAPITAL LETTER D WITH DOT ABOVE", "Lu", 0),
("LATIN SMALL LETTER D WITH DOT ABOVE", "Ll", 0),
("LATIN CAPITAL LETTER D WITH DOT BELOW", "Lu", 0),
("LATIN SMALL LETTER D WITH DOT BELOW", "Ll", 0),
("LATIN CAPITAL LETTER D WITH LINE BELOW", "Lu", 0),
("LATIN SMALL LETTER D WITH LINE BELOW", "Ll", 0),
("LATIN CAPITAL LETTER D WITH CEDILLA", "Lu", 0),
("LATIN SMALL LETTER D WITH CEDILLA", "Ll", 0),
("LATIN CAPITAL LETTER D WITH CIRCUMFLEX BELOW", "Lu", 0),
("LATIN SMALL LETTER D WITH CIRCUMFLEX BELOW", "Ll", 0),
("LATIN CAPITAL LETTER E WITH MACRON AND GRAVE", "Lu", 0),
("LATIN SMALL LETTER E WITH MACRON AND GRAVE", "Ll", 0),
("LATIN CAPITAL LETTER E WITH MACRON AND ACUTE", "Lu", 0),
("LATIN SMALL LETTER E WITH MACRON AND ACUTE", "Ll", 0),
("LATIN CAPITAL LETTER E WITH CIRCUMFLEX BELOW", "Lu", 0),
("LATIN SMALL LETTER E WITH CIRCUMFLEX BELOW", "Ll", 0),
("LATIN CAPITAL LETTER E WITH TILDE BELOW", "Lu", 0),
("LATIN SMALL LETTER E WITH TILDE BELOW", "Ll", 0),
("LATIN CAPITAL LETTER E WITH CEDILLA AND BREVE", "Lu", 0),
("LATIN SMALL LETTER E WITH CEDILLA AND BREVE", "Ll", 0),
("LATIN CAPITAL LETTER F WITH DOT ABOVE", "Lu", 0),
("LATIN SMALL LETTER F WITH DOT ABOVE", "Ll", 0),
("LATIN CAPITAL LETTER G WITH MACRON", "Lu", 0),
("LATIN SMALL LETTER G WITH MACRON", "Ll", 0),
("LATIN CAPITAL LETTER H WITH DOT ABOVE", "Lu", 0),
("LATIN SMALL LETTER H WITH DOT ABOVE", "Ll", 0),
("LATIN CAPITAL LETTER H WITH DOT BELOW", "Lu", 0),
("LATIN SMALL LETTER H WITH DOT BELOW", "Ll", 0),
("LATIN CAPITAL LETTER H WITH DIAERESIS", "Lu", 0),
("LATIN SMALL LETTER H WITH DIAERESIS", "Ll", 0),
("LATIN CAPITAL LETTER H WITH CEDILLA", "Lu", 0),
("LATIN SMALL LETTER H WITH CEDILLA", "Ll", 0),
("LATIN CAPITAL LETTER H WITH BREVE BELOW", "Lu", 0),
("LATIN SMALL LETTER H WITH BREVE BELOW", "Ll", 0),
("LATIN CAPITAL LETTER I WITH TILDE BELOW", "Lu", 0),
("LATIN SMALL LETTER I WITH TILDE BELOW", "Ll", 0),
("LATIN CAPITAL LETTER I WITH DIAERESIS AND ACUTE", "Lu", 0),
("LATIN SMALL LETTER I WITH DIAERESIS AND ACUTE", "Ll", 0),
("LATIN CAPITAL LETTER K WITH ACUTE", "Lu", 0),
("LATIN SMALL LETTER K WITH ACUTE", "Ll", 0),
("LATIN CAPITAL LETTER K WITH DOT BELOW", "Lu", 0),
("LATIN SMALL LETTER K WITH DOT BELOW", "Ll", 0),
("LATIN CAPITAL LETTER K WITH LINE BELOW", "Lu", 0),
("LATIN SMALL LETTER K WITH LINE BELOW", "Ll", 0),
("LATIN CAPITAL LETTER L WITH DOT BELOW", "Lu", 0),
("LATIN SMALL LETTER L WITH DOT BELOW", "Ll", 0),
("LATIN CAPITAL LETTER L WITH DOT BELOW AND MACRON", "Lu", 0),
("LATIN SMALL LETTER L WITH DOT BELOW AND MACRON", "Ll", 0),
("LATIN CAPITAL LETTER L WITH LINE BELOW", "Lu", 0),
("LATIN SMALL LETTER L WITH LINE BELOW", "Ll", 0),
("LATIN CAPITAL LETTER L WITH CIRCUMFLEX BELOW", "Lu", 0),
("LATIN SMALL LETTER L WITH CIRCUMFLEX BELOW", "Ll", 0),
("LATIN CAPITAL LETTER M WITH ACUTE", "Lu", 0),
("LATIN SMALL LETTER M WITH ACUTE", "Ll", 0),
("LATIN CAPITAL LETTER M WITH DOT ABOVE", "Lu", 0),
("LATIN SMALL LETTER M WITH DOT ABOVE", "Ll", 0),
("LATIN CAPITAL LETTER M WITH DOT BELOW", "Lu", 0),
("LATIN SMALL LETTER M WITH DOT BELOW", "Ll", 0),
("LATIN CAPITAL LETTER N WITH DOT ABOVE", "Lu", 0),
("LATIN SMALL LETTER N WITH DOT ABOVE", "Ll", 0),
("LATIN CAPITAL LETTER N WITH DOT BELOW", "Lu", 0),
("LATIN SMALL LETTER N WITH DOT BELOW", "Ll", 0),
("LATIN CAPITAL LETTER N WITH LINE BELOW", "Lu", 0),
("LATIN SMALL LETTER N WITH LINE BELOW", "Ll", 0),
("LATIN CAPITAL LETTER N WITH CIRCUMFLEX BELOW", "Lu", 0),
("LATIN SMALL LETTER N WITH CIRCUMFLEX BELOW", "Ll", 0),
("LATIN CAPITAL LETTER O WITH TILDE AND ACUTE", "Lu", 0),
("LATIN SMALL LETTER O WITH TILDE AND ACUTE", "Ll", 0),
("LATIN CAPITAL LETTER O WITH TILDE AND DIAERESIS", "Lu", 0),
("LATIN SMALL LETTER O WITH TILDE AND DIAERESIS", "Ll", 0),
("LATIN CAPITAL LETTER O WITH MACRON AND GRAVE", "Lu", 0),
("LATIN SMALL LETTER O WITH MACRON AND GRAVE", "Ll", 0),
("LATIN CAPITAL LETTER O WITH MACRON AND ACUTE", "Lu", 0),
("LATIN SMALL LETTER O WITH MACRON AND ACUTE", "Ll", 0),
("LATIN CAPITAL LETTER P WITH ACUTE", "Lu", 0),
("LATIN SMALL LETTER P WITH ACUTE", "Ll", 0),
("LATIN CAPITAL LETTER P WITH DOT ABOVE", "Lu", 0),
("LATIN SMALL LETTER P WITH DOT ABOVE", "Ll", 0),
("LATIN CAPITAL LETTER R WITH DOT ABOVE", "Lu", 0),
("LATIN SMALL LETTER R WITH DOT ABOVE", "Ll", 0),
("LATIN CAPITAL LETTER R WITH DOT BELOW", "Lu", 0),
("LATIN SMALL LETTER R WITH DOT BELOW", "Ll", 0),
("LATIN CAPITAL LETTER R WITH DOT BELOW AND MACRON", "Lu", 0),
("LATIN SMALL LETTER R WITH DOT BELOW AND MACRON", "Ll", 0),
("LATIN CAPITAL LETTER R WITH LINE BELOW", "Lu", 0),
("LATIN SMALL LETTER R WITH LINE BELOW", "Ll", 0),
("LATIN CAPITAL LETTER S WITH DOT ABOVE", "Lu", 0),
("LATIN SMALL LETTER S WITH DOT ABOVE", "Ll", 0),
("LATIN CAPITAL LETTER S WITH DOT BELOW", "Lu", 0),
("LATIN SMALL LETTER S WITH DOT BELOW", "Ll", 0),
("LATIN CAPITAL LETTER S WITH ACUTE AND DOT ABOVE", "Lu", 0),
("LATIN SMALL LETTER S WITH ACUTE AND DOT ABOVE", "Ll", 0),
("LATIN CAPITAL LETTER S WITH CARON AND DOT ABOVE", "Lu", 0),
("LATIN SMALL LETTER S WITH CARON AND DOT ABOVE", "Ll", 0),
("LATIN CAPITAL LETTER S WITH DOT BELOW AND DOT ABOVE", "Lu", 0),
("LATIN SMALL LETTER S WITH DOT BELOW AND DOT ABOVE", "Ll", 0),
("LATIN CAPITAL LETTER T WITH DOT ABOVE", "Lu", 0),
("LATIN SMALL LETTER T WITH DOT ABOVE", "Ll", 0),
("LATIN CAPITAL LETTER T WITH DOT BELOW", "Lu", 0),
("LATIN SMALL LETTER T WITH DOT BELOW", "Ll", 0),
("LATIN CAPITAL LETTER T WITH LINE BELOW", "Lu", 0),
("LATIN SMALL LETTER T WITH LINE BELOW", "Ll", 0),
("LATIN CAPITAL LETTER T WITH CIRCUMFLEX BELOW", "Lu", 0),
("LATIN SMALL LETTER T WITH CIRCUMFLEX BELOW", "Ll", 0),
("LATIN CAPITAL LETTER U WITH DIAERESIS BELOW", "Lu", 0),
("LATIN SMALL LETTER U WITH DIAERESIS BELOW", "Ll", 0),
("LATIN CAPITAL LETTER U WITH TILDE BELOW", "Lu", 0),
("LATIN SMALL LETTER U WITH TILDE BELOW", "Ll", 0),
("LATIN CAPITAL LETTER U WITH CIRCUMFLEX BELOW", "Lu", 0),
("LATIN SMALL LETTER U WITH CIRCUMFLEX BELOW", "Ll", 0),
("LATIN CAPITAL LETTER U WITH TILDE AND ACUTE", "Lu", 0),
("LATIN SMALL LETTER U WITH TILDE AND ACUTE", "Ll", 0),
("LATIN CAPITAL LETTER U WITH MACRON AND DIAERESIS", "Lu", 0),
("LATIN SMALL LETTER U WITH MACRON AND DIAERESIS", "Ll", 0),
("LATIN CAPITAL LETTER V WITH TILDE", "Lu", 0),
("LATIN SMALL LETTER V WITH TILDE", "Ll", 0),
("LATIN CAPITAL LETTER V WITH DOT BELOW", "Lu", 0),
("LATIN SMALL LETTER V WITH DOT BELOW", "Ll", 0),
("LATIN CAPITAL LETTER W WITH GRAVE", "Lu", 0),
("LATIN SMALL LETTER W WITH GRAVE", "Ll", 0),
("LATIN CAPITAL LETTER W WITH ACUTE", "Lu", 0),
("LATIN SMALL LETTER W WITH ACUTE", "Ll", 0),
("LATIN CAPITAL LETTER W WITH DIAERESIS", "Lu", 0),
("LATIN SMALL LETTER W WITH DIAERESIS", "Ll", 0),
("LATIN CAPITAL LETTER W WITH DOT ABOVE", "Lu", 0),
("LATIN SMALL LETTER W WITH DOT ABOVE", "Ll", 0),
("LATIN CAPITAL LETTER W WITH DOT BELOW", "Lu", 0),
("LATIN SMALL LETTER W WITH DOT BELOW", "Ll", 0),
("LATIN CAPITAL LETTER X WITH DOT ABOVE", "Lu", 0),
("LATIN SMALL LETTER X WITH DOT ABOVE", "Ll", 0),
("LATIN CAPITAL LETTER X WITH DIAERESIS", "Lu", 0),
("LATIN SMALL LETTER X WITH DIAERESIS", "Ll", 0),
("LATIN CAPITAL LETTER Y WITH DOT ABOVE", "Lu", 0),
("LATIN SMALL LETTER Y WITH DOT ABOVE", "Ll", 0),
("LATIN CAPITAL LETTER Z WITH CIRCUMFLEX", "Lu", 0),
("LATIN SMALL LETTER Z WITH CIRCUMFLEX", "Ll", 0),
("LATIN CAPITAL LETTER Z WITH DOT BELOW", "Lu", 0),
("LATIN SMALL LETTER Z WITH DOT BELOW", "Ll", 0),
("LATIN CAPITAL LETTER Z WITH LINE BELOW", "Lu", 0),
("LATIN SMALL LETTER Z WITH LINE BELOW", "Ll", 0),
("LATIN SMALL LETTER H WITH LINE BELOW", "Ll", 0),
("LATIN SMALL LETTER T WITH DIAERESIS", "Ll", 0),
("LATIN SMALL LETTER W WITH RING ABOVE", "Ll", 0),
("LATIN SMALL LETTER Y WITH RING ABOVE", "Ll", 0),
("LATIN SMALL LETTER A WITH RIGHT HALF RING", "Ll", 0),
("LATIN SMALL LETTER LONG S WITH DOT ABOVE", "Ll", 0),
("LATIN SMALL LETTER LONG S WITH DIAGONAL STROKE", "Ll", 0),
("LATIN SMALL LETTER LONG S WITH HIGH STROKE", "Ll", 0),
("LATIN CAPITAL LETTER SHARP S", "Lu", 0),
("LATIN SMALL LETTER DELTA", "Ll", 0),
("LATIN CAPITAL LETTER A WITH DOT BELOW", "Lu", 0),
("LATIN SMALL LETTER A WITH DOT BELOW", "Ll", 0),
("LATIN CAPITAL LETTER A WITH HOOK ABOVE", "Lu", 0),
("LATIN SMALL LETTER A WITH HOOK ABOVE", "Ll", 0),
("LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND ACUTE", "Lu", 0),
("LATIN SMALL LETTER A WITH CIRCUMFLEX AND ACUTE", "Ll", 0),
("LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND GRAVE", "Lu", 0),
("LATIN SMALL LETTER A WITH CIRCUMFLEX AND GRAVE", "Ll", 0),
("LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND HOOK ABOVE", "Lu", 0),
("LATIN SMALL LETTER A WITH CIRCUMFLEX AND HOOK ABOVE", "Ll", 0),
("LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND TILDE", "Lu", 0),
("LATIN SMALL LETTER A WITH CIRCUMFLEX AND TILDE", "Ll", 0),
("LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND DOT BELOW", "Lu", 0),
("LATIN SMALL LETTER A WITH CIRCUMFLEX AND DOT BELOW", "Ll", 0),
("LATIN CAPITAL LETTER A WITH BREVE AND ACUTE", "Lu", 0),
("LATIN SMALL LETTER A WITH BREVE AND ACUTE", "Ll", 0),
("LATIN CAPITAL LETTER A WITH BREVE AND GRAVE", "Lu", 0),
("LATIN SMALL LETTER A WITH BREVE AND GRAVE", "Ll", 0),
("LATIN CAPITAL LETTER A WITH BREVE AND HOOK ABOVE", "Lu", 0),
("LATIN SMALL LETTER A WITH BREVE AND HOOK ABOVE", "Ll", 0),
("LATIN CAPITAL LETTER A WITH BREVE AND TILDE", "Lu", 0),
("LATIN SMALL LETTER A WITH BREVE AND TILDE", "Ll", 0),
("LATIN CAPITAL LETTER A WITH BREVE AND DOT BELOW", "Lu", 0),
("LATIN SMALL LETTER A WITH BREVE AND DOT BELOW", "Ll", 0),
("LATIN CAPITAL LETTER E WITH DOT BELOW", "Lu", 0),
("LATIN SMALL LETTER E WITH DOT BELOW", "Ll", 0),
("LATIN CAPITAL LETTER E WITH HOOK ABOVE", "Lu", 0),
("LATIN SMALL LETTER E WITH HOOK ABOVE", "Ll", 0),
("LATIN CAPITAL LETTER E WITH TILDE", "Lu", 0),
("LATIN SMALL LETTER E WITH TILDE", "Ll", 0),
("LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND ACUTE", "Lu", 0),
("LATIN SMALL LETTER E WITH CIRCUMFLEX AND ACUTE", "Ll", 0),
("LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND GRAVE", "Lu", 0),
("LATIN SMALL LETTER E WITH CIRCUMFLEX AND GRAVE", "Ll", 0),
("LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND HOOK ABOVE", "Lu", 0),
("LATIN SMALL LETTER E WITH CIRCUMFLEX AND HOOK ABOVE", "Ll", 0),
("LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND TILDE", "Lu", 0),
("LATIN SMALL LETTER E WITH CIRCUMFLEX AND TILDE", "Ll", 0),
("LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND DOT BELOW", "Lu", 0),
("LATIN SMALL LETTER E WITH CIRCUMFLEX AND DOT BELOW", "Ll", 0),
("LATIN CAPITAL LETTER I WITH HOOK ABOVE", "Lu", 0),
("LATIN SMALL LETTER I WITH HOOK ABOVE", "Ll", 0),
("LATIN CAPITAL LETTER I WITH DOT BELOW", "Lu", 0),
("LATIN SMALL LETTER I WITH DOT BELOW", "Ll", 0),
("LATIN CAPITAL LETTER O WITH DOT BELOW", "Lu", 0),
("LATIN SMALL LETTER O WITH DOT BELOW", "Ll", 0),
("LATIN CAPITAL LETTER O WITH HOOK ABOVE", "Lu", 0),
("LATIN SMALL LETTER O WITH HOOK ABOVE", "Ll", 0),
("LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND ACUTE", "Lu", 0),
("LATIN SMALL LETTER O WITH CIRCUMFLEX AND ACUTE", "Ll", 0),
("LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND GRAVE", "Lu", 0),
("LATIN SMALL LETTER O WITH CIRCUMFLEX AND GRAVE", "Ll", 0),
("LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND HOOK ABOVE", "Lu", 0),
("LATIN SMALL LETTER O WITH CIRCUMFLEX AND HOOK ABOVE", "Ll", 0),
("LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND TILDE", "Lu", 0),
("LATIN SMALL LETTER O WITH CIRCUMFLEX AND TILDE", "Ll", 0),
("LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND DOT BELOW", "Lu", 0),
("LATIN SMALL LETTER O WITH CIRCUMFLEX AND DOT BELOW", "Ll", 0),
("LATIN CAPITAL LETTER O WITH HORN AND ACUTE", "Lu", 0),
("LATIN SMALL LETTER O WITH HORN AND ACUTE", "Ll", 0),
("LATIN CAPITAL LETTER O WITH HORN AND GRAVE", "Lu", 0),
("LATIN SMALL LETTER O WITH HORN AND GRAVE", "Ll", 0),
("LATIN CAPITAL LETTER O WITH HORN AND HOOK ABOVE", "Lu", 0),
("LATIN SMALL LETTER O WITH HORN AND HOOK ABOVE", "Ll", 0),
("LATIN CAPITAL LETTER O WITH HORN AND TILDE", "Lu", 0),
("LATIN SMALL LETTER O WITH HORN AND TILDE", "Ll", 0),
("LATIN CAPITAL LETTER O WITH HORN AND DOT BELOW", "Lu", 0),
("LATIN SMALL LETTER O WITH HORN AND DOT BELOW", "Ll", 0),
("LATIN CAPITAL LETTER U WITH DOT BELOW", "Lu", 0),
("LATIN SMALL LETTER U WITH DOT BELOW", "Ll", 0),
("LATIN CAPITAL LETTER U WITH HOOK ABOVE", "Lu", 0),
("LATIN SMALL LETTER U WITH HOOK ABOVE", "Ll", 0),
("LATIN CAPITAL LETTER U WITH HORN AND ACUTE", "Lu", 0),
("LATIN SMALL LETTER U WITH HORN AND ACUTE", "Ll", 0),
("LATIN CAPITAL LETTER U WITH HORN AND GRAVE", "Lu", 0),
("LATIN SMALL LETTER U WITH HORN AND GRAVE", "Ll", 0),
("LATIN CAPITAL LETTER U WITH HORN AND HOOK ABOVE", "Lu", 0),
("LATIN SMALL LETTER U WITH HORN AND HOOK ABOVE", "Ll", 0),
("LATIN CAPITAL LETTER U WITH HORN AND TILDE", "Lu", 0),
("LATIN SMALL LETTER U WITH HORN AND TILDE", "Ll", 0),
("LATIN CAPITAL LETTER U WITH HORN AND DOT BELOW", "Lu", 0),
("LATIN SMALL LETTER U WITH HORN AND DOT BELOW", "Ll", 0),
("LATIN CAPITAL LETTER Y WITH GRAVE", "Lu", 0),
("LATIN SMALL LETTER Y WITH GRAVE", "Ll", 0),
("LATIN CAPITAL LETTER Y WITH DOT BELOW", "Lu", 0),
("LATIN SMALL LETTER Y WITH DOT BELOW", "Ll", 0),
("LATIN CAPITAL LETTER Y WITH HOOK ABOVE", "Lu", 0),
("LATIN SMALL LETTER Y WITH HOOK ABOVE", "Ll", 0),
("LATIN CAPITAL LETTER Y WITH TILDE", "Lu", 0),
("LATIN SMALL LETTER Y WITH TILDE", "Ll", 0),
("LATIN CAPITAL LETTER MIDDLE-WELSH LL", "Lu", 0),
("LATIN SMALL LETTER MIDDLE-WELSH LL", "Ll", 0),
("LATIN CAPITAL LETTER MIDDLE-WELSH V", "Lu", 0),
("LATIN SMALL LETTER MIDDLE-WELSH V", "Ll", 0),
("LATIN CAPITAL LETTER Y WITH LOOP", "Lu", 0),
("LATIN SMALL LETTER Y WITH LOOP", "Ll", 0),
)
|
https://github.com/Kasci/LiturgicalBooks | https://raw.githubusercontent.com/Kasci/LiturgicalBooks/master/CSL_old/oktoich/Hlas1/3_Streda.typ | typst | #let V = (
"HV": (
("", "Prechváľniji múčenicy", "Na kresťí prihvoždájem, Christé Bóže, jáko čelovík, čelovíčeskoje jestestvó obožíl jesí, i načalozlóbnaho umertvíl jesí zmíja. Nás svobodíl jesí kľátvy jáže ot dréva, jáko blahoutróben býv kľátva: prišél jesí, jáko da vsím podási blahoslovénije, i véliju mílosť."),
("", "", "Vsjákija prevýšši čésti sýj Vladýko, obezčéstitisja blahovolíl jesí, ponósnuju preterpív ščédre na drévi smérť, jejáže rádi bezsmértije, obját ród čelovíčeskij, i žízň pérvuju vospriját, tebí uméršu plótiju vsesíľne."),
("", "", "Kreste vsečéstnýj, vírnych vsích očistílišče, vsjá osvjatí tebí poklaňájuščyjasja i Christá slávjaščyja, rúci prečísťiji prostéršaho na tebí neizrečénnaho rádi blahoutróbija i koncý zemlí vsjá vo jedíno sobrávšaho."),
("", "Nebésnych činóv", "U krestá predstojášči Sýna i Bóha tvojehó, i dolhoterpínije tohó smotrjájušči, hlahólaše pláčušči Máti čístaja: uvý mňí, čádo sladčájšeje! Čtó sijá stráždeši neprávedno Slóve Bóžij? da spáséši čelovíčestvo."),
("", "", "U krestá predstojášči, nevísto neiskusomúžnaja, i jáže ot boľíznej jázvy prijémľušči, vopijáše: da ne bezčádnu mjá javíši, čádo mojé, róždšuju ťá Slóve Bóžij: ne ostávi mjá jedínu jedinoródnyj, Otcú soprisnosúščnyj."),
("", "", "Vnehdá ťa raždách, boľízni nikákože imích: i káko nýňi boľízni podjémľu, tebí Slóve neprávedno raspinájemu? Vopijáše hórko Ďíva slezjášči. Uvý mňí! Ne terpľú víďiti na krest, vozdvížena ťá čelovikoľúbče."),
("Krestobohoródičen", "", "Tvojehó Sýna i Vladýku, drévle jáko víďila jesí, na kresťí rúci rasprostérša, i kopijém rébra iskopovájema, Máti čístaja rydájušči vzyvála jesí: uvý mňí! Káko stráždeši, strásti čelovíkov otémľaj čelovikoľúbče?"),
),
"S": (
("", "", "Krest vodruzísja na lóbňim, i procvité nám bezsmértije, ot istóčnika prisnotekúščaho rebrá Spásova."),
("", "", "Nerazrušéna sťiná nám jésť čéstnýj krest Spásov: na nehó bo naďíjuščesja, spasájemsja vsí."),
("Múčeničen", "", "O dóbryja kúpli vášeja svjatíji! jáko króvi dáste, i nebésnyja nasľídovaste, i privrémenno iskusívšesja, víčno veselitésja: voístinnu dobrá váša kúpľa, tľínnaja bo ostávľše, netľínnaja vosprijáste, i so ánhely likovstvújušče, pojéte neprestánno Tróicu jedinosúščnuju."),
("Krestobohoródičen", "Nebésn<NAME>inóv", "Vozdvížena jáko víďi na kresťí Áhnca, neporóčnaja Ďíva pláčušči vopijáše: sládkoje mojé čádo, čtó nóvoje i preslávnoje viďínije? Káko soderžáj vsjáčeskaja hórstiju, na drévi prihvoždáješisja plótiju?")
),
)
#let P = (
"1": (
("", "", "Tvoja pobidíteľnaja desníca Bohoľípno v kríposti proslávisja: tá bo bezsmértne, jáko vsemohúščaja protívnyja sotré, Izráiľťanom púť hlubiný novosoďílavšaja."),
("", "", "Íže vójinstvom nebésnym nedovídomyj, otrokovíce vseneporóčnaja, plóť priját ot plóti tvojejá, i obnoví istľívšuju prestuplénijem pérvym."),
("", "", "Písňmi ublažím vírniji, Bóžija Slóva páče slovesé Rodítelnicu: sijá bo preneporóčnaja, zemným javísja ukrašénije, i vsím sohrišájuščym predstáteľnica býsť."),
("", "", "Javílasja jesí prostránňijši nebés: tvorcá bo vsjáčeskich vmíščši Máti prisnoďívo. ťímže vopijú ti: ťisnotý vsjákija mjá smertoródnyja izbávi Bohorádovannaja."),
("", "", "Dážď nám pómošč čístaja, oburevájemym moľbóju skorbéj, nizloží vrahóv nášich lukávaja voznošénija, i podážď vsím spasénije, blahočéstno ťá slávjaščym."),
),
"3": (
("", "", "Jedíne vídyj čelovíčeskaho suščestvá némošč, i mílostivno v né voobrážsja, prepojáši mjá s vysotý síloju, jéže vopíti tebí svjatýj: oduševlénnyj chráme, neizrečénnyja slávy tvojejá čelovikoľúbče."),
("", "", "Pólnyj istoščavájetsja nás rádi, i prijémlet beznačáľnyj ot tebé načálo Ďívo preneporóčnaja, i víditsja nevídimyj, i pitájaj vsjáčeskaja, mlekóm pitájetsja, obnovíti čelovíki promyšľája."),
("", "", "Iscilí sokrušénije náše Ďívo neiskusobráčnaja, iscilíteľa róždšaja, i Hóspoda, vchód nám k žízni pokazávšaho blahodátiju : jehóže neprestánno molí uščédriti i spastí rabý tvojá."),
("", "", "Jáže jedína jestestvó čelovíkov obožívšaja, páče jestestvá vseneporóčnaja, róždšemusja iz tebé molísja, sohrišénij nášich proščénije dáti, i rádovanije víčnoje, presvjatája Ďívo vsepítaja."),
("", "", "V ľínosti iždív žízň, pripádaju tí prečístaja, jáže k Bóhu prísnymi molítvami tvojími vozdvíhni mój úm, i prosvítí vsehó mja očernénaho, pokajánija svitlosťmí, da víroju i ľubóviju slávľu ťá."),
),
"4": (
("", "", "Hóru ťá blahodátiju Bóžijeju priosinénnuju, prozorlívyma Avvakúm usmotrív očíma, iz tebé izýti Izráilevu provozhlašáše svjatómu, vo spasénije náše i obnovlénije."),
("", "", "Božéstvennuju ťá palátu slóva znájem, v ňúže vselísja plótiju, obnoví nás istľívšich strasťmí. Ťímže čístaja, Bóžiju Máter ťá čtím, i ot tebé róždšahosja slávim."),
("", "", "Vselísja vo utróbu tvojú Ďívo, Slóvo voplóščšejesja, i vséľšujusja préžde kľátvu v jestestvó čelovíčeskoje izhná, i svojím božéstvennym sovokuplénijem oboží Bohoľípno, sehó rádi ťá vospivájem."),
("", "", "Mértvosť podját Adám vseneporóčnaja, otnéľíže vkusí plodá tľínnaho: nýňi že tvojím roždestvóm oživé, i v selénijich rájskich vodvorjájetsja. Sehó rádi ťá po dólhu vospivájem."),
("", "", "Ustávila jesí tók smértnyj, róždši bezsmértija istóčnik Christá Bóha, čístaja. Tohó úbo molí Bohoblahodátnaja, duší mojejá umorívšyja iscilíti strásti, i spastí mja."),
),
"5": (
("", "", "Prosvitívyj sijánijem prišéstvija tvojehó Christé, i osvitívyj krestóm tvojím míra koncý, serdcá prosvití svítom tvojehó Bohorazúmija, pravoslávno pojúščich ťá."),
("", "", "Vozsijá ot čréva tvojehó nezachodímoje sólnce preneporóčnaja, i ťmú do koncá potrebí, i zémľu ujasní rázumy božéstvennymi: ťímže vírno vospivájem ťá."),
("", "", "Rádujsja, ánheľskij hlás vzyvájem tí prečístaja: rodilá bo jesí velíkaho sovíta ánhela, i Otcú sobeznačáľna, plóť bývšaho Ďívo, za jéže spastí čelovíka."),
("", "", "Hospóď vséľsja čístaja, vo črévo tvojé, íže blahočéstno v nehó vírujuščyja, izbávil jésť ot vladýčestvija vrážija: ťímže velehlásno vsí vospivájem ťá prečístaja."),
("", "", "Obléksja v mjá Vladýka, iz tebé prójde vseneporóčnaja, i istľívšeje jestestvó oboží: no tohó molí Bohorodíteľnice, náha vsjákaho hrichá sotvoríti mjá."),
),
"6": (
("", "", "Obýde nás posľídňaja bézdna, ňísť izbavľájaj, vminíchomsja jáko óvcy zakolénija. spasí ľúdi tvojá, Bóže náš: tý bo kríposť nemoščstvújuščich i ispravlénije."),
("", "", "Bez símene Bóha vo črévi začalá jesí, i po roždeství stránňim Ďíva prebylá jesí vseneporóčna: ťímže chvalámi slávim ťá, íže tobóju prečístaja, izbávľšesja kľátvy."),
("", "", "Ľístvica, júže Jákov víde: horá prisínnaja: vsesvítlyj óblak božéstvennaho svíta: dvér, jéjuže Bóh jedín prójde: blahoslovénnaja v ženách, tý jesí preneporóčnaja."),
("", "", "Zakónov jestéstvennych kromí rodilá jesí Ďívo neiskusobráčnaja, Slóvo Bóžije ipostásnoje, isciľájuščeje náše sokrušénije: jehóže priľížno molí, spastí vsích nás."),
("", "", "Boľívšuju mojú dúšu prestupléňmi prinés, vzyváju tí vsesvjatája, preslávnaja, čístaja: iscilí i spasí mja chodátajstvom tvojím, jáko da vospojú i veličáju zastuplénije tvojé."),
),
"S": (
("", "", "Tvojé predstáteľstvo imúšče prečístaja, i tvojími molítvami ľútych izbavľájemi, krestóm Sýna tvojehó vezďí sobľudájemi, po dólhu ťá vsí blahočéstno veličájem."),
),
"7": (
("", "", "Tebé úmnuju Bohoródice, péšč razsmotrjájem vírniji: jákože bo ótroki spasé trí prevoznosímyj, mír obnoví, vo črévi tvojém vsecíl, chváľnyj otcév Bóh, i preproslávlen."),
("", "", "Zakóna síni, i prédňaja hadánija Bohohlásnych prorók, tvojé bezsímennoje roždestvó jávi provozvistíša, prečístaja vseneporóčnaja: jéže vospivájušče zovém, vospítaho otcév Bóha i preproslávlennaho."),
("", "", "Vostók sólnca rodilá jesí Bohoblahodátnaja čístaja, prosvíščšaho vírnych vsích ispolnénija, nóšč že umáľšaho zločéstija. Ťímže čtím vospítaho otcév Bóha i preproslávlennaho."),
("", "", "Kupiná inohdá neopáľnaja, vseneporóčnaja, tvojé voobražáše črévo, íbo ne opalí ťa otňúd óhň Božestvá. Ťímže moľú ťa, ohňá nehasímaho izbávi mjá, jáko da pojú nemólčno čístaja, velíčija tvojá."),
("", "", "Máti Bóžija, vírnych pómošče, sohrišájuščich očiščénije, blahích vsích podáteľnice, prijimí mja blahoutróbijem tvojím mílostivnym pripádajušča, i prichoďášča k tebí s pláčem, i prosjáščaho razrišénija sohrišénij mojích."),
),
"8": (
("", "", "V peščí ótrocy Izráilevy, jákože v horníľi dobrótoju blahočéstija, čisťíje zláta bleščáchusja, hlahóľušče: blahoslovíte vsjá ďilá Hospódňa Hóspoda, pójte i prevoznosíte vo vsjá víki."),
("", "", "Zakónniji óbrazi, i prédňaja hadánija Ďívo, Hospódňu ťá čístuju Máter predskazáša jávi: mý že sbytijé veščéj nýňi víďašče, pojém ťá sohlásno, i slavoslóvim vo vsjá víki."),
("", "", "Ukrasísja božéstvennymi dobrótami, bez razsuždénija v dobrótach, Slóvo Bóžije róždši vseneporóčnaja, krasotámi božéstvennymi vsích serdcá ujasňájuščeje, víroju pisnoslóvjaščich jehó vo vsjá víki."),
("", "", "Svjaščénnymi hlásy izdaléča skazáša prorócy, Máter ťá býti vseneporóčnaja Vladýci Bóhu, jemúže vsí zovém: blahoslovíte vsjá ďilá Hóspoda, pójte i prevoznosíte jehó vo víki."),
("", "", "Jáko krasná, jáko predobrá Ďívo, krásnaho v dobrótach, páče viný rodilá jesí Christá, jemúže vsí zovém: blahoslovíte vsjá ďilá Hóspoda, pójte i prevoznosíte jehó vo víki."),
),
"9": (
("", "", "Óbraz čístaho roždestvá tvojehó, ohnepalímaja kupiná pokazá neopáľnaja: i nýňi na nás napástej svirípijuščuju uhasíti mólimsja péšč, da ťá Bohoródice neprestánno veličájem."),
("", "", "Jestestvó jéže préžde osuždénnoje zemných Ďívo, prejestéstvennym tvojím božéstvennym roždestvóm bezsmértije ulučí: i dobrótu préžňuju vospriját, pojúšče ťá sohlásno rádostnymi písňmi."),
("", "", "Nósiši vsjá nosjáščaho, i mlekóm pitáješi, vsím píšču dajúščaho: vélije i strášnoje, jéže páče umá tvojé tájinstvo, kovčéže čéstnáho svjaščénstva Ďívo Bohoródice. Ťímže ťá vsí ublažájem."),
("", "", "Svít mňí ležášču, prečístaja, v ľínosti ťmý, nýňi vozsijáj, osľipľájuščyja mí pómysly strastéj rišášči, i mír hlubók vseneporóčnaja, prísno soďivájušči v duší mojéj, sláviti ťá."),
("", "", "Strašúsja sudíšča neumýtnaho, i sudií nezabvénnaho vseneporóčnaja: ímam bo mnóžestvo sohrišénij bezčíslennoje, v ľínosti žív vsestrástnyj: ťímže mjá Bohoródice, uščédrivši pomíluj."),
),
)
#let U = (
"S1": (
("", "", "Raspénšusja tí Christé, pohíbe mučíteľstvo, i poprána býsť síla vrážija: nižé bo ánhel, ni čelovík, no tý sám Hóspodi spásl jesí nás, sláva tebí."),
("", "", "Krestá tvojehó drévu poklaňájemsja čelovikoľúbče: jáko na ném prihvozdílsja jesí životé vsích, i ráj otvérzl jesí Spáse, víroju prišédšemu k tebí razbójniku, i píšči spodóbil jesí ispovídajuščaho ťá: pomjaní mja Hóspodi. Prijimí jákože ónaho i nás zovúščich: sohrišíchom vsí, milosérdijem tvojím ne prézri nás."),
("", "", "Áhnca na kresťí áhnica zrjášči, s razbójnikoma raspinájema ťá dolhoterpilíve Slóve, i kopijém k rébra probodájema, vosklicáše vopijúšči máterski: čtó stránnoje i užásnoje, Iisúse mój, tájinstvo, neskazánno soveršájemoje? Káko pokryváješisja hróbom neopísannyj Bóže? Da mjá róždšuju ťá ne ostáviši, Sýne mój sladčájšij."),
),
"S2": (
("", "", "Spasí, Hóspodi, ľúdi tvojá i blahosloví dostojánije tvojé, pobídy na soprotívnyja dáruja i tvojé sochraňája krestóm tvojím žíteľstvo."),
("", "", "Orúžije krestnoje vo braňích javísja ňíkohda blahočestívomu carjú Konstantínu, nepobidímaja pobída na vrahí víry rádi: sehó trepéščut soprotívnyja síly: séj býsť vírnych spasénije, i Pávlu pochvalá."),
("Múčeničen", "", "Boľízňmi svjatých, ímiže o tebí postradáša, umolén búdi Hóspodi: i vsjá náša boľízni iscilí čelovikoľúbče, mólimsja."),
("Krestobohoródičen", "", "Tvojé predstáteľstvo imúšče prečístaja, i tvojími molítvami ľútych izbavľájemi, krestóm Sýna tvojehó vezdé sobľudájemi, po dólhu ťá vsí blahočéstno veličájem."),
),
"S3": (
("", "", "Na drévi ťá Slóve krestňim, za milosérdije mílosti, povíšena plótiju vóleju, jáko víďi sólnce, ne terpjá derznovénija pomračísja. Ťímže omračénnuju dúšu mojú prosvití nepristúpnym svítom tvojím, i spasí mja, moľúsja."),
("", "", "Rasprostrýj na kresťí dláni tvojá ščédre, jazýki bývšija daléče ot tebé, sobrál jesí sláviti mnóhuju tvojú blahostýňu: no prízri na nasľídije tvojé, i nizloží vojújuščich na ný, krestóm tvojím čestným."),
("Krestobohoródičen", "", "Neskvérnaja áhnica, áhnca i pástyrja povíšena na drévi mértva zrjášči, pláčušči viščáše, máterski vosklicájušči: káko preterpľú tvojé jéže páče slóva Sýne mój snítije, i vóľnyja strásti, Bóže preblahíj?"),
),
"K": (
"P1": (
"1": (
("", "", "Hórkija rabóty izbávľsja Izráiľ, neprochodímoje prójde jáko súšu, vrahá zrjá potopľájema, písň jáko blahoďíteľu pojét Bóhu, čudoďíjuščemu mýšceju vysókoju, jáko proslávisja."),
("", "", "Na kresťí vozdvizájem Christé, sovozdvíhl jesí pádšaho čelovíka, i vsjú vrážiju sílu nizvérhl jesí Slóve. Ťímže tvojá strásti vospiváju postradávšaho, i ot strastéj izbávľšaho mjá."),
("", "", "Slávy Hospóď tý jesí, íže slávoju vinčávyj čelovíka, térnijem vinčálsja jesí, jáko da ternonósnoje jestestvó náše sotvoríši plodonósno, sadíteľu božéstvennych ďijánij."),
("Múčeničen", "", "Svjatých sobór presvjatýj zakónno postradávyj, vsjú krovéj svjatých tečéňmi tvár osvjatíl jésť, i skvérnyja bisóm žértvy prinosímyja, o Bózi Otcí potrebíl jésť."),
("Múčeničen", "", "Váša vsesvjatíji múčenicy, óblacy mučénij ne skrýša terpilívnaja borénija: ťímže páče sólnečnych lúč slávniji javístesja, oblistájušče jávi zarí spasénija."),
("Bohoródičen", "", "Orúžijem sňidášesja prečístaja, strastéj Sýna tvojehó, jáko zrjáše tohó kopijém probodájema, jéže v rají vozbraníteľnoje otrivájuščaho orúžije, ne dajúščeje vírnym božéstvennaho vchóda."),
),
"2": (
("", "", "Tvojá pobidíteľnaja desníca Bohoľípno v kríposti proslávisja, tá bo bezsmértne, jáko vsemohúščaja, protívnyja sotré, Izráiľťanom púť hlubiný novosoďílavšaja."),
("", "", "Strují mňí sléz dušévnych dáruj vseneporóčnaja, jáže istóčnik ostavlénija róždši, hrichóvnuju skvérnu otmyvájušča, i vo smiréniji žízň mojú izvoďášča."),
("", "", "Prevýšši býsť čístaja tvári, Bóha voplóščši. Ťímže moľú ťá: ot hnója strastéj vozstávi mjá, i k božéstvenňij vysoťí bezstrástija vozvedí."),
("", "", "Mílostiva mí javísja čístaja, v déň súdnyj, moľúsja, vsjákaho izbavľájušči mjá strášnaho stojánija i ľútaho mučénija, pribihájuščaho pod króv tvój prečístaja Vladýčice."),
("", "", "Mrákom hrichóvnym oderžíma mjá, i pádša prečístaja, vozdvíhni, sléz túču dajúšči mí, ímiže omýju skvérnaja ďilá: ťá bo jedínu zastúpnicu ímamy Bohoródice."),
),
),
"P3": (
"1": (
("", "", "Ne múdrostiju i bohátstvom da chválitsja smértnyj svojím, no víroju Hospódneju pravoslávno vzyvája Christú Bóhu, i pojá prísno: na kámeni tvojích zápovidej utverdí mja Vladýko."),
("", "", "Iskopáša tí bezzakónniji rúci i nózi Iisúse mój, dlániju neizrečénno sozdávšaho pérvije Christé Bóže čelovíka, i strástiju strastéj, i tlí vsích svobóždšaho."),
("", "", "Da stánet, vopijáše Iisús, luná že i sólnce, jéže na kresťí propisújaj postradávšaho Vladýku plótiju, svitílom pomračénije. Ímže tmý načála lukávaja posrámlena býša."),
("Múčeničen", "", "Terpjáchu usérdno rány slávniji múčenicy, i ujazvľájemi, velijára zmíja ujazvíša krípko: ťímže dúš nášich rány isciľájut prísno, božéstvennym manovénijem."),
("Múčeničen", "", "Kápišča bisóvskaja i chrámy razoríste múčenicy, boľízňmi že i múžestvom sámi sebé preslávno chrámy vozdvihóste blahodátiju , vmistíteľny Otcú, i Sýnu, i svjatómu Dúchu."),
("Bohoródičen", "", "V čás strastéj, krásnaho dobrotóju zrjášči Ďívo, viďínija nižé dobróty imúšča, vopijála jesí hórko čístaja, vosklicájušči: uvý mňí, káko stráždeši Sýne, ot strastéj vsích choťáj izbáviti?"),
),
"2": (
("", "", "Jedíne vídyj čelovíčeskaho suščestvá némošč, i mílostivno v né voobrážsja: prepojáši mjá s vysotý síloju, jéže vopíti tebí svjatýj: oduševlénnyj chráme neizrečénnyja slávy tvojejá, čelovikoľúbče."),
("", "", "Chrám bylá jesí prečístaja, vsími cárstvujuščaho, bývša mjá vertép dušetľínnych razbójnik, ischití ot ťích ozloblénija, i božéstvennaho Dúcha čísto žilíšče javí mja."),
("", "", "Chrám bylá jesí prečístaja, vsími cárstvujuščaho, bývša mjá vertép dušetľínnych razbójnik, ischití ot ťích ozloblénija, i božéstvennaho Dúcha čísto žilíšče javí mja."),
("", "", "Sléz mí poslí túču, izsušájušču tečénija lukávych mojích ďijánij, moľúsja, jáže blahoutróbija róždši tíchuju pučínu, Christá Bóha nášeho, Bohoródice Ďívo vsepítaja."),
("", "", "Kríposť nám i stólp nepokolebím búdi Bohorádovannaja, i ščít, i orúžije nepobidímoje, mýslennych vráh polkí ot nás vozbraňájušči, Bohoródice prečístaja, víroju i ľubóviju počitájuščich ťá."),
),
),
"P4": (
"1": (
("", "", "Slýša drévle Avvakúm Christé čúdnyj tvój slúch, i stráchom vzyváše: ot júha Bóh priídet, i svjatýj ot horý priosinénnyja čášči, spastí pomázannyja: sláva síľi tvojéj Hóspodi."),
("", "", "Rány i jázvy Christé preterpíl jesí, jázvy sérdca mojehó isciľája, žélči vkusív hórkija, sládkaho vkúsa tletvórnaho otémľa vréd: na drévi že prihvóždsja drévňuju kľátvu potrebíl jesí."),
("", "", "Daléče otrinovénnyja ot tebé jazýki, vozdvizájem na kresťí blíz privlékl jesí, primiríl že jesí nás Otcú dolhoterpilíve, v sredú vvél jesí jáko chodátaj sebé: i posreďí zemlí strásť preterpíl jesí ponósnuju."),
("Múčeničen", "", "V móre krovéj vášich tájno Bohoblažénniji, so vsími svojími vójinstvy, mýslennyj faraón vpád potopísja. Ťímže rádostiju vý spásšesja prijidóste ko obetovánňij zemlí, i nebésniji hráždane býste."),
("Múčeničen", "", "Vozmohóša vžiľájemi Christóvoju strástiju blažénniji, strásti razlíčnyja vosprijáti na čestňij plóti. Sehó rádi ustavľájut strásti dúš že i ťilés, voschvaľájuščich ťích, i blažáščich vsehdá."),
("Bohoródičen", "", "Neprávedno zrjášči zakolénije ťá Christé róždšaja, rydájušči vopijáše tí: pravosúde Sýne, káko neprávedno osudílsja jesí, choťáj opravdáti prestuplénijem osuždényja drévle, i k tľíniju popólzšyjasja?"),
),
"2": (
("", "", "Hóru ťá blahodátiju Bóžijeju priosinénnuju, prozorlívyma Avvakúm usmotrív očíma, iz tebé izýti Izráilevu provozhlašáše svjatómu, vo spasénije náše i obnovlénije."),
("", "", "Bisóvskimi lesťmí ľúťi otvlačímaho mjá ot zápovidej Bóžijich, ne prézri blahája: no uščédri moľúsja, i tohó prélesti pokaží mja výšša, pribihájuščaho prečístaja k tvojéj mílosti."),
("", "", "Bisóvskimi lesťmí ľúťi otvlačímaho mjá ot zápovidej Bóžijich, ne prézri blahája: no uščédri moľúsja, i tohó prélesti pokaží mja výšša, pribihájuščaho prečístaja k tvojéj mílosti."),
("", "", "Jedíne sýj mílostivne Christé Bóže, tebé róždšija molítvami, na ťá upovájuščich pomíluj, i uščédri, i k svítu zápovidej tvojích nastávi, i víčnyja žízni spodóbi."),
("", "", "Usnúvša v smérť, i vo hróbi ležášča otčájanija prečístaja, okóvana žeľízy prehrišénij mojích, tvojéju bódrennoju molítvoju vozdvíhni, i k pokajániju isprávi, moľúsja."),
),
),
"P5": (
"1": (
("", "", "Svít tvój nezachodímyj vozsijáj Christé v serdcá vírno pojúščich ťá, mír podavájaj nám, páče umá. Ťím ot nóšči nevíďinija ko dňú svítom tvojím tekúšče, slavoslóvim ťá čelovikoľúbče."),
("", "", "Sólnce Spáse obnažísja svíta, na drévi náha tebé zrjá vísjašča, na vodách povísivšaho zémľu: kámeni že, na kámeni jáko oščutíša vozdvížena, raspadášesja stráchom, i osnovánija pokolebášasja."),
("", "", "Vozdvížen na drévo, i hvozďmí prihvóždsja, okrovavíl jesí perstý dolhoterpilíve, i kopijém probodájem v rébra, iscilíl jesí jázvu Adámovu, júže priját rebrá poslúšav, i preslúšav sotvóršaho í."),
("Múčeničen", "", "Ráj javísja múčenik mnóžestvo, živótnoje imíja posreďí drévo Christá: za nehóže ponósnuju dóblestvennym pómyslom smérť preterpívše, sňídiju ródu načáľniki umertvívšaho zmíja, Božéstvennoju síloju umertvíša."),
("Múčeničen", "", "Króvnymi kápľami Christóvy stradáľcy, bezbóžija hlubinú izsušíste, i Božéstvennymi istočéniji čudés svjaščénnych, strastéj tečénija dúš že i ťilés zahraždájete. ťímže dostodólžno ublažájemi jesté."),
("Bohoródičen", "", "Udivľášesja neporóčnaja, na drévi zrjášči Christá vozdvížena vóleju, i pláčušči vopijáše: Sýne mój i Bóže, boľízni v roždeství izbíhši, nýňi boľízni straždú, neprávedno ot bezzakónnych raspinájemu tí."),
),
"2": (
("", "", "Prosvitívyj sijánijem prišéstvija tvojehó Christé, i osvitívyj krestóm tvojím míra koncý, serdcá prosvití svítom tvojehó Bohorazúmija, pravoslávno pojúščich ťá."),
("", "", "Potócy mnóhich mí prehrišénij priverhóšasja, i chrám duší mojejá nizložíša prečístaja: no jáže jesí ispravlénije práotcem Bohoródice, vozstávi mjá rabá tvojehó."),
("", "", "V timíniji mjá strastéj uhľíbnuvša okajánnaho, i búreju mnóhich sohrišénij potopľájema, rúku podávši Vladýčice, vozvedí mja, i ko pristánišču pokajánija naprávi."),
("", "", "Dušévnych mí skvérn očiščénije dáruj, i plotskích mjá boľíznej iscilí moľúsja, i ot obderžáščaho ľútaho unýnija preminí molítvami tvojími."),
),
),
"P6": (
"1": (
("", "", "Vés ot strastéj bezmírnych soderžúsja, i kítom zól snizpadóch: no vozvedí iz istľínija mjá Bóže, jákože préžde Jónu, i víroju bezstrástije mí dáruj, jáko da vo hlási chvalénija, i spasénija Dúchom požrú ti."),
("", "", "Jehdá Moiséj rúci vozďív na vysotú, tvojú strásť voobražáše, prostéršaho na drévi dláni, i lukávaho razrušívša deržávu páhubnuju, ťímže izbáviteľa vídušče ťá i Spása pojím, čelovikoľúbče."),
("", "", "Mértvosť preterpíl jesí vozdvizájem na drévo, i umertvíteľa nášeho umertvíl jesí: i oživív rukú tvojéju Christé sozdánije, v rébra že kopijém probodájem, istočíl jesí dví ricí ostavlénija, vo dvojú vóľu vospivájemyj."),
("Múčeničen", "", "Čestná váša smérť svjatíji pred Hóspodem nýňi býsť, počétšich vsích čestnými svojími strasťmí, i bezčéstnaho velijára posramívšich, vsími priložéniji múk nizložíti vsích vás kóznstvujuščaho."),
("Múčeničen", "", "Vséju dušéju ko vsím otlučístesja mnohovídnym premúdriji mučénijem, vsjú obritóste sposóbstvujuščuju vám pómošč, vo vsé čelovíčestvo obólkšahosja. Ťímže na údy ssikájemi: i ohňú približájuščesja veseľástesja."),
("Bohoródičen", "", "Raspjátije tvojé zrjášči prečístaja, vopijáše: Sýne, čtó zrímoje stránnoje viďínije? Íže strásti boľáščich isciľájaj, káko strásť Christé terpíši novíjšuju? Čtó ti vrazí vozdáša blahodáteľu, za ňáže blahodáť prijáša?"),
),
"2": (
("", "", "Obýde nás posľídňaja bézdna, ňísť izbavľájaj, vminíchomsja jáko óvcy zakolénija, spasí ľúdi tvojá Bóže náš: tý bo kríposť nemoščstvújuščich i ispravlénije."),
("", "", "Rukopisánije prečístaja, prehrišénij mojích kopijém rastórhni, róždšahosja rádi iz bezsímennaho tvojehó čréva: v knízi mjá napisáti spodóbi izbránnych, pribihájuščaho k božéstvennomu pokróvu tvojemú."),
("", "", "Rukopisánije prečístaja, prehrišénij mojích kopijém rastórhni, róždšahosja rádi iz bezsímennaho tvojehó čréva: v knízi mjá napisáti spodóbi izbránnych, pribihájuščaho k božéstvennomu pokróvu tvojemú."),
("", "", "Očísti Christé, rabý tvojá molítvami róždšija ťá, i nizposlí jáko jedín bláh sohrišénij proščénije: tý bo jesí Spás, i izbáviteľ vsím naďíjuščymsja na ťá."),
("", "", "Umerščvléna mjá strasťmí prečístaja Ďívo, jáže žiznodávca róždšaja, oživí nýňi tvojími molítvami, i pobidíteľa javí mja na vrahá zláho: ťá bo jedínu ímamy k Bóhu pomóščnicu nášu."),
),
),
"P7": (
"1": (
("", "", "Proidóša jáko čertóh péščnyj plámeň nesterpímyj, íže za blahočéstije inohdá ótrocy svjatíji pokazávšesja jávi, i sohlásno vospivájušče, písň pojáchu: otcév Bóže blahoslovén jesí."),
("", "", "Vladýka sýj ot rabá priját Iisúse mój, udarénije, svobodíti mjá choťáj poraboščénnaho vrahú, na kresťí že prihvóždsja spasáješi mjá pojúšča: íže otcév Bóže, blahoslovén jesí."),
("", "", "Potrjasésja vsjá tvár, raspinájemu tí blahoutróbne Hóspodi, kopijém probodájemu tí, vráh vseťilésnuju priját jázvu, ujázvennyj že Adám isciľí, vopijá: blahoslovén Bóh otéc nášich."),
("Múčeničen", "", "Krestóm ohraždénnoje strastotérpec vójinstvo slávnoje, opolčénija vrážija pohubí blahodátiju , i pobídy vincý priját, vopijá: blahoslovén Bóh otéc nášich."),
("Múčeničen", "", "Ohňá síľňíjše sťažávše stradáľcy proizvolénije, ne opáľšesja ohňú priobščájuščesja, no popalíste zločéstija lukávuju véšč, vopijúšče: otéc nášich Bóže blahoslovén jesí."),
("Bohoródičen", "", "Roždestvó tvojé Ďívo, preslávno víki porodí: i vozdvížen na krest, pádšyja sovozdvíže, i nebésnyja žíteli pokazá vopijúščyja: otcév Bóže blahoslovén jesí."),
),
"2": (
("", "", "Tebé úmnuju Bohoródice, péšč razsmotrjájem vírniji: jákože bo ótroki spasé trí prevoznosímyj, mír obnoví vo črévi tvojém vsecíl, chváľnyj otcév Bóh, i preproslávlen."),
("", "", "Jáko istóčnika žízni róždšaja, uméršuju mojú dúšu živonósnoju desníceju, prečístaja, voskresí, i vopíti spodóbi vo umiléniji sérdca mojehó: prechváľnyj otcév Bóže blahoslovén jesí."),
("", "", "Jáko istóčnika žízni róždšaja, uméršuju mojú dúšu živonósnoju desníceju, prečístaja, voskresí, i vopíti spodóbi vo umiléniji sérdca mojehó: prechváľnyj otcév Bóže blahoslovén jesí."),
("", "", "Nóv Adám ot čístych krovéj tvojích býti izvólil jésť, íže préžde vík Bóh. Jehóže nýňi molí, obvetšávšaho mjá obnovíti, zovúšča: prechváľnyj otéc nášich Bóže blahoslovén jesí."),
("Bohoródičen", "", "Hňíva putém vráh prichoďá, voschítiti choťá neščádno dúšu mojú smirénnuju, sehó sovíty, prečístaja, razruší: i pojúšča mjá uščédri: voschvaľájemyj otcév Bóže blahoslovén jesí."),
),
),
"P8": (
"1": (
("", "", "Čúda prejestéstvennaho pokazá óbraz, ohnerósnaja péšč drévle: óhň bo ne opalí júnyja ďíti, Christóvo javľája bezsímennoje ot Ďívy božéstvennoje roždestvó. Ťím vospivájušče vospojím: da blahoslovít tvár vsjá Hóspoda, i prevoznósit vo vsjá víki"),
("", "", "Ráspjat býl jesí na kresťí vóleju, íže mánijem nébo prostrýj: hvozďmí že prihvozdísja, uprazdníti choťá popolznovénije strástnoje pervozdánnaho Adáma. Ťím vospivájušče pojém: da blahoslovít tvár vsjákaja Hóspoda: i prevoznósit jehó vo víki."),
("", "", "Jehdá ťa kámeňa na kámeni kamenoserdéčnyj sobór vozdvíže, hóry pokolebášesja. zemľá potrjasésja, Slóve Bóžij: i dúši koléblemyja utverdíšasja k božéstvenňij žízni, vopijúščyja vsehdá, da blahoslovít tvár vsjákaja Hóspoda, i prevoznósit jehó vo víki."),
("Múčeničen", "", "Istkáša odéždu spasíteľnuju sebí jávi svjatíji strastotérpcy: v nahoťí ťilésňij stráždušče terpilívno, i posýpanije ránam prijémľušče. Ťím vospivájušče pojút: da blahoslovít tvár vsjákaja Hóspoda, i prevoznósit jehó vo víki."),
("Múčeničen", "", "Nohoťmí nemílostivno strastotérpcy strúžemi, i neščádno na údy ssicájemi, i ránam vsjáčeskim priobščájuščesja, istukánnym ne požróša, múžestva že stolpí vírnym javíšasja: blahoslovíte Christá ďilá vsjá, zovúšče, i prevoznosíte jehó vo víki."),
("Bohoródičen", "", "Da ťá preohorčevájaj bezúmnyj sobór: jákože vozmňáše ot zemlí vzjáti ťá: bezčádna bých i smuščájusja, i máterski sérdcem boľíznuju, neiskusomúžnaja vopijáše inohdá: na kresťí víďašči ťá vozdvížena: s néjuže tvár slávit ťá, vsích izbáviteľa Iisúse vo víki."),
),
"2": (
("", "", "V peščí ótrocy Izráilevy, jákože v horníľi dobrótoju blahočéstija, čisťíje zláta bleščáchusja, hlahóľušče: blahoslovíte vsjá ďilá Hospódňa Hóspoda, pójte i prevoznosíte vo vsjá víki."),
("", "", "Prosvití mi óči serdéčnyja, jáže dvér svíta čístaja, óblak strastéj, i ťmú hlubókuju razhoňájušči, da pojú: vsjá ďilá Hospódňa Hóspoda pójte, i prevoznosíte jehó vo víki."),
("", "", "Prosvití mi óči serdéčnyja, jáže dvér svíta čístaja, óblak strastéj, i ťmú hlubókuju razhoňájušči, da pojú: vsjá ďilá Hospódňa Hóspoda pójte, i prevoznosíte jehó vo víki."),
("", "", "O vsích Vladýčice čístaja, ne prestáj moľáščisja tebé prizyvájuščich jáko <NAME>, Ďívo vseneporóčnaja, i vopijúščich: blahoslovíte vsjá ďilá Hospódňa Hóspoda, pójte i prevoznosíte jehó vo víki."),
("", "", "Spasénija vinú Christá neizrečénno róždšaja, molí o vsích vopijúščich priľížno Ďívo vsepítaja: blahoslovíte vsjá ďilá Hospódňa Hóspoda, pójte i prevoznosíte jehó vo víki."),
),
),
"P9": (
"1": (
("", "", "Neizhlahólannoje Ďívy tájinstvo: Nébo bo sijá, i prestól cheruvímskij, i svitonósnyj čertóh pokazásja. Christá Bóha vsederžíteľa. Sijú blahočéstno jáko Bohoródicu veličájem."),
("", "", "Jákože víďi ťá drévle na drévi povíšena Spáse, zémľu povísivšaho na vodách bezmírnych, razbójnik blahorazúmnyj, vírno vopijáše tí: pomjaní mja, s nímže blahočéstno tvojá stradánija proslavľájem."),
("", "", "Raspinájem pokolebál jesí zemlí osnovánija, kopijém že probodájem istočáješi bezsmértnyja kápli, króv i vódu, ímiže čelovíčestvo očístil jesí ot strastéj Iisúse: Ťímže ťá vospivájušče veličájem."),
("Múčeničen", "", "Veseľáchusja v mučénijich svjatíji, sámi sebé pooščrjájušče jákože na sládosť, dóbliji: stánem, vopijúšče: sé otvérze póprišče Christós, vincý nýňi podajét ťím, íchže vozľubí."),
("Múčeničen", "", "Prosviščájetsja vsjáko vírnych jedínstvennoje toržestvó, stradánija počitájuščeje vsích nepobidímych múčenik, i ťmý boľíznej: íchže rádi neboľíznennyja spodóbišisja sládosti i žízni, i prisnosúščnaho naslaždénija."),
("Bohoródičen", "", "Čelovikoľúbca Slóva neizrečénno poróždšaja, jehóže zrjášči otrokovíca ot čelovík vóleju stráždušča, čtó sijé, vopijáše? Bóh bezstrásten strásť prijémlet: jáko da ot strastéj izbávit víroju poklaňájuščichsja jemú."),
),
"2": (
("", "", "Óbraz čístaho roždestvá tvojehó ohnepalímaja kupiná pokazá neopáľnaja: i nýňi na nás napástej svirípijuščuju uhasíti mólimsja péšč, da ťá Bohoródice neprestánno veličájem."),
("", "", "Vozmí ťážkoje brémja mojích sohrišénij, Bohoródice vsepítaja, i lehčájšeje ího Sýna i Bóha tvojehó spodóbi mjá nosíti, i po stezí šéstvovati k hórnemu soveršéniju vozvoďáščej."),
("", "", "Vozmí ťážkoje brémja mojích sohrišénij, Bohoródice vsepítaja, i lehčájšeje ího Sýna i Bóha tvojehó spodóbi mjá nosíti, i po stezí šéstvovati k hórnemu soveršéniju vozvoďáščej."),
("", "", "Trepéšču pomyšľája, vseneporóčnaja, strášnyj déň prišéstvija Christóva: vsjá bo žízň mojá vo hrisích skončásja, i strastéj dušá mojá ispólnisja. No uščédri mjá i vsjákaho izbávi tohdá osuždénija."),
("", "", "Prijimí prečístaja Vladýčice, nepotrébnaho rabá tvojehó molénija, i duší mojejá i ťíla smuščénije vo hlubókuju tišinú preloží: jáko da ťá veličáju spásájem."),
),
),
),
"ST": (
("", "", "Tebé na drévi prihvóždšahosja plótiju, i živót nám podávšaho, jáko Spása i Vladýku, pojím neprestánno."),
("", "", "Tvojím krestóm Christé, jedíno stádo býsť ánhelov i čelovíkov, i vo jedínom sobóri nébo i zemľá veselítsja, vopijá: Hóspodi sláva tebí."),
("", "", "Vás vsechváľniji múčenicy, ni skórb, ni tesnotá, ni hlád, ni honénije, nižé rány, ni járosť zviréj, ni méč, nižé óhň preťáščij razlučíti ot Bóha vozmohóša: ľubóviju že páče k nemú, jáko v čuždích podvíhšesja ťilesích, jestestvó zabýste, smérť prezrívše. Ťímže i po dostojániju boľíznej vášich mzdú prijáste, i nebésnaho cárstvija nasľídnicy býste, neprestánno molítesja o dušách nášich."),
("Krestobohoródičen", "", "U krestá tvojehó predstojášči slóve Bóžij, áhnica i neporóčnaja Máti tvojá, rydájušči vopijáše: uvý mňí Sýne, káko umiráješi na kresťí? Uvý mňí, svíte mój sládkij, hďí tvojejá dobróty nýňi zájde zrák? Krasňíjšij páče vsích čelovík."),
)
)
#let L = (
"B": (
("", "", "Sňídiju izvedé iz rajá vráh Adáma: krestóm že razbójnika vvedé Christós vóň, pomjaní mja zovúšča, jehdá priídeši vo cárstviji tvojém."),
("", "", "Ponósnuju preterpíl jesí strásť Christé: i ponošénije náše vsjákoje oťál jesí bláže, i výšňaho cárstvija pričástniki nás javíl jesí, poklaňájuščichsja tvojemú sošéstviju."),
("", "", "Adámovo Christé obnažénije tý pokryvájaj, obnažílsja jesí plótiju: voznésl že sja na krest, voznésl jesí nás ot hlubiný zlých. Ťímže tvojé Slóve slávim svjatóje schoždénije."),
("", "", "Svjátými vášimi strúpy, Prechváľniji múčenicy, mnóžestvo bisóv ostrupívše, vsjá čelovíčeskija jázvy i strúpy, blahodátiju vsehdá voístinnu isciľájete."),
("", "", "Tróica prosviščájet vsích, číste sijú počitájuščich, i víduščich jú, deržávu imúšču nerazorímuju, jéjže vozopijím: spasí ľubóviju Tróice pojúščich ťá."),
("", "", "Predstojášči preneporóčnaja pri kresťí, i zrjášči Christá prihvoždéna plótiju, vosklicájušči vzyváše: hďí tvojá zájde milosérde nýňi dobróta, slávy Hóspodi?"),
)
) |
|
https://github.com/mem-courses/calculus | https://raw.githubusercontent.com/mem-courses/calculus/main/note-1/1.基础知识.typ | typst | #import "../template.typ": *
#show: project.with(
course: "Calculus I",
course_fullname: "Calculus (A) I",
course_code: "821T0150",
semester: "Autumn-Winter 2023",
title: "Note #1: 基础知识",
authors: (
(
name: "memset0",
email: "<EMAIL>",
id: "3230104585",
),
),
date: "October 22, 2023",
)
#let def(x) = text("【" + x + "】", weight: "bold")
#let deft(x) = text("【" + x + "】", weight: "bold", fill: rgb("#FFFFFF"))
= 常用公式
== 三角恒等变换
#[
#set text(size: 11.5pt)
#table(
columns: (1fr, auto),
inset: 11pt,
stroke: 0.5pt,
align: center + horizon,
[和差角公式],
[$
sin(u pm v) = sin u cos v pm cos u sin v quad quad
cos(u pm v) = cos u cos v mp sin u sin v
$],
[倍角公式],
[$
sin 2theta &= 2 sin theta cos theta quad quad
cos 2theta &= cos^2 theta - sin^2 theta = 2 cos^2 theta - 1 = 1 - 2 sin^2 theta\
$],
[半角公式],
[$
sin theta / 2 = pm sqrt((1-cos theta)/2) quad quad
cos theta / 2 = pm sqrt((1+cos theta)/2) quad quad
tan theta / 2 = (sin theta) / (1 + cos theta) = (1 - cos theta) / (sin theta)
$],
[和差化积],
[$
sin u + sin v = 2 sin (u+v) / 2 cos (u-v) / 2 quad quad
sin u - sin v = 2 cos (u+v) / 2 sin (u-v) / 2\
cos u + cos v = 2 cos (u+v) / 2 cos (u-v) / 2 quad quad
cos u - cos v = -2 sin (u+v) / 2 sin (u-v) / 2\
$],
[积化和差],
[$
sin u cos v = 1 / 2(sin(u+v) + sin(u-v)) quad quad
cos u sin v = 1 / 2(sin(u+v) - sin(u-v))\
cos u cos v = 1 / 2(cos(u+v) + cos(u-v)) quad quad
sin u sin v = -1 / 2(cos(u+v) + cos(u-v))\
$],
[万能公式],
[$
sin u = display(2 tan u/2) / display(1 + tan^2 u/2) quad quad
cos u = display(1 - tan^2 u/2) / display(1 + tan^2 u/2) quad quad
tan u = display(2 tan u/2) / display(1 - tan^2 u/2)\
$],
[辅助角公式],
[
设 $A,B != 0$,那么 $A sin x + B cos x = sqrt(A^2 + B^2) sin(x + phi)$
其中 $phi$ 满足:$display(sin phi = display(B/sqrt(A^2 + B^2)\, sp cos phi = display(A/sqrt(A^2 + B^2))))$ 。
],
)
]
== 二项式定理
$ (a+b)^n = sum_(i=0)^n binom(n,i) a^(n-i) b^i $
== 均值不等式
$
a
< 2 / display(1/a+1/b)
< sqrt(a b)
< (a-b) / (ln a - ln b)
< (a+b) / 2
< sqrt((a^2 + b^2) / 2)
< b
$
== 柯西不等式
== 伯努利不等式
设 $x>-1$,$alpha$ 是大于 $0$ 的有理数。
1. 如果 $alpha>1$,那么 $(1+x)^alpha >= 1 + alpha x$,当且仅当 $x=0$ 时取等;
2. 如果 $0<alpha<1$,那么 $(1+x)^alpha <= 1 + alpha x$,当且仅当 $x=0$ 时取等。
= 有界集、确界原理
== 有界集
#definition[
既有上界,又有下界的数集称为*有界集*。因此 $ A "有界" quad <==> quad exists M_1, M_2 in RR,sp st forall x in A,sp M_2 <= x <= M_1 . $
等价于 $ A "有界" quad<==>quad exists M>0,sp st forall x in A ,sp |x|<=M. $
若 $A$ 不是有界集,则称 $A$ 为*无界集*。因此 $ A "无界" quad<==>quad forall M>0,sp exists x_0 in A,sp st |x_0| >M. $
]
== 确界
#definition[
设 $A subset RR, A != emptyset$,若存在常数 $alpha$,满足:
1. $forall x in A,sp x <= alpha.$($alpha$ 是 $A$ 的一个上界)
2. $forall eps>0,sp exists x_0 in A,sp st x_0>alpha-eps$(即 $alpha$ 是 $A$ 的最小上界)
则称 $alpha$ 为数集 $A$ 的*上确界*,记为 $alpha=sup A$。同理可定义数集 $A$ 的*下确界*,记为 $beta=inf A$。
]
== 有界集确界原理
#theorem(name: "有界集确界原理")[
1. 非空有上界的数集,必有上确界。非空有下界的数集,必有下确界。
2. 非空有界数集,必有上、下确界。
#note[
有界集确界原理告诉我们,在判断是否数集是否存在确界时,不需要找出确界,只需要证明有界性即可说明确界存在。
]
]
|
|
https://github.com/cspr-rad/actus-spec | https://raw.githubusercontent.com/cspr-rad/actus-spec/master/presentation/speakers-notes.md | markdown | # ACTUS Specification 2.0 speaker's notes.
These are the speaker's notes that accompany the presentation of the same name.
Please find the presentation `.pdf` file to give this presentation.
You can use `pdfpc` to give this presentation.
## Why are we talking about this?
We are a team from Casper, trying to implement ACTUS in a zero-knowledge context.
When we started off trying to build a Rust implementation, we ran into some
issues and noticed some room for improvement.
Today we'd like to point out these issues and propose some improvements.
## Current situation
This diagram shows the current situation of the ACTUS specification.
There is an Excel sheet contains the information about contract types, terms,
state variables, applicability, etc
This sheet comes with a `create-dictionary.R` script that lets you turn it into
a `.json` blob.
There is also a java implementation that co-evolved with the Excel sheet, but
is inconsistent with it in various ways.
There is also a specification pdf that is more or less independent of the
dictionary, and only specifies the mathematical definition of state transitions
and payoffs.
It means that the source of truth is .. all of these together.
Then we come along and want to write a Rust implementation and think "Where do we start?"
We started by looking at the specification pdf and noticed that it was missing most of the specification.
We then looked at the dictionary and found that is was also missing certain pieces.
So we looked at the java implementation as well, and noticed that it was inconsistent with the dictionary.
Clearly some things had gone wrong despite some very smart people making a well-intentioned effort.
## Our proposals
We will propose a few things.
Each of these are optional, and they are in order of importance.
*list the proposals* in one sentence each.
We will explain them one by one now.
# Single-source of truth.
The first proposal is to have a single source of truth.
Why is this important?
The most important reason is avoid inconsistencies by making in clear which behaviour is expected.
When there are multiple sources of truth, they eventually diverge.
We propose to designate one document as _the_ source of truth.
Then we can base implementations, tests, and documentation on it.
# Fix important issues in the spec
There are some important problem with the current specification.
They describe data types like "Real number" and "Timestamp".
Timestamps are complicated. Which granularity? Which time zone? Leap seconds?
Real numbers are an even bigger problem because they don't even exist in computers.
There are also some keys missing in the dictionary, and some broken references in the spec, but these are easy to fix once there is a single source of truth.
# Specify machine-readable tests
There are already some machine-readable tests, but we would like to propose that
* The spec describes what tests look like
* The spec comes with some tests that an implementation must pass in order to be call an implementation
This has some benefits:
* Tests become data that we can share and improve on
* We can write a test generator to continuously test an implementation
# Make the specification with typst
The specification is currently written in LaTeX and then compiled to a pdf.
* Free & Open-source
* Modern alternative to LaTeX
* Fast incremental compilation
* Excellent error messages
# Get rid of the Excel sheet
Excell is closed-source, binary (hard to version-control) format.
This would help lessen the confusion around what is the source of truth.
If you really need an excel sheet then it'd be best to generate that.
# Proposed situation
This is our proposed situation.
Note that all arrows are going from the GitHub repository outward.
The source of truth here is the combination of the dictionary data, the specification in typst source, and the manually written test data.
# Current situation
We currently have a draft specification document written in typst, as well as
some proposed test data.
The draft specification is ready enough to make the decision about which of
these proposals to adopt, but not for any other purpose.
To continue this work, we need a big "OK, let's do it", and maybe some
commitments about who wants to help, if anyone does.
I wouldn't mind doing all the work, but we still need to come to an agreement
to adopt the new specification together.
# Future work
Here are some next steps that we can take when/if we agree to go this way.
The first important step will be to describe what we want a test to look like.
I would like to work together with someone who knows about the current test
data to do that.
Next comes some annoying work, but maybe we can automate some of it.
If we choose to use Typst, then we need to rewrite the LaTeX formulas in Typst.
I wouldn't mind doing this myself because I have written a LOT of LaTeX.
If instead we choose to use LaTeX, then we need to rewrite what we currently
have in Typst, in LaTeX.
I'd prefer to not do this because LaTeX makes what we've done in Typst quite
complicated.
Once tests are specified, we can write a test generator to keep implementations
in agreement.
We can then also make a documentation generator that can make a nice website
from the dictionary and test data.
# References
Here are some more references.
The first is the repository with this presentation and the new specification work.
The second is a blog post that details the recommended way to work with money in software.
|
|
https://github.com/mumblingdrunkard/mscs-thesis | https://raw.githubusercontent.com/mumblingdrunkard/mscs-thesis/master/src/conclusion/index.typ | typst | = Conclusion <ch:conclusion>
In this project, we have made progress towards implementing doppelganger loads in synthesisable hardware.
We have uncovered multiple challenges that arise and require solving and we have solved some of them while giving approachable starting points for solving others.
We have provided a background that introduces foundational computer architecture and terminology and modern hardware development processes and tools.
We have then described the basis for our implementation---the Berkeley out-of-order machine, before outlining the problems presented by speculative execution and their mitigations and then the optimisation that is doppelganger loads.
We have then detailed our implementation in high-level terms and described how our changes integrate into the processor and which adaptations we have made that are specific to our implementation, such as making predictions on physical addresses instead of virtual ones.
We have then described our process for gathering results and we show those results.
We have then discussed the results and provided some interpretation for how they may come to be.
Especially interesting are the accuracy results for tight-loop programs.
We have then provided discussion of various problems that arose with our implementation and we have outlined the future work that should be done to implement, test, verify, and improve the design.
Despite challenges with implementation, few of these are inherently with the technique of doppelganger loads and more with lacking familiarity with the BOOM project, the Chisel library, and the Scala language.
A higher degree of proficiency in all of these would likely have allowed us to implement doppelganger loads more accurately and faster without as many problems.
The arguably half-baked implementation has still yielded results that show some promise for further implementation in combination with secure speculation schemes, though the technique is a likely dead-end for improving performance over a baseline when compared to something like speculative load wakeups.
This seems mostly to be caused by the fact that doppelganger loads are unable to wake up dependents any faster after the address has been confirmed as opposed to using speculative load wakeups.
Still, with doppelgangers that are allowed to miss and deeper cache access pipelines, this picture might shift significantly, but the implementation became too tedious for us to test these.
We conclude that doppelganger loads is a feasible generalised technique in terms of hardware implementation and the proposed design has few or no obvious oversights that are not simple to adapt to the specific solution.
It is only a matter of trade-offs at the hardware level.
|
|
https://github.com/j10ccc/zjut-social-practice-report-typst | https://raw.githubusercontent.com/j10ccc/zjut-social-practice-report-typst/main/README.md | markdown | # ZJUT-Social-Practice-Report-Typst
A template of social practice report for zjuters.
## Requirements
- [typst](https://typst.app)
- One font for report body(recommend `songti`)
## Layout convention
- The font should be an 11pt serif font
- The title should be in bold
- The paper should be `a4` sized, numbered in the center of the footer
## Usage
> TL;DR, maybe you can check out `/example.typ` for a more quick start
0. Clone the repo.
1. Choose one of your system font for compile, add it by editing `font_family`. It is recommended to choose one containing both **regular** and **bold** weight. By the words, for Chinese characters, `songti` collection should be better.
```typst
#let font_family = (
songti: "$FONT_NAME"
)
```
List all of your system fonts by
```sh
$ typst fonts
```
2. Get start from `/main.typ`, edit the `meta` to customize your information displayed in report cover. You can delete or add some keys & values.
```typst
#let meta = (
"姓 名": "$姓名",
"指导老师": "$指导老师",
)
```
**NOTE**: For fully aligning Chinese characters in the key, you can type white space between words to make visual gaps.
3. Complete your main report content below the `#show: project.with()` declaration.
4. Compile your work by
```sh
$ typst compile main.typ
```
## Further
For more customized feature, you could read following suggestions.
### Image
Attach image file in the end of the report.
```typst
// /main.typ
// ...report content
#image("/assets/photo_1.jpg")
// also a grid layout
#grid(
columns: (auto, auto),
gutter: 16pt,
image("/assets/photo_1.jpg"),
image("/assets/photo_2.jpg"),
image("/assets/photo_3.jpg"),
image("/assets/photo_4.jpg"),
)
```
### Page header
Display report title in pages header besides cover and catalog.
```typst
// /main.typ
#let meta = (
"实践报告": "一个响亮的报告名"
)
```
```typst
// /layout/project.typ
set page(
// ...
header: {
locate(loc => {
if loc.page() >= 3 { // content starts from 3th page
align(right)[
#text(size: 10pt)[
#meta.named().at("实践报告") | 社会实践报告 // get value from your meta
]
]
}
})
}
)
```
## Reference
- [zjut-report-typst](https://github.com/zjutjh/zjut-report-typst)
|
|
https://github.com/iXORTech/typst-library-swift | https://raw.githubusercontent.com/iXORTech/typst-library-swift/main/README.md | markdown | Apache License 2.0 | # Typst Library Swift
Swift Package for using Typst Library in iOS, iPadOS, and macOS applications developed in Swift
## Requirements
- macOS Monterey (12.0) or later
- Xcode 13.0 or later
- rustup
- Rust 1.80.0 or later, **installed via rustup**
- [cargo-swift](https://crates.io/crates/cargo-swift), **installed via `cargo install cargo-swift`**
## Build Swift Package
1. Open the project in Terminal
2. Run `cargo swift package`
3. Keep the default package name `TypstLibrarySwift` and build target **macOS** and **iOS**
4. The Swift package will be built in the `TypstLibrarySwift` directory
## Acknowledgments
This project relies on the following open-source projects:
- [cargo-swift](https://github.com/antoniusnaumann/cargo-swift) for building Swift packages from Rust code
- [Typst Libraries](https://crates.io/crates/typst) for [Typst](https://typst.app) related functionality such as Typst document rendering
This project heavily relies on the implementation of [tfachmann/typst-as-library](https://github.com/tfachmann/typst-as-library)
for the Typst Wrapper in Rust, and other implementations to interact with the Typst Library.
### Embedded Fonts
To make sure that the Typst Library can render the text whenever the library is used, some fonts are embedded in the Swift package.
They are **all** open-source fonts, licensed under the [SIL Open Font License](https://openfontlicense.org/).
The fonts are:
- [CMU* Concrete](https://fontlibrary.org/en/font/cmu-concrete)
- [CMU* Sans Serif](https://fontlibrary.org/en/font/cmu-sans-serif)
- [CMU* Serif](https://fontlibrary.org/en/font/cmu-serif)
- [CMU* Typewriter](https://fontlibrary.org/en/font/cmu-typewriter)
- [IBM Plex Mono](https://www.ibm.com/plex/)
- [IBM Plex Sans](https://www.ibm.com/plex/)
- [IBM Plex Serif](https://www.ibm.com/plex/)
- [STIX Two Math](https://stixfonts.org/)
- [LXGW WenKai Mono Lite](https://github.com/lxgw/LxgwWenKai-Lite)
* CMU stands for Computer Modern Unicode, which is a [derivative of the Computer Modern font family](https://en.wikipedia.org/wiki/Computer_Modern).
By default, the fonts always falls backs to:
- STIX Two Math for mathematical formulas
- IBM Plex Mono for raw text (e.g. code)
- IBM Plex Sans and LXGW WenKai Mono Lite for normal text (LXGW WenKai Mono Lite is used for characters that are not supported by IBM Plex Sans, such as Chinese characters)
|
https://github.com/IdoWinter/UnitedDumplingsLegislatureArchive | https://raw.githubusercontent.com/IdoWinter/UnitedDumplingsLegislatureArchive/main/elections/example/example.typ | typst | MIT License | #import "../ballot.typ": *
#set page(fill: color.linear-rgb(255, 255, 255, 255))
#repeat_ballot(ballot("אבג", [כופתה אחת \ בראשות גברת כופתה]))
#pagebreak()
#set page(fill: yellow)
#repeat_ballot(pm_ballot([גברת], [כופתה])) |
https://github.com/fredguth/bid_produto_1 | https://raw.githubusercontent.com/fredguth/bid_produto_1/main/_extensions/fredguth/desid-report/typst-show.typ | typst |
#show: doc => report(
$if(title)$
title: [$title$],
$endif$
$if(subtitle)$
subtitle: [$subtitle$],
$endif$
$if(by-author)$
authors: (
$for(by-author)$
$if(it.name.literal)$
( name: [$it.name.literal$],
role: [$for(it.roles)$$it.role$ $endfor$],
corresponding: [$it.attributes.corresponding$],
affiliation: [$for(it.affiliations)$$it.name$$sep$, $endfor$],
email: [$it.email$] ),
$endif$
$endfor$
),
$endif$
$if(iadb.contract)$
iadb_contract: [$iadb.contract$],
$endif$
$if(iadb.project)$
iadb_project: [$iadb.project$],
$endif$
$if(iadb.product)$
iadb_product: [$iadb.product$],
$endif$
$if(date)$
date: [$date$],
$endif$
$if(lang)$
lang: "$lang$",
$endif$
$if(region)$
region: "$region$",
$endif$
$if(abstract)$
abstract: [$abstract$],
$endif$
$if(margin)$
margin: ($for(margin/pairs)$$margin.key$: $margin.value$,$endfor$),
$endif$
$if(papersize)$
paper: "$papersize$",
$endif$
$if(mainfont)$
font: ("$mainfont$",),
$endif$
$if(fontsize)$
fontsize: $fontsize$,
$endif$
$if(section-numbering)$
sectionnumbering: "$section-numbering$",
$endif$
$if(toc)$
toc: $toc$,
$endif$
cols: $if(columns)$$columns$$else$1$endif$,
doc,
)
|
|
https://github.com/EpicEricEE/typst-plugins | https://raw.githubusercontent.com/EpicEricEE/typst-plugins/master/droplet/tests/explicit/test.typ | typst | #import "/src/lib.typ": dropcap
#set page(width: 6cm, height: auto, margin: 1em)
// Test explicitly passed first letter.
#dropcap(square(size: 1em), gap: 1em)[A square is a square.]
#dropcap(square(size: 1em), gap: 1em, height: 3, lorem(13))
#dropcap(square(), height: 14pt, gap: 1em, lorem(10))
#dropcap[\#1][The winner has won what was to win.]
|
|
https://github.com/RiccardoTonioloDev/Bachelor-Thesis | https://raw.githubusercontent.com/RiccardoTonioloDev/Bachelor-Thesis/main/preface/summary.typ | typst | Other | #import "../config/constants.typ": abstract
#import "../config/variables.typ": *
#pagebreak(to: "odd")
#set page(numbering: "i")
#counter(page).update(1)
#v(10em)
#align(center)[#text(24pt, weight: "thin", abstract)]
#v(2em)
#set par(first-line-indent: 0pt)
Questa tesi esplora la predizione della profondità utilizzando tecniche di _deep learning_ con immagini provenienti da una telecamera monoculare. Durante uno stage di 320 ore presso il gruppo di ricerca VIMP Group dell'Università degli Studi di Padova, sono stati sviluppati, implementati e validati diversi modelli di rete neurale, tra cui PyDNet e XiNet. È stata successivamente creata PyXiNet, una famiglia di modelli, con l'obiettivo di migliorare la precisione e l'efficienza della stima della profondità.
In particolare, la tesi si è focalizzata su:
- PyDNet: Migrazione del modello da TensorFlow a PyTorch con successiva validazione dei risultati;
- XiNet: Studio, validazione e impiego di un modello con un'architettura più efficiente;
- Moduli di Attenzione: Studio, implementazione e impiego di moduli di attenzione per migliorare le prestazioni dei modelli;
- PyXiNet: esplorazione di combinazioni dei moduli e modelli precedentemente citati.
I risultati dimostrano che l'uso di tecniche di _deep learning_ per la stima della profondità da immagini monoculari è promettente, con miglioramenti significativi apportati dall'integrazione di moduli di attenzione.
#v(1fr)
|
https://github.com/TC-Fairplay/member-listing | https://raw.githubusercontent.com/TC-Fairplay/member-listing/main/junioren-a.typ | typst | MIT License | #import "members-list.typ": members-list
#show: doc => members-list("junioren_a.csv", "A", doc)
|
https://github.com/jrihon/multi-bibs | https://raw.githubusercontent.com/jrihon/multi-bibs/main/chapters/02_chapter/bib_02_chapter.typ | typst | MIT License | #let dict_02_chapter = (
"Zgarbova2015dnaol15": 1,
"Sega2011sixring": 2,
"Cremer1975general": 3,
)
#let biblio = (
bibchapter: dict_02_chapter,
bibyml: "../chapters/02_chapter/02_chapter.yml",
)
|
https://github.com/Myriad-Dreamin/typst.ts | https://raw.githubusercontent.com/Myriad-Dreamin/typst.ts/main/fuzzers/corpora/layout/grid-rtl_00.typ | typst | Apache License 2.0 |
#import "/contrib/templates/std-tests/preset.typ": *
#show: test-page
#set text(dir: rtl)
- מימין לשמאל
|
https://github.com/VisualFP/docs | https://raw.githubusercontent.com/VisualFP/docs/main/SA/design_concept/content/poc/translation_component.typ | typst | #import "../../../acronyms.typ": ac
= Translation Component <translation-layer>
The translation component has been built between the #ac("UI") and the inference engine.
As can be seen in @component-diagram, it is responsible for translating between the data models used by the #ac("UI") and the type inference engine:
1. From the untyped model of the #ac("UI") to the input model of the inference engine
2. From the inferred model of the inference engine to the typed #ac("UI") model
This process isn't as straightforward as one might think, as the #ac("UI") and
inference engine have different representations of function application: The #ac("UI")
maintains a list of arguments per reference. In contrast, the inference engine
expects application to happen in dedicated nodes. This discrepancy has also
been described in @application-decision.
Translating the inferred model into the typed #ac("UI") model is quite simple:
Applications are simplified into arguments of the underlying element.
Translating untyped #ac("UI") values, where the amount of arguments is unknown, into
the input model of the inference engine requires a more elaborate process.
One approach might be to try out different numbers of
nested applications and see if one might successfully type-check.
For VisualFP a different approach was chosen: In case the arguments of a
reference need to be inferred, the #ac("UI") model passes the original type hole along.
The translation component then compares the arity of the type hole with the arity of
the reference and adds as many applications as needed for the two to match.
|
|
https://github.com/jgm/typst-hs | https://raw.githubusercontent.com/jgm/typst-hs/main/test/typ/compiler/ops-assoc-01.typ | typst | Other | // Assignment is right-associative.
{
let x = 1
let y = 2
x = y = "ok"
test(x, none)
test(y, "ok")
}
|
https://github.com/MrToWy/Bachelorarbeit | https://raw.githubusercontent.com/MrToWy/Bachelorarbeit/master/Code/searchGroup.typ | typst | ```ts
this.courseService.getAll().subscribe(courses => {
this.groupedModules = courses.map(course => {
const courseLabel = course?.translations?.[activeTranslationIndex]?.name;
const coursePath = `/faculty/${course.department.facultyId}/department/${course.department.id}/course/${course.id}`;
const items = course.modules.map(module => {
return {
label: module.translations?.[activeTranslationIndex]?.name,
value: `${coursePath}/module/${module.id}`
};
});
return {
label: courseLabel,
items: items
};
});
});
``` |
|
https://github.com/jgm/typst-hs | https://raw.githubusercontent.com/jgm/typst-hs/main/test/typ/compiler/closure-02.typ | typst | Other | // Pass closure as argument and return closure.
// Also uses shorthand syntax for a single argument.
#{
let chain = (f, g) => (x) => f(g(x))
let f = x => x + 1
let g = x => 2 * x
let h = chain(f, g)
test(h(2), 5)
}
|
https://github.com/jgm/typst-hs | https://raw.githubusercontent.com/jgm/typst-hs/main/test/typ/layout/par-justify-cjk-03.typ | typst | Other | // Test Variants of Mainland China, Hong Kong, and Japan.
// 17 characters a line.
#set page(width: 170pt + 10pt, margin: (x: 5pt))
#set text(font: "Noto Serif CJK SC", lang: "zh")
#set par(justify: true)
孔雀最早见于《山海经》中的《海内经》:\u{200b}“有孔雀。”东汉杨孚著《异物志》记载,岭南:“孔雀,其大如大雁而足高,毛皆有斑纹彩,捕而蓄之,拍手即舞。”
#set text(font: "Noto Serif CJK TC", lang: "zh", region: "hk")
孔雀最早见于《山海经》中的《海内经》:「有孔雀。」东汉杨孚著《异物志》记载,岭南:「孔雀,其大如大雁而足高,毛皆有斑纹彩,捕而蓄之,拍手即舞。」
|
https://github.com/typst/packages | https://raw.githubusercontent.com/typst/packages/main/packages/preview/cetz-plot/0.1.0/src/plot/util.typ | typst | Apache License 2.0 | #import "/src/cetz.typ"
#import cetz.util: bezier
/// Clip line-strip in rect
///
/// - points (array): Array of vectors representing a line-strip
/// - low (vector): Lower clip-window coordinate
/// - high (vector): Upper clip-window coordinate
/// -> array List of line-strips representing the paths insides the clip-window
#let clipped-paths(points, low, high, fill: false) = {
let (min-x, max-x) = (calc.min(low.at(0), high.at(0)),
calc.max(low.at(0), high.at(0)))
let (min-y, max-y) = (calc.min(low.at(1), high.at(1)),
calc.max(low.at(1), high.at(1)))
let in-rect(pt) = {
return (pt.at(0) >= min-x and pt.at(0) <= max-x and
pt.at(1) >= min-y and pt.at(1) <= max-y)
}
let interpolated-end(a, b) = {
if in-rect(a) and in-rect(b) {
return b
}
let (x1, y1, ..) = a
let (x2, y2, ..) = b
if x2 - x1 == 0 {
return (x2, calc.min(max-y, calc.max(y2, min-y)))
}
if y2 - y1 == 0 {
return (calc.min(max-x, calc.max(x2, min-x)), y2)
}
let m = (y2 - y1) / (x2 - x1)
let n = y2 - m * x2
let x = x2
let y = y2
y = calc.min(max-y, calc.max(y, min-y))
x = (y - n) / m
x = calc.min(max-x, calc.max(x, min-x))
y = m * x + n
return (x, y)
}
// Append path to paths and return paths
//
// If path starts or ends with a vector of another part, merge those
// paths instead appending path as a new path.
let append-path(paths, path) = {
if path.len() <= 1 {
return paths
}
let cmp(a, b) = {
return a.map(calc.round.with(digits: 8)) == b.map(calc.round.with(digits: 8))
}
let added = false
for i in range(0, paths.len()) {
let p = paths.at(i)
if cmp(p.first(), path.last()) {
paths.at(i) = path + p
added = true
} else if cmp(p.first(), path.first()) {
paths.at(i) = path.rev() + p
added = true
} else if cmp(p.last(), path.first()) {
paths.at(i) = p + path
added = true
} else if cmp(p.last(), path.last()) {
paths.at(i) = p + path.rev()
added = true
}
if added { break }
}
if not added {
paths.push(path)
}
return paths
}
let clamped-pt(pt) = {
return (calc.max(min-x, calc.min(pt.at(0), max-x)),
calc.max(min-y, calc.min(pt.at(1), max-y)))
}
let paths = ()
let path = ()
let prev = points.at(0)
let was-inside = in-rect(prev)
if was-inside {
path.push(prev)
} else if fill {
path.push(clamped-pt(prev))
}
for i in range(1, points.len()) {
let prev = points.at(i - 1)
let pt = points.at(i)
let is-inside = in-rect(pt)
let (x1, y1, ..) = prev
let (x2, y2, ..) = pt
// Ignore lines if both ends are outsides the x-window and on the
// same side.
if (x1 < min-x and x2 < min-x) or (x1 > max-x and x2 > max-x) {
if fill {
let clamped = clamped-pt(pt)
if path.last() != clamped {
path.push(clamped)
}
}
was-inside = false
continue
}
if is-inside {
if was-inside {
path.push(pt)
} else {
path.push(interpolated-end(pt, prev))
path.push(pt)
}
} else {
if was-inside {
path.push(interpolated-end(prev, pt))
} else {
let (a, b) = (interpolated-end(pt, prev),
interpolated-end(prev, pt))
if in-rect(a) and in-rect(b) {
path.push(a)
path.push(b)
} else if fill {
let clamped = clamped-pt(pt)
if path.last() != clamped {
path.push(clamped)
}
}
}
if path.len() > 0 and not fill {
paths = append-path(paths, path)
path = ()
}
}
was-inside = is-inside
}
// Append clamped last point if filling
if fill and not in-rect(points.last()) {
path.push(clamped-pt(points.last()))
}
if path.len() > 1 {
paths = append-path(paths, path)
}
return paths
}
/// Compute clipped stroke paths
///
/// - points (array): X/Y data points
/// - x (axis): X-Axis
/// - y (axis): Y-Axis
/// -> array List of stroke paths
#let compute-stroke-paths(points, x, y) = {
clipped-paths(points, (x.min, y.min), (x.max, y.max), fill: false)
}
/// Compute clipped fill path
///
/// - points (array): X/Y data points
/// - x (axis): X-Axis
/// - y (axis): Y-Axis
/// -> array List of fill paths
#let compute-fill-paths(points, x, y) = {
clipped-paths(points, (x.min, y.min), (x.max, y.max), fill: true)
}
/// Return points of a sampled catmull-rom through the
/// input points.
///
/// - points (array): Array of input vectors
/// - tension (float): Catmull-Rom tension
/// - samples (int): Number of samples
/// -> array Array of vectors
#let sampled-spline-data(points, tension, samples) = {
assert(samples >= 1 and samples <= 100,
message: "Must at least use 1 sample per curve")
let curves = bezier.catmull-to-cubic(points, tension)
let pts = ()
for c in curves {
for t in range(0, samples + 1) {
let t = t / samples
pts.push(bezier.cubic-point(..c, t))
}
}
return pts
}
/// Simplify linear data by "detecting" linear sections
/// and skipping points until the slope changes.
/// This can have a huge impact on the number of lines
/// getting rendered.
///
/// - data (array): Data points
/// - epsilon (float): Curvature threshold to treat data as linear
#let linearized-data(data, epsilon) = {
let pts = ()
// Current slope, set to none if infinite
let dx = none
// Previous point, last skipped point
let prev = none
let skipped = none
// Current direction
let dir = 0
let len = data.len()
for i in range(0, len) {
let pt = data.at(i)
if prev != none and i < len - 1 {
let new-dir = pt.at(0) - prev.at(0)
if new-dir == 0 {
// Infinite slope
if dx != none {
if skipped != none {pts.push(skipped); skipped = none}
pts.push(pt)
} else {
skipped = pt
}
dx = none
} else {
// Push the previous and the current point
// if slope or direction changed
let new-dx = ((pt.at(1) - prev.at(1)) / new-dir)
if dx == none or calc.abs(new-dx - dx) > epsilon or (new-dir * dir) < 0 {
if skipped != none {pts.push(skipped); skipped = none}
pts.push(pt)
dx = new-dx
dir = new-dir
} else {
skipped = pt
}
}
} else {
if skipped != none {pts.push(skipped); skipped = none}
pts.push(pt)
}
prev = pt
}
return pts
}
// Get the default axis orientation
// depending on the axis name
#let get-default-axis-horizontal(name) = {
return lower(name).starts-with("x")
}
// Setup axes dictionary
//
// - axis-dict (dictionary): Existing axis dictionary
// - options (dictionary): Named arguments
// - plot-size (tuple): Plot width, height tuple
#let setup-axes(ctx, axis-dict, options, plot-size) = {
import "/src/axes.typ"
// Get axis option for name
let get-axis-option(axis-name, name, default) = {
let v = options.at(axis-name + "-" + name, default: default)
if v == auto { default } else { v }
}
for (name, axis) in axis-dict {
if not "ticks" in axis { axis.ticks = () }
axis.label = get-axis-option(name, "label", $#name$)
// Configure axis bounds
axis.min = get-axis-option(name, "min", axis.min)
axis.max = get-axis-option(name, "max", axis.max)
assert(axis.min not in (none, auto) and
axis.max not in (none, auto),
message: "Axis min and max must be set.")
if axis.min == axis.max {
axis.min -= 1; axis.max += 1
}
axis.mode = get-axis-option(name, "mode", "lin")
axis.base = get-axis-option(name, "base", 10)
// Configure axis orientation
axis.horizontal = get-axis-option(name, "horizontal",
get-default-axis-horizontal(name))
// Configure ticks
axis.ticks.list = get-axis-option(name, "ticks", ())
axis.ticks.step = get-axis-option(name, "tick-step", axis.ticks.step)
axis.ticks.minor-step = get-axis-option(name, "minor-tick-step", axis.ticks.minor-step)
axis.ticks.decimals = get-axis-option(name, "decimals", 2)
axis.ticks.unit = get-axis-option(name, "unit", [])
axis.ticks.format = get-axis-option(name, "format", axis.ticks.format)
// Axis break
axis.show-break = get-axis-option(name, "break", false)
axis.inset = get-axis-option(name, "inset", (0, 0))
// Configure grid
axis.ticks.grid = get-axis-option(name, "grid", false)
axis-dict.at(name) = axis
}
// Set axis options round two, after setting
// axis bounds
for (name, axis) in axis-dict {
let changed = false
// Configure axis aspect ratio
let equal-to = get-axis-option(name, "equal", none)
if equal-to != none {
assert.eq(type(equal-to), str,
message: "Expected axis name.")
assert(equal-to != name,
message: "Axis can not be equal to itself.")
let other = axis-dict.at(equal-to, default: none)
assert(other != none,
message: "Other axis must exist.")
assert(other.horizontal != axis.horizontal,
message: "Equal axes must have opposing orientation.")
let (w, h) = plot-size
let ratio = if other.horizontal {
h / w
} else {
w / h
}
axis.min = other.min * ratio
axis.max = other.max * ratio
changed = true
}
if changed {
axis-dict.at(name) = axis
}
}
for (name, axis) in axis-dict {
axis-dict.at(name) = axes.prepare-axis(ctx, axis, name)
}
return axis-dict
}
|
https://github.com/iMilesHo/resume-template-typst | https://raw.githubusercontent.com/iMilesHo/resume-template-typst/main/README.md | markdown | Apache License 2.0 | # A resume template for Software Developer written in Typst
## Usage
Approach 1:
1. Clone the repository
2. Use VSCode to open the project
3. Install the Typst preview extension and Typst LSP extension
- Typst preview extension: used to preview the resume in real-time
- Typst LSP extension: used to generate the resume in PDF format
4. Open the `Resume_YourName.typ` file
Approach 2:
1. Clone the repository
2. Upload the project to `Typst.app` which is a web-based editor for Typst
Here is the preview of the resume and edit view:

---
Please feel free to use the template and modify it as per your needs. If you have any suggestions or feedback, please feel free to reach out to me.
And if you like the template, please give it a star.
|
https://github.com/typst/packages | https://raw.githubusercontent.com/typst/packages/main/packages/preview/ttt-exam/0.1.0/lib/cover.typ | typst | Apache License 2.0 |
#import "i18n.typ": *
#import "@preview/ttt-utils:0.1.0": components, grading
#import components: checkbox, field, lines
#let grading_table(dist) = {
table(
columns: (2cm, 1fr, 5cm),
inset: 0.7em,
align: center,
"Note", "Punkteschlüssel", "Anzahl",
..dist.rev().map(g => (g.grade, [von #g.lower-limit bis #g.upper-limit], []) ).flatten(),
table.cell(colspan: 2)[
#align(end)[Notendurchschnitt #math.lr(size: 1em)[#sym.diameter]:]
]
)
}
// COVER PAGE
#let cover-page(
class: none,
subject: none,
dates: (
gehalten: none,
zurückgegeben: none,
eingetragen: none,
),
comment: none,
total_points: 100,
..args
) = {
return page(
margin: (left: 20mm, right: 20mm, top: 10mm, bottom: 20mm),
footer: none
)[
#set text(16pt)
// header - title
#box(
width: 100%,
stroke: luma(70),
inset: 1em,
radius: 3pt
)[
#align(center)[#text(22pt)[Deckblatt Leistungsnachweis]]
]
// content
#grid(
columns: (auto, 1fr, auto, auto),
align: (col, _) => if ( calc.even(col) ) { end } else { auto },
gutter: 1em,
linguify("class", from: ling_db) + ": ", text(weight: "semibold", class),
"Schuljahr: ",
{
if type(dates.gehalten) == datetime {
let date = dates.gehalten;
if date.month() < 9 {str(date.year()-1) + "/" + str(date.year())} else { str(date.year()) + "/" + str(date.year()+1) }
} else { align(bottom,line(length: 3cm))}
},
linguify("subject", from: ling_db) + ": ", text(weight: "semibold", subject),
grid.cell(colspan: 2, align: start)[#checkbox() SA #h(1em) #checkbox() KA \ #checkbox() #field(none)]
)
#v(0.5cm)
// Missing student and student count
#table(
columns: (auto),
row-gutter: (1cm),
stroke: none,
inset: 0pt,
align: bottom,
[Fehlende SchülerInnen: #box(width: 1fr)[#align(end)[ Anzahl Teilnehmer: #box(width:1.5cm, stroke: (bottom: 0.5pt))]]],
lines(2)
)
// Dates
Datum: #h(1fr)
#field("gehalten", value: dates.gehalten.display("[day].[month].[year]")) #h(1fr)
#field("zurückgegeben") #h(1fr)
#field("eingetragen")
#v(0.5cm)
// Grading table uses the ihk grading distribution
#grading_table(grading.ihk-grades(total_points));
// Comment
#grid(
columns: (auto),
row-gutter: 1cm,
smallcaps("Bemerkung:"),
if (comment != none) {comment} else {
lines(2)
},
)
// Signature
#align(bottom,
box(
stroke: (top: (thickness:1pt, paint:blue, dash: "dashed") ),
width: 100%,
inset: (top: 4pt)
)[
#text(12pt)[#smallcaps("Unterschrift:")]
#h(1cm) #field("Lehrer")
#h(1fr) #field("Fachbetreuer")
]
)
] // end page
}
|
https://github.com/Fuzzy-Technical-Indicator/poster | https://raw.githubusercontent.com/Fuzzy-Technical-Indicator/poster/main/main.typ | typst | #import "poster.typ": *
#show: poster.with(
size: "24x36",
title: "ระบบสนับสนุนการตัดสินใจซื้อขายสินทรัพย์ด้วยฟัซซีโลจิก\nFuzzy Logic in Market Trading Decision Support System",
authors: "<NAME>, ธนวัตน์ บําเพ็งพันธ์ุ",
departments: "คณะวิศวกรรมศาสตร์ ภาควิชาวิศวกรรมคอมพิวเตอร์",
univ_logo: "Chiang_mai_university_logo.svg",
footer_text: "",
footer_url: "",
footer_email_ids: "",
footer_color: "ebcfb2",
// Use the following to override the default settings
// for the poster header.
num_columns: "2",
univ_logo_scale: "45",
title_font_size: "34",
authors_font_size: "20",
univ_logo_column_size: "3",
title_column_size: "10",
footer_url_font_size: "15",
footer_text_font_size: "24",
)
= บทคัดย่อ
ในการวิเคราะห์ทางเทคนิค มีการใช้อินดิเคเตอร์ทางเทคนิคและปัจจัยอื่นๆมาใช้ช่วยในการตัดสินใจ ซึ่งหลายๆ อย่างก็มีการตีความหมายด้วยเกณฑ์ที่ไม่สามารถรับความไม่แน่นอนและความผันผวนของตลาดได้
เช่น ค่าคงที่เป็นต้น และถ้าเราใช้อินดิเคเตอร์ทางเทคนิคหลายๆ อันด้วยกันแล้วการตีความหมายแต่ละอย่าง
พร้อมๆกันก็เป็นเรื่องที่เราทําได้ยาก
ดังนั้นทางผู้จัดจึงสร้างระบบเพื่อช่วยนักลงทุนในการเทรดโดยนําอินดิเคเตอร์ทางเทคนิคและปัจจัยอื่นๆ ของผู้ใช้งานที่ใช้ในการวิเคราะห์การซื้อ และการขายมาสร้างอินดิเคเตอร์ตัว
ใหม่ที่ช่วยตัดสินใจโดยใช้ Fuzzy Logic ซึ่งต่างจากอินดิเคเตอร์ทางเทคนิคแบบดั้งเดิม เนื่องจากสามารถเอา
มุมมองการวิเคราะห์ส่วนตัวของผู้ใช้งานใส่เข้าไปในอินดิเคเตอร์ตัวนี้ได้ โดยอินดิเคเตอร์ตัวนี้จะรับข้อมูลอย่าง
เช่น RSI, MA, การทํากําไรของสินทรัพย์, ความผันผวนของตลาด และข้อมูลอื่นๆ ที่ผู้ใช้งานอาจจะต้องการ ในขณะที่ผลลัพธ์คือสัญญาณการซื้อ และการขาย หรือสัญญาณวิเคราะห์อื่นๆ ที่ผู้ใช้งานต้องการสร้าง
ขึ้น
ด้วยวิธีดังกล่าวอินดิเคเตอร์ของเราจะสามารถช่วยนักลงทุนในการจัดการกับข้อมูลหลายๆปัจจัยที่ผู้ใช้งาน
ใช้ในการวิเคราะห์ออกมาเป็นสัญญาณใหม่เพียง 1 หรือ 2 สัญญาณที่เข้าใจง่าย เพื่อใช้ในการช่วยตัดสินใจ
เราจะสร้างเว็บแอพพลิเคชั่นจากไอเดียดังกล่าวข้างต้น และทดสอบว่าอินดิเคเตอร์จาก Fuzzy Logic นั้นให้ผลลัพธ์ที่ดีกว่า
= จุดประสงค์
1. เพื่อพัฒนา Fuzzy Logic ร่วมกับ Particle Swarm Optimization (PSO) สําหรับการสร้างวิธีการซื้อขายเฉพาะของแต่ละสินทรัพย์
2. เพื่อสร้างเว็บไซต์ไว้ใช้งานระบบของเรา
= วิธีการ
เราจะใช้อินดิเคเตอร์ Aroon และ MACD ในการมาทำอินดิเคเตอร์ใหม่ด้วย Fuzzy Logic และการเข้าซื้อแบบ Classical ก็จะใช้ค่าของอินดิเคเตอร์เหล่านี้ตรงๆ เลย
#figure(image("example.png", width: 60%), caption: [ตัวอย่างของการใช้ Fuzzy Logic มาแทนที่แบบ Classical], supplement: [รูปที่])
ในการทดลองนี้เราจะใช้ระบบของเราในการทำการทดสอบโดยจะทำการทดสอบโดยใช้เงินตั้งต้น 3,000 USD และทดสอบบนตลาด Crypto Currency (BTC, ETH, BNB) และตลาดหุ้น NASDAQ (AAPL, IBM, JPM, MSFT, NKE, TSLA) ซึ่งเงินตั้งต้นจะถูกแบ่งให้เท่าๆ กันจาก 3,000 USD สำหรับแต่ละเหรียญหรือหุ้นในทั้ง 2 ตลาด โดยวิธีการเข้าซื้อจะมีดังนี้
#align(center, table(
columns: (auto, auto, auto, auto, auto, auto),
align: horizon,
inset: 10pt,
[ส่วนเสริม], [Classical], [Fuzzy], [Fuzzy C], [Fuzzy PSO], [Fuzzy C PSO],
[ใช้ Fuzzy Logic ในการทำอินดิเคเตอร์ขึ้นมา], [], [√], [√], [√], [√],
[การจัดการเงินทุนโดยใช้ค่าของอินดิเคเตอร์จาก Fuzzy Logic (Liquidation F)], [], [], [√], [], [√],
[การใช้ Particle Swarm Optimization (PSO) ในการปรับค่าของตัวแปรทางภาษาของอินดิเคเตอร์], [], [], [], [√], [√]
))
โดยสำหรับวิธี Classical นั้นเราจะใช้ค่าของอินดิเคเตอร์แต่ละตัวตรงๆ มาใช้ตัดสินใจเข้าซื้อ ,สำหรับวิธีที่ใช้ Fuzzy Logic เราจะเข้าซื้อเมื่อค่าของอินดิเคเตอร์มีค่าเกิน 30 และสำหรับการใช้ PSO เราจะใช้ข้อมูล ตั้งแต่จุดเริ่มต้นต้นของแต่ละตลาดถึงเดือนมีนาคม 2023 ในการฝึกสอน แล้วในเดือนเมษายน 2023 ถึงเดือนกันยายน 2023 จะเป็นช่วงของการทดสอบและเลือกการปรับค่าที่ดีที่สุด
ทั้งหมดนี้แต่ละการเข้าซื้อมีขั้นต่ำอยู่ที่ 30 USD และสำหรับการเข้าซื้อแบบที่ไม่ได้การจัดการเงินทุนจะเข้าซื้อที่ 5% ของเงินที่มีอยู่ขณะนั้น และในการออกจากการเข้าซื้อที่ทำไปแล้วจะใช้วิธีเมื่อกำไรของการเข้าซื้อนั้น ≥ 20\% สำหรับ Crypto Currecny และ ≥ 10\% สำหรับหุ้น NASDAQ ก็จะให้ทำการขายเอากำไรเลย (take profit) และเมื่อการเข้าซื้อนั้นขาดทุนมากกว่า ≥ 10\% สำหรับ Crypto Currency และ ≥ 5\% สำหรับหุ้น NASDAQ ก็ให้ทำการขายเพื่อไม่ให้ขาดทุนไปมากกว่านี้เลย (stop loss)
นอกจากนี้เราจะมีวิธี Buy & Hold ซึ่งเป็นวิธีการนี้ก็คือการซื้อ สินทรัพย์ไว้ด้วยจำนวนเงินทั้งหมด ตั้งแต่วันแรกที่ทดสอบไว้ แล้วถือไว้โดยไม่ขายออก เป็นตัวไว้เปรียบเทียบ เวลาที่เริ่มทดสอบ คือวันที่ 1 ตุลาคม 2023 เวลา 00:00 (GMT+07) ถึง 24 กุมภาพันธ์ 2024 เวลา 17:50 (GMT+07) เป็นเวลาประมาณ 5 เดือน
= ผลลัพธ์
#align(center)[
#figure(table(
columns: (auto, auto, auto, auto, auto, auto),
[Symbol], [Classical], [Fuzzy], [Fuzzy C], [Fuzzy PSO], [Fuzzy C PSO],
[BTC], [334.28], [763.41], [867.74], [759.38], [*872.94*],
[ETH], [91.40], [680.26], [715.21], [692.24], [*759.44*],
[BNB], [141.54], [*805.67*], [654.23], [*805.67*], [653.76]
), caption: [กำไรสุทธิของเหรียญในตลาด Crypto Currency], supplement: [ตารางที่]) <table1>
#figure(table(
columns: (auto, auto, auto, auto, auto, auto),
[Symbol], [Classical], [Fuzzy], [Fuzzy C], [Fuzzy PSO], [Fuzzy C PSO],
[AAPL], [-4.30], [*6.05*], [3.22], [*6.05*], [3.22],
[IBM], [74.68], [*153.63*], [114.13], [*153.63*], [114.13],
[JPM], [4.98], [139.66], [*141.72*], [139.66], [*141.72*],
[MSFT], [72.51], [134.59], [*143.97*], [128.24], [131.94],
[NKE], [6.14], [51.12], [50.29], [*68.45*], [45.82],
[TSLA], [*150.11*], [-65.41], [-92.88], [-65.41], [-92.71]
), caption: [กำไรสุทธิของหุ้นในตลาดหุ้น NASDAQ], supplement: [ตารางที่]) <table2>
#figure(image("crypto.svg"), caption: [การเปลี่ยนแปลงของเงินลงทุนสำหรับแต่ละวิธีในตลาด Crypto Currency], supplement: [รูปที่]) <crypto_g>
#figure(image("stock.svg"), caption: [การเปลี่ยนแปลงของเงินลงทุนสำหรับแต่ละวิธีในตลาดหุ้น NASDAQ], supplement: [รูปที่]) <stock_g>
]
= สรุปผล
จาก @crypto_g และ @stock_g เราจะเห็นว่าการใช้ Fuzzy Logic มาสร้างอินดิเคเตอร์ใหม่นั้นให้ผลลัพธ์ ที่ดีกว่าการใช้ตัวเลขธรรมดาแบบ Classical เสมอ โดยเฉพาะในตลาด Crypto Currency ที่จะเห็นว่าแบบ Classical นั้นให้ผลลัพธ์ที่แย่กว่าแบบ Fuzzy อย่างชัดเจน และจะเห็นว่าถ้าเราเปรียบเทียบกับการ Buy & Hold เราจะได้ผลลัพธ์ที่ใกล้เคียงกัน แต่การเปลี่ยนแปลงของเงินทุนนั้นมีความผันผวนกว่า และมีช่วงที่เงินทุนลดไปเป็นจำนวนมากเยอะ ถ้าเราดูใน @table1 และ @table2 จะเห็นว่าไม่มีวิธีการเข้าซื้อจาก Fuzzy Logic แบบไหนที่ให้ผลลัพธ์นี่ดีกว่าแบบอื่นอย่างเป็นเอกฉันท์ และจะมีบางเหรียญหรือหุ้นที่ Fuzzy กับ Fuzzy PSO ให้ผลเหมือนกันเนื่องจาก PSO นั้นสรุปว่าการไม่เปลี่ยนแปลงตัวแปรทางภาษาเลยให้ผลที่ดีที่สุดแล้วในเวลาที่ใช้ฝึกสอน
ดังนั้นด้วยความสามารถของ Fuzzy Logic ในการจัดการกับข้อมูลที่มีความผันผวน และไม่แน่นอนของข้อมูล ทำให้เราเห็นว่าการใช้ Fuzzy Logic ในการสร้างอินดิเคเตอร์ใหม่นั้นเป็นวิธีให้ผลลัพธ์ที่ดีกว่าการใช้ตัวเลขธรรมดาแบบ Classical
= ตัวอย่างเว็บแอพพลิเคชัน
#align(center)[
#figure(image("web-preview.svg"), caption: [เว็บแอพพลิเคชันระบบสนับสนุนการตัดสินใจซื้อขายสินทรัพย์ด้วยฟัซซีโลจิก], supplement: [รูปที่]) <fzt_preview>
]
// QR Code section
#place(
dx: 250pt,
dy: 125pt,
figure(
rect(stroke: 1pt)[
#figure(image("qr-code.svg", width: 25%)) <live_web_qr_code>
],
)
)
#place(
dx: 152pt,
dy: 350pt,
rect(stroke: none)[
#align(center)[
สแกนเพื่อเข้าชม \
เว็บแอพพลิเคชันของระบบสนับสนุนการตัดสินใจซื้อขายสินทรัพย์ด้วยฟัซซีโลจิก \
#link("https://cmu.to/FZT") \
ล็อกอินด้วยชื่อ u1
]
]
) |
|
https://github.com/ShapeLayer/ucpc-solutions__typst | https://raw.githubusercontent.com/ShapeLayer/ucpc-solutions__typst/main/lib/presets/difficulties.typ | typst | Other | #import "/lib/colors.typ": color
#let difficulties = (
easy: [#text(fill: color.bronze.III, weight: "bold")[Easy]],
normal: [#text(fill: color.silver.III, weight: "bold")[Normal]],
hard: [#text(fill: color.gold.III, weight: "bold")[Hard]],
challenging: [#text(fill: color.diamond.III, weight: "bold")[Challenging]],
bronze: [#text(fill: color.bronze.III, weight: "bold")[Bronze]],
silver: [#text(fill: color.silver.III, weight: "bold")[Silver]],
gold: [#text(fill: color.gold.III, weight: "bold")[Gold]],
platinum: [#text(fill: color.platinum.V, weight: "bold")[Platinum]],
diamond: [#text(fill: color.diamond.III, weight: "bold")[Diamond]],
ruby: [#text(fill: color.ruby.III, weight: "bold")[Ruby]],
)
|
https://github.com/Area-53-Robotics/53E-Notebook-Over-Under-2023-2024 | https://raw.githubusercontent.com/Area-53-Robotics/53E-Notebook-Over-Under-2023-2024/giga-notebook/entries/tournament-gateway/entry.typ | typst | Creative Commons Attribution Share Alike 4.0 International | #import "/packages.typ": notebookinator, diagraph
#import notebookinator: *
#import themes.radial.components: *
#import "/utils.typ": tournament-from-csv
#import diagraph: *
#show: create-body-entry.with(
title: "Tournament: Gateway to the West",
type: "test",
date: datetime(year: 2024, month: 2, day: 3),
author: "<NAME>",
witness: "<NAME>",
)
= Qualifications
#let qual-data = tournament-from-csv(
read("./RE-VRC-23-1495-Gateway to the West HS-Results-2024-02-13.csv"),
team-name: "53E",
section: "qualifications",
)
#(qual-data.at(4).auton = true)
#(qual-data.at(4).awp = true)
#tournament(..qual-data)
= Reflection
#grid(
columns: (1fr, 1fr),
gutter: 20pt,
pie-chart(
(value: 3, color: green, name: "wins"),
(value: 7, color: red, name: "losses"),
),
[
Despite the fact that we didn't make it to eliminations this tournament was very
successful for us. We got to see first hand how high level strategy works, and
were introduced to techniques like field starvation.
We also finally were paired with alliance partners who could score the other
half of the AWP, and we were able to gauge its effectiveness.
],
)
== Strategic Performance
The first thing we noticed was that many teams were running a field starvation
strategy. Teams were playing for control, rather than trying to score as many
points as possible by shooting triballs.
We had seen other teams use this strategy at the Kalahari classic, but we had
never seen it in person.
This strategy was completely different from what we'd encountered in the past,
it basically completely changed the game. Our shooting mechanism become mostly
useless, and we found that in the matches we did shoot, the opposing alliance
was able to use our triballs more effectively than we were.
// Notes:
// Q1
// shooting strats
// switched to bowling
// Q28
// DCed
// Q48
// heavy defence played on us
// got a hang off
// Q67
// shooting
// we lost, badly
// Q80
// field starvation
// Q100
// Shooting/Field starvation hybrid
// Q116
// I'm not even sure what to call this
// I guess this was shooting?
// Q128
// Field starvation
// Q141
== Autonomous Performance
#grid(
columns: (1fr, 1fr),
gutter: 20pt, //
pie-chart(
(value: 1, color: blue, name: "AWP"),
(value: 9, color: red, name: "No AWP"),
), //
[
We scored the autonomous win point for the first time during this tournament,
but only once.
Despite this, the AWP gave us a large advantage during qualifications, placing
us above our other sister teams who didn't have it.
],
)
|
https://github.com/Wuvist/lcpc | https://raw.githubusercontent.com/Wuvist/lcpc/main/lcpc_slide.typ | typst | // Get Polylux from the official package repository
#import "@preview/polylux:0.3.1": *
#import themes.simple: *
#import "@preview/tablex:0.0.8": tablex, colspanx, rowspanx
// Make the paper dimensions fit for a presentation and the text larger
#set page(paper: "presentation-4-3")
#set text(size: 25pt)
#set quote(block: true)
#set par(
justify: true,
)
// Use #polylux-slide to create a slide and style it using your favorite Typst functions
#polylux-slide[
#align(horizon + center)[
= Living Cost Pressure Curve
== in Singapore and beyond
<NAME>
Mar 12, 2024
]
]
#polylux-slide[
== Motivation
"Singapore kept its position as the world's most expensive city this year, for the ninth time in 11 years." - Economist Intelligence Unit(EIU) Worldwide Cost of Living 2023
=== SG is the most expensive ???
]
#polylux-slide[
#image("slides/imf.png")
=== SG is the richest ???
]
#polylux-slide[
= Resource Question
- How to have quick understanding of living cost pressure in a economy?
- Existing economic indicator doesn't fit well
- CPI
- GDP per capita
- World Cost Of Living by EIU
- Let me come out with a suitable one
]
#focus-slide[
_Living Cost Pressure_
$ L C P = (sum "Expenditure")/(sum "Income") $
]
#polylux-slide[
== LCPC - Living Cost Pressure Curve
- Calculate LCP for different group in the economy
- For example: by income
- construct a curve to show how living cost pressure distributed in the economy
]
#polylux-slide[
#image("data/LCPC_income.png", width: 90%)
#uncover(2)[LCP for `1st-20th` group exceed 1 ???]
]
#polylux-slide[
= Dive into the data
- Data from Household Expenditure Survey(HES) by SingStat
- Conducted every 5 years
- Each Survey about 14,000 dwellings in Singapore
#uncover((2,3))[#quote["It is notable, for example, that some resident households in the lowest 20% owned a car (13.6 per cent), employed a maid (13.9 per cent), lived in private property (7.1 per cent) or were headed by persons aged 65 years and over (36.7 per cent) in 2017/18." - HES 2017/18]]
#uncover(3)[
- Low income may not imply poor
- Elderly aged 65 years and over should be handled separately
]
]
#polylux-slide[
#set par(
justify: false,
)
#grid(
columns: 2,
gutter: 5pt,
[ SG government assume
- Household in bigger dwelling are richer],
[#image("slides/transfer.png", width: 80%)]
)
#set text(size: 16pt)
#figure(
tablex(
columns: 8,
align: center + horizon,
auto-vlines: false,
rowspanx(2)[],colspanx(4)[*HDB*], rowspanx(2)[*Condo*], rowspanx(2)[*Landed*],rowspanx(2)[*All*],
(), [*1-2 Room*], [*3-Room*], [*4-Room*], [*5-Room&EC*],(),
[Percentage], [7.0%], [17.0%], [31.3%], [22.4%], [17.2%], [4.8%], [100%],
),
kind: table,
caption: "Resident Households by Type of Dwelling 2023"
) <households>
]
#polylux-slide[
#image("data/LCPC_dwelling.png", width: 95%)
#set text(size: 16pt)
- Households comprising Solely Non-Working Persons Aged 65 Years and Over are ignored
]
#polylux-slide[
#set text(size: 20pt)
=== Change of LCP by type of dwelling from 2007/08 to 2017/18
#image("data/LCPC_change.png", width: 95%)
]
#polylux-slide[
- All LCP below 1: no household face deficit.
- LCP of all groups drop from 2007/08 to 2017/18, the lower type of dwelling tends to have higher drop in LCP.
- LCPC thus become much more "flat" in 2017/18 than in 2012/13, implies social equality has improved.
- HDB 1-2 Room group has the most improvement from 2012/13 to 2017/18, as a result of larger increment in income than expenditure.
- This could be a result of large transfer payment by the government.
- LCPC of 2017/18 is in a slight "W" shape, "middle class squeezed"?
- Dive deeper into the data...
]
#focus-slide[
Should expenditure include \
Mortgage Repayment?
]
#polylux-slide[
- Mortgage repayment data is hard to find
- SingStat has it from HES, but never reveal
- Mortgage repayment is harder to estimate
- What's buying a house?
- Turn cash asset into fixed asset
- It's investment, not expenditure
- So, NO
]
#focus-slide[
Should expenditure include rental?
]
#polylux-slide[
- YES! It's real expenditure.
- But, not be relevant to Singaporean
- About 90% house ownership rate
- Rental is income for Singaporean
- Crucial for foreigner in SG
- 2023: 30% or 1.77M non-residents
]
#polylux-slide[
= LCPC for foreign worker in SG
- Regress/Forecast/Estimate with CPI & expenditure
- Estimate income
- Estimate rental for both HDB & condo
\
\
#set text(size: 18pt)
#figure(
tablex(
columns: 7,
align: center + horizon,
auto-vlines: false,
rowspanx(2)[], rowspanx(2)[*WP*], rowspanx(2)[*SP*], colspanx(2)[*EP*], rowspanx(2)[*PEP*], rowspanx(2)[*ONE Pass*],
[*Rent HDB*], [*Rent Condo*],
[Estimated Expenditure], [1,010], [1,667], [1,667], [3,454], [10,362], [13,816],
[Estimated Rental#h(28pt)], [562], [1,126], [1,126], [2,328], [4,656], [6,983],
[Estimated Income#h(24pt)], [1,600], [3,150], [5,000], [5,500], [22,500], [30,000],
[LCP], [0.98], [0.89], [0.56], [1.05], [0.67], [0.69],
),
kind: table,
caption: "ESTIMATED SG foreign worker's income & expenditure by type of work pass"
) <sg_worker_by_pass>
]
#polylux-slide[
#image("data/LCPC_foreign.png" , width: 95%)
- Rental HDB or condo?
]
#focus-slide[
LCPC not just for SG
Let's look at Hong Kong!
]
#polylux-slide[
#image("data/LCPC_hk.png", width: 95%)
- Relocating from HK to SG for smaller living cost pressure?
]
#polylux-slide[
= Conclusion
LCPC has only two simple idea:
- Ratio between expenditure and income: LCP
- LCP for different group, form a curve LCPC
LCPC is simple but versatile.
All data and source code are available at:
- https://github.com/Wuvist/lcpc
]
#focus-slide[
SG is expensive? Cite LCPC
Thank You
]
|
|
https://github.com/hweissi/tugraz-typst-theme | https://raw.githubusercontent.com/hweissi/tugraz-typst-theme/main/README.md | markdown | # TU Graz Typst theme
This is a theme inspired by the TUGraz Metropolis LaTeX theme, with some added nice features.
The flake provides a Dev-Shell and includes required fonts.
The theme is not Nix-packaged yet, because in their great wisdom, Typst devs decided to look in `$XDG_DATA_HOME` for packages instead of `$XDG_DATA_DIRS`
## Installation as local package
Install with
```sh
git clone https://github.com/hweissi/tugraz-typst-theme.git ~/.local/share/typst/packages/local/tugraz-typst-theme/1.0.0
```
Init project with template
```sh
typst init @local/tugraz-typst-theme:1.0.0
```
To build package using Nix, simply type `nix build`. The presentation will appear in `result/`.
This repo can use Github Actions to automatically build and upload the finished PDF.
To do that, enable write access for Github Actions in the repository settings, and tag a commit.
The resulting PDF appears in the Releases page of the repo.
|
|
https://github.com/olligobber/friggeri-cv | https://raw.githubusercontent.com/olligobber/friggeri-cv/master/README.md | markdown | # Friggeri CV
This is a version of the Friggeri CV, originally created by <NAME> in LaTeX, imitated countless times by countless others. This version was tweaked by myself in LaTeX and then finally ported to Typst. See the example usage at [example.pdf](example.pdf).
|
|
https://github.com/kaarmu/splash | https://raw.githubusercontent.com/kaarmu/splash/main/src/palettes.typ | typst | MIT License | #import "palettes/beamer.typ": *
#import "palettes/google-workspace.typ": *
#import "palettes/kth.typ": *
#import "palettes/misc.typ": *
#import "palettes/seaborn.typ" as seaborn
#import "palettes/tailwind-css.typ": *
#import "palettes/tol.typ": *
#import "palettes/typst-highlighting.typ": *
#import "palettes/xcolor.typ": *
#import "palettes/xkcd.typ": *
#import "palettes/okabe-ito.typ": *
|
https://github.com/liuguangxi/fractusist | https://raw.githubusercontent.com/liuguangxi/fractusist/main/examples/dragon-curve-n12.typ | typst | MIT License | #set document(date: none)
#import "/src/lib.typ": *
#set page(width: auto, height: auto, margin: 0pt)
#dragon-curve(
12,
step-size: 6,
stroke-style: stroke(
paint: gradient.linear(..color.map.crest, angle: 45deg),
thickness: 3pt,
cap: "square"
)
)
|
https://github.com/VisualFP/docs | https://raw.githubusercontent.com/VisualFP/docs/main/SA/design_concept/content/introduction/motivation.typ | typst | = Motivation <motivation>
Block-based programming tools enable a purely visual introduction to programming
for the imperative programming paradigm. Common beginner mistakes, such as
compiling code with incorrect syntax, are impossible in such an environment.
Examples include Scratch, developed by MIT, and the LEGO Mindstorms software.
There aren't many similar tools available to teach functional programming,
which is why most educators start their courses by either showing the
logical nature of functional programming through e.g. the lambda calculus,
or by jumping right into code, leaving many students puzzled.
Some visual approaches to functional programming exist; the ones researched during this project
are covered in @existing_tools. Unfortunately, none seem suitable as an
introduction to general-purpose functional programming.
However, block-based tools don't need to be limited to education: A sufficiently
powerful environment that allows conversion to and from a text-based
programming language could also see adoption among professionals looking for
ways to visualize their code.
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.