repo
stringlengths
26
115
file
stringlengths
54
212
language
stringclasses
2 values
license
stringclasses
16 values
content
stringlengths
19
1.07M
https://github.com/EunTilofy/NumComputationalMethods
https://raw.githubusercontent.com/EunTilofy/NumComputationalMethods/main/Chapter10/Chapter10-2.typ
typst
#import "../template.typ": * #show: project.with( course: "Computing Method", title: "Computing Method - Chapter10-2", date: "2024.6.1", authors: "<NAME>, 3210106357", has_cover: false ) *Problems:4,6,7* #HWProb(name: "10-4")[ 求 $f(x) = x^3 - 3x -1 = 0$ 在 $x_0 = 2$ 附近的实根,准确到小数点后第 $4$ 位,讨论其收敛性。 #set enum(numbering: "(1)") + 用迭代法; + 用 Newton 法; + 用弦位法。 ] #solution[ #set enum(numbering: "(1)") + 迭代法:$x_(n+1) = (3x + 1)^(1/3)$,```python x = 2 x1 = (1+3*x)**(1/3) n = 1 print(x, x1) while abs(x - x1) > 5e-5: _ = x1 x1 = (1+3*x1)**(1/3) x = _ n = n + 1 print(x1) print(x1, n) ``` 7次迭代后,得到答案 $hat(x) = 1.8794$。对于 $phi(x) = (3x + 1)^(1/3)$,$phi([1, 2]) in [1, 2]$,且 $forall x in [1, 2], abs(phi'(x)) leq L < 1, phi'(2) approx 0.27$,所以该迭代法收敛。 + Newton 法:$x_(n+1) = x_n - (f(x_n))/(f'(x_n)) = x_n - (x_n^3 - 3x_n - 1)/(3x_n^2 - 3)$,```python x = 2 x_1 = x - (x**3-3*x-1)/(3*x**2 - 3) n = 1 print(x, x1) while abs(x - x1) > 5e-5: _ = x1 x1 = x1 - (x1**3-3*x1-1)/(3*x1**2 - 3) x = _ n = n + 1 print(x1) print(x1, n) ```2次迭代后得到 $hat(x) = 1.8794$。根据 *10-7* 该方法二阶收敛。 + 弦位法:$x_(n+1) = x_n - (f(x_n))/(f(x_n)-f(x_(n-1)))(x_n - x_(n-1)) = x_n - (x_n^3 - 3x_n - 1)/(x_n^2 + x_n x_(n-1)+ x_(n-1)^2-3)$,取 $x_0 = 2, x_1 = 1.5$.```python x0 = 2 x1 = 1.5 n = 1 print(x0, x1) while abs(x0 - x1) > 5e-5: _ = x1 x1 = x1 - (x1**3-3*x1-1)/(x1**2+x0*x1+x0**2-3) x0 = _ n = n + 1 print(x1) print(x1, n) ``` 6次迭代后得到 $hat(x) = 1.8794$。因为 $f(x)$ 在 $x^*$ 附近有连续的二阶微商,且 $f'(x^*) eq.not 0$,当所取的初始值充分接近 $x^*$ 时,该方法收敛,收敛阶接近 $p = (sqrt(5)+ 1)/2$。 ] #HWProb(name: "10-6")[ 用牛顿法求 $x^3 - c = 0$ 的根,写出迭代公式和收敛阶。 ] #solution[ $f(x) = x^3 - c, f'(x) = 3x^2, x_(n+1) = x_n - (x^3 - c)/(3x_n^2) = 2/3x_n+ c/(3x_n^2)$。该方法是二阶收敛的,设 $epsilon_n = x_n - c^(1/3)$,所以 $ epsilon_(n+1) &= 2/3 x_n + c/(3x_n^2) - c^(1/3) \ &= x_n - c^(1/3) - 1/3 x_n + c/(3x_n^2) \ &= x_n - c^(1/3) - (x_n^3 - c) / (3x_n^2) \ &= (x_n - c^(1/3)) (1 - (x_n^2 + x_n c^(1/3) + c^(2/3))/(3x_n^2)) \ &= (x_n - c^(1/3)) (2x_n^2 - x_n c^(1/3) - c^(2/3))/(3x_n^2) \ &= (x_n - c^(1/3))^2 (2x_n + c^(1/3))/(3x_n^2) \ &= epsilon_n^2 ((2x_n + c^(1/3))/(3 x_n^2)) $ 所以 $epsilon_(n+1) / epsilon_n^2 = (2x_n + c^(1/3))/(3x_n^2) arrow (3 c^(1/3))/(3 c^(2/3)) = c^(-1/3)$,所以收敛阶为2. ] #HWProb(name: "10-7")[ 试证明: #set enum(numbering: "(1)") + Newton 法在单根附近二阶收敛; + Newton 法在重根附近一阶收敛。 ] #Proof[ #set enum(numbering: "(1)") 对于方程 $f(x) = 0$,使用 Newton 法 $x_(n+1) = x_n - (f(x_n))/(f'(x_n))$,设根为 $alpha$: + 在根处 Taylor 展开得到:($xi$ 在 $alpha$ 到 $x_n$ 之间)$ f(alpha) = f(x_n) + (alpha - x_n) f'(x_n) + (alpha - x_n)^2/2 f''(xi) $ 因为 $f(alpha) = 0$,所以 $-alpha = - x_n + f(x_n)/(f'(x_n)) + (alpha - x_n)^2 / 2 (f''(xi))/(f'(x_n))$,所以$ x_(n+1) - alpha = 1/2 (x_n - alpha)^2 (f''(xi))/(f'(x_n)) $ 因为 $f'$ 连续,且由于 $alpha$ 是单根,所以 $f'(alpha) eq.not 0$,所以 $exists delta > 0, text("s.t. ") forall x in [alpha - delta, alpha + delta], f'(x) eq.not 0$。定义 $ M = (max_(x in [alpha - delta, alpha + delta]) abs(f''(x)))/(2 min_(x in [alpha - delta, alpha + delta]) abs(f'(x))) $ 若选择足够接近 $alpha$ 的 $x_0$,满足以下条件: $1, abs(x_0 - alpha) < delta; quad 2, M abs(x_0 - alpha) < 1$。 那么$ x_(n+1) - alpha leq M(x_n - alpha^2) arrow.double abs(x_n - alpha) leq 1/M (M abs(x_0 - alpha))^(2^n) $ 所以 ${x_n}$ 二阶收敛到 $alpha$。 + 对于 $k$ 重根 $alpha$,设 $f(x) = g(x)(x - alpha)^k$, 那么$g(alpha) eq.not 0, g in C^1$,那么$ x_(n+1) &= x_n - (g(x_n)(x_n - alpha)^k)/(k g(x_n)(x_n - alpha)^(k-1)+g'(x_n)(x_n - alpha)^k) \ &= x_n - (g(x_n)(x_n-alpha))/(k g(x_n) + g'(x_n)(x_n - alpha)) $ 所以,$ x_(n+1) - alpha &= x_n - alpha - (g(x_n)(x_n-alpha))/(k g(x_n) + g'(x_n)(x_n - alpha)) \ &= (x_n - alpha) (1 - (g(x_n))/(k g(x_n) + g'(x_n)(x_n - alpha))) \ &= (x_n - alpha) [((k-1) g(x_n) + g'(x_n)(x_n - alpha)) / (k g(x_n) + g'(x_n)(x_n - alpha))] \ &= (x_n - alpha) [1/(1 + g(x_n)/((k-1) g(x_n) + g'(x_n)(x_n - alpha)) )] $ 当 $abs(x_0 - alpha) < abs(((k-1) min_(x in D_f) abs(g(x)) - epsilon)/(max_(x in D_f) abs(g'(x)))),((k-1) min_(x in D_f) abs(g(x)) > epsilon > 0)$ 时,$ (x_(n+1) - alpha) / (x_n - alpha) < M = 1/(1 + (max_(x in D_f) abs(g(x_n)))/(epsilon )) < 1 $ 所以 ${x_n}$ 一阶收敛到 $alpha$。 ]
https://github.com/ItsEthra/typst-live
https://raw.githubusercontent.com/ItsEthra/typst-live/master/README.md
markdown
MIT License
# Typst-live This is a simple utility to watch for changes in your [typst](https://github.com/typst/typst) file and automatically recompile them for live feedback. `typst-live` allows you to open a tab in your browser with typst generated pdf and have it automatically reload whenever your source `.typ` files are changed. ## Difference from `--watch` flag `typst-live` hosts a webserver that automatically refreshes the page so you don't have to manually reload it with `typst --watch` ## Installation If you have [rust](https://www.rust-lang.org) setup use the following command: ``` cargo install typst-live ``` If you use Nix, you can run typst-live directly from the GitHub repository using the following command: ``` nix run github:ItsEthra/typst-live ``` ## Usage ### 1. With auto recompilation * Launch `typst-live` from your terminal: ``` $ ./typst-live <file.typ> Server is listening on http://127.0.0.1:5599/ ``` * Go to `http://127.0.0.1:5599/` in your browser. * Now edit your `file.typ` and watch changes appear in browser tab. ### 2. With manual recompilation You can use `typst-live` to reload pdf files without recompilation of source files. For that you want to use `--no-recompile` option which disables recompilation and just hosts your pdf file in browser tab, you will need to specify `filename` as pdf instead of source `.typ` file. Whenever pdf file changes browser tab will be refreshed.
https://github.com/gomazarashi/slydst_test_crc
https://raw.githubusercontent.com/gomazarashi/slydst_test_crc/main/巡回冗長検査.typ
typst
#set text(lang: "ja") // 言語を日本語に設定 #set text(font: ("Yu Gothic")) // フォントを設定 #set heading(numbering: none) #import "@preview/slydst:0.1.1": * #show: slides.with( title: "巡回冗長検査(CRC)の概要 ", // 必須 authors: ("ごま"), date: [#datetime.today().display()], subtitle: none, layout: "medium", ratio: 4 / 3, title-color: none, ) = はじめに == 巡回冗長検査って? - 巡回冗長検査(CRC: Cyclic Redundancy Check)は、データの#text(fill: blue.darken(30%), weight: "bold")[誤り検出]に使われる技術の一つ - 送信データと受信データの間に誤りがあるかどうかを検出するために用いられる == CRCの基本概念 - CRCは、データに対して#text(fill: blue.darken(30%), weight: "bold")[生成多項式]と呼ばれる数式で割り算を行い、その#text(fill: blue.darken(30%), weight: "bold")[余りの値]を用いることで誤り検出を行う
https://github.com/Enter-tainer/typstyle
https://raw.githubusercontent.com/Enter-tainer/typstyle/master/tests/assets/typstfmt/80-func-call-with-label.typ
typst
Apache License 2.0
#figure( image("glacier.jpg", width: 70%), caption: [ _Glaciers_ form an important part of the earth's climate system. ], )<glaciers>
https://github.com/matteobongio/Calculus-2-Notes
https://raw.githubusercontent.com/matteobongio/Calculus-2-Notes/master/main.typ
typst
#import "@preview/showybox:2.0.1": showybox #import "@preview/cetz:0.2.2" #import "@preview/pinit:0.2.0": * #let bluebox(title, text, ..opts) = { showybox( title-style: ( weight: 900, color: blue.darken(40%), sep-thickness: 0pt, align: center ), frame: ( title-color: blue.lighten(80%), border-color: blue.darken(40%), body-color: blue.lighten(90%), thickness: (left: 1pt), radius: (top-right: 5pt, bottom-right:5pt, rest: 0pt) ), title: title, text, ..opts ) } #let DefCounters = state("defs", 0) #let DefBox(text, ..opts) = { DefCounters.update(x => x + 1) let c = context DefCounters.get() bluebox([Definition ] + c, text, ..opts) } #let TheoremCnts = state("theorems", 0) #let TheoremBox(title, text, ..opts) = { TheoremCnts.update(x => x + 1) let c = context TheoremCnts.get() showybox( title-style: ( weight: 900, color: green.darken(40%), sep-thickness: 0pt, align: center ), frame: ( title-color: green.lighten(80%), border-color: green.darken(40%), body-color: green.lighten(90%), thickness: (left: 1pt), radius: (top-right: 5pt, bottom-right:5pt, rest: 0pt) ), title: [Theorem ] + c+ [: ] + title, text, ..opts ) } #let ExCnts = state("exmples", 0) #let Examplebox(text, ..opts) = { ExCnts.update(x => x + 1) let c = context ExCnts.get() showybox( title-style: ( weight: 900, color: orange.darken(40%), sep-thickness: 0pt, align: center ), frame: ( title-color: orange.lighten(80%), border-color: orange.lighten(40%), body-color: orange.lighten(90%), thickness: (left: 1pt), radius: (top-right: 5pt, bottom-right:5pt, rest: 0pt) ), title: [Example ] + c, text, ..opts ) } = Calculus 2 == ODEs (Ordinary Differentiable Equations) - 1 independant variable $x$ - 1 dependant variable $y$ #Examplebox([ $ y = x y', y = x y' + x^2, m y'' + k y = 0, m y'' + k y = sin x $ ]) #DefBox([ ODE: $ a, b in RR quad [a, b] in RR \ y : [a, b] -> RR \ x |-> y(x) \ "assume" exists y' x y'' x, ..., y^((n))x "on" [a, b] in.rev x \ F : [a, b] times RR times RR^n ->RR \ (F "being good (cont., diff-ble) with respect to each argument") \ F (x, y, y', ..., y^((n))) in RR \ F (x, y(x), y'(x), ..., y^((n))(x)) = 0 $ ODE of order $n$: highest derivative that is in the argument ]) #Examplebox([ === Radioactive Decay $ frac(d, d "(time)") "(mass)(time)" = "(const < 0)" times "(mass)"lr((("time")), size: #150%) \ y' (x) = - k y(x) \ cal(E) = { y' + k y = 0} \ "Ord = 1, no " x "specifically" therefore "linear homogenueus" $ ]) #let Func = $F( x, y, y', ..., y^((n)))$ #DefBox([ if in $cal(E) = { Func } = 0$; LHS in linear in $y, y', ...$; NB: but maybe NOT linear in $x$ $=> cal(E)$ in linear $ F = f (x) + a_0 (x) y + a_1 (x) y' + ... $ and if $f (x) equiv 0$ (on $x in [a, b]$) then $cal(E)_("lin")$ is homogeneaus \ else $cal(E)_("lin")$ is inhomogeneaus \ ]) #let oy = $overline(y)(x)$ #DefBox([ === Particular solution #oy of $cal(E) = {Func = 0}$ on $x in [a, b]$\ if $forall x in [a, b] F( x, oy, oy', ..., oy^((n))) = Phi(x)$ \ if $overline(y)$ turns $F$ into identity REMARK: General Solution: Finding some/all solutions of $cal(E) = {F = 0}$ is called integration ]) #Examplebox([ $ cal(E) = {y' - 3x^2 = 0}\ y' = 3x^2 \ therefore y = x^3 + C \ forall C, "it is a solution of " cal(E) $ ]) #DefBox([ Integral curve (for $Epsilon$) is the graph ${x, y(x)}, x in [a, b]$ of a particular solution NB $[a, b]$ can depend on $y(x)$ $x d x + y d y = 0$ #cetz.canvas({ import cetz.draw: * // Your drawing code goes here circle((0, 0), radius: .5) circle((0, 0), radius: .75) circle((0, 0), radius: 1) line((-1.5, 0), (1.5, 0)) line((0, -1.5), (0, 1.5)) }) ]) #Examplebox([ $ y(x) = x + C, x in RR, C in RR $ incline depends on the constant Whatever point $(x_0, y_0)$ we have, there will be an integral curve passing through it. #cetz.canvas({ import cetz.plot plot.plot(size: (2, 2), axis-style: none, { plot.add(domain: (0, 2*calc.pi), (x) => x) plot.add(domain: (0, 2*calc.pi), (x) => x + 1) plot.add(domain: (0, 2*calc.pi), (x) => x - 1) }) }) ]) #Examplebox([ $ y frac(d y, d x) + x = 0 $ ]) #Examplebox([ *Blow-up Equation* $ Epsilon_2 = { y ' = y^2 } $ To solve: $y(x; C)$ ? Do all solutions exist over all $x in RR$ ]) #DefBox([ Given $Epsilon = { F = 0}$ of order $n>= 1$ - Initial Condition(s) ${x = x_0, x in RR and y(x_0) = y_0, y in RR}$ (Cauchy datum/ data) The number of conditions is $\# n = "ord"(Epsilon)$ $ cases( n = 1 => F(x, y, y') = 0, n > 1 => F_(n > 1)(x, y, y', ..., y^((n))) = 0, y'(x_0) = y_0 \, y_0\,...\, y^(n - 1) in RR quad y''(x_0) = y_0^2 ... ) $ - Boundry Condition(s) $ >= \# n cases( cases( A attach(\, , t: eq.not) B\, ... in RR supset.eq [a, b], y(A) = Y_A \, y(B) = Y_B \, ... ), "It can be that"&\ &y'(A) = Y_A^((1))\ &y'(B) = Y_B^((1)) \ &dots.v ) $ #cetz.canvas({ import cetz.plot plot.plot(size: (2, 2), x-min: 0, y-min:0, axis-style: "school-book", x-ticks: ((3.2, [a]), (4, [b])), x-tick-step: none, y-tick-step: none, { //TODO add y_A and y_B at the ends of the func plot.add(domain: (3.2, 4), (x) => calc.sin(2*x)) }) }) ]) #Examplebox([ $Epsilon = { y'' = 6x}$ 1. $y(0) = 1, y'(0) = -2$ ? Find $C_1, C_2$ $overline(y)(x) = ... $ 2. $y(0) = 1, y(1) = 2$ ? Find $C_1, C_2$ $overline(y)(x) = ...$ General solution: $y(x) = x^3 + C_1 x + c_2$ ]) #DefBox([ *Cauchy problem* (initial value problem) for $Epsilon$ $Epsilon = {F(x, y, y', ..., y^n) = 0}$ $ "and the number of initial condition(s)" &{y(x_0) = y_0, y'(x_0) = y_0^((1))}\ &quad quad quad quad dots.v\ &{y^((n-1))(x_0) = y_0^((n-1))} $ ?: To find a particular solution $y=y(x; x_0, y_0, y_0^((1)), ..., y_0^((n-1)))$ for $x in [a,b] in.rev x_0$ ]) #DefBox([ $Epsilon = { y' = y(x, y)} <-$ ODE resolved with respect to the derivative #Examplebox([ $Epsilon = {y = y'}$ non-example $x y' = y$ ]) *Cauchy Problem*: ${y' = f(x, y); y(x_0) = y_0}$ The geometric sense of (the preocess of) soluiton of Cauchy problem 1. Consider in $O_(x b) subset D = { (x, y) | "right hand side is defined"}$ 2. At $forall x, y in D$ attach vector ${1; f(x, y)} = accent(v, arrow) (x, y) = {frac(d x, d x), frac(d y, d x)}$ (the vector field of inclines) *Solving Cauchy problem* $<=>$ find the integral trajectories passing through $(x_0, y_0)$ Range of $C in RR$ gives us the range of $y_0^("new") in RR$ near out initially taken $y_0$ claim: integration constants parametrize Cauchy data over $x_0$ #Examplebox([ $ y' = y; y = C e^x\ cases( y = e^(x - c) > 0, - e^(x- c) < 0, y = 0 ) $ Kinda TODO: improve #cetz.canvas({ import cetz.plot plot.plot(size: (2, 2), axis-style: "school-book", x-tick-step: none, y-tick-step: none, { plot.add(domain: (-4, 4), (x) => calc.pow(2, x)) plot.add(domain: (-4, 4), (x) => calc.pow(2, x - 1)) plot.add(domain: (-4, 4), (x) => calc.pow(2, x - 2)) plot.add(domain: (-4, 4), (x) => calc.pow(2, x + 1)) plot.add(domain: (-4, 4), (x) => -calc.pow(2, x)) plot.add(domain: (-4, 4), (x) => -calc.pow(2, x - 1)) plot.add(domain: (-4, 4), (x) => -calc.pow(2, x + 1)) plot.add(domain: (-4, 4), (x) => -calc.pow(2, x - 2)) }) }) ]) *Conclusion:* Finding the general solution means finding a family of integral curves\ $y = y(x; C)$. It means finding the description $Phi (x, y; C) = 0$ of the integral curves. ]) #TheoremBox("Cauchy-Koualeska", [ If RHS of $f(x, y)$ is constant at $forall x,y in D subset.eq circle_(x y)$ and is the dependence if $f$ on $y$ is good (e.g. $exists$ continous $frac(diff y, diff x) => forall$ inner points $(x_0, y_0) in D$, $exists$ a unique $y = y(x; x_0, y_0))$ of ${y'f(x, y), y(x_0) = y_0}$ for $x$ near $x_0$. Moreover, this integer curve does extend up to the boundry $diff D$. ]) #table(columns: (auto, auto, auto, auto, auto), table.header([], [Stewart], [Demidouich], [Filippou], [Elsholtz]), [Ode, Direction field], [IX.2], [IX.1 exercise 2704], [1 exercise 1], [I.1], [Cauchy 1st], [], [IX 2 exercise 2733], [1 exemple 35], [I.6], [Seperable equidimensional], [IX.3], [IX.3 exercise 2742 \ exercise 2768], [2 exercise 51 \ 4 exercise 101], [I.2 \ I.3], [Linear variation of constants \ Bernoulli], [IX.5 \ (exercise 27-29)], [5 exerceise 2792 \ + IX.9], [6 exercise 186 \ 9 exercise 301], [I.5] ) = Lecture 3: Solving 1sr order ODE == Seperable ODE #let arrv = $arrow(v)$ #Examplebox([ $ arrv (x, y) = x (x, y) arrow(e)_x + y (x, y) arrow(e)_y \ cases( arrow.r arrow(e)_x: frac(d x, d t) = x, arrow.t arrow(e)_y: frac(d y, d t) = y, ) \ t = "time" $ ]) 1. Express $d("time")$ $ ""^ast.basic integral d t = integral frac(d x, X(x)) = integral frac(d y, Y(y)) } Phi(x, y, "const" = \"C\") = 0 -> y = t(x, "const") $ $""^ast.basic$ Time to get from start to end point 2. $frac(frac(d y, d t), frac(d x, d t)) = frac(Y(y), X(x)) = frac(d y, d x) = y'(x) } epsilon$ Steps to solve: 1. Bring $d x$ and all $x$ left 2. Bring $d y$ and all $y$ right 3. Integrate both sides 4. Do not forget $C$ In steps 1 and 2, when dividing, we can't divide by 0, do not discard those solutions. #Examplebox([ $ epsilon = {y' = x y^2} \ frac(d y, d x) = x y^2 quad frac(d y, y^2) = x d x \ cases( y = 0 -> d y = 0 => y = 0 "is a solution", y eq.not 0 -> integral frac(d y, y^2) = integral x d x => 1/y = 1/2 x^2 + C ) $ Inspect if $y = 0$ fits into $y(x; C)$ as a limit case ]) == Equidimensional Euler's scaling homogeneous #set math.cases(reverse: true) #columns( [ $ cases( epsilon = {y' = f(b/x)}, f(x, y) = f(k x, k y), "solving: New" z = frac(y(x), x) ) $ #colbreak() $ &y(x) = x z(x)\ &y'(x) = z + x z' \ &epsilon = {z + x z' = f(z)} ; x z' = f(z) - z $ ], gutter: 2% ) #set math.cases(reverse: false) $ cases( x = 0 -> epsilon = {z' = frac(f(z) - z, x)}, f(z) - z = 0 -> {integral frac(d z, f(z) - z) = integral frac(d x, x) = Phi (x, z; C) => z = (x, C) => y (x, C) = x z (x, C) } ) $ #Examplebox([ $ epsilon = {y' = frac(x^2 y^2, 2 x y)} x eq.not 0, y eq.not 0 $ Divide both sidees by $x^2$ $ frac(1 + (y / x)^2, 2 (y/ x)) = frac(1 + z^2, 2z) $ ]) == Linear ODEs of first order $ L[y(z)] = "RHS" (x) $ L is a polynomial in $d/(d x)$ ${a_0 (x) y'(x) + a_1 (x) y (x) = f(x)}$ where $a_0, a_1, f$ are given in $f n$ Suppose $a_0 (x) eq.not forall x in [a, b] subset RR$ $ epsilon = {y' + p(x) y = q(x)} $ #DefBox([ $epsilon$ is homogeneous if $f = 0 (=> q equiv 0)$ Else $(f equiv.not 0, q equiv.not 0) ->$ non-homogeneous #Examplebox([ $epsilon = {y' + x^2 y = 0}$ homogeneous, linear 1st order ODE if $f equiv 0 or q equiv 0$ the equation is seperable ]) ]) Extra Exercises #set enum(numbering: "a)") + $(1 + (y')^2 + x^2 y = 0) ->$ Non-linear + $b' + x^2 y^2 = 0 ->$ Linear, homogeneous + $y' - 2 x y = 1 + x ->$ Linear, non-homogeneous + $y' - 2 x y = 1 + y ->$ Linear, non-homogeneous + $y' - 2 x y = 1 + x + y^2 ->$ non-linear = Lecture 4 Linear ODE + Method of variation of constsants when ord$(epsilon) = n = 1$ $ &epsilon = {y' + p(x) y = q(x)}\ &y(x) = C(x) underbrace(b_0(x), "c = 1")#pin(1) $ #pinit-point-from(1)["Solution of" epsilon_0 = {"LHS" = 0})] #set math.cases(reverse: true) $ "plug" y(x) \ y' = C'(x) underbrace(b_0, c = 1) + C underbrace(b'_0, c = 1)\ y'_0 + p(x) y_0 = 0\ ("Const" y_0') + p(x) ("Const" y_0) = 0\ c' y_0 + C (y'_0 + p(x) y_0) = C'(x) y^((c = 1))_0 + C(x) y'_0 + p(x) c(x) y_0 = q(x) \ cases( c'(x) y_0(x) = 1(x) -> "new equation", c(x) = integral frac(q(x), y_0(n)) + "const" ) y(x_1, C_1) = [integral frac(q(x), y_0(x)) d x + C_1] y_0(x) $ #set math.cases(reverse: false) write down formula of $y_0(x)$ $ frac(d y_0, d x) + p(x) y_0 = 0 -> integral frac(d y_0, y_0) = - integral p(x) d x \ "Express" y_0 $ #Examplebox([ $ epsilon = { y' + 4 x y = 2 x} $ === Steps #set enum(numbering : "1") + $ y' + 4 x y = 0 \ cases( y != 0 => ln | y | = - 2 x^2 + accent(C, tilde) => y = plus.minus e^(-2x^2) e^(accent(C, tilde)) , y = 0 => frac(d y, d x) = - 4 x y => c = e^epsilon or 0 ) "General Solution": y_0 = C e^(-2x^2) $ + $ C'(x) e^(-2x^2) = 2x\ C'(x) = 2x e^(2x^2)\ "particular solution": C(x) = 1/2 e^(2x^2) + "const" $ + $ "general + particular": y(x, c) = (1/2 e^(2x^2) + "const") e^(-2 x^2) = 1/2 + "const" e^(-2x^2) $ ]) == Bernouilli equation $ = {y' + p(x) y = q(x) y^n, n in RR} $ - $n = 0 -> "linear non-homogenous"$ - $n = 1 -> "linear homogenous"$ - $n in.not {0, 1} -> "non-linear"$ $ y = 0 or \ frac(y', y^n) + p(x) 1/(y^(n-1)) = q(x) <= (1/y^(n-1))' = -(n - 1) y'/y^n \ 1/(-(n - 1)) (1/y^(n - 1))' + p(x) 1/y^(n - 1) = 1(x)\ "let" z(x) = 1/(y^(n - 1)(x))\ - 1/(n - 1) z' + p(x) z = 1(x) } "ODE " "ord" = 1 "Linear non-homogeneous"\ => z(x; "const") => y(x; "const") $ == Ricatti $ y' a(x) y + b(x) y^2 = c(x) $ $ y' = "polynomial degree" = z "in" y(x) "with coeffitient" (x) $ Generally unsolvable Bernouilli: $n = 2 and c(x) = 0$ If you know/guess 1 solution of $overline(y)(x)$ of Riccati put $y = overline(y) (x) + z (x)$ in the Riccati equation $->$ Bernoulli "(z(x))" == $n >= 2$ Linear ODE $ a_0 (x) y^n + a_1 (x) y^(n -1) + ... + a_(n - 1) (x) y' + a_n (x) y = f(x) $ where $a_0, ..., a_n$ are known functions. Suppose $a_0(x) != 0, x in [a, b]$ $ y^((n)) + alpha_1 (x) y^((n - 1)) + .. + alpha_(n - 1) y' + alpha_n (x) y = B(x) $ #text(weight: "bold")[Def.] $ &f(x) equiv 0 => B = 0 => "homogeneous linear" n^"th" "order ODE"\ &f(x) equiv.not 0 => B = 0 => "nono-homogeneous linear" n^"th" "order ODE" $ #set enum(numbering : "1") + General properties of spaces of solutions of such $epsilon_"lin"$ Case $f = 0$ (homogeneous) + The set of all solutions of $epsilon_"lin"(f equiv 0)$ s a vector space (over $RR$) $ forall y_1, y_2 in L -> k y_1 + lambda y_2 in L $ #showybox( title-style: ( weight: 900, color: red.darken(40%), sep-thickness: 0pt, align: center ), frame: ( title-color: gray.lighten(80%), border-color: gray.darken(90%), body-color: gray.lighten(90%), thickness: (left: 0pt), radius: (top-right: 5pt, bottom-right:5pt, rest: 5pt) ), title: "axioms", [ $ y_1 + y_2 &= y_2 + y_1\ k(y_1 + y_2) &= k y_1 + k y_2\ (k + lambda) y_1 &= k y_1 + lambda y_2 \ (k lambda) y_1 &= k (lambda y_1) $ ] ) $ cases( bold("Def.") "Linearly dependent": C_1 y_1 + ... + C_k y_k = 0 in L "for not all" c_i = 0, "Linearly independent": sum c_i y_i = 0 -> c_i = 0, "dim"(L) = "max number of linearly independent elements", bold("Rem.") y_1 (x) "and" y_2(x) "are linearly independent if" y_1 (x) = ( "const" != 0 ) y_2 (x) ) $ + Fundamental theorem about $L$ of #pin(2)$epsilon_"lin" (f equiv 0) } N B (n = 1), forall y_0(x, c) = c "sol"(x) in RR$ #pinit-point-to(2)[ord $n >= 1$] \ \ \ $forall epsilon_"lin"^n (f = 0)$ has $n$ linearly independent solutions $y_1 (x), ..., y_n(x)$ $"dim"_RR L = n$ $bold("Rem.") "In the space of all" f(x), x in [a, b]$ #set enum(start: 3) + The structure of affine space of solutions $"sol"(epsilon_"lin"^n (f != 0))$ $y(x) = 0 in.not "sol"(epsilon(f != 0))$ $y(x) = y_*(x) + y_0(x, C_1, ..., c_n)$
https://github.com/jamesrswift/journal-ensemble
https://raw.githubusercontent.com/jamesrswift/journal-ensemble/main/src/elements.typ
typst
The Unlicense
#import "ensemble.typ": color-accent-1, color-accent-2 #import "elements/cetz-plot.typ": plot #let marker = context text(fill: color-accent-1.get(), sym.square.filled, baseline: -0.125em) #let sep = box( width: 1.25em, align(center, marker) ) #let fancy-box( body ) = { place(right, move( dy: -0.25cm, dx: 0.3cm, context rect( fill: color-accent-1.get(), width: 1.25cm, height: 100% + 0.5cm, ) )) context rect( width: 100%, height: 100%, inset: 1cm, fill: color-accent-2.get(), body ) }
https://github.com/ymgyt/blog
https://raw.githubusercontent.com/ymgyt/blog/main/lt/synd-lt/presen.typ
typst
#import "@preview/polylux:0.3.1": * #import themes.bipartite: * #show: bipartite-theme.with(aspect-ratio: "16-9") #set text( size: 25pt, font: ( "JetBrainsMono Nerd Font", "Noto Sans CJK JP", )) #title-slide( title: [TUIのFeed Viewerを自宅のRaspbery Piで公開するまで], subtitle: [NixでRustの開発環境からCI,Deployまで管理する], author: [山口 裕太], date: [2024-03-05], ) #west-slide(title: "自己紹介")[ ```toml [speaker] name = "<NAME>" github = "https://github.com/ymgyt" blog = "https://blog.ymgyt.io/" ``` ] #west-slide(title: "会社紹介")[ ```toml [company] name = "FRAIM Inc." tech_blog = "https://zenn.dev/p/fraim" ``` ] #west-slide(title: "話すこと")[ 作成したツールのライフサイクルについて - TUIのFeed Viewerを作った - Nixで開発環境,CI,Deployを管理した - Releaseではcargo-releaseとcargo-distを利用した - Trace,Metrics,LogsはOpenTelemetryを利用した ] #west-slide(title: "RustでTUI")[ #figure( image("./images/ss-1.png", width: 80%, height: 80%, fit: "contain"), numbering: none, caption: [ FeedのEntry一覧 ], ) ] #west-slide(title: "RustでTUI")[ #figure( image("./images/ss-2.png", width: 80%, height: 80%, fit: "contain"), numbering: none, caption: [ Feedの一覧 ], ) ] #west-slide(title: "RustのTUI library")[ + crossterm(cross platform terminal library) + ratatui(tui widgets library) ] #west-slide(title: "RustのTUI library")[ #figure( image("./images/ratatui-ss.png", width: 80%, height: 80%, fit: "contain"), numbering: none, caption: [ Netflixが公開したeBPFのtui toolでもratatuiが使われている ], ) ] #west-slide(title: "ratatui")[ #set text(size: 20pt) ```rust let (header, widths, rows) = self.entry_rows(cx); let entries = Table::new(rows, widths) .header(header.style(cx.theme.entries.header)) .column_spacing(2) .style(cx.theme.entries.background) .highlight_symbol(ui::TABLE_HIGHLIGHT_SYMBOL) .highlight_style(cx.theme.entries.selected_entry) .highlight_spacing(HighlightSpacing::WhenSelected); ``` TableやList等の基本的なwidgetが用意されている ] #west-slide(title: "crossterm")[ #set text(size: 20pt) ```rust async fn event_loop<S>(&mut self, input: &mut S) where S: Stream<Item = io::Result<CrosstermEvent>> + Unpin, { loop { tokio::select! { biased; Some(event) = input.next() => { } _ = self.background_jobs => { } }; } ``` 複数の入力もasyncで書ける ] #west-slide(title: "crossterm")[ #set text(size: 20pt) ```rust fn handle_terminal_event(&mut self, event: std::io::Result<CrosstermEvent>) { match event.unwrap() { CrosstermEvent::Resize(columns, rows) => { } CrosstermEvent::Key(key) => match key.code { KeyCode::Tab => { }, KeyCode::Char('j') => { }, } } } ``` Key入力の処理も簡単 ] #west-slide(title: "Nixによる開発環境の管理")[ このRustのprojectをNixで管理しました ] #west-slide(title: "Nixによる開発環境の管理")[ そもそもNixとは > A build tool, package manager, and programming language https://zero-to-nix.com/concepts/nix ] #west-slide(title: "Nixで管理すると何がうれしいのか")[ - 開発環境をNixで管理できる ] #west-slide(title: "Nixによる開発環境の管理")[ #set text( size: 20pt, font: ( "JetBrainsMono Nerd Font", "Noto Sans CJK JP", )) ```nix { inputs.nixpkgs.url = "github:NixOS/nixpkgs/release-23.11"; outputs = { self, nixpkgs, ... }: let dev_packages = with pkgs; [ graphql-client git-cliff cargo-release cargo-dist oranda ]; in { devShells.default = craneLib.devShell { packages = dev_packages; }; }); } ``` project rootのflake.nixで開発時の依存を宣言 ] #west-slide(title: "nix develop")[ #figure( image("./images/nix-develop-1.png", width: 100%, height: 40%, fit: "stretch"), numbering: none, caption: [ nix developを実行すると宣言したpackageがPATHに入った状態で開発環境(shell)が立ち上がる ], ) ] #west-slide(title: "Nixで管理すると何がうれしいのか")[ #text(fill: gray.lighten(50%),[- 開発環境をNixで管理できる]) - CIをNixで管理できる ] #west-slide(title: "CIでもnix develop")[ ```yaml name: CI jobs: tests: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - run: nix develop .#ci --accept-flake-config --command just check ``` - install actionが不要 - 開発環境と同一version ] #west-slide(title: "Nixで管理すると何がうれしいのか")[ #text(fill: gray.lighten(50%),[- 開発環境をNixで管理できる]) #text(fill: gray.lighten(50%),[- CIをNixで管理できる]) - CacheをNixで管理できる ] #west-slide(title: "Nixで管理すると何がうれしいのか")[ `/nix/store/3sn5pij1hjvdlnq468c0m8vz8nibhrdc-cargo-release-0.25.0/bin/cargo-release`の \ `3sn5pij1hjvdlnq468c0m8vz8nibhrdc`が入力に対応するhashとなっており、cacheがあればbuildせずにbinaryを取得できる ] #west-slide(title: "Nixで管理すると何がうれしいのか")[ #figure( image("./images/ci-cache.png", width: 100%, height: 40%, fit: "contain"), numbering: none, caption: [ cacheから取得 ], ) ] #west-slide(title: "Nixで管理すると何がうれしいのか")[ #set text( size: 20pt) ```yaml name: CI jobs: tests: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: cachix/install-nix-action@v25 with: github_access_token: ${{ secrets.GITHUB_TOKEN }} - uses: cachix/cachix-action@v14 with: name: syndicationd authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' - run: nix develop .#ci --accept-flake-config --command just check ``` cacheを設定した最終的なCIのworkflow \ localとCIで同じcacheの仕組みを利用できる ] #west-slide(title: "Nixで管理すると何がうれしいのか")[ #text(fill: gray.lighten(50%),[- 開発環境をNixで管理できる]) #text(fill: gray.lighten(50%),[- CIをNixで管理できる]) #text(fill: gray.lighten(50%),[- CacheをNixで管理できる]) - InstallをNixで管理できる ] #west-slide(title: "Nixで管理すると何がうれしいのか")[ #figure( image("./images/run-ss.png", width: 100%, height: 40%, fit: "contain"), numbering: none, caption: [ nix runで一時的に実行したり \ nix profileでinstallもできる \ MacとLinuxで同じpackage管理ができる ], ) ] #west-slide(title: "Nixで管理すると何がうれしいのか")[ #text(fill: gray.lighten(50%),[- 開発環境をNixで管理できる]) #text(fill: gray.lighten(50%),[- CIをNixで管理できる]) #text(fill: gray.lighten(50%),[- CacheをNixで管理できる]) #text(fill: gray.lighten(50%),[- InstallをNixで管理できる]) - DeployをNixで管理できる ] #west-slide(title: "Nixでsystemd serviceを宣言")[ #set text( size: 19pt, font: ( "JetBrainsMono Nerd Font", "Noto Sans CJK JP", )) ```nix { config, pkgs, syndicationd, ... }: let syndPkg = syndicationd.packages."${pkgs.system}".synd-api; in { config = { systemd.services.synd-api = { description = "Syndicationd api"; wantedBy = [ "multi-user.target" ]; environment = { SYND_LOG = "INFO"; }; serviceConfig = { ExecStart = "${syndPkg}/bin/synd-api" }; }; }; } ``` https://github.com/ymgyt/mynix/blob/main/homeserver/modules/syndicationd/default.nix ] #west-slide(title: "NixでDeploy")[ #figure( image("./images/deploy-rs.png", width: 100%, height: 80%, fit: "contain"), numbering: none, caption: [ deploy-rsでNixOSが入ったRaspberryPiにdeploy ] ) ] #west-slide(title: "Nixで管理すると何がうれしいのか")[ - 開発環境をNixで管理できる - CIをNixで管理できる - CacheをNixで管理できる - InstallをNixで管理できる - DeployをNixで管理できる ] #west-slide(title: "cargoでも公開したい")[ とはいえ、cargo installもしたい ] #west-slide(title: "cargoでも公開したい")[ `cargo publish`するには以下が必要 - Cargo.tomlの`package.version`のbump - Workspace内に依存packageがある場合は合わせてbump - CHANGELOGの生成 - gitのtagging これをworkspaceのmember crateごとに実施する必要がある ] #west-slide(title: "cargoでも公開したい")[ cargo-releaseが全て面倒をみてくれる ] #west-slide(title: "cargoでも公開したい")[ `cargo release --package foo patch`を実行すると \ - foo packageのCargo.toml `package.version`をbump(`v0.1.2` -> `v0.1.3`) - fooに依存しているworkspace内のpackageの`dependencies.foo.version`をbump - 設定に定義したreplace処理を実施(CHANGELOGの`[unreleased]` -> `[v0.1.3]`) - gitのcommit, tagging, push - cargo publish ] #west-slide(title: "homebrewでも公開したい")[ brew installもしたい ] #west-slide(title: "homebrewでも公開したい")[ 専用のrepository(`homebrew-syndicationd`)に以下のような記述が必要 #set text( size: 15pt ) ```ruby class Synd < Formula desc "terminal feed viewer" version "0.1.6" on_macos do on_arm do url "https://github.com/ymgyt/syndicationd/releases/download/synd-term-v0.1.6/synd-term-aarch64-apple-darwin.tar.gz" sha256 "c02751ba979720a2a24be09e82d6647a6283f28290bbe9c2fb79c03cb6dbb979" end on_intel do url "https://github.com/ymgyt/syndicationd/releases/download/synd-term-v0.1.6/synd-term-x86_64-apple-darwin.tar.gz" sha256 "3be81f95c68bde17ead0972df258c1094b28fd3d2a96c1a05261dba2326f31d8" end end ``` ] #west-slide(title: "homebrewでも公開したい")[ cargo-distが全て面倒をみてくれる ] #west-slide(title: "cargo-distがやってくれる")[ `cargo dist init`を実行して質問に答えると - Cargo.tomlの`[workspace.metadata.dist]`に設定が追加 - `.github/workflows/release.yml`を生成 #pause この状態でcargo-releaseでgit tagをpushすると ] #west-slide(title: "cargo-distがやってくれる")[ #figure( image("./images/release-ss.png", width: 100%, height: 80%, fit: "contain"), numbering: none, caption: [ Github releaseと各種installerが作成される ] ) ] #west-slide(title: "cargo-distがやってくれる")[ cargo-distが以下をやってくれる(設定次第) - 各種platform(aarch64,x86のdarwin,windows, linux gnu,musl)向けのbinary生成 - shell,powershellのinstall script作成 - homebrew用repositoryの更新(push権限を渡す必要あり) ] #west-slide(title: "cargo-distがやってくれる")[ #figure( image("./images/cargo-dist-plan.png", width: 90%, height: 60%, fit: "contain"), numbering: none, caption: [ `cargo dist plan`を実行するとCIで実行される内容を確認できる \ workflow yamlにベタ書きされているのではなく、`cargo dist plan`の出力を参照するようになっている ] ) ] #west-slide(title: "cargo-distがやってくれる")[ cargo-releaseと一緒に使うことが想定されており \ cargo publishとgitのtag pushまでがcargo-release \ それ以降の配布処理がcargo-distという役割分担がよかったので使ってみた ] #west-slide(title: "監視もしたい")[ DeployとReleaseができたので次に監視がしたい #pause \ OpenTelemetryを使う ] #west-slide(title: "RustでOpenTelemetry")[ Rustで`tracing`を使っている場合 \ `tracing-opentelemetry`と`opentelemetry_sdk`を使うと\ Logs, Traces, Metricsを取得できる ] #west-slide(title: "RustでOpenTelemetry")[ #figure( image("./images/dashboard-ss.png", width: 100%, height: 80%, fit: "contain"), numbering: none, caption: [ 公開しているGrafana dashboard ] ) ] #west-slide(title: "RustでOpenTelemetry")[ #figure( image("./images/trace-ss.png", width: 100%, height: 80%, fit: "contain"), numbering: none, caption: [ Entry取得時のTrace ] ) ] #west-slide(title: "まとめ")[ Nix,cargo-{release,dist},OpenTelemetryで \ 楽しいツール開発 ] #west-slide(title: "各種link")[ - #link("https://github.com/crate-ci/cargo-release")[cargo-release] - #link("https://github.com/axodotdev/cargo-dist")[cargo-dist] - #link("https://github.com/serokell/deploy-rs")[deploy-rs] - #link("https://github.com/ymgyt/syndicationd")[syndicationd] - #link("https://github.com/ymgyt/mynix/tree/main/homeserver")[raspi nix configuration] ]
https://github.com/Hucy/cv_typst_template
https://raw.githubusercontent.com/Hucy/cv_typst_template/main/cv_en.typ
typst
MIT License
#let primary_color = rgb("#7F96AD") #show link: underline #set text( size: 12pt, weight: "regular", font: ("linux libertine", "Microsoft YaHei", "PingFang SC"), ) #set list(indent: .6em, marker: ([•])) #set page( paper: "a4", margin: (left: 1.4cm, right: 1.4cm, top: .8cm, bottom: .8cm), ) #set par(justify: true) #let section(title, body) = { block[ #set text(weight: "bold", size: 14pt, fill: primary_color) #h(0.2em) #title #box(width: 1fr, line(length: 100%, stroke: 0.5pt + primary_color)) ] pad(x: .4em)[ #body ] } #let contact_info(name, location, phone, email) = { grid( columns: (1fr), gutter: 0.4em, align(right)[ #set text(size: 10pt) #location \ #phone \ #email ], rect( width: 100%, fill: primary_color, inset: 0.4em, [#align(left)[#text(fill: white, weight: "bold", size: 18pt)[#name]]], ) ) } #let job(company, title, start, ..end) = { let e = if end.pos().len() != 0 [-- #end.pos().at(0)] block[ *#company* #h(1fr) #start #e \ #title ] } #contact_info("<NAME>", "US.AG", "012020", "<EMAIL>") #section("Introduction")[ #lorem(20) ] #section("Skills")[ - Tech Stack: #lorem(2), #lorem(4) - Languages: #lorem(1), #lorem(1) - Others: #lorem(1), #lorem(1) ] #section("Work Experience")[ #job("xxx company", "xxdeveloper", "2000.3", "Present") #lorem(20)\ - #lorem(4): - #lorem(11) - #lorem(11) - #lorem(7): - #lorem(10) - #lorem(10) - #lorem(5): - #lorem(10) #job("xxx company", "xxdeveloper", "2000.3", "2000.7") #lorem(20)\ - #lorem(10) - #lorem(10) ] #section("Projects")[ #link("")[ *#lorem(6)* ]\ #lorem(15) ] #section("Education")[ #job("xxxx", "xxxx", "2000.9", "2019.6") ]
https://github.com/AnsgarLichter/cv-typst
https://raw.githubusercontent.com/AnsgarLichter/cv-typst/main/README.md
markdown
# CV This is my CV created with Typst.
https://github.com/ntjess/typst-tada
https://raw.githubusercontent.com/ntjess/typst-tada/main/examples/titanic.typ
typst
The Unlicense
// https://github.com/ntjess/showman.git #import "@local/showman:0.1.0": runner, formatter #import "../lib.typ" as tada // redefine to ensure path is read here instead of from showman executor #let local-csv(path) = csv(path) #show: formatter.template.with( theme: "dark", eval-kwargs: ( scope: (tada: tada, csv: local-csv), eval-prefix: "#let to-tablex(it) = output(tada.to-tablex(it))", direction: ltr, ), ) #let cache = json("/.coderunner.json").at("examples/titanic.typ", default: (:)) #show raw.where(lang: "python"): runner.external-code.with(result-cache: cache) #set page(margin: 0.7in, height: auto) = Poking around the `titanic` dataset == First in Python ```python import requests from pathlib import Path def download(url, output_file): if not Path(output_file).exists(): r = requests.get(url) with open(output_file, "wb") as f: f.write(r.content) print("Download finished") download("https://web.stanford.edu/class/archive/cs/cs109/cs109.1166/stuff/titanic.csv", "examples/titanic.csv") ``` ```python import pandas as pd df = pd.read_csv("examples/titanic.csv") df["Name"] = df["Name"].str.split(" ").str.slice(0, 3).str.join(" ") df = df.drop(df.filter(like="Aboard", axis=1).columns, axis=1) print(df.head(5)) ``` = Can we do it in Typst? ```globalexample #let csv-to-tabledata(file, n-rows: -2) = { let data = csv(file) let headers = data.at(0) let rows = data.slice(1, n-rows + 1) tada.from-rows(rows, field-info: headers) } #import tada: TableData, subset, chain, filter, update-fields, agg, sort-values #let td = chain( csv-to-tabledata("/examples/titanic.csv"), // Shorten long names tada.add-expressions.with( Name: `Name.split(" ").slice(1, 3).join(" ")`, ), ) #output[ Data loaded! #chain( td, subset.with( fields: ("Name", "Age", "Fare"), indexes: range(3) ), to-tablex ) ] ``` == Make it prettier ```globalexample #let row-fmt(index, row) = { let fill = none if index == 0 { fill = rgb("#8888") } else if calc.odd(index) { fill = rgb("#1ea3f288") } row.map(cell => (..cell, fill: fill)) } #let title-fmt(name) = heading(outlined: false, name) #td.tablex-kwargs.insert("map-rows", row-fmt) #td.field-defaults.insert("title", title-fmt) #to-tablex(subset(td, fields: ("Name", "Age", "Fare"), indexes: range(0, 5))) ``` == Convert types & clean data ```globalexample #let usd = tada.display.format-usd #let td = chain( td, tada.add-expressions.with( Pclass: `int(Pclass)`, Name: `Name.slice(0, Name.position("("))`, Sex: `upper(Sex.at(0))`, Age: `float(Age)`, Fare: `float(Fare)`, ), update-fields.with( Fare: (display: usd), ), subset.with( fields: ("Pclass", "Name", "Age", "Fare") ), sort-values.with(by: "Fare", descending: true), ) #to-tablex(subset(td, indexes: range(0, 10))) ``` == Find just the passengers over 30 paying over \$230 ```globalexample #to-tablex(filter(td, expression: `Age > 30 and Fare > 230`)) ``` == See how much each class paid and their average age ```globalexample #let fares-per-class = tada.group-by( td, by: "Pclass", aggs: ( "Total Fare": `Fare.sum()`, "Avg Age": `int(Age.sum()/Age.len())`, ), field-info: ("Total Fare": (display: usd)), ) #to-tablex(fares-per-class) ```
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/glossary.typ
typst
Creative Commons Attribution Share Alike 4.0 International
#import "@local/notebookinator:0.1.0": * #glossary.add-term( "Holonomic", )[ A vehicle is described as holonomic when it can move in any X/Y direction at any time, regardless of its rotation. X-drive and Mecanum drivetrains are examples of holonomic vehicles. ] #glossary.add-term( "Python", )[ A high level programming language implemented in C. It's very useful for data science and data visualization. ] #glossary.add-term( "CSV", )[ A minimal text based file format for spreadsheets. This allows a lot of data to be stored in a relatively simple, organized manner. ] #glossary.add-term( "CLI", )[ Short for command line interface. This is a style of software interface where everything is controlled from the command line by typing in commands, rather than clicking with buttons. ] #glossary.add-term("Singleton Pattern")[ A software design pattern where a class is only instantiated once. ] #glossary.add-term( "Mutual Exclusion", )[ A software design pattern where a shared resource can only be accessed by a single thread of execution at a time. It is often used to prevent race conditions. ] #glossary.add-term( "Skid Steer", )[ A style of vehicle where the wheels have a fixed alignment. This is typically seen on heavy equipment like front loaders. ] #glossary.add-term("Parallelism")[ The process of running code in parallel across multiple cores. ] #glossary.add-term( "Asynchronous", )[ When code is run out of order to achieve the illusion of running at the same time (parallelism). ] #glossary.add-term( "Auton", )[ It could either refer to: the code designed for the autonomous section of a robotics match or the autonomous section of a robotics match. ] #glossary.add-term( "API", )[ Acronym for application programming interface. It is a translation layer between two pieces of software. ] #glossary.add-term( "Arcade Drive", )[ A driver control method where one joystick controls forward and backwards)and the other controls turning. ] #glossary.add-term("AWP")[ An acronym that stands for Autonomous Win Point. ] #glossary.add-term("CAD")[ Computer aided design. Used for planning out designs virtually. ] #glossary.add-term( "C", )[ A low level programming language. Referred to as the mother of all languages. ] #glossary.add-term( "C++", )[ A low level programming language that is a superset of C's functionality, originally called C with Classes. ] #glossary.add-term( "CNC", [ An acronym that stands for Computer numerical control. This is any application where a computer cuts, carves, or forms parts based on instructions that control the movement. ], ) #glossary.add-term( "Framework", )[ A collection of code that serves as a base for other code to be written on top of. ] #glossary.add-term("FRC")[ A rival competition system to Vex. ] #glossary.add-term( "Git", )[ A version control system. Used to create saved points in time in your code called commits. ] #glossary.add-term( "GitHub", )[ A collection of git repositories hosted by Microsoft. Allows us to make our code easily accessible. ] #glossary.add-term("Library")[ A collection of code that provides common utility. ] #glossary.add-term("PID")[ Control theory used to move a system to a target smoothly. ] #glossary.add-term( "Pure Pursuit", )[ A path following algorithm that causes the robot to move to a series of points. ] #glossary.add-term("PROS")[ An library developed by students at Purdue used to control vex robots. ] #glossary.add-term( "Odometry", )[ A method of tracking the position of the robot in cartesian coordinates developed by team 5225, the Pilons. ] #glossary.add-term( "Absolute Movement", )[ Movement that is in relation to a fixed point, rather than relative to itself. ] #glossary.add-term( "Tank Drive", )[ A driver control method where the left joystick controls the left wheels of the bot, and the right joystick controls the right side of the bot. ]
https://github.com/mrtz-j/typst-thesis-template
https://raw.githubusercontent.com/mrtz-j/typst-thesis-template/main/modules/backpage.typ
typst
MIT License
#let backpage() = { set page( paper: "a4", margin: (left: 3mm, right: 3mm, top: 12mm, bottom: 12mm), header: none, footer: none, numbering: none, number-align: center, ) // --- Back Page --- place( bottom + center, dy: 27mm, image("../assets/backpage.svg", width: 216mm, height: 303mm), ) }
https://github.com/lankoestee/sysu-report-typst
https://raw.githubusercontent.com/lankoestee/sysu-report-typst/main/README.md
markdown
MIT License
# SYSU-Report-Typst ![](https://img.shields.io/badge/Sun%20Yat--sen%20University-005826) ![](https://img.shields.io/badge/Typst-239DAD) 适用于中山大学的一个简单的,自己正在使用的**Typst**报告模板。当然这**不能**适用于学位论文等正式论文的编写,但是对于小型的报告还是非常适用的。 本仓库相同的模板还有几乎一模一样的**LaTeX**的版本!详见[SYSU-Report-LaTeX](https://github.com/lankoestee/sysu-report-latex)。 该模板也是本人报告写作方法的一部分,详见[舒适写作大法 | 大聪明de小妙招 (cleversmall.com)](https://cleversmall.com/posts/e06f63c1/)。 ## 快速使用 ```bash git clone https://github.com/lankoestee/sysu-report-typst ``` 克隆后,直接编辑里面的`report.typ`。里面包括了一些`founder.typ`模板文件的预制变量,可以根据自己的需求进行修改。 当然对于不是中山大学的使用者而言,你可以修改`figure/badge.svg`为自己学校或单位的正方形图标,修改`figure/badge-horizonal.svg`为自己学校或单位的长方形图标。 > [!TIP] > 本仓库中的`image`文件夹**不是**必要的,仅为了展示README中的图片,克隆后推荐删除。 ## 模板特点 - 使用了CMU字体作为英文标准字体,使用方正系列字体作为中文标准字体,由于方正系列的字体都只有单一的粗细大小,因此可能需要下载多种字体; - 使用Monaco字体作为代码标准字体,并为多行代码标注了行号,加深了背景; - 为简单朴素的Typst添加了一个封面,封面中的信息内容可以自己控制; - 还添加了一个目录,自动目录从一级标题收录到三级标题,四级及以下的标题不再收录; - 将目录编号为第一页,封面不做编号; - 可以加入了标准三线表的对应样式; - 添加了一个简单的页眉; - 添加了一些简单的可用样式。 ## 所需字体 为避免版权争议,不附下载链接🔗。 | 字体名称 | 索引名称 | | --------------- | ------------------- | | CMU Serif Roman | CMU Serif | | CMU Sans Serif | CMU Sans Serif | | Monaco | Monaco | | 方正小标宋简体 | FZXiaoBiaoSong-B05S | | 方正书宋简体 | FZShuSong-Z01S | | 方正大黑简体 | FZDaHei-B02S | | 方正黑体简体 | FZHei-B01S | ## 模板展示 ![](./image/report_1.png) ![](./image/report_2.png) ![](./image/report_3.png) ![](./image/report_4.png)
https://github.com/jassielof/typst-templates
https://raw.githubusercontent.com/jassielof/typst-templates/main/apa7/utils/languages.typ
typst
MIT License
#let get-terms(language) = { if language == "en" { ( "and": "and", "Author Note": "Author Note", "Abstract": "Abstract", "Keywords": "Keywords", "Appendix": "Appendix", "Annex": "Annex", ) } else if language == "es" { ( "and": "y", "Author Note": "Nota del autor", "Abstract": "Resumen", "Keywords": "Palabras clave", "Appendix": "Apéndice", "Annex": "Anexo", ) } else if language == "de" { ( "and": "und", "Author Note": "Autorennotiz", "Abstract": "Zusammenfassung", "Keywords": "Schlüsselwörter", "Appendix": "Anhang", "Annex": "Anhang", ) } else if language == "pt" { ( "and": "e", "Author Note": "Nota do autor", "Abstract": "Resumo", "Keywords": "Palavras-chave", "Appendix": "Apêndice", "Annex": "Anexo", ) } else { panic("Unsupported language:", language) } }
https://github.com/kdog3682/mathematical
https://raw.githubusercontent.com/kdog3682/mathematical/main/0.1.0/src/examples/pixel-art-3d-shapes-dirty-anchors.typ
typst
#import "@preview/cetz:0.2.2" #import cetz.draw: * #let my-star(center, name: none, ..style) = { group(name: name, ctx => { // Define a default style let def-style = (n: 5, inner-radius: .3, radius: .2) // Resolve the current style ("star") let style = cetz.styles.resolve( ctx.style, merge: style.named(), base: def-style, root: "star", ) // Compute the corner coordinates let corners = range(0, style.n * 2).map(i => { let a = 90deg + i * 360deg / (style.n * 2) let r = if calc.rem(i, 2) == 0 { style.radius } else { style.inner-radius } // Output a center relative coordinate (rel: (calc.cos(a) * r, calc.sin(a) * r, 0), to: center) }) line(..corners, ..style, close: true) }) } // Call the element #cetz.canvas({ set-style(star: (fill: yellow)) // set-style works, too! my-star((0,4)) grid((0, 0), (5, 5), stroke: 0.25pt) let fooga(stroke: black) = { set-style( rect: (stroke: stroke), ) rect((0, 0), (1, 1)) } content(anchor: "west", (0, 0), { text("HIIIII\n") text("HIIIII\n") text("HIIIII\n") }) content(anchor: "north", (3, 5), [addd f f]) content(anchor: "north", (rel: (0, -0.6)), [aaaaaab c d]) content(anchor: "north-west", (0, 0), { table( columns: (1cm, 1cm, 1cm), rows: (1cm, 1cm), align: center + horizon, [1], table.cell([1], stroke: blue, fill: yellow), [1], [1], [1], [1], [1], [1], ) }) })
https://github.com/typst/packages
https://raw.githubusercontent.com/typst/packages/main/packages/preview/numty/0.0.2/lib.typ
typst
Apache License 2.0
// == types == #let arrarr(a,b) = (type(a) == array and type(b) == array) #let arrflt(a,b) = (type(a) == array and type(b) != array) #let fltarr(a,b) = (type(a) != array and type(b) == array) #let fltflt(a,b) = (type(a) != array and type(b) != array) #let arr(a) = (type(a) == array) // == boolean == #let isna(v) = { if arr(v){ v.map(i => if (type(i)==float){i.is-nan()} else {false}) } else{ if (type(v)==float){v.is-nan()} else {false} } } #let all(v) ={ // easily fooled if wrong array type if (v == true or v == 1){ return true } else if (v == false or v == 0){ return false } else { // is array v = v.map(i => if (i==1 or i==true){true} else {false}) not v.contains(false) } } #let _eq(i,j, equal-nan) ={ i==j or (all(isna((i,j))) and equal-nan) } #let eq(u,v, equal-nan: false) = { // Checks for equality element wise // eq((1,2,3), (1,2,3)) = (true, true, true) // eq((1,2,3), 1) = (true, false, false) if arrarr(u,v) { u.zip(v).map(((i,j)) => (_eq(i,j, equal-nan))) } else if arrflt(u,v) { u.map(i => _eq(i,v,equal-nan)) } else if fltarr(u,v) { v.map(i => _eq(i,u,equal-nan)) } else if fltflt(u,v) { _eq(u,v,equal-nan) } } #let any(v) ={ v = v.map(i => if (i==1 or i==true){true} else {false}) v.contains(true) } #let all-eq(u,v) = all(eq(u,v)) // == Operators == #let add(a,b) = { if arrarr(a,b) { a.zip(b).map(((i,j)) => i+j) } else if arrflt(a,b) { a.map(a => a+b) } else if fltarr(a,b) { b.map(b => a+b) } else { a+b } } #let sub(u, v) = { if arrarr(u, v) { u.zip(v).map(((u, v)) => u - v) } else if arrflt(u, v) { u.map(i => i - v) } else if fltarr(u, v) { v.map(j => u - j) } else { u - v } } #let mult(u, v) = { if arrarr(u, v) { u.zip(v).map(((i,j)) => i*j) } else if arrflt(u,v) { u.map(i => i*v) } else if fltarr(u,v) { v.map(i => i*u) } else { u*v } } #let div(u, v) = { if arrarr(u, v) { u.zip(v).map(((i,j)) => if (j!=0) {i/j} else {float.nan}) } else if arrflt(u,v) { u.map(i => i/v) } else if fltarr(u,v) { v.map(j => u/j) } else { u/v } } #let pow(u, v) = { if arrarr(u, v) { u.zip(v).map(((i,j)) => calc.pow(i,j)) } else if arrflt(u,v) { u.map(i => calc.pow(i,v)) } else if fltarr(u,v) { v.map(j => calc.pow(u,j)) } else { calc.pow(u,v) } } // == vectorial == #let normalize(a, l:2) = { // normalize a vector if l==1{ let aux = a.sum() a.map(b => b/aux) } else { panic("Only supported L1 normalization") } } #let norm(a) = { // deprecate let aux = a.sum() a.map(b => b/aux) } // dot product #let dot(a,b) = mult(a,b).sum() // == Algebra, trigonometry == #let sin(a) = { if arr(a) { a.map(a => calc.sin(a)) } else { calc.sin(a) } } #let cos(a) = { if arr(a) { a.map(a => calc.cos(a)) } else { calc.cos(a) } } #let tan(a) = { if arr(a) { a.map(a => calc.tan(a)) } else { calc.tan(a) } } #let log(a) = { if arr(a) { a.map(a => if (a>0) {calc.log(a)} else {float.nan}) } else { calc.log(a) } } // others: #let linspace = (start, stop, num) => { // mimics numpy linspace let step = (stop - start) / (num - 1) range(0, num).map(v => start + v * step) } #let logspace = (start, stop, num, base: 10) => { // mimics numpy logspace let step = (stop - start) / (num - 1) range(0, num).map(v => calc.pow(base, (start + v * step))) } #let geomspace = (start, stop, num) => { // mimics numpy geomspace let step = calc.pow( stop / start, 1 / (num - 1)) range(0, num).map(v => start * calc.pow(step,v)) }
https://github.com/GYPpro/DS-Course-Report
https://raw.githubusercontent.com/GYPpro/DS-Course-Report/main/Rep/10.typ
typst
#import "@preview/tablex:0.0.6": tablex, hlinex, vlinex, colspanx, rowspanx #import "@preview/codelst:2.0.1": sourcecode // Display inline code in a small box // that retains the correct baseline. #set text(font:("Times New Roman","Source Han Serif SC")) #show raw.where(block: false): box.with( fill: luma(230), inset: (x: 3pt, y: 0pt), outset: (y: 3pt), radius: 2pt, ) #show raw: set text( font: ("consolas", "Source Han Serif SC") ) #set page( paper: "a4", ) #set text( font:("Times New Roman","Source Han Serif SC"), style:"normal", weight: "regular", size: 13pt, ) #let nxtIdx(name) = box[ #counter(name).step()#counter(name).display()] #set math.equation(numbering: "(1)") #show raw.where(block: true): block.with( fill: luma(240), inset: 10pt, radius: 4pt, ) #set math.equation(numbering: "(1)") #set page( paper:"a4", number-align: right, margin: (x:2.54cm,y:4cm), header: [ #set text( size: 25pt, font: "KaiTi", ) #align( bottom + center, [ #strong[暨南大学本科实验报告专用纸(附页)] ] ) #line(start: (0pt,-5pt),end:(453pt,-5pt)) ] ) /*----*/ = 基于R-BTree实现`set` \ #text( font:"KaiTi", size: 15pt )[ 课程名称#underline[#text(" 数据结构 ")]成绩评定#underline[#text(" ")]\ 实验项目名称#underline[#text(" ") 基于R-BTree实现`set` #text(" ")]指导老师#underline[#text(" 干晓聪 ")]\ 实验项目编号#underline[#text(" 10 ")]实验项目类型#underline[#text(" 设计性 ")]实验地点#underline[#text(" 数学系机房 ")]\ 学生姓名#underline[#text(" 郭彦培 ")]学号#underline[#text(" 2022101149 ")]\ 学院#underline[#text(" 信息科学技术学院 ")]系#underline[#text(" 数学系 ")]专业#underline[#text(" 信息管理与信息系统 ")]\ 实验时间#underline[#text(" 2024年6月13日上午 ")]#text("~")#underline[#text(" 2024年7月13日中午 ")]\ ] #set heading( numbering: "1.1." ) = 实验目的 基于已有的`RB_Tree`结构实现`set` = 实验环境 计算机:PC X64 操作系统:Windows + Ubuntu20.0LTS 编程语言:C++:GCC std20 IDE:Visual Studio Code = 程序原理 `set`要求元素不重合,因此选择直接使用红黑树维护,提供`insert`和`erase`操作。 由红黑树性质易得,插入复杂度$OO(log_2 n)$,删除复杂度$OO(log_2 n)$ #pagebreak() = 程序代码 == `mySet.h` #sourcecode[```cpp #ifndef PRVLIBCPP_SET_HPP #define PRVLIBCPP_SET_HPP #include <Dev\08\RB_Tree.h> namespace myDS { template<typename VALUE_TYPE> class set{ private: myDS::RBtree<VALUE_TYPE> dataST; public: set(){ } ~set(){ } void insert(VALUE_TYPE _d) {dataST.insert(_d);} bool erase(VALUE_TYPE _d) {return dataST.erase(_d);} bool find(VALUE_TYPE _d) {return dataST.find(_d);} auto begin() {return dataST.begin();} auto end() {return dataST.end();} }; } // namespace myDS #endif ```] == `_PRIV_TEST.cpp` #sourcecode[```cpp #include <iostream> #include <Dev\10\mySet.h> using namespace std; int main() { myDS::set<int> testST; while(1) { string s; cin >> s; if(s == "i") { int t; cin >> t; testST.insert(t); } else if(s == "p") { for(auto x:testST) cout << x << " "; cout << "\n"; } else if(s == "d") { int t; cin >> t; cout << testST.erase(t) << "\n"; } else if(s == "f") { int t; cin >> t; cout << testST.find(t) << "\n"; } } } ```] = 测试数据与运行结果 运行上述`_PRIV_TEST.cpp`测试代码中的正确性测试模块,得到以下内容: ``` i 1 i 2 i 3 i 6 i 5 p 1 2 3 5 6 i 6 i 5 p 1 2 3 5 6 d 3 1 d 4 0 p 1 2 5 6 f 2 1 f 3 0 f 4 0 ``` 可以看出,代码运行结果与预期相符,可以认为代码正确性无误。
https://github.com/konradroesler/edym-skript
https://raw.githubusercontent.com/konradroesler/edym-skript/main/utils.typ
typst
#let sspace = [ #h(100cm) ] #let bold(content) = { text(font: "CMU Serif Bold", weight: "bold")[#content] } #let italic(content) = { text(font: "CMU Serif Italic", weight: "regular")[#content] } #let bolditalic(content) = { text(size: 50pt, fill: red)[AHHH] } #let definition(number, name, content) = { box( width: 100%, height: auto, // 225, 225, 225 fill: rgb(225,225,225), radius: 10pt, inset: 0.5cm, [ #bold[Definition #number: #name] \ #v(5pt) #set text(size: 11pt) #box(inset: (top: -3mm), [#content $#sspace$]) #v(-1em) ] ) } // simple box used for theorems lemmata and corollaries #let stroked_box(content) = [ #box(width: 100%, height: auto, inset: 0.4cm, stroke: 1pt + rgb(100,100,100), radius: 5pt, content) ] #let theorem(number, content) = [ #stroked_box[ #bold[Satz #number:] #content // #sspace ] ] #let lemma(number, content) = [ #stroked_box[ #bold[Lemma #number:] #content // #sspace ] ] #let corollary(number, content) = [ #stroked_box[ #bold[Korollar #number:] #content // #sspace ] ] #let boxedlist(..content) = { box( width: 100%, inset: ( right: 0.5cm, left: 0.5cm, ), list( ..content ) ) } #let boxedenum(..content) = { box( width: 100%, inset: ( right: 0.5cm, left: 0.5cm, ), enum( ..content ) ) } #let corres = $op(hat(#h(1pt) = #h(1pt)))$ #let isomorph = $op(tilde(#h(1pt) = #h(1pt)))$ #let endproof = [ #set text(size: 0.75em) #align(right, $ballot$) ] #let italic(content) = [ #text(style: "italic", weight: "medium")[#content] ] #let startproof = italic[Beweis:] #let circ = $op(circle.small)$ #let oplus = $op(plus.circle)$ #let otimes = $op(times.circle)$ #let odot = $op(dot.circle)$ #let rg(content) = $"rg"(content)$ #let sect_delim = align(right, line(length: 5%, stroke: 0.5pt)) #let sgn = $"sgn"$ #let char = $"char"$ #let staudihaufen = $#h(8pt) #move(dy: -0.3em, scale(200%, $. #h(-1.414pt) dot #h(-1.414pt) .$)) #h(8pt)$ #let ip(arg1, arg2) = $angle.l arg1, arg2 angle.r$ #let norm(content) = $bar.double #h(-0em) content #h(-0em) bar.double$ #let ar(content) = $arrow(content)$ #let circs = $circle.filled.small$ #let hull(content) = $angle.l content angle.r_"aff"$ #let smar(content) = context { let content = box($content$) if measure(content).width > measure($->$).width [ $limits(content)^#[#context line(stroke: 0.048em, length: measure(content).width - measure($->$).width) #h(-0.055em) $->$]$ ] else [ $limits(content)^->$ ] }
https://github.com/Myriad-Dreamin/typst.ts
https://raw.githubusercontent.com/Myriad-Dreamin/typst.ts/main/fuzzers/corpora/layout/list-attach_04.typ
typst
Apache License 2.0
#import "/contrib/templates/std-tests/preset.typ": * #show: test-page // Test that wide lists cannot be ... #set block(spacing: 15pt) Hello - A - B World
https://github.com/pedrofp4444/BD
https://raw.githubusercontent.com/pedrofp4444/BD/main/report/content/[5] Implementação Física/criaçãoUtilizadores.typ
typst
#let criaçãoUtilizadores = { [ == Criação de utilizadores da base de dados Beneficiando agora dos requisitos de controlo recolhidos inicialmente, a equipa passou a desenvolver e definir toda a caracterização relativa aos utilizadores da base de dados em questão. Neste caso, os únicos utilizadores a serem criados no sistema seriam os representantes da _Lusium_ e os detetives do departamento de espionagem. Seguida da criação dos mesmos, são definidas as suas permissões de trabalho na base de dados, de forma a garantir a segurança e integridade da mesma. \ Na base de dados, o utilizador "detetive" foi criado com permissões limitadas ao controlo de casos e suspeitos adjacentes. Para tal, a este utilizador são atribuídas permissões de "SELECT", "INSERT" e "UPDATE" nas tabelas Caso e Suspeito e de, unicamente, "SELECT" na tabela Funcionário e na view FuncionariosEmCasos. Para além disso, também conta com permissões de execução do procedimento CriarCasosETornarSuspeitos e da função CalcularEstimativaDeRoubo. #align(center)[ #figure( kind: image, caption: [Criação de utilizadores "detetive" e devidas permissões.], block( fill: rgb("#f2f2eb"), inset: 8pt, ```sql CREATE USER 'detetive'@'localhost' IDENTIFIED BY 'detetive1234'; GRANT SELECT, INSERT, UPDATE ON Caso TO 'detetive'@'localhost'; GRANT SELECT, INSERT, UPDATE ON Suspeito TO 'detetive'@'localhost'; GRANT SELECT ON Funcionário TO 'detetive'@'localhost'; GRANT SELECT ON FuncionariosEmCasos TO 'detetive'@'localhost'; GRANT EXECUTE ON PROCEDURE CriarCasoETornarSuspeitos TO 'detetive'@'localhost'; GRANT EXECUTE ON FUNCTION CalcularEstimativaDeRoubo TO 'detetive'@'localhost'; ``` ) ) ] \ Foi também criado o utilizador "representante" com permissões limitadas ao controlo de funcionários e terrenos. Assim, o mesmo tem acesso às tabelas Gere, Função, Terreno, Trabalha, Funcionário e Número de telemóvel, onde está restrito às operações de "SELECT", "INSERT" e "UPDATE" nas mesmas. Adicionalmente, também dispõe da permissão de "SELECT" na vista FuncionariosEmTerrenos. #align(center)[ #figure( kind: image, caption: [Criação de utilizadores "representantes" e devidas permissões.], block( fill: rgb("#f2f2eb"), inset: 8pt, ```sql CREATE USER 'representante'@'localhost' IDENTIFIED BY 'representante1234'; GRANT SELECT, INSERT, UPDATE ON Gere TO 'representante'@'localhost'; GRANT SELECT, INSERT, UPDATE ON Função TO 'representante'@'localhost'; GRANT SELECT, INSERT, UPDATE ON Terreno TO 'representante'@'localhost'; GRANT SELECT, INSERT, UPDATE ON Trabalha TO 'representante'@'localhost'; GRANT SELECT, INSERT, UPDATE ON Funcionário TO 'representante'@'localhost'; GRANT SELECT, INSERT, UPDATE ON Número de telemóvel TO 'representante'@'localhost'; GRANT SELECT ON FuncionariosEmTerrenos TO 'representante'@'localhost'; ``` ) ) ] \ Desta forma, ficam definidos os utilizadores da base de dados, assim como as suas permissões. Os detetives apenas têm autorização para manipular os casos e os seus suspeitos, enquanto que os representantes têm permissões mais abrangentes que lhes permitem manipular todas as tabelas, com a exceção das tabelas caso e suspeito. ] }
https://github.com/SWATEngineering/Docs
https://raw.githubusercontent.com/SWATEngineering/Docs/main/src/2_RTB/VerbaliEsterni/VerbaleEsterno_240111/content.typ
typst
MIT License
#import "meta.typ": inizio_incontro, fine_incontro, luogo_incontro, company #import "functions.typ": glossary, team #let participants = csv("participants.csv") #let participants_company = csv("participants_company.csv") = Partecipanti / Inizio incontro: #inizio_incontro / Fine incontro: #fine_incontro / Luogo incontro: #luogo_incontro == Partecipanti di #team #table( columns: (3fr, 1fr), [*Nome*], [*Durata presenza*], ..participants.flatten() ) == Partecipanti di #emph[#company] #for member in participants_company.flatten() [ - #member ] = Sintesi Elaborazione Incontro /*************************************/ /* INSERIRE SOTTO IL CONTENUTO */ /*************************************/ == Analisi dei Requisiti === Superamento delle soglie L'incontro si è aperto con una breve discussione riguardo la dashboard contenente tabelle dedicate alla visualizzazione di dati anomali e di dati che hanno superato soglie preimpostate; in particolare, il team ha illustrato l'idea di fare in modo che le soglie siano variabili, ovvero impostabili e modificabili da parte dell'utente. Tale funzionalità potrebbe essere realizzata tramite le Grafana variables, che consentirebbero anche di condizionare le notifiche di allerta in base al valore corrente delle soglie. Tuttavia, avendo appreso che l'implementazione di tale funzionalità necessita di soluzioni che prevedono la modifica del file di configurazione Docker Compose per includere suddette variabili o simili (le variabili non sarebbero direttamente istanziabili all'interno di Grafana), il team ha deciso, su consiglio della Proponente, di mantenere le soglie fisse (ovvero impostate a priori e non modificabili da parte dell'utente). Inoltre, come canale di ricezione delle notifiche si è concordato di utilizzare Discord, dato che è più semplice da utilizzare rispetto a email, Slack o altro. === Dashboard contenente informazioni sul singolo sensore La discussione si è poi orientata verso la possibilità di implementare una dashboard dedicata alla visualizzazione dei dati pertinenti ad un singolo sensore, a cui si accederebbe cliccando sull'icona di un sensore specifico all'interno della mappa contenente la totalità dei sensori che l'utente visualizza inizialmente. La Proponente ha proposto l'idea di integrare una panoramica dello stato complessivo del sistema di monitoraggio della città all'interno della dashboard iniziale. Questa panoramica dovrebbe includere informazioni su eventuali superamenti di soglie, lo stato attuale dei sensori e i dati più recenti trasmessi da essi, preferibilmente organizzati in modo chiaro e intuitivo. == Progettazione dopo il PoC Infine, il team ha espresso l'intenzione di utilizzare "Pydantic" (libreria Python che semplifica la validazione e l'analisi dei dati, permettendo di definire in modo dichiarativo la struttura dei dati e di specificarne i vincoli di validazione) all'interno della componente del progetto software che verrà realizzata in Python; la Proponente ha sottolineato come, nonostante questa scelta rientri nelle best practices consigliate per migliorare la qualità del prodotto, il team non è vincolato a considerarla, specialmente se comporta un utilizzo di risorse che potrebbero altrimenti essere impiegate per implementare funzionalità aggiuntive. Tuttavia, considerando l'ottica in cui l'uso di Pydantic andrebbe a rafforzare e rendere più rigidi i controlli qualitativi sui dati generati dai sensori, la decisione di utilizzarlo rimane valida, a condizione che venga giustificata in modo appropriato. Per quanto riguarda il formato dei dati generati, sarebbe interessante focalizzarsi in particolare sulle coordinate geo-spaziali dei sensori e implementarle come un campo di tipo "GeoJSON" all'interno dei dati stessi, dato che ad oggi è il modo standard di gestire questa tipologia di informazioni. L'ultimo punto di discussione è stata la possibilità di introdurre un contesto comune per poter fare in modo che i dati generati dai sensori (che agirebbero in maniera asincrona, ognuno sul proprio thread) possano influenzarsi reciprocamente e si vengano a creare delle correlazioni tra tipologie di dati che emulino la realtà; La proponente ha suggerito l'adozione di un "burattinaio" centrale in grado di generare e monitorare dati di un certo tipo. Successivamente, il "burattinaio" potrebbe prendere la decisione di generare dati di un tipo potenzialmente correlato al primo in modo sensato, concretizzando così la correlazione. Tuttavia, è importante tenere a mente il fatto che i simulatori di dati non fanno formalmente parte del prodotto software finale e, di conseguenza, le risorse da dedicare alla loro realizzazione devono essere pianificate e valutate con attenzione. D'altra parte, nell'ottica di un progetto non esclusivamente didattico, l'implementazione di correlazioni realistiche potrebbe offrire un vantaggio in termini di presentazione. Ciò consentirebbe al cliente di visualizzare dati che si comportano in modo realistico, migliorando la comprensione delle funzionalità del prodotto finale.
https://github.com/ntjess/typst-tada
https://raw.githubusercontent.com/ntjess/typst-tada/main/README.md
markdown
The Unlicense
# Overview TaDa provides a set of simple but powerful operations on rows of data. A full manual is available online: <https://github.com/ntjess/typst-tada/blob/v0.1.0/docs/manual.pdf> Key features include: - **Arithmetic expressions**: Row-wise operations are as simple as string expressions with field names - **Aggregation**: Any function that operates on an array of values can perform row-wise or column-wise aggregation - **Data representation**: Handle displaying currencies, floats, integers, and more with ease and arbitrary customization Note: This library is in early development. The API is subject to change especially as typst adds more support for user-defined types. **Backwards compatibility is not guaranteed!** Handling of field info, value types, and more may change substantially with more user feedback. ## Importing TaDa can be imported as follows: ### From the official packages repository (recommended): ``` typst #import "@preview/tada:0.1.0" ``` ### From the source code (not recommended) **Option 1:** You can clone the package directly into your project directory: ``` bash # In your project directory git clone https://github.com/ntjess/typst-tada.git tada ``` Then import the functionality with ``` typst #import "./tada/lib.typ" ``` **Option 2:** If Python is available on your system, use `showman` to install TaDa in typst’s `local` directory: ``` bash # Anywhere on your system git clone https://github.com/ntjess/typst-tada.git cd typst-tada # Can be done in a virtual environment pip install "git+https://github.com/ntjess/showman.git" showman package ./typst.toml ``` Now, TaDa is available under the local namespace: ``` typst #import "@local/tada:0.1.0" ``` # Table adjustment ## Creation TaDa provides three main ways to construct tables – from columns, rows, or records. - **Columns** are a dictionary of field names to column values. Alternatively, a 2D array of columns can be passed to `from-columns`, where `values.at(0)` is a column (belongs to one field). - **Records** are a 1D array of dictionaries where each dictionary is a row. - **Rows** are a 2D array where `values.at(0)` is a row (has one value for each field). Note that if `rows` are given without field names, they default to (0, 1, ..$n$). ``` typst #let column-data = ( name: ("Bread", "Milk", "Eggs"), price: (1.25, 2.50, 1.50), quantity: (2, 1, 3), ) #let record-data = ( (name: "Bread", price: 1.25, quantity: 2), (name: "Milk", price: 2.50, quantity: 1), (name: "Eggs", price: 1.50, quantity: 3), ) #let row-data = ( ("Bread", 1.25, 2), ("Milk", 2.50, 1), ("Eggs", 1.50, 3), ) #import tada: TableData #let td = TableData(data: column-data) // Equivalent to: #let td2 = tada.from-records(record-data) // _Not_ equivalent to (since field names are unknown): #let td3 = tada.from-rows(row-data) #to-tablex(td) #to-tablex(td2) #to-tablex(td3) ``` ![Example 1](https://www.github.com/ntjess/typst-tada/raw/v0.1.0/assets/example-01.png) ## Title formatting You can pass any `content` as a field’s `title`. **Note**: if you pass a string, it will be evaluated as markup. ``` typst #let fmt(it) = { heading(outlined: false, upper(it.at(0)) + it.slice(1).replace("_", " ") ) } #let titles = ( // As a function name: (title: fmt), // As a string quantity: (title: fmt("Qty")), ) #let td = TableData(..td, field-info: titles) #to-tablex(td) ``` ![Example 2](https://www.github.com/ntjess/typst-tada/raw/v0.1.0/assets/example-02.png) ## Adapting default behavior You can specify defaults for any field not explicitly populated by passing information to `field-defaults`. Observe in the last example that `price` was not given a title. We can indicate it should be formatted the same as `name` by passing `title: fmt` to `field-defaults`. **Note** that any field that is explicitly given a value will not be affected by `field-defaults` (i.e., `quantity` will retain its string title “Qty”) ``` typst #let defaults = (title: fmt) #let td = TableData(..td, field-defaults: defaults) #to-tablex(td) ``` ![Example 3](https://www.github.com/ntjess/typst-tada/raw/v0.1.0/assets/example-03.png) ## Using `__index` TaDa will automatically add an `__index` field to each row that is hidden by default. If you want it displayed, update its information to set `hide: false`: ``` typst // Use the helper function `update-fields` to update multiple fields // and/or attributes #import tada: update-fields #let td = update-fields( td, __index: (hide: false, title: "\#") ) // You can also insert attributes directly: // #td.field-info.__index.insert("hide", false) // etc. #to-tablex(td) ``` ![Example 4](https://www.github.com/ntjess/typst-tada/raw/v0.1.0/assets/example-04.png) ## Value formatting ### `type` Type information can have attached metadata that specifies alignment, display formats, and more. Available types and their metadata are: - **string** : (default-value: "", align: left) - **content** : (display: , align: left) - **float** : (align: right) - **integer** : (align: right) - **percent** : (display: , align: right) - **index** : (align: right) While adding your own default types is not yet supported, you can simply defined a dictionary of specifications and pass its keys to the field ``` typst #let currency-info = ( display: tada.display.format-usd, align: right ) #td.field-info.insert("price", (type: "currency")) #let td = TableData(..td, type-info: ("currency": currency-info)) #to-tablex(td) ``` ![Example 5](https://www.github.com/ntjess/typst-tada/raw/v0.1.0/assets/example-05.png) ## Transposing `transpose` is supported, but keep in mind if columns have different types, an error will be a frequent result. To avoid the error, explicitly pass `ignore-types: true`. You can choose whether to keep field names as an additional column by passing a string to `fields-name` that is evaluated as markup: ``` typst #to-tablex( tada.transpose( td, ignore-types: true, fields-name: "" ) ) ``` ![Example 6](https://www.github.com/ntjess/typst-tada/raw/v0.1.0/assets/example-06.png) ### `display` If your type is not available or you want to customize its display, pass a `display` function that formats the value, or a string that accesses `value` in its scope: ``` typst #td.field-info.at("quantity").insert( "display", val => ("/", "One", "Two", "Three").at(val), ) #let td = TableData(..td) #to-tablex(td) ``` ![Example 7](https://www.github.com/ntjess/typst-tada/raw/v0.1.0/assets/example-07.png) ### `align` etc. You can pass `align` and `width` to a given field’s metadata to determine how content aligns in the cell and how much horizontal space it takes up. In the future, more `tablex` setup arguments will be accepted. ``` typst #let adjusted = update-fields( td, name: (align: center, width: 1.4in) ) #to-tablex(adjusted) ``` ![Example 8](https://www.github.com/ntjess/typst-tada/raw/v0.1.0/assets/example-08.png) ## Deeper `tablex` customization TaDa uses `tablex` to display the table. So any argument that `tablex` accepts can be passed to TableData as well: ``` typst #let mapper = (index, row) => { let fill = if index == 0 {rgb("#8888")} else {none} row.map(cell => (..cell, fill: fill)) } #let td = TableData( ..td, tablex-kwargs: ( map-rows: mapper, auto-vlines: false ), ) #to-tablex(td) ``` ![Example 9](https://www.github.com/ntjess/typst-tada/raw/v0.1.0/assets/example-09.png) ## Subselection You can select a subset of fields or rows to display: ``` typst #import tada: subset #to-tablex( subset(td, indexes: (0,2), fields: ("name", "price")) ) ``` ![Example 10](https://www.github.com/ntjess/typst-tada/raw/v0.1.0/assets/example-10.png) Note that `indexes` is based on the table’s `__index` column, *not* it’s positional index within the table: ``` typst #let td2 = td #td2.data.insert("__index", (1, 2, 2)) #to-tablex( subset(td2, indexes: 2, fields: ("__index", "name")) ) ``` ![Example 11](https://www.github.com/ntjess/typst-tada/raw/v0.1.0/assets/example-11.png) Rows can also be selected by whether they fulfill a field condition: ``` typst #to-tablex( tada.filter(td, expression: "price < 1.5") ) ``` ![Example 12](https://www.github.com/ntjess/typst-tada/raw/v0.1.0/assets/example-12.png) ## Concatenation Concatenating rows and columns are both supported operations, but only in the simple sense of stacking the data. Currently, there is no ability to join on a field or otherwise intelligently merge data. - `axis: 0` places new rows below current rows - `axis: 1` places new columns to the right of current columns - Unless you specify a fill value for missing values, the function will panic if the tables do not match exactly along their concatenation axis. - You cannot stack with `axis: 1` unless every column has a unique field name. ``` typst #import tada: stack #let td2 = TableData( data: ( name: ("Cheese", "Butter"), price: (2.50, 1.75), ) ) #let td3 = TableData( data: ( rating: (4.5, 3.5, 5.0, 4.0, 2.5), ) ) // This would fail without specifying the fill // since `quantity` is missing from `td2` #let stack-a = stack(td, td2, missing-fill: 0) #let stack-b = stack(stack-a, td3, axis: 1) #to-tablex(stack-b) ``` ![Example 13](https://www.github.com/ntjess/typst-tada/raw/v0.1.0/assets/example-13.png) # Operations ## Expressions The easiest way to leverage TaDa’s flexibility is through expressions. They can be strings that treat field names as variables, or functions that take keyword-only arguments. - **Note**! When passing functions, every field is passed as a named argument to the function. So, make sure to capture unused fields with `..rest` (the name is unimportant) to avoid errors. ``` typst #let make-dict(field, expression) = { let out = (:) out.insert( field, (expression: expression, type: "currency"), ) out } #let td = update-fields( td, ..make-dict("total", "price * quantity" ) ) #let tax-expr(total: none, ..rest) = { total * 0.2 } #let taxed = update-fields( td, ..make-dict("tax", tax-expr), ) #to-tablex( subset(taxed, fields: ("name", "total", "tax")) ) ``` ![Example 14](https://www.github.com/ntjess/typst-tada/raw/v0.1.0/assets/example-14.png) ## Chaining It is inconvenient to require several temporary variables as above, or deep function nesting, to perform multiple operations on a table. TaDa provides a `chain` function to make this easier. Furthermore, when you need to compute several fields at once and don’t need extra field information, you can use `add-expressions` as a shorthand: ``` typst #import tada: chain, add-expressions #let totals = chain(td, add-expressions.with( total: "price * quantity", tax: "total * 0.2", after-tax: "total + tax", ), subset.with( fields: ("name", "total", "after-tax") ), // Add type information update-fields.with( after-tax: (type: "currency", title: fmt("w/ Tax")), ), ) #to-tablex(totals) ``` ![Example 15](https://www.github.com/ntjess/typst-tada/raw/v0.1.0/assets/example-15.png) ## Sorting You can sort by ascending/descending values of any field, or provide your own transformation function to the `key` argument to customize behavior further: ``` typst #import tada: sort-values #to-tablex(sort-values( td, by: "quantity", descending: true )) ``` ![Example 16](https://www.github.com/ntjess/typst-tada/raw/v0.1.0/assets/example-16.png) ## Aggregation Column-wise reduction is supported through `agg`, using either functions or string expressions: ``` typst #import tada: agg, item #let grand-total = chain( totals, agg.with(after-tax: array.sum), // use "item" to extract exactly one element item ) // "Output" is a helper function just for these docs. // It is not necessary in your code. #output[ *Grand total: #tada.display.format-usd(grand-total)* ] ``` ![Example 17](https://www.github.com/ntjess/typst-tada/raw/v0.1.0/assets/example-17.png) It is also easy to aggregate several expressions at once: ``` typst #let agg-exprs = ( "# items": "quantity.sum()", "Longest name": "[#name.sorted(key: str.len).at(-1)]", ) #let agg-td = tada.agg(td, ..agg-exprs) #to-tablex(agg-td) ``` ![Example 18](https://www.github.com/ntjess/typst-tada/raw/v0.1.0/assets/example-18.png)
https://github.com/gongke6642/tuling
https://raw.githubusercontent.com/gongke6642/tuling/main/内省/柜台/柜台.typ
typst
#image("image.png") #image("image2.png") #image("image3.png") #image("image4.png") #image("image5.png") #image("image6.png") #image("image7.png") #image("image8.png") #image("image9.png") #image("image10.png")
https://github.com/alperari/cyber-physical-systems
https://raw.githubusercontent.com/alperari/cyber-physical-systems/main/week8/solution.typ
typst
#import "@preview/diagraph:0.1.2": * #set text( size: 15pt, ) #set page( paper: "a4", margin: (x: 1.8cm, y: 1.5cm), ) #align(center, text(21pt)[ *Cyber Physical Systems - Discrete Models \ Exercise Sheet 8 Solution* ]) #grid( columns: (1fr, 1fr), align(center)[ <NAME> \ <EMAIL> ], align(center)[ <NAME> \ <EMAIL> ] ) #align(center)[ December 10, 2023 ] = Exercise 1: Prefixes and Closure I == Part A #label("part-a") $ P subset.eq "cl"(P) $ === Solution Let $omega in P$, then $"pref"(omega) subset.eq "pref"(P)$ trivially. Since $"pref"(omega) subset.eq "pref"(P)$ is the predicate for closure, then we can conclude $forall omega in P -> omega in "cl"(P)$, thefore $P subset.eq "cl"(P)$. == Part B $ "pref"("cl"(P)) = "pref"(P) $ === Solution If we prove both $"pref"("cl"(P)) subset.eq "pref"(P)$ and $"pref"(P) subset.eq "pref"("cl"(P))$, then we can conclude $"pref"("cl"(P)) = "pref"(P)$. ==== Direction 1: $"pref"("cl"(P)) subset.eq "pref"(P)$ Let $omega in "pref"("cl"(P))$, then $exists sigma in "cl"(P) -> omega in "pref"(sigma)$. By the definition of closure, $forall sigma in "cl"(P) -> "pref"(sigma) subset.eq "pref"(P)$. Hence, $w in "pref"(P)$. Which concludes that $forall omega in "pref"("cl"(P)) -> omega in "pref"(P)$. ==== Direction 2: $"pref"(P) subset.eq "pref"("cl"(P))$ Let $omega in "pref"(P)$, then $exists sigma in P -> omega in "pref"(sigma)$. By proof in #link(label("part-a"))[part a], we can claim $forall sigma in P -> sigma in "cl"(P)$. Therefore, $omega in "pref"(P) -> omega in "pref"("cl"(P))$. #pagebreak() = Exercise 2: Prefixes and Closure II == Part A $ & P_1 = {A_0 A_1 ... | exists S subset.eq N dot (|S| = 1 and forall i in S a in A_i)} \ & P_2 = {A_0 A_1 ... | forall i dot (a in A_i -> b in A_(i + 1))} \ & P_3 = {A_0 A_1 ... | exists i dot (forall j dot (j >= i -> a in.not A_j))} \ & P_4 = {A_0 A_1 ... | a in A_0 and limits(exists)^infinity i dot a in A_i} \ $ == Part B $ & "pref"(P_1) = {A_0 A_1 ... A_k | exists S subset.eq N dot (|S| <= 1 and forall i in S a in A_i)} \ & "pref"(P_2) = {A_0 A_1 ... A_k | forall i dot (i < k and a in A_i -> b in A_(i + 1))} \ & "pref"(P_3) = {A_0 A_1 ... A_k | "true"} \ & "pref"(P_4) = {A_0 A_1 ... A_k | a in A_0} \ $ == Part C $ & "cl"(P_1) = {A_0 A_1 ... | exists S subset.eq N dot (|S| <= 1 and forall i in S a in A_i)} \ & "cl"(P_2) = {A_0 A_1 ... | forall i dot (a in A_i -> b in A_(i + 1))} \ & "cl"(P_3) = {A_0 A_1 ... | "true" } \ & "cl"(P_4) = {A_0 A_1 ... | a in A_0} \ $ #pagebreak() = Exercise 3: Safety & Liveness Properties == Part A === $P_1$ - Is an invariant. - Invariation condition: $a in.not S$. === $P_2$ - Not an invariant. - Example trace: $(w = {a}^omega) in.not P_2$. However, $forall sigma in w dot sigma = {a}$, and we can give trace ${a}{b}^omega in P_2$ as a counter example. === $P_3$ - Is an invariant. - Invariant condition: $a in S -> b in S$. === $P_4$ - Not an invariant. - Example trace: $(w = {b}^omega) in.not P_4$. However, $forall sigma in w dot sigma = {b}$, and we can give trace ${b}{a}^omega in P_2$ as a counterexample. == Part B === $P_1$ - Is a safety property. - Set of bad prefixes: $"BadPref" = {A_0 A_1 ... A_n | exists i in {0, ..., n} dot a in A_i}$. === $P_2$ - Not a safety property. - Example trace: $(sigma = {a}^omega) in (2^"AP")^omega without P_2$. But $forall w in "pref"(sigma)$, we can always extend it with $sigma{b}^w in P_2$ so no $sigma$ can be a bad prefix. === $P_3$ - Is a safety property. - Set of bad prefixes: $"BadPref" = {A_0 A_1 ... A_n | exists i in {0, ..., n} dot b in A_i and a in.not A_i}$. === $P_4$ - Is a safety property. - Set of bad prefixes: $"BadPref" = {A_0 A_1 ... A_n | exists S subset.eq {0, ..., n} dot |S| > 1 and (forall i in S dot b in S_i)}$ == Part C === $P_1$ - Is not a liveness property. - Example bad prefix: ${a}$. $forall w in (2^"AP")^omega dot ({a}w) in.not P_1$. === $P_2$ - Is a liveness property. - We can extend any finite trace with ${b}^omega$. $forall w in (2^"AP")^* dot w{b}^omega in P_2$. === $P_3$ - Is not a liveness property. - Example bad prefix: ${b}$. $forall w in (2^"AP")^omega dot ({b}w) in.not P_3$. === $P_4$ - Is not a liveness property. - Example bad prefix: ${b}{b}$. $forall w in (2^"AP")^omega dot ({b}{b}w) in.not P_4$.
https://github.com/matzemathics/typst-template
https://raw.githubusercontent.com/matzemathics/typst-template/main/src/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! #let project(title: "", authors: (), body) = { // Set the document's basic properties. set document(author: authors.map(a => a.name), title: title) set page(numbering: "1", number-align: center) // Save heading and body font families in variables. let body-font = "New Computer Modern" let sans-font = "New Computer Modern Sans" // Set body font family. set text(font: body-font, lang: "en") show math.equation: set text(weight: 400) show heading: set text(font: sans-font) set heading(numbering: "1.1") // Set run-in subheadings, starting at level 3. show heading: it => { if it.level > 2 { parbreak() text(11pt, style: "italic", weight: "regular", it.body + ".") } else { it } } // Title row. align(center)[ #block(text(font: sans-font, weight: 700, 1.75em, title)) ] // Author information. pad( top: 0.5em, bottom: 0.5em, x: 2em, grid( columns: (1fr,) * calc.min(3, authors.len()), gutter: 1em, ..authors.map(author => align(center)[ *#author.name* \ #author.email ]), ), ) // Main body. set par(justify: true) body }
https://github.com/MattiaOldani/Informatica-Teorica
https://raw.githubusercontent.com/MattiaOldani/Informatica-Teorica/master/capitoli/template.typ
typst
// Setup #import "@preview/ouset:0.1.1": overset #import "@preview/algo:0.3.3": code, i, d #import "@preview/lemmify:0.1.5": * #let (theorem, lemma, corollary, remark, proposition, example, proof, rules: thm-rules) = default-theorems( "thm-group", lang: "it", ) #show: thm-rules #show thm-selector("thm-group", subgroup: "theorem"): it => block( it, stroke: red + 1pt, inset: 1em, breakable: true, ) #show thm-selector("thm-group", subgroup: "corollary"): it => block( it, stroke: red + 1pt, inset: 1em, breakable: true, ) #show thm-selector("thm-group", subgroup: "proof"): it => block( it, stroke: green + 1pt, inset: 1em, breakable: true, ) #import "../alias.typ": * // Appunti /*********************************************/ /***** DA CANCELLARE PRIMA DI COMMITTARE *****/ /*********************************************/ #set heading(numbering: "1.") #show outline.entry.where(level: 1): it => { v(12pt, weak: true) strong(it) } #outline(indent: auto) /*********************************************/ /***** DA CANCELLARE PRIMA DI COMMITTARE *****/ /*********************************************/ = Lezione NN
https://github.com/jamesrswift/blog
https://raw.githubusercontent.com/jamesrswift/blog/main/assets/packages/booktabs/impl.typ
typst
MIT License
#import "footnotes.typ" #import "style.typ": * #let make( header: none, footer: none, notes: footnotes.display, data: none, keys: none, columnwise-transform: (none,), ..args ) = { set text(size: 9pt) set math.equation(numbering: none) show table.cell.where(y:0): set text(weight: "bold") if header != none footnotes.clear() + table( stroke: none, ..args.named(), table.hline(stroke: toprule), ..(if (header != none){ ( table.header(..header), table.hline(stroke: midrule) ) }), ..(if (data != none and keys != none){ for entry in data { for key in keys{ (entry.at(key, default: none),) } } } else { args.pos() }), ..(if footer != none {( table.hline(stroke: midrule), table.footer(..footer), ) }), table.hline(stroke: bottomrule) ) + if (notes != none) {footnotes.display-style(notes)} } // #let lr-measure(..cell-contents-varg, separator: ".") = { // let measures = cell-contents-varg.pos().fold( (), (acc, input)=>{ // let split = input.text.split(separator) // return acc + (( // l: measure(text(split.at(0, default: ""))).width, // r: measure(text(split.at(1, default: ""))).width, // ),) // }) // let bounds = measures.fold((l: 0pt, r: 0pt), (acc, it)=>{ // ( // l: calc.max(acc.l, it.l), // r: calc.max(acc.r, it.r) // ) // }) // cell-contents-varg.pos().enumerate().map( ((key, value)) => { // pad( // left: bounds.l - measures.at(key, default: (l: 0pt)).l, // right: bounds.r - measures.at(key, default: (r: 0pt)).r, // value // ) // }) // }
https://github.com/TypstApp-team/typst
https://raw.githubusercontent.com/TypstApp-team/typst/master/tests/typ/compiler/bench.typ
typst
Apache License 2.0
// Ref: false // Configuration with `page` and `font` functions. #set page(width: 450pt, margin: 1cm) // There are variables and they can take normal values like strings, ... #let city = "Berlin" // ... but also "content" values. While these contain markup, // they are also values and can be summed, stored in arrays etc. // There are also more standard control flow structures, like #if and #for. #let university = [*Technische Universität #city*] #let faculty = [*Fakultät II, Institut for Mathematik*] // The `box` function just places content into a rectangular container. When // the only argument to a function is a content block, the parentheses can be // omitted (i.e. `f[a]` is the same as `f([a])`). #box[ // Backslash adds a forced line break. #university \ #faculty \ Sekretariat MA \ Dr. <NAME> \ <NAME>, <NAME> ] #align(right, box[*WiSe 2019/2020* \ Woche 3]) // Adds vertical spacing. #v(6mm) // If the last argument to a function is a content block, we can also place it // behind the parentheses. #align(center)[ // Markdown-like syntax for headings. ==== 3. Übungsblatt Computerorientierte Mathematik II #v(4mm) *Abgabe: 03.05.2019* (bis 10:10 Uhr in MA 001) #v(4mm) *Alle Antworten sind zu beweisen.* ] *1. Aufgabe* #align(right)[(1 + 1 + 2 Punkte)] Ein _Binärbaum_ ist ein Wurzelbaum, in dem jeder Knoten ≤ 2 Kinder hat. Die Tiefe eines Knotens _v_ ist die Länge des eindeutigen Weges von der Wurzel zu _v_, und die Höhe von _v_ ist die Länge eines längsten (absteigenden) Weges von _v_ zu einem Blatt. Die Höhe des Baumes ist die Höhe der Wurzel. #v(6mm)
https://github.com/justmejulian/typst-documentation-template
https://raw.githubusercontent.com/justmejulian/typst-documentation-template/main/sections/summary.typ
typst
= Summary #rect( width: 100%, radius: 10%, stroke: 0.5pt, fill: yellow, )[ Note: This chapter includes the status of your thesis, a conclusion and an outlook about future work. ] == Status #rect( width: 100%, radius: 10%, stroke: 0.5pt, fill: yellow, )[ Note: Describe honestly the achieved goals (e.g. the well implemented and tested use cases) and the open goals here. if you only have achieved goals, you did something wrong in your analysis. ] === Realized Goals #rect( width: 100%, radius: 10%, stroke: 0.5pt, fill: yellow, )[ Note: Summarize the achieved goals by repeating the realized requirements or use cases stating how you realized them. ] === Open Goals #rect( width: 100%, radius: 10%, stroke: 0.5pt, fill: yellow, )[ Note: Summarize the open goals by repeating the open requirements or use cases and explaining why you were not able to achieve them. Important: It might be suspicious, if you do not have open goals. This usually indicates that you did not thoroughly analyze your problems. ] == Conclusion #rect( width: 100%, radius: 10%, stroke: 0.5pt, fill: yellow, )[ Note: Recap shortly which problem you solved in your thesis and discuss your *contributions* here. ] == Future Work #rect( width: 100%, radius: 10%, stroke: 0.5pt, fill: yellow, )[ Note: Tell us the next steps (that you would do if you have more time). Be creative, visionary and open-minded here. ]
https://github.com/typst/packages
https://raw.githubusercontent.com/typst/packages/main/packages/preview/unichar/0.1.0/ucd/block-0250.typ
typst
Apache License 2.0
#let data = ( ("LATIN SMALL LETTER TURNED A", "Ll", 0), ("LATIN SMALL LETTER ALPHA", "Ll", 0), ("LATIN SMALL LETTER TURNED ALPHA", "Ll", 0), ("LATIN SMALL LETTER B WITH HOOK", "Ll", 0), ("LATIN SMALL LETTER OPEN O", "Ll", 0), ("LATIN SMALL LETTER C WITH CURL", "Ll", 0), ("LATIN SMALL LETTER D WITH TAIL", "Ll", 0), ("LATIN SMALL LETTER D WITH HOOK", "Ll", 0), ("LATIN SMALL LETTER REVERSED E", "Ll", 0), ("LATIN SMALL LETTER SCHWA", "Ll", 0), ("LATIN SMALL LETTER SCHWA WITH HOOK", "Ll", 0), ("LATIN SMALL LETTER OPEN E", "Ll", 0), ("LATIN SMALL LETTER REVERSED OPEN E", "Ll", 0), ("LATIN SMALL LETTER REVERSED OPEN E WITH HOOK", "Ll", 0), ("LATIN SMALL LETTER CLOSED REVERSED OPEN E", "Ll", 0), ("LATIN SMALL LETTER DOTLESS J WITH STROKE", "Ll", 0), ("LATIN SMALL LETTER G WITH HOOK", "Ll", 0), ("LATIN SMALL LETTER SCRIPT G", "Ll", 0), ("LATIN LETTER SMALL CAPITAL G", "Ll", 0), ("LATIN SMALL LETTER GAMMA", "Ll", 0), ("LATIN SMALL LETTER RAMS HORN", "Ll", 0), ("LATIN SMALL LETTER TURNED H", "Ll", 0), ("LATIN SMALL LETTER H WITH HOOK", "Ll", 0), ("LATIN SMALL LETTER HENG WITH HOOK", "Ll", 0), ("LATIN SMALL LETTER I WITH STROKE", "Ll", 0), ("LATIN SMALL LETTER IOTA", "Ll", 0), ("LATIN LETTER SMALL CAPITAL I", "Ll", 0), ("LATIN SMALL LETTER L WITH MIDDLE TILDE", "Ll", 0), ("LATIN SMALL LETTER L WITH BELT", "Ll", 0), ("LATIN SMALL LETTER L WITH RETROFLEX HOOK", "Ll", 0), ("LATIN SMALL LETTER LEZH", "Ll", 0), ("LATIN SMALL LETTER TURNED M", "Ll", 0), ("LATIN SMALL LETTER TURNED M WITH LONG LEG", "Ll", 0), ("LATIN SMALL LETTER M WITH HOOK", "Ll", 0), ("LATIN SMALL LETTER N WITH LEFT HOOK", "Ll", 0), ("LATIN SMALL LETTER N WITH RETROFLEX HOOK", "Ll", 0), ("LATIN LETTER SMALL CAPITAL N", "Ll", 0), ("LATIN SMALL LETTER BARRED O", "Ll", 0), ("LATIN LETTER SMALL CAPITAL OE", "Ll", 0), ("LATIN SMALL LETTER CLOSED OMEGA", "Ll", 0), ("LATIN SMALL LETTER PHI", "Ll", 0), ("LATIN SMALL LETTER TURNED R", "Ll", 0), ("LATIN SMALL LETTER TURNED R WITH LONG LEG", "Ll", 0), ("LATIN SMALL LETTER TURNED R WITH HOOK", "Ll", 0), ("LATIN SMALL LETTER R WITH LONG LEG", "Ll", 0), ("LATIN SMALL LETTER R WITH TAIL", "Ll", 0), ("LATIN SMALL LETTER R WITH FISHHOOK", "Ll", 0), ("LATIN SMALL LETTER REVERSED R WITH FISHHOOK", "Ll", 0), ("LATIN LETTER SMALL CAPITAL R", "Ll", 0), ("LATIN LETTER SMALL CAPITAL INVERTED R", "Ll", 0), ("LATIN SMALL LETTER S WITH HOOK", "Ll", 0), ("LATIN SMALL LETTER ESH", "Ll", 0), ("LATIN SMALL LETTER DOTLESS J WITH STROKE AND HOOK", "Ll", 0), ("LATIN SMALL LETTER SQUAT REVERSED ESH", "Ll", 0), ("LATIN SMALL LETTER ESH WITH CURL", "Ll", 0), ("LATIN SMALL LETTER TURNED T", "Ll", 0), ("LATIN SMALL LETTER T WITH RETROFLEX HOOK", "Ll", 0), ("LATIN SMALL LETTER U BAR", "Ll", 0), ("LATIN SMALL LETTER UPSILON", "Ll", 0), ("LATIN SMALL LETTER V WITH HOOK", "Ll", 0), ("LATIN SMALL LETTER TURNED V", "Ll", 0), ("LATIN SMALL LETTER TURNED W", "Ll", 0), ("LATIN SMALL LETTER TURNED Y", "Ll", 0), ("LATIN LETTER SMALL CAPITAL Y", "Ll", 0), ("LATIN SMALL LETTER Z WITH RETROFLEX HOOK", "Ll", 0), ("LATIN SMALL LETTER Z WITH CURL", "Ll", 0), ("LATIN SMALL LETTER EZH", "Ll", 0), ("LATIN SMALL LETTER EZH WITH CURL", "Ll", 0), ("LATIN LETTER GLOTTAL STOP", "Lo", 0), ("LATIN LETTER PHARYNGEAL VOICED FRICATIVE", "Ll", 0), ("LATIN LETTER INVERTED GLOTTAL STOP", "Ll", 0), ("LATIN LETTER STRETCHED C", "Ll", 0), ("LATIN LETTER BILABIAL CLICK", "Ll", 0), ("LATIN LETTER SMALL CAPITAL B", "Ll", 0), ("LATIN SMALL LETTER CLOSED OPEN E", "Ll", 0), ("LATIN LETTER SMALL CAPITAL G WITH HOOK", "Ll", 0), ("LATIN LETTER SMALL CAPITAL H", "Ll", 0), ("LATIN SMALL LETTER J WITH CROSSED-TAIL", "Ll", 0), ("LATIN SMALL LETTER TURNED K", "Ll", 0), ("LATIN LETTER SMALL CAPITAL L", "Ll", 0), ("LATIN SMALL LETTER Q WITH HOOK", "Ll", 0), ("LATIN LETTER GLOTTAL STOP WITH STROKE", "Ll", 0), ("LATIN LETTER REVERSED GLOTTAL STOP WITH STROKE", "Ll", 0), ("LATIN SMALL LETTER DZ DIGRAPH", "Ll", 0), ("LATIN SMALL LETTER DEZH DIGRAPH", "Ll", 0), ("LATIN SMALL LETTER DZ DIGRAPH WITH CURL", "Ll", 0), ("LATIN SMALL LETTER TS DIGRAPH", "Ll", 0), ("LATIN SMALL LETTER TESH DIGRAPH", "Ll", 0), ("LATIN SMALL LETTER TC DIGRAPH WITH CURL", "Ll", 0), ("LATIN SMALL LETTER FENG DIGRAPH", "Ll", 0), ("LATIN SMALL LETTER LS DIGRAPH", "Ll", 0), ("LATIN SMALL LETTER LZ DIGRAPH", "Ll", 0), ("LATIN LETTER BILABIAL PERCUSSIVE", "Ll", 0), ("LATIN LETTER BIDENTAL PERCUSSIVE", "Ll", 0), ("LATIN SMALL LETTER TURNED H WITH FISHHOOK", "Ll", 0), ("LATIN SMALL LETTER TURNED H WITH FISHHOOK AND TAIL", "Ll", 0), )
https://github.com/wychwitch/typst-mla9-template
https://raw.githubusercontent.com/wychwitch/typst-mla9-template/main/README.md
markdown
MIT License
# typst-mla9-template A typst template for use in MLA formats. Pull requests and issues VERY welcome!!! In order to use, simply clone this repo, copy the Example.typ (or the Template.typ if you don't need the examples to guide you) and fill it out!
https://github.com/Enter-tainer/typstyle
https://raw.githubusercontent.com/Enter-tainer/typstyle/master/tests/assets/unit/grid/large-cell.typ
typst
Apache License 2.0
#figure( grid( columns: (auto, auto), rows: (auto, auto), gutter: 0em, [ #read("large-cell.typ", encoding: "utf8") ], [ #read("large-cell.typ", encoding: "utf8") ], ), caption: [], ) #table( columns: 3, [Substance], [Subcritical °C], [Supercritical °C], [#read("large-cell.typ", encoding: "utf8")], [12.0], [92.1], [Sodium Myreth Sulfate], [16.6], [104], [#read("large-cell.typ", encoding: "utf8"), #read("large-cell.typ", encoding: "utf8")], [24.7], [114.514] )
https://github.com/Myriad-Dreamin/tinymist
https://raw.githubusercontent.com/Myriad-Dreamin/tinymist/main/contrib/typst-preview/editors/vscode/README.md
markdown
Apache License 2.0
# [DEPRECATION NOTICE] Typst preivew extension has been integrated into [tinymist](https://github.com/Myriad-Dreamin/tinymist) We recommend all users migrate to tinymist for the following benefits: - More centralized resource management - Reduced redundancy and lower resource usage - Easier updates and maintenance This repository will no longer be updated in future. All development will move to tinymist. Thank you for your support and understanding! - We still maintain the typst-preview extension for a while in a best effort way. - The lazy people can continue using their setting, as all old things are still working. - This respect people who love minimal env, like a treesitter plugin plus preview. - Tinymist will ensure compatibility to typst-preview as much as possible. - for vscode users: uninstall the preview extension and install the tinymist extension. - for standalone cli users: `typst-preview -> tinymist preview` # [Typst Preview VSCode](https://github.com/Enter-tainer/typst-preview) Preview your Typst files in vscode instantly! ## Features - Low latency preview: preview your document instantly on type. The incremental rendering technique makes the preview latency as low as possible. - Open in browser: open the preview in browser, so you put it in another monitor. https://github.com/typst/typst/issues/1344 - Cross jump between code and preview: We implement SyncTeX-like feature for typst-preview. You can now click on the preview panel to jump to the corresponding code location, and vice versa. Install this extension from [marketplace](https://marketplace.visualstudio.com/items?itemName=mgt19937.typst-preview), open command palette (Ctrl+Shift+P), and type `>Typst Preview:`. You can also use the shortcut (Ctrl+K V). ![demo](demo.png) For more information, please visit documentation at [Typst Preview Book](https://enter-tainer.github.io/typst-preview/). ## Extension Settings See https://enter-tainer.github.io/typst-preview/config.html ## Bug report To achieve high performance instant preview, we use a **different rendering backend** from official typst. We are making our best effort to keep the rendering result consistent with official typst. We have set up comprehensive tests to ensure the consistency of the rendering result. But we cannot guarantee that the rendering result is the same in all cases. There can be unknown corner cases that we haven't covered. **Therefore, if you encounter any rendering issue, please report it to this repo other than official typst repo.** ## Known Issues See [issues](https://github.com/Enter-tainer/typst-preview/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc) on GitHub. ## Legal This project is not affiliated with, created by, or endorsed by Typst the brand. ## Change Log See [CHANGELOG.md](CHANGELOG.md)
https://github.com/storopoli/Bayesian-Statistics
https://raw.githubusercontent.com/storopoli/Bayesian-Statistics/main/slides/02-statistical_distributions.typ
typst
Creative Commons Attribution Share Alike 4.0 International
#import "@preview/polylux:0.3.1": * #import themes.clean: * #import "utils.typ": * #import "@preview/cetz:0.1.2": * #import "@preview/plotst:0.2.0": plot as pplot, axis, bar_chart, graph_plot, overlay #new-section-slide("Statistical Distributions") #slide(title: "Recommended References")[ - #cite(<grimmettProbabilityRandomProcesses2020>, form: "prose"): - Chapter 3: Discrete random variables - Chapter 4: Continuous random variables - #cite(<dekkingModernIntroductionProbability2010>, form: "prose"): - Chapter 4: Discrete random variables - Chapter 5: Continuous random variables - #cite(<betancourtProbabilisticBuildingBlocks2019>, form: "prose") ] #focus-slide(background: julia-purple)[ #align(center)[#image("images/memes/statistical_distributions.jpg")] ] #slide(title: [Probability Distributions])[ Bayesian statistics uses probability distributions as the inference engine of the parameter and uncertainty estimates. #v(2em) Imagine that probability distributions are small "Lego" pieces. We can construct anything we want with these little pieces. We can make a castle, a house, a city; literally anything. The same is valid for Bayesian statistical models. We can construct models from the simplest ones to the most complex using probability distributions and their relationships. ] #slide(title: [Probability Distribution Function])[ A probability distribution function is a mathematical function that outputs the probabilities for different results of an experiment. It is a mathematical description of a random phenomena in terms of its sample space and the event probabilities (subsets of the sample space). $ P(X): X → RR ∈ [0, 1] $ For discrete random variables, we define as "mass", and for continuous random variables, we define as "density". ] #slide(title: [Mathematical Notation])[ We use the notation $ X tilde "Dist"(θ_1, θ_2, dots) $ where: - $X$: random variable - Dist: distribution name - $θ_1, θ_2, dots$: parameters that define how the distribution behaves Every probability distribution can be "parameterized" by specifying parameters that allow to control certain distribution aspects for a specific goal. ] #slide(title: [Probability Distribution Function])[ #align(center)[ #canvas( length: 0.9cm, { plot.plot( size: (16, 9), x-label: $X$, y-label: "PDF", x-tick-step: 1, y-tick-step: 0.1, y-max: 0.45, { plot.add( domain: (-4, 4), samples: 200, style: (stroke: (paint: julia-purple, thickness: 2pt)), x => gaussian(x, 0, 1), ) }, ) }, ) ] ] #slide(title: [Cumulative Distribution Function])[ The cumulative distribution function (CDF) of a random variable $X$ evaluated at $x$ is the probability that $X$ will take values less or qual than $x$: $ "CDF" = P(X <= x) $ ] #slide(title: [Cumulative Distribution Function])[ #align(center)[ #canvas( length: 0.9cm, { plot.plot( size: (16, 9), x-label: $X$, y-label: "PDF", x-tick-step: 1, y-tick-step: 0.25, y-min: -0.01, y-max: 1.01, { plot.add( domain: (-4, 4), samples: 200, style: (stroke: (paint: julia-purple, thickness: 2pt)), x => normcdf(x, 0, 1), ) }, ) }, ) ] ] #slide(title: [Discrete Distributions])[ Discrete probability distributions are distributions which the results are a discrete number: $-N, dots, -2, 1, 0, 1, 2, dots, N$ and $N ∈ ZZ$. #v(2em) In discrete probability distributions we call the probability of a distribution taking certain values as "mass". The probability mass function (PMF) is the function that specifies the probability of a random variable $X$ taking value $x$: #v(2em) $ "PMF"(x) = P(X = x) $ ] #slide(title: [Discrete Uniform])[ The discrete uniform is a symmetric probability distribution in which a finite number of values are equally likely of being observable. Each one of the $n$ values have probability $1 / n$. #v(1em) The uniform discrete distribution has two parameters and its notation is $"Uniform"(a, b)$: - $a$ -- lower bound - $b$ -- upper bound #v(1em) Example: dice. ] #slide(title: [Discrete Uniform])[ #v(4em) $ "Uniform"(a, b) = f(x, a, b) = 1 / (b - a + 1) "for" a <= x <= b "and" x ∈ { a, a + 1, dots ,b - 1, b } $ ] #slide(title: [Discrete Uniform])[ #align(center)[ #figure( { let data = for i in range(1, 7) { ((discreteuniform(1, 6), i),) } let x_axis = axis( min: 0, max: 7, step: 1, location: "bottom", title: none, ) let y_axis = axis( min: 0, max: 0.21, step: 0.1, location: "left", title: $"PMF"$, ) let pl = pplot(data: data, axes: ((x_axis, y_axis))) bar_chart(pl, (350pt, 275pt), bar_width: 70%, caption: none) }, caption: [$a = 1, b = 6$], numbering: none, ) ] ] #slide(title: [Bernoulli])[ Bernoulli distribution describes a binary event of the success of an experiment. We represent $0$ as failure and $1$ as success, hence the result of a Bernoulli distribution is a binary variable $Y ∈ {0, 1}$. Bernoulli distribution is often used to model binary discrete results where there is only two possible results. Bernoulli distribution has only a single parameter and its notation is $"Bernoulli"(p)$: - $p$ -- probability of success #v(1em) Example: If the patient survived or died or if the client purchased or not. ] #slide(title: [Bernoulli])[ #v(4em) $ "Bernoulli"(p) = f(x, p)=p^(x)(1 - p)^(1 - x) "for" x ∈ {0, 1} $ ] #slide(title: [Bernoulli])[ #align(center)[ #figure( { let data = ((0.666, "0"), (0.333, "1")) let x_axis = axis( values: ("", "0", "1"), location: "bottom", title: none, ) let y_axis = axis( min: 0, max: 0.7, step: 0.2, value_formatter: "{:.1}", location: "left", title: $"PMF"$, ) let pl = pplot(data: data, axes: ((x_axis, y_axis))) bar_chart(pl, (350pt, 275pt), bar_width: 70%, caption: none) }, caption: [$p = 1 / 3$], numbering: none, ) ] ] #slide(title: [Binomial])[ The binomial distribution describes an event in which the number of successes in a sequence $n$ independent experiments, each one making a yes--no question with probability of success $p$. Notice that Bernoulli distribution is a special case of the binomial distribution where $n = 1$. #v(1em) The binomial distribution has two parameters and its notation is $"Binomial"(n, p)$ : - $n$ -- number of experiments - $p$ -- probability of success #v(1em) Example: number of heads in five coin throws. ] #slide(title: [Binomial])[ #v(4em) $ "Binomial"(n,p) = f(x, n, p) = binom(n, x)p^(x)(1-p)^(n-x) "for" x ∈ { 0, 1, dots, n } $ ] #slide(title: [Binomial])[ #side-by-side[ #align(center)[ #figure( { let data = for i in range(0, 11) { ((binomial(i, 10, 1 / 5), str(i)),) } data.insert(0, (0, "")) let x_ticks = range(0, 11).map(str) x_ticks.insert(0, "") let x_axis = axis(values: x_ticks, location: "bottom", title: none) let y_axis = axis( min: 0, max: 0.5, step: 0.1, value_formatter: "{:.1}", location: "left", title: $"PMF"$, ) let pl = pplot(data: data, axes: ((x_axis, y_axis))) bar_chart(pl, (350pt, 275pt), bar_width: 70%, caption: none) }, caption: [$n = 10, p = 1 / 5$], numbering: none, ) ] ][ #align(center)[ #figure( { let data = for i in range(0, 11) { ((binomial(i, 10, 1 / 2), str(i)),) } data.insert(0, (0, "")) let x_ticks = range(0, 11).map(str) x_ticks.insert(0, "") let x_axis = axis(values: x_ticks, location: "bottom", title: none) let y_axis = axis( min: 0, max: 0.5, step: 0.1, value_formatter: "{:.1}", location: "left", title: $"PMF"$, ) let pl = pplot(data: data, axes: ((x_axis, y_axis))) bar_chart(pl, (350pt, 275pt), bar_width: 70%, caption: none) }, caption: [$n = 10, p = 1 / 2$], numbering: none, ) ] ] ] #slide(title: [Poisson])[ Poisson distribution describes the probability of a certain number of events occurring in a fixed time interval if these events occur with a constant mean rate which is known and independent since the time of last occurrence. Poisson distribution can also be used for number of events in other type of intervals, such as distance, area or volume. #v(1em) Poisson distribution has one parameter and its notation is $"Poisson"(λ)$: - $λ$ -- rate #v(1em) Example: number of e-mails that you receive daily or the number of the potholes you'll find in your commute. ] #slide(title: [Poisson])[ #v(4em) $ "Poisson"(λ) = f(x, λ) = (λ^x e^(-λ)) / (x!) "for" λ > 0 $ ] #slide(title: [Poisson])[ #side-by-side[ #align(center)[ #figure( { let data = for i in range(0, 9) { ((poisson(i, 2), str(i)),) } data.insert(0, (0, "")) let x_ticks = range(0, 9).map(str) x_ticks.insert(0, "") let x_axis = axis(values: x_ticks, location: "bottom", title: none) let y_axis = axis( min: 0, max: 0.5, step: 0.1, value_formatter: "{:.1}", location: "left", title: $"PMF"$, ) let pl = pplot(data: data, axes: ((x_axis, y_axis))) bar_chart(pl, (350pt, 275pt), bar_width: 70%, caption: none) }, caption: [$λ = 2$], numbering: none, ) ] ][ #align(center)[ #figure( { let data = for i in range(0, 9) { ((poisson(i, 3), str(i)),) } data.insert(0, (0, "")) let x_ticks = range(0, 9).map(str) x_ticks.insert(0, "") let x_axis = axis(values: x_ticks, location: "bottom", title: none) let y_axis = axis( min: 0, max: 0.5, step: 0.1, value_formatter: "{:.1}", location: "left", title: $"PMF"$, ) let pl = pplot(data: data, axes: ((x_axis, y_axis))) bar_chart(pl, (350pt, 275pt), bar_width: 70%, caption: none) }, caption: [$λ = 3$], numbering: none, ) ] ] ] #slide(title: [ Negative Binomial #footnote[ any phenomena that can be modeles as a Poisson distribution can be modeled also as negative binomial distribution @gelman2013bayesian, @gelman2020regression. ] ])[ #text(size: 16pt)[ The binomial distribution describes an event in which the number of successes in a sequence $n$ independent experiments, each one making a yes--no question with probability of success $p$ until $k$ successes. Notice that it becomes the Poisson distribution in the limit as $k → oo$. This makes it a robust option to replace a Poisson distribution to model phenomena with overdispersion (presence of greater variability in data than would be expected). The negative binomial has two parameters and its notation is $"Negative Binomial"(k, p)$: - $k$ -- number of successes - $p$ -- probability of success Example: annual occurrence of tropical cyclones. ] ] #slide(title: [Negative Binomial])[ #v(4em) $ "Negative Binomial"(k, p) &= f(x, k, p) &= binom(x + k - 1, k - 1)p^(x)( 1-p )^(k) \ \ & &"for" x ∈ {0, 1, dots, n} $ ] #slide(title: [Negative Binomial])[ #side-by-side[ #align(center)[ #figure( { let data = for i in range(0, 9) { ((negativebinomial(i, 1, 0.5), str(i)),) } data.insert(0, (0, "")) let x_ticks = range(0, 9).map(str) x_ticks.insert(0, "") let x_axis = axis(values: x_ticks, location: "bottom", title: none) let y_axis = axis( min: 0, max: 0.5, step: 0.1, value_formatter: "{:.1}", location: "left", title: $"PMF"$, ) let pl = pplot(data: data, axes: ((x_axis, y_axis))) bar_chart(pl, (350pt, 275pt), bar_width: 70%, caption: none) }, caption: [$k = 1, p = 1 / 2$], numbering: none, ) ] ][ #align(center)[ #figure( { let data = for i in range(0, 9) { ((negativebinomial(i, 5, 0.5), str(i)),) } data.insert(0, (0, "")) let x_ticks = range(0, 9).map(str) x_ticks.insert(0, "") let x_axis = axis(values: x_ticks, location: "bottom", title: none) let y_axis = axis( min: 0, max: 0.5, step: 0.1, value_formatter: "{:.1}", location: "left", title: $"PMF"$, ) let pl = pplot(data: data, axes: ((x_axis, y_axis))) bar_chart(pl, (350pt, 275pt), bar_width: 70%, caption: none) }, caption: [$k = 5, p = 1 / 2$], numbering: none, ) ] ] ] #slide(title: [Continuous Distributions])[ #text(size: 16pt)[ Continuous probability distributions are distributions which the results are values in a continuous real number line: $(-oo, +oo) ∈ RR$. In continuous probability distributions we call the probability of a distribution taking values as "density". Since we are referring to real numbers we cannot obtain the probability of a random variable $X$ taking exactly the value $x$. This will always be $0$, since we cannot specify the exact value of $x$. $x$ lies in the real number line, hence, we need to specify the probability of $X$ taking values in an interval $[a,b]$. The probability density function (PDF) is defined as: $ "PDF"(x) = P(a <= X <= b) = ∫_a^b f(x) dif x $ ] ] #slide(title: [Continuous Uniform])[ The continuous uniform distribution is a symmetric probability distribution in which an infinite number of value intervals are equally likely of being observable. Each one of the infinite $n$ intervals have probability $1 / n$. #v(1em) The continuous uniform distribution has two parameters and its notation is $"Uniform"(a, b)$: - $a$ -- lower bound - $b$ -- upper bound ] #slide(title: [Continuous Uniform])[ #v(4em) $ "Uniform"(a,b) = f(x, a, b) = 1 / (b-a) "for" a <= x <= b "and" x ∈ [a, b] $ ] #slide(title: [Continuous Uniform])[ #align(center)[ #figure( { canvas( length: 0.9cm, { plot.plot( size: (16, 9), x-label: none, y-label: "PDF", x-tick-step: 1, y-tick-step: 0.1, x-min: 0, x-max: 6, y-max: 0.4, y-min: 0, { plot.add( domain: (0, 6), samples: 200, style: (stroke: (paint: julia-purple, thickness: 2pt)), x => continuousuniform(0, 6), ) }, ) }, ) }, caption: [$a = 0, b = 6$], numbering: none, ) ] ] #slide(title: [Normal])[ This distribution is generally used in social and natural sciences to represent continuous variables in which its underlying distribution are unknown. #v(1em) This assumption is due to the central limit theorem (CLT) that, under precise conditions, the mean of many samples (observations) of a random variable with finite mean and variance is itself a random variable which the underlying distribution converges to a normal distribution as the number of samples increases (as $n → oo$). #v(1em) Hence, physical quantities that we assume that are the sum of many independent processes (with measurement error) often have underlying distributions that are similar to normal distributions. ] #slide(title: [Normal])[ The normal distribution has two parameters and its notation is $"Normal"(μ, σ)$ or $"N"(μ, σ)$: - $μ$ -- mean of the distribution, and also median and mode - $σ$ -- standard deviation #footnote[sometimes is also parameterized as variance $σ^2$.], a dispersion measure of how observations occur in relation from the mean #v(1em) Example: height, weight etc. ] #slide(title: [Normal #footnote[ see how the normal distribution was derived from the binomial distribution in the backup slides. ] ])[ #v(4em) $ "Normal"(μ, σ) = f(x, μ, σ) = 1 / (σ sqrt(2π)) e^(- 1 / 2 ((x-μ) / σ)^2) "for" σ > 0 $ ] #slide(title: [Normal])[ #side-by-side[ #align(center)[ #figure( { canvas( length: 0.75cm, { plot.plot( size: (16, 9), x-label: none, y-label: "PDF", x-tick-step: 1, y-tick-step: 0.1, x-min: -4, x-max: 4, y-max: 0.65, y-min: 0, { plot.add( domain: (-4, 4), samples: 200, style: (stroke: (paint: julia-purple, thickness: 2pt)), x => gaussian(x, 0, 1), ) }, ) }, ) }, caption: [$μ = 0, σ = 1$], numbering: none, ) ] ][ #align(center)[ #figure( { canvas( length: 0.75cm, { plot.plot( size: (16, 9), x-label: none, y-label: "PDF", x-tick-step: 1, y-tick-step: 0.1, x-min: -4, x-max: 4, y-max: 0.65, y-min: 0, { plot.add( domain: (-4, 4), samples: 200, style: (stroke: (paint: julia-purple, thickness: 2pt)), x => gaussian(x, 1, 2 / 3), ) }, ) }, ) }, caption: [$μ = 1, σ = 2 / 3$], numbering: none, ) ] ] ] #slide(title: [Log-Normal])[ The log-normal distribution is a continuous probability distribution of a random variable which its natural logarithm is distributed as a normal distribution. Thus, if the natural logarithm a random variable $X$, $ln(X)$, is distributed as a normal distribution, then $Y = ln(X)$ is normally distributed and $X$ is log-normally distributed. A log-normal random variable only takes positive real values. It is a convenient and useful model for measurements in exact and engineering sciences, as well as in biomedical, economical and other sciences. For example, energy, concentrations, length, financial returns and other measurements. A log-normal process is the statistical realization of a multiplicative product of many independent positive random variables. ] #slide(title: [Log-Normal])[ The log-normal distribution has two parameters and its notation is $"Log-Normal"(μ, σ^2)$: #v(2em) - $μ$ -- mean of the distribution's natural logarithm - $σ$ -- square root of the variance of the distribution's natural logarithm ] #slide(title: [Log-Normal])[ #v(4em) $ "Log-Normal"(μ,σ) = f(x, μ, σ) = 1 / (x σ sqrt(2π))e^(( -ln(x) - μ )^2 / (2 σ^2)) "for" σ > 0 $ ] #slide(title: [Log-Normal])[ #side-by-side[ #align(center)[ #figure( { canvas( length: 0.75cm, { plot.plot( size: (16, 9), x-label: none, y-label: "PDF", x-tick-step: 1, y-tick-step: 0.1, x-min: 0, x-max: 5, y-max: 0.7, y-min: 0, { plot.add( domain: (0.001, 5), samples: 200, style: (stroke: (paint: julia-purple, thickness: 2pt)), x => lognormal(x, 0, 1), ) }, ) }, ) }, caption: [$μ = 0, σ = 1$], numbering: none, ) ] ][ #align(center)[ #figure( { canvas( length: 0.75cm, { plot.plot( size: (16, 9), x-label: none, y-label: "PDF", x-tick-step: 1, y-tick-step: 0.1, x-min: 0, x-max: 5, y-max: 0.7, y-min: 0, { plot.add( domain: (0.001, 5), samples: 200, style: (stroke: (paint: julia-purple, thickness: 2pt)), x => lognormal(x, 1, 2 / 3), ) }, ) }, ) }, caption: [$μ = 1, σ = 2 / 3$], numbering: none, ) ] ] ] #slide(title: [Exponential])[ The exponential distribution is the probability distribution of the time between events that occurs in a continuous manner, are independent, and have constant mean rate of occurrence. #v(1em) The exponential distribution has one parameter and its notation is $"Exponential"(λ)$: - $λ$ -- rate #v(1em) Example: How long until the next earthquake or how long until the next bus arrives. ] #slide(title: [Exponential])[ #v(4em) $ "Exponential"(λ) = f(x, λ) = λ e^(-λ x) "for" λ > 0 $ ] #slide(title: [Exponential])[ #side-by-side[ #align(center)[ #figure( { canvas( length: 0.75cm, { plot.plot( size: (16, 9), x-label: none, y-label: "PDF", x-tick-step: 1, y-tick-step: 0.25, x-min: 0, x-max: 5, y-max: 0.95, y-min: 0, { plot.add( domain: (0.001, 5), samples: 200, style: (stroke: (paint: julia-purple, thickness: 2pt)), x => exponential(x, 1), ) }, ) }, ) }, caption: [$λ = 1$], numbering: none, ) ] ][ #align(center)[ #figure( { canvas( length: 0.75cm, { plot.plot( size: (16, 9), x-label: none, y-label: "PDF", x-tick-step: 1, y-tick-step: 0.25, x-min: 0, x-max: 5, y-max: 0.95, y-min: 0, { plot.add( domain: (0.001, 5), samples: 200, style: (stroke: (paint: julia-purple, thickness: 2pt)), x => exponential(x, 1 / 2), ) }, ) }, ) }, caption: [$λ = 1 / 2$], numbering: none, ) ] ] ] #slide(title: [Gamma])[ The gamma distribution is a long-tailed distribution with support only for positive real numbers. #v(1em) The gamma distribution has two parameters and its notation is $"Gamma"(α, θ)$: - $α$ -- shape parameter - $θ$ -- rate parameter #v(1em) Example: Any waiting time can be modelled with a gamma distribution. ] #slide(title: [Gamma])[ #v(4em) $ "Gamma"(α, θ) = f(x, α, θ) = (x^(α-1) e^(-x / θ)) / (Γ( α ) θ^α) "for" x, α, θ > 0 $ ] #slide(title: [Gamma])[ #side-by-side[ #align(center)[ #figure( { canvas( length: 0.75cm, { plot.plot( size: (16, 9), x-label: none, y-label: "PDF", x-tick-step: 1, y-tick-step: 0.2, x-min: 0, x-max: 6, y-max: 0.95, y-min: 0, { plot.add( domain: (0.001, 6), samples: 200, style: (stroke: (paint: julia-purple, thickness: 2pt)), x => gammadist(x, 1, 1), ) }, ) }, ) }, caption: [$α = 1, θ = 1$], numbering: none, ) ] ][ #align(center)[ #figure( { canvas( length: 0.75cm, { plot.plot( size: (16, 9), x-label: none, y-label: "PDF", x-tick-step: 1, y-tick-step: 0.2, x-min: 0, x-max: 6, y-max: 0.95, y-min: 0, { plot.add( domain: (0.001, 6), samples: 200, style: (stroke: (paint: julia-purple, thickness: 2pt)), x => gammadist(x, 2, 1 / 2), ) }, ) }, ) }, caption: [$α = 2, θ = 1 / 2$], numbering: none, ) ] ] ] #slide(title: [Student's $t$])[ #text(size: 18pt)[ Student's $t$ distribution arises by estimating the mean of a normally-distributed population in situations where the sample size is small and the standard deviation is known #footnote[this is where the ubiquitous Student's $t$ test.]. #v(1em) If we take a sample of $n$ observations from a normal distribution, then Student's $t$ distribution with $ν = n - 1$ degrees of freedom can be defined as the distribution of the location of the sample mean in relation to the true mean, divided by the sample's standard deviation, after multiplying by the scaling term $sqrt(n)$. #v(1em) Student's $t$ distribution is symmetric and in a bell-shape, like the normal distribution, but with long tails, which means that has more chance to produce values far away from its mean. ] ] #slide(title: [Student's $t$])[ Student's $t$ distribution has one parameter and its notation is $"Student"(ν)$: - $ν$ -- degrees of freedom, controls how much it resembles a normal distribution #v(1em) Example: a dataset full of outliers. ] #slide(title: [Student's $t$])[ #v(4em) $ "Student"(ν) = f(x, ν) = (Γ ((ν + 1) / 2) ) / (sqrt(ν π) Γ (ν / 2)) ( 1+ x^2 / ν )^(-(ν+1) / 2) "for" ν >= 1 $ ] #slide(title: [Student's $t$])[ #side-by-side[ #align(center)[ #figure( { canvas( length: 0.75cm, { plot.plot( size: (16, 9), x-label: none, y-label: "PDF", x-tick-step: 1, y-tick-step: 0.1, x-min: -4, x-max: 4, y-max: 0.45, y-min: 0, { plot.add( domain: (-4, 4), samples: 200, style: (stroke: (paint: julia-purple, thickness: 2pt)), x => student(x, 1), ) }, ) }, ) }, caption: [$ν = 1$], numbering: none, ) ] ][ #align(center)[ #figure( { canvas( length: 0.75cm, { plot.plot( size: (16, 9), x-label: none, y-label: "PDF", x-tick-step: 1, y-tick-step: 0.1, x-min: -4, x-max: 4, y-max: 0.45, y-min: 0, { plot.add( domain: (-4, 4), samples: 200, style: (stroke: (paint: julia-purple, thickness: 2pt)), x => student(x, 3), ) }, ) }, ) }, caption: [$ν = 3$], numbering: none, ) ] ] ] #slide(title: [Cauchy])[ The Cauchy distribution is bell-shaped distribution and a special case for Student's $t$ with $ν = 1$. #v(1em) But, differently than Student's $t$, the Cauchy distribution has two parameters and its notation is $"Cauchy"(μ, σ)$: - $μ$ -- location parameter - $σ$ -- scale parameter #v(1em) Example: a dataset full of outliers. ] #slide(title: [Cauchy])[ #v(4em) $ "Cauchy"(μ, σ) = 1 / (π σ (1 + ((x - μ) / σ)^2)) "for" σ >= 0 $ ] #slide(title: [Cauchy])[ #side-by-side[ #align(center)[ #figure( { canvas( length: 0.75cm, { plot.plot( size: (16, 9), x-label: none, y-label: "PDF", x-tick-step: 1, y-tick-step: 0.1, x-min: -4, x-max: 4, y-max: 0.65, y-min: 0, { plot.add( domain: (-4, 4), samples: 200, style: (stroke: (paint: julia-purple, thickness: 2pt)), x => cauchy(x, 0, 1), ) }, ) }, ) }, caption: [$μ = 0, σ = 1$], numbering: none, ) ] ][ #align(center)[ #figure( { canvas( length: 0.75cm, { plot.plot( size: (16, 9), x-label: none, y-label: "PDF", x-tick-step: 1, y-tick-step: 0.1, x-min: -4, x-max: 4, y-max: 0.65, y-min: 0, { plot.add( domain: (-4, 4), samples: 200, style: (stroke: (paint: julia-purple, thickness: 2pt)), x => cauchy(x, 0, 1 / 2), ) }, ) }, ) }, caption: [$μ = 0, σ = 1 / 2$], numbering: none, ) ] ] ] #slide(title: [Beta])[ The beta distribution is a natural choice to model anything that is restricted to values between $0$ e $1$. Hence, it is a good candidate to model probabilities and proportions. #v(1em) The beta distribution has two parameters and its notations is $"Beta" (α, β)$: - $α$ (or sometimes $a$) -- shape parameter, controls how much the shape is shifted towards $1$ - $β$ (or sometimes $b$) -- shape parameter, controls how much the shape is shifted towards $0$ #v(1em) Example: A basketball player that has already scored 5 free throws and missed 3 in a total of 8 attempts -- $"Beta"(3, 5)$ ] #slide(title: [Beta])[ #v(4em) $ "Beta"(α, β) = f(x, α, β) (x^(α - 1)(1 - x)^(β - 1)) / ((Γ(α)Γ(β)) / (Γ( α +β ))) "for" α, β > 0 "and" x ∈ [0, 1] $ ] #slide(title: [Beta])[ #side-by-side[ #align(center)[ #figure( { canvas( length: 0.75cm, { plot.plot( size: (16, 9), x-label: none, y-label: "PDF", x-tick-step: 1, y-tick-step: 0.1, x-min: 0, x-max: 1, y-max: 0.3, y-min: 0, { plot.add( domain: (0.0001, 0.9999), samples: 200, style: (stroke: (paint: julia-purple, thickness: 2pt)), x => beta(x, 1, 1), ) }, ) }, ) }, caption: [$α = 1, β = 1$], numbering: none, ) ] ][ #align(center)[ #figure( { canvas( length: 0.75cm, { plot.plot( size: (16, 9), x-label: none, y-label: "PDF", x-tick-step: 1, y-tick-step: 0.1, x-min: 0, x-max: 1, y-max: 0.3, y-min: 0, { plot.add( domain: (0.0001, 0.9999), samples: 200, style: (stroke: (paint: julia-purple, thickness: 2pt)), x => beta(x, 3, 2), ) }, ) }, ) }, caption: [$α = 3, β = 2$], numbering: none, ) ] ] ]
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/auton-routes/identify.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: "Identify: Autonomous Strategy", type: "identify", date: datetime(year: 2023, month: 12, day: 1), author: "<NAME>", witness: "<NAME>", ) The autonomous period is a essential part of the game. It can give you a head start on the match itself, and the autonomous bonus can even decide close games. = Points Breakdown Here's a breakdown of the total amounts of points possible for each task. We assume 6 triballs is the amount for each triball related goal. #grid( columns: (2fr, 1fr), gutter: 20pt, pie-chart( (value: 10, color: blue, name: "Auton bonus"), (value: 30, color: green, name: "Triballs in goal"), (value: 12, color: red, name: "Triballs in offensive zone"), ), [ Overall scoring triballs in the goal is the most efficient way to score points during the autonomous period. ], ) = AWP AWP (autonomous win point) is another possible task to complete during the autonomous period. It awards an additional win point for completing several tasks. Win points are the primary way teams are ranked during qualification matches. #grid( columns: (1fr, 1fr), gutter: 20pt, pie-chart( (value: 1, color: yellow, name: "Tie"), (value: 2, color: green, name: "Win"), (value: 1, color: blue, name: "AWP"), ), [ The maximum possible amount of win points we can score during a match is 3, but even if we lose, AWP gives us the same amount of points that we would have gotten had we tied the match. Overall, AWP is a super powerful tool that can get us ahead in tournaments even if we lose matches. ], ) The following tasks are required to get AWP: - Score a triball in your alliance goal - Remove the triball from your alliance match load zone - Touch the elevation bar = Conclusion Overall going for AWP seems like a much safer bet to getting us ahead, even if the tasks cannot be accomplished by a single robot. We'll need 2 different autonomous routines to be able to accommodate for any alliance partner we'll be paired with.
https://github.com/505000677/Apply4Job
https://raw.githubusercontent.com/505000677/Apply4Job/main/chicv.typ
typst
#let chiline() = { v(-3pt); line(length: 100%, stroke: gray); v(-10pt) } #import "fontawesome.typ": *; #let iconlink( uri, text: [], icon: link-icon) = { if text == [] { text = uri } link(uri)[#fa[#icon] #text] } #let githublink(userRepo) = { link("https://github.com/" + userRepo)[#fa[#github] #userRepo] } // https://github.com/typst/typst/issues/1987#issuecomment-1690672386 #let latex = { // set text(font: "New Computer Modern") box(width: 2.55em, { [L] place(top, dx: 0.3em, text(size: 0.7em)[A]) place(top, dx: 0.7em)[T] place(top, dx: 1.26em, dy: 0.22em)[E] place(top, dx: 1.8em)[X] }) } #let cventry( tl: lorem(2), tr: "1145/14 - 1919/8/10", bl: [], br: [], content ) = { block( inset: (left: 0pt), tl + h(1fr) + tr + linebreak() + if bl != [] or br != [] { bl + h(1fr) + br + linebreak() } + content ) } #let chicv(body) = { set par(justify: true) show heading.where( level: 1 ): set text( size: 18pt, weight: "light", ) let the-font = ( "Palatino Linotype", "Source Han Serif SC", "Source Han Serif", ) show heading.where( level: 2 ): it => text( size: 14pt, font: the-font, weight: "bold", block( chiline() + it, ) ) set list(indent: 0pt) set text( size: 10pt, font: the-font ) show link: it => underline(offset: 2pt, it) set page( margin: (x: 0.5cm, y: 0.9cm), numbering: "1 / 1" ) set par(justify: true) body } #let today() = { let month = ( "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December", ).at(datetime.today().month() - 1); let day = datetime.today().day(); let year = datetime.today().year(); [#month #day, #year] }
https://github.com/polarkac/MTG-Stories
https://raw.githubusercontent.com/polarkac/MTG-Stories/master/stories/023%20-%20Oath%20of%20the%20Gatewatch/003_Reclamation.typ
typst
#import "@local/mtgstory:0.2.0": conf #show: doc => conf( "Reclamation", set_name: "Oath of the Gatewatch", story_date: datetime(day: 06, month: 01, year: 2016), author: "<NAME>", doc ) #emph[The elves of Zendikar have spent generations adapting to the plane's ever-changing environment. Resilient and fearless against the destruction of the Roil and the Eldrazi, their close-knit villages seemed to regrow with the speed of the jungles themselves.] #emph[But with the coming of the Eldrazi, two of the three great elf nations—the Mul Daya and the Joraga—were nearly eliminated. For the Mul Daya, a group steeped in tradition and familial ties, survivors were torn between either staying to die with their village Speakers in the devastated remains of their land or venturing far away to seek assistance. Greenweaver Mina and her brother Denn are two lone refugees who have traveled an entire continent away to Murasa in search of aid and the means to reclaim their fallen home.] #figure(image("003_Reclamation/01.png", width: 100%), caption: [], supplement: none, numbering: none) #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) Days, weeks had passed traveling through the Blight. The humid, heavy breath of the ancient Guum forests gave way to a desiccated whisper of plains laid bare by skittering feet. Mina had kept careful watch over the passages of the sun, bearing steadily toward a location she had only ever heard of in reluctant murmurs or vague accounts. #emph[Close now, close] . She reassured herself. The dust from the Blight covered her clothes and coated her bare feet. The tough, ossified ground left patterned imprints on soles more closely accustomed to the dense mosses of her lost homeland. Resolute, but footsore, she reached the ravine that formed the outskirts of the Murasan forests. Or what had once been the forests. The Blight was a blinding pure white and rose in twisted spires that had once been trees, animals, rocks. The sheer cliffs were immaculately blank, silence reverberating through the valley. The silence weighed heavily on her—since her childhood she had been surrounded by the sounds of her land, her elders, her family. Whispers, yells, commands, pleas...their sounds had always tethered her to something, someone. Here she was a lone piece of color and noise, an affront to the blankness around her. She kicked at the ground absently, and a cloud of white dust obediently wafted up and fell back down in ashen flakes. Like snow without winter, she mused. The blankness filled her vision and her ears with the dull-ringing white noise of senses desperate for purpose. She turned slowly, her keen red eyes scanning the horizon for signs of color, sound, life. The blank cliff faces leered back at her. So the Blight had reached all the way here as well. #figure(image("003_Reclamation/02.jpg", width: 100%), caption: [Art by <NAME>], supplement: none, numbering: none) #emph[Ancestors] , she mentally swore. #emph[Denn will not be pleased] . She had been convinced they could find the Tajuru Grove here, and the two had parted ways at midday to cover more ground in their search. Mina's fists clenched around her long knife, the familiar wooden handle and heft of it settling pleasantly into place. A surge of familiar bitterness rose in her chest, savage and warm, rattling against her ribs. She let out a long, ragged tone that reverberated back at her from the ravine below. She smiled, satisfied with any way to break the oppressive silence. From the other end of the ravine, something stirred. A shape twice Mina's size scuttled forward into the light, the tapping of bony appendages against the rigid surface of the blighted ground. Her breath caught in her chest—the creature couldn't have wandered too far from its feeding ground, perhaps there was new ground yet? It turned towards her with a dull hiss. Excellent, it had seen her. Mina grinned, baring a mouthful of pointed teeth. She hastened down into the ravine, leaving a cloud of dust and shattered Blight with the graceless enthusiasm of a baloth pup. Reaching the floor of the ravine, she barreled towards the creature, unsheathing her knife from her belt as she lunged forward in a fluid reflexive motion. The thing paused, eyeless face throwing forth feelers in her direction, pseudopods blooming from its skin and bristling along its radial crests. A keening sound emitted from the crest of its body, perhaps in some harmony with commands Mina could not hear. She dove beneath its primary mass, gripping pseudopods in one hand and finding flesh with the other, the engraved blade of her knife gliding with satisfying ease, carving paths into the creature's underside. Blood pounded in Mina's temples; the flesh of its back was rubbery and unexpectedly cool to the touch. A cut that would have spilled the guts of any ordinary beast instead produced a meager drip of acrid gray fluid. Not an unfamiliar outcome for their kind. She welcomed the chance to express her gratitude for her dusty, footsore state with a messier approach. Dodging the whip of a sinuous limb, she grabbed it as it passed and clambered up its length—they were sturdy as any root or branch, which she was well equipped to handle. On its back, she gripped behind its bony head-plate, piercing beneath it with her knife and twisting it with relish. The thing immediately collapsed beneath her, limbs twitching. Mina leapt off its back and stood back, waited for it to rise. It stayed on the ground, phantom nerves helplessly pulling at severed limbs. Mina reached down for its head and pulled it up towards her, staring into its vacant face. #emph[What were you seeking here? Why do you stay?] The mask stared back, impassive. There was no emotion to read on it, no panic in death, no begging or bargaining, no pity. The elves had always been a resilient people, weathering the roiling landscape as it shifted and changed. They coexisted with the Roil's inconsistencies, left their dead in shallow graves under the protective grasp of the jaddi roots. The elders had thought the tide of Eldrazi would, like the Roil, force them to adapt and change. Instead, they drowned. The creature's flailing slowed and stopped. Mina dropped it to the ground with a dull thud. From the shadows of the ravine, two new humanoid figures emerged, one of them very familiar. Like Mina, her twin brother Denn was unarmored, barefoot, visibly unarmed save for their long knives carved from the poisonous woods of the Guum. In place of armor, vine-like markings snaked over both of their arms, messages bearing the words and lineage of their kin—dead, living, unborn—their murmurs crystallized onto skin. When the two left Bala Ged, they took with them the bones of their fallen that now adorned their dark red hair. Behind Denn stood a slight, hooded woman clad in leather armor from pauldrons to stirruped boots. Unmarked and solemn, she led her mount behind her. There was no mistaking the sturdy construction and expert workmanship of her armor—a sentry of the Tajuru elf nation. #figure(image("003_Reclamation/03.jpg", width: 100%), caption: [Art by <NAME>], supplement: none, numbering: none) Mina scrambled to meet the pair, bowing her head to the Tajuru, eager to converse with the elf. But Denn had already noticed the pulp of the Eldrazi corpse behind her, and regarded her sternly. "Did you know they'd already passed this far into Murasa?" Denn asked Mina with forced slowness, his voice cracking with rising panic. "We're close. This was where they'd told us!" Mina flashed him a reckless smile that she hoped would mask her doubt. "That was weeks ago now! Has there still been nothing since?" Denn's face was stubbornly solemn—he'd learned the true meanings of Mina's expressions many times over. Mina stared at him, wishing she had words to say to him. The silence hung between them, a rift, wedging the twins apart. Denn looked away first. "Our Speaker had never said anything about this." It was Mina's turn to look down, hands clenching helplessly into fists. "More than far enough, to be certain," the stranger answered from behind him in lilting Tajuru tones before Mina could respond. "I've been sent to warn travelers away from this place, and found you two on my patrol." She paused, looking them over. "I am Warden Tenru, one of the many guardians of these Tajuru lands. It seems you've both strayed far from your village...?" she said, raising an eyebrow. Mina wiped her knife on the fallen Eldrazi and swept its dead flesh from her arms. "We are Mul Daya." "'We'?" Tenru asked, peering behind Mina into the emptiness of the ravine. "Are you scouts? Where are the others?" Mina sighed inwardly. Words had never come easily to her. Her head was always so full of sound and instinct that the words would bubble up and trip over themselves instead of leaving her mouth. Others would just tumble out before she could give them form and meaning. But this, this was important, and she had practiced this speech for weeks during their travels. "Months ago, we Mul Daya had stayed in our homes in Guum, reassured by our Speaker that our Ancestors insisted we stand our ground. The scions arrived first, and the defenses led by our vine ghosts beat them back." She nodded toward Denn, whose sullen silence gave no sign of acknowledgement. "But as the scions gave rise to their full-grown kin, the ranks of the vine ghosts thinned and our borders shrank so close as to touch the edges of the shallow graves of the elders." She paused, remembering their eyes staring up at her from their loamy beds, recalled how she had dreamt of their dreams. It was their essence, their memories, generations of history that had been processed into dust along with the groves they dwelled in. "Droves of us fell in defense of our homes. Our speaker fell ill and the voices of our Ancestors were silenced." she continued. Mina felt strangely detached from herself, listening to her own voice. Her own words sounded hollow and formal, with none of the visceral weight of the shame, pride, frustration from that time. "The Eldrazi arrived, conquered, fed, and left." She felt the slightest quaver enter her voice and stopped for a second to breathe in slowly. "I had...a vision as I slept near our dead. A vision of the destruction of Bala Ged. I took my brother during the night to seek audience from the Elven Nations. To ask them for aid, guidance." "And you?" Tenru asked gently. "What are you called?" "My name is Mina, Greenweaver of the Mul Daya." She rolled up her right sleeve to reveal the rank's insignia, carved deeply in wine-red ink on her forearm. Mina saw Tenru size up what she was sure appeared to be a matted, dusty, inexperienced mess in front of her. Tenru raised a doubting eyebrow, but nodded politely. "The conclave isn't located in any one place, but shifted with the incoming tides of Eldrazi," Tenru said. "Our motions are now a strategic network of planning and scouting, keeping close to what remained of the world they knew, careful of being encircled like...like our sisters". Mina's jaw clenched involuntarily. "I've patrolled the borderlands, bringing word of the Blight's spread back to the conclave," Tenru continued. "Their newest wave struck suddenly two nights ago, in greater numbers than we'd anticipated. We took our homes and retreated back toward the heart of the Grove—" "The Grove still stands?" Mina bolted upright, eyes shining. "Please—take us there?" #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) The jaddi grove jutted up from midst of the valley, splitting through earth and slowly dissolving slabs of rock beneath the unyielding grip of its roots. A dense canopy of perennially green leaves reached up into the cloud line where the humidity was densest. Spiraling patterns of leaves, each the length of an elf, festooned its many offshoots. In quieter times, the hollowed interiors of fallen trees had served as permanent homes. While the Mul Daya had made their homes amongst its roots, the Tajuru had become accustomed to the upper reaches of the branches, hidden from the view of the land-bound Eldrazi. This adaptation had kept them safe for years, until new waves of monsters arrived from the air itself. The three stood atop the ridge, staring down at the Grove. As the clouds shifted, sunlight fell over the valley. Mina heard Tenru inhale sharply, breath catching in her lungs. The ground here was completely unlike the pale nothing of the ravine. In its place, a dazzling array of vibrant colors refracted from the sharp facets of the rock. Some formations had crystallized vertically, in a twisted mockery of the trees that had once stood in their place. A thick, oily sheen oozed out from the multifaceted surface like an open wound, forming a slick coat on the remains of the undergrowth. "What...#emph[is ] that?" Mina breathed. From the corner of her eye, she saw Denn shake his head in horrified awe. #figure(image("003_Reclamation/04.jpg", width: 100%), caption: [Art by <NAME>], supplement: none, numbering: none) Below the encampment, a group of Eldrazi had gathered, proboscises grasping onto its roots. One had scaled to the first offshoot, dislodging the tents of the settlement from their high perches and tumbling them to the forest floor. Residents of the encampment had retreated to their homes in the highest branches. Denn faced Mina, his face pale and drawn. "When we stood before the Speaker, I valued our blood over my word. I followed you when no others would, an entire continent away. I was ready to join the rest of our kin in the ground, our ground. And here, we've come so far, haven't we? From one plagued village to watching this one wither and perish...an entire world away". Tenru's face darkened at his words. "Watch your tone, <NAME>—this is my home. I grieve for your loss, but never asked your help. We have no intention of succumbing to your same fate." #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) Mina tore through the valley, sliding over the slick, flat surfaces toward the Eldrazi as they gathered to feed. Like their brethren on Bala Ged, these too had deadly clusters of limbs and mouths. They pulled their pale masses up through the boughs on powerful forelimbs to draw sustenance from the trees and ground. But instead of bony plating, their bodies were insectoid and full of impossible symmetries. Above their heads sat crowns of delicate plating of a polished black stone so dark it seemed to both absorb and reflect light. Her knife still fouled with the fibrous gristle of the spawn from the ravine, Mina rushed at her closest foe. A sinuous hulking thing, its bulk was bloated from feeding and strained against the shell of its exoskeleton. Its smooth plates were the same depthless black as its crowned head, all angles and symmetry with no space for pity. Its many legs were crusted with eyes that glowed with unblinking, gemlike shapes. She swung the knife forward, slinging all her strength and momentum with it, aiming to spill open whatever innards the creature might hold. The weapon reverberated with the unexpected impact to the Eldrazi's outer mass, sending shockwaves down her arm and through to her teeth. She reeled, her numbed fingers dropping the knife. Behind her, she heard Denn scream and run toward her. A dull, oddly familiar sound filled her ears. Was it jangled nerves? The force of the impact? She struggled to her feet, holding her head in one hand and scrabbling for her knife with the other. She grasped something solid and looked up... ...into the four slavering jaws of a black-crowned Eldrazi. She flinched away instinctively, but it was too late. She clenched her eyes shut. It screamed. Or she thought it did. A shrill chorus of tones, barely audible to her brain, vibrated through her skull. She felt something warm in her right ear. Blood. Pain bloomed along her body, matching the waves of vibrations that racked her frame. Blind panic seized her, and she scrambled backward on all fours like a hunted animal. Out of the corner of her eye, she saw Denn reaching out to her and whirled toward him. The monster turned toward them, abdomen distended with air, and wailed. #figure(image("003_Reclamation/05.jpg", width: 100%), caption: [Art by <NAME>], supplement: none, numbering: none) The colors on the edge of Mina's vision blurred. In front of her, Denn's form collapsed and reformed in waves, the red of his hair and eyes draining from his body and bleeding into the edges of her vision. His outstretched arm was deflected in the opposite direction, bending at an impossible angle. His mouth opened and the words drifted helplessly from his mouth, his tongue unable to form their sounds, the air passing uselessly through his lungs. They hung in the air, meaningless and small, and dissipated. Mina thrust her arm forward toward his and felt her muscles sag uselessly, her bones flowing like viscous smoke through the air, impossibly slowly. Her fingers drifted apart, their tendons unwinding from the bone, veins distending and tangling. Even the ground beneath her turned to viscous liquid, sagging and flowing beneath her weight. Her legs were impossibly heavy, pulling her down and away from her outstretched arm. Her other arm found the hilt of her knife, and struggled to hold it as she unwound. Instinct propelled the blade from her hand, travelling outside the path of the monster's wail, striking it in one of its many gemlike eyes. Its wailing stopped for a moment, and Mina's body collapsed like a rag doll. The impact sent her crashing through the weakened Blight below her. When she opened her eyes, she found herself in a shallow depression, wind knocked out of her, head pounding. The light of day filtered down from above her, and she could see the underside of the thin, brittle layer of Blight that she had fallen through, the way a layer of ice covers the waters of a winter pond. The dull, familiar rhythm had returned. It was louder now. She struggled to find the thread of sound below the rumble of the beasts above her. It rose and fell like a breath, or was it...a voice? She tried to form patterns from it, shape the frequencies into meaning. From what felt like miles above her, the sounds of Denn's voice filtered into her waning consciousness. #emph[Mi-nah. Mee-na.] She crouched in the darkness, hands on the ground to steady herself. The sounds in her head were whispers. They were the voices she had heard in Bala Ged, of her elders, her jaddi. Her family. They melded together into something familiar. What was it they were saying? Her brow furrowed, hands clenching involuntarily around something...familiar. The ground under her hand was not the hard surface of the Blight. It was land, the thick, fragrant soils of her youth. Time's inexorable wheels stopped for her, suspended in a synesthetic bubble of collective memories. The smell of that same patch of soil baked by summer, boot-trodden, stained by blood or green with new spring growth, filled her lungs. She watched it with eyes that were not hers. The sounds rushed into her head again. #emph[Mina.] "Mina!" Her brother's voice cut through her reverie, breaking her concentration. #emph[Denn!] A hand blotted out the light over Mina's head, and she felt herself lifted up and out of the ground in her brother's arms. She could smell the blood on them, though she knew not whose it was. A whooshing sound passed just over their heads, and the ground behind them swelled and burst before their eyes. The impact of the errant wail left a cratered trail in its wake. "Denn! They're here! The Ancestors are still with us! There's land under the Blight here!" "Mina? Slow down, you're bleeding, we need to move—" Mina reached up and cradled her brother's head as the next wail hurtled straight towards them, and dropped the handful of soil. The particles exploded into life, each expanding into a wall of thick stems, roots, and earth that shook as the wave of sound struck it, the outlines of its impact forming a kaleidoscopic stain in its center. "Listen!" The sounds in Mina's head were deafening now. Multilayered and toned, it blended choruses of voices and noises of all pitches, frequencies, volumes. A calm settled over her. She took a deep breath, cupped her hand over Denn's ear, and they all rushed from her lips like a ruptured dam. Some words were angry, tender, sullen, a secret language shared with a sibling whose voice she felt as her own. Some tumbled out in rumbling reprimand, stern warnings she had heard long ago. Others were a language and a tone that she felt but did not know, the warm gusts of wind in summer, the dull ache of regret. It was the sound of memories congealed in time and space. A calm settled over Mina, and she wove her words around Denn's wounded flesh and hands. His eyes widened, surprise washing away any attempts at feigned callousness. "Are these the Ancestors' voices? Where did you learn to speak in their voices? What do they tell you?" Mina only nodded, and said nothing. Another wail shattered the vine wall, the packed earth and thick curling stems falling into brittle, coruscating pieces. Mina turned slowly to face the creature, arms outstretched, and began to speak. In one sound, she spoke of her childhood home in the steaming jungles of the Guum, crouched in the undergrowth, listening to the rain. Pillars of wet earth and rock erupted from the ground, sending great jagged cracks racing across the surface like lightning over the facets of the Blight, tumbling the monsters from its face. The Eldrazi bellowed and stumbled to regain their footing. In the next she told stories she had never known, but that she knew were true. Stories of bravery and sacrifice. She pulled her second knife from its place at her hip. It was warm and smelled of damp leaves. She inhaled deeply and grinned to herself with savage zeal. #figure(image("003_Reclamation/06.jpg", width: 100%), caption: [Mina and Denn, Wildborn | Art by Izzy], supplement: none, numbering: none) This time, her cut slid easily through the carapace, her other hand plunging into the opened shell and ripping out whatever she could find underneath. Armored in cold obstinacy, she carved her knife in lazy circles through its pale body, spilling out pools of its essence. Behind her, something brushed past her shoulder as Denn felled another of the monsters, its body crashing to the ground as he severed its insectile legs. His laughter settled and froze for a second as she grasped and crystallized it into memory. It had been a long time since last she had heard it. She reached the roots of the jaddi. The crowned ones had spotted her now, reeking of power and new life, and raced down from the boughs towards her like arrows to their quarry. They pooled around her in a frenzy of clicking feet and open jaws. Mina saw the top of Denn's head disappear in the crush of crowned beasts. A deep rumbling radiated outward from beneath her feet. Thick roots tore through the ground, enveloping the armored bodies of the Eldrazi and pulling them in through the cracks in the earth. Boughs of the jaddi snaked forward and pulled the rest into the body of the tree itself, encasing them in bark. The surface of the valley splintered into scintillating plates of Blight, then sank into the soft new earth that surged from below Mina and Denn's feet. #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) Tenru arrived soon after, joined by a group of a dozen heavily armed Tajuru and their mounts. Behind their ranks stood a fair-haired elf, smaller in stature but with a calm and gravitas that most often accompanied age. Her leather armor was intricately engraved, though harshly weathered by years of use. They hunkered in close to Mina, who had collapsed with her back propped up against the tree roots, cleaning her wounds. "So you are our kin from across the water?" the fair-haired elf asked. She picked up Mina's fallen knife, nearly hidden beneath the shattered layer of Blight, and handed her the hilt. "My pardon," Tenru interjected, "these are Greenweaver Mina and her brother Denn. Ghost vines of the Mul Daya". The fair-haired elf smiled kindly and bowed her head. "We welcome you as all our elven kind. Let distance and generations not separate us. What news do you bring from your kin?" Mina bowed her head in return, steeling herself to speak, though the words came easily this time. "I've come in search of Nisede, leader of the Tajuru, with the request that she accept aid from us, the...survivors of Bala Ged." "I am Nisede. What of your Speaker? Has he sent you in his place?" Mina's cheeks burned. As she started to speak, Denn gently interrupted. "We...are unsure. But I know that Mina, too, can speak with the voices of our kin. I've heard it. I—we ask to join you, that we can hold the memories of the Mul Daya safe." Nisede's face turned grave and her speech became slow and thoughtful. "My elves will continue to adapt and move, as we always have. We have heard word of a Zendikari encampment, near the Halimar Basin. An alliance of kor, human, and merfolk has arisen to make our stand or fall trying. I cannot promise you a safe place for your histories, but I can promise that we can deliver you to give your strength and your stories to the strongest place we know of." The others nodded solemnly. "Today we march to join them. Our leader is called 'Tazri,' a human from a city set on the coast of the Halimar. The city of Sea Gate."
https://github.com/Amelia-Mowers/typst-tabut
https://raw.githubusercontent.com/Amelia-Mowers/typst-tabut/main/doc/example-snippets/slice.typ
typst
MIT License
#import "@preview/tabut:<<VERSION>>": tabut, records-from-csv #import "usd.typ": usd #import "example-data/titanic.typ": titanic #let classes = ( "N/A", "First", "Second", "Third" ); #let titanic-head = titanic.slice(0, 5); #tabut( titanic-head, ( (header: [*Name*], func: r => r.Name), (header: [*Class*], func: r => classes.at(r.Pclass)), (header: [*Fare*], func: r => usd(r.Fare)), (header: [*Survived?*], func: r => ("No", "Yes").at(r.Survived)), ), fill: (_, row) => if calc.odd(row) { luma(240) } else { luma(220) }, stroke: none )
https://github.com/tobiaswuttke/rss-submission-template
https://raw.githubusercontent.com/tobiaswuttke/rss-submission-template/main/README.md
markdown
# RSS Typst Submission Template This repository provides a [Typst](https://typst.app/) template for the Research Seminar Series (RSS) at the DTIR Chair at the Hasso Plattner Institute. Please refer to the [Typst GitHub repository](https://github.com/typst/typst) for a local installation or use the [Typst web app](https://typst.app/).
https://github.com/Myriad-Dreamin/typst.ts
https://raw.githubusercontent.com/Myriad-Dreamin/typst.ts/main/fuzzers/corpora/bugs/newline-mode_00.typ
typst
Apache License 2.0
#import "/contrib/templates/std-tests/preset.typ": * #show: test-page #{ "hello" .clusters() if false { } else { ("1", "2") } }
https://github.com/dainbow/MatGos
https://raw.githubusercontent.com/dainbow/MatGos/master/themes/37.typ
typst
#import "../conf.typ": * = Разложение функции регулярной в кольце в ряд Лорана. Изолированные особые точки однозначного характера. == Разложение функции регулярной в кольце в ряд Лорана. #theorem[ Пусть $f$ голоморфна в кольце $ K = {z in CC | r < |z - a| < R }$. Тогда #eq[$forall z in K: space f(z) = sum_(n = -infinity)^(+infinity)c_n (z-a)^n$] где #eq[$c_n = 1 / (2 pi i) integral_(gamma_rho) (f(xi) d xi) / (xi - a)^(n+1)$] ] где $gamma_rho $ положительно определеная окружность радиуса $rho in (r, R)$ с центром в $а$. #proof[ Для начала покажем независимость коэфициентов от выбора $rho$. Возьмем две окружности радиусов $rho$ и $rho'$. Применим для $Gamma = rho - rho'$ интегральную теорему Коши и получим требуемое. Рассмотрим $r < r' < R' < R$. Тогда $forall z in K'_(r', R')$ #eq[$ f(z) = 1 / (2 pi i) integral_Gamma (f(xi) d xi) / (xi - z) = (2 pi i) (integral_(gamma_(R')) (f(xi) d xi) / (xi - z) - integral_(gamma_(r')) (f(xi) d xi) / (xi - z)) =: f_1 + f_2 $] Заметим, что $f_1 = integral_(gamma_(R')) (f(xi) d xi) / (xi - z)$ голоморфна в $O_(R')(a)$. А значит раскладывается в ряд Тейлора. $f_1 = sum_(n = 0)^(+infinity) c_n (z-a)^n$ Вновь раскладываем $1 / (z - xi) = sum^infinity_(n = 1) (xi - a)^n / (z-a)^(n+1)$ при $|(xi-a)/(z-a)| < 1$ Значит #eq[$ f_2(z) = sum_(n = 0)^(infinity) (z-a)^(-n-1) dot.op (c_(-n-1) := 1/ (2 pi i) integral_(gamma_(r')) f(xi) (xi - a)^n d xi) $] Итого получили требуемое, не зависящее от $r', R'$ ] #definition[ Такое представление голоморфной функции называется _рядом Лорана_ ] #lemma[_Единсвенность ряда Лорана_ Если $f(z) = sum_(n = -infinity)^(+infinity) c_n (z-a)^n$ в кольце $К$, то $f$ голоморфна в этом кольце, причем ряд лорана совпадает с данным. То есть $c_n = 1 / (2 pi i) dot.op integral_(gamma_rho) (f(xi) d xi) / (xi - a)^(n+1)$ ] #proof[ $f$ голоморфна как предел сходящегося ряда. Проверка равенства коэфициентов. Для $n=-1$ #eq[$integral_(gamma_rho) f(z) d z = sum_(-infinity)^(+infinity) integral_(gamma_rho) c_n (z-a)^n d z = c_(-1)$] Для $n!=-1$ двигаем ряд так чтобы нужный коэфициент встал на $-1$. ] == Изолированные особые точки однозначного характера. Здесь пусть $f(z)$ функция имеющая изолированную особую точку $a$, тогда: #definition[ a - устранимая особенная точка, если $exists A in CC: space lim_(z -> a) f(z) = A$ ] #definition[ a - полюс, если $lim_(z -> a) f(z) = infinity$ ] #definition[ a - существенная особенная точка, если $ exists.not lim_(z -> a) f(z) $ ] #theorem[ a - УОТ $<=> f$ ограничена в какой-то $ dot(O)_delta(a)$ ] #proof[ ($=>$) очевидно из определения предела. ($arrow.l.double$) Положим $M_(rho)(f) = max_(gamma_rho)|f|$ Тогда оценим #eq[$ |c_n| <= 1 / (2 pi) integral_(gamma_rho) (abs(f) abs(d xi) / rho^(n+1)) <= (M_rho (f)) / rho^n $] Из ограниченности, можно оценить $M_rho$ как константу. А значит при $n<0, rho->0: space |c_n| -> 0$. Следовательно |c_n|. А значит есть только регулярная часть ряда Лорана, а следовательно $a$ - УОТ. ] #theorem[ $а$ - полюс $<=>$ существует лишь конечное число ненулевых членов в главной части ряда Лорана. ] #proof[ ($arrow.l.double$) аккурано посчитаем предел и получим требуемое. ($=>$) По условию $lim_(z->a) f(z) = infinity => lim_(z->a) 1 / f(z) = 0$. Т.е функция $1/f(z)$ имеет в $a$ УОТ. В силу изолированности $a$, $1/f(z)$ голоморфна в окрестности $a$, причем отлична от 0. А значит из предыдущего доказтельства получим разложение в Тейлора. #eq[$1/f(z) = (z-a)^m h(z), h(a) != 0 => f(z) = 1/(z-a)^m dot.op 1/h(z)$] $1/h(z) $ голоморфная в окрестности $=>$ раскладывается в Тейлора ] #theorem[_Сохоцкого_ Если а - СОТ, то $forall A in overline(CC) exists {z_n} -> a, f(z_n) -> A$ ] #proof[(Необязательно) Для $A = infinity$ очевидно. Если не существует, то ограничена $=>$ УОТ. Если $A != infinity$, то рассмотрим $g(z) := 1 / (f(z) - A)$. Если А не предельная, то $f(z) - A$ отделена от нуля, а значит g(z) ограничена. Следовательно $a$ - УОТ для g. Причем $g(z) != 0$ в области определения. Тогда заметим, что $f(z) = A + 1 / g(z)$. Если $g(a) != 0$, то $a$ - УОТ для $f$. Иначе полюс. Противоречие.]
https://github.com/touying-typ/touying
https://raw.githubusercontent.com/touying-typ/touying/main/themes/default.typ
typst
MIT License
#import "../src/exports.typ": * /// Touying slide function. /// /// - `config` is the configuration of the slide. You can use `config-xxx` to set the configuration of the slide. For more several configurations, you can use `utils.merge-dicts` to merge them. /// /// - `repeat` is the number of subslides. Default is `auto`,which means touying will automatically calculate the number of subslides. /// /// The `repeat` argument is necessary when you use `#slide(repeat: 3, self => [ .. ])` style code to create a slide. The callback-style `uncover` and `only` cannot be detected by touying automatically. /// /// - `setting` is the setting of the slide. You can use it to add some set/show rules for the slide. /// /// - `composer` is the composer of the slide. You can use it to set the layout of the slide. /// /// For example, `#slide(composer: (1fr, 2fr, 1fr))[A][B][C]` to split the slide into three parts. The first and the last parts will take 1/4 of the slide, and the second part will take 1/2 of the slide. /// /// If you pass a non-function value like `(1fr, 2fr, 1fr)`, it will be assumed to be the first argument of the `components.side-by-side` function. /// /// The `components.side-by-side` function is a simple wrapper of the `grid` function. It means you can use the `grid.cell(colspan: 2, ..)` to make the cell take 2 columns. /// /// For example, `#slide(composer: 2)[A][B][#grid.cell(colspan: 2)[Footer]]` will make the `Footer` cell take 2 columns. /// /// If you want to customize the composer, you can pass a function to the `composer` argument. The function should receive the contents of the slide and return the content of the slide, like `#slide(composer: grid.with(columns: 2))[A][B]`. /// /// - `..bodies` is the contents of the slide. You can call the `slide` function with syntax like `#slide[A][B][C]` to create a slide. #let slide( config: (:), repeat: auto, setting: body => body, composer: auto, ..bodies, ) = touying-slide-wrapper(self => { touying-slide(self: self, config: config, repeat: repeat, setting: setting, composer: composer, ..bodies) }) /// Touying metropolis theme. /// /// Example: /// /// ```typst /// #show: default-theme.with(aspect-ratio: "16-9", config-colors(primary: blue))` /// ``` /// /// - `aspect-ratio` is the aspect ratio of the slides. Default is `16-9`. #let default-theme( aspect-ratio: "16-9", ..args, body, ) = { set text(size: 20pt) show: touying-slides.with( config-page(paper: "presentation-" + aspect-ratio), config-common( slide-fn: slide, ), ..args, ) body }
https://github.com/satoqz/dhbw-template
https://raw.githubusercontent.com/satoqz/dhbw-template/main/example.typ
typst
MIT License
#import "template.typ" : template #show: template.with( title: "Thesis Title", author: "<NAME>", date: datetime(year: 1970, month: 1, day: 1), logos: ( image("assets/dhbw.svg", width: 30%), image("assets/hpe.svg", width: 30%), ), details: ( "Company": "Hewlett Packard Enterprise", "Supervisor at Company": "Supervisor Name", "Supervisor at University": "Supervisor Name", "Time Period": "01.01.1970 - 01.01.2000", "Course, Student ID": "TINF01A, 1000000", ), abstract: [ #lorem(50) ], acronyms: ( API: [Application Programming Interface], JSON: [JavaScript Object Notation], ), ) = Introduction #lorem(50) @lorem-ipsum-generator == Motivation #lorem(50) == Structure of this Work #lorem(50) = State of Technology #lorem(50) = Summary & Conclusion #lorem(50) == Summary #lorem(50) == Future Work #lorem(50) == Conclusion #lorem(50)
https://github.com/ouuan/cv
https://raw.githubusercontent.com/ouuan/cv/master/README.md
markdown
Apache License 2.0
我的简历,使用 Typst 编写。 参考了 [qianxi0410/cv.typ](https://github.com/qianxi0410/cv.typ)、[OrangeX4/Chinese-Resume-in-Typst](https://github.com/OrangeX4/Chinese-Resume-in-Typst),做了很大修改,适配我的个人需求。
https://github.com/Hao-Yuan-He/resume_typst
https://raw.githubusercontent.com/Hao-Yuan-He/resume_typst/main/lib.typ
typst
/* * Package Entrypoint, links only to resume.typ for now * May add more later if I decide to also add cover letter support */ #import "./resume.typ": *
https://github.com/danbalarin/typst-templates
https://raw.githubusercontent.com/danbalarin/typst-templates/main/vse-assignment/template.typ
typst
#let project(title: "", authors: (), subtitle: "", place: "", date: "", body) = { set document(author: authors, title: title) set text(font: "New Computer Modern", lang: "en") show math.equation: set text(weight: 400) align(center)[ #block(text(weight: 500, 1.5em, "Vysoká škola ekonomická v Praze")) ] v(2em) align(center)[ #block(text(weight: 500, 1.25em, "Fakulta informatiky a statistiky")) ] pad( top: 3em, bottom: 3em, align(center)[ #image(width: 25%, "vse-fis.png") ] ) align(center)[ #block(text(weight: 700, 1.25em, title)) ] if subtitle != "" { v(1em) align(center)[ #block(text(weight: 500, 1.25em, subtitle)) ] } align(center + bottom)[ #pad( top: 3em, bottom: 3em, x: 2em, grid( columns: (1fr,) * calc.min(3, authors.len()), gutter: 1em, ..authors.map(author => align(center, text(1em, author))), ), ) ] if place != "" and date != "" { v(1em) align(center + bottom)[ #block(text(weight: 500, 1em, place + ", " + date)) ] } pagebreak() set page(numbering: "1", number-align: right) set par(justify: true) body }
https://github.com/tiankaima/typst-notes
https://raw.githubusercontent.com/tiankaima/typst-notes/master/867afe-l1_norm_minimization/main.typ
typst
#show math.equation: it => math.display(it) = $L^1$ norm minimization problem *Def 7.2* A finite-dimensional linear $L^1$ norm minimization problem is defined as: $ &O_(alpha, B) = { k | k = "argmin"_k norm(a-k B)_1 } quad quad a in RR^n, k in RR^m, B in RR^(m times n)\ // &O_B = {k | k in O_(alpha, B) | forall alpha in RR^n } = union_(alpha in RR^n) O_(alpha, B)\ $ *Def 7.3* The characteristic function space of the set $O_(alpha, B)$ is defined as: $ Lambda_B &= {f | f in RR^m, \#f(O_(alpha,B)) = 1, forall alpha in RR^n } subset V(RR^n)\ $ Here we treat $f(k) = f dot k$ ($L^2$ inner product) as a function $f: RR^m -> RR$ *Prop 7.2* Notice that the characteristic function space of the optimization problem is a linear space: $ forall f, g in Lambda_B, forall alpha, quad quad & \# f(O_(alpha,B)) = \# g(O_(alpha,B)) = 1\ forall a,b in RR, quad quad & (a dot f + b dot g)(k) := a dot f(k) + b dot g(k)\ =>& \# (a dot f + b dot g)(O_(alpha, B)) = 1\ $ *Prop 7.3* If the matrix $B=(b_(i,j))_(1<=i<=m, 1<=j<=n)$ - contains at most one nonzero element than one row (let it be the $j_0$-th row) - $forall i, forall n_j in {0,1}(forall j) quad sum_(j=1)^n (-1)^(n_j) b_(i,j) != 0$ then we can show $f=(b_(i,j_0)) in RR^m$ is a characteristic linear function of the optimization problem, which is to say $f in Lambda_B$ *Proof:* Use induction: - $m=1$ The target function $g_alpha (k) = sum_(j=1)^n abs(a_(j) - k b_(j))$ is a piecewise convex function of $k$, since the slope at each piece $(dif g_alpha)/(dif k) = sum_(j=1)^n (-1)^(n_j) b_(j) !=0 quad forall n_j in {0,1}(forall j)$, (For $k = a_j\/b_j$ points, its left and right derivitives holds the same property) which means $g_alpha (k)$ is a stricly convex function. Provided that the solution exists, using contradiction, we can show the solution is unique, so $ forall alpha quad \# O_(alpha, B) = 1 $ which would mean $ forall f: RR -> RR quad \# f(O_(alpha, B)) = 1 $ then $f_j (k) = b_j dot k$ is a characteristic function of the optimization problem. ($forall j$), a even stronger statement for $m = 1$ $qed$ - Assumng the statement holds for $forall m < M$, let $b_(M,j_0) != 0$. Consider $k_i, i={1,dots.c, M-1}$ are fixed, $g_alpha (k) = g_alpha (k_1, dots.c, k_(M-1), k_M) = g_alpha (k_M)$ is a stricly convex piecewise function of $k_M$, which could be shown similarly to the $m=1$ case: $ (diff g_alpha)/(diff k_M) = sum_(j=1)^(n) (-1)^(n_j) b_(M,j) != 0 $ The best $k_M$ could be any turning point as $k_i, i={1, dots, M-1}$ varies, which can be written as: $ & k_M in {a_l/b_(i,j_0) | b_(i,l)!=0 quad forall i} := S_(M,l) quad exists l != j_0\ "or" quad & k_M = 1/b_(M,j_0) (a_(j_0) - sum_(i=1)^(M-1) k_i b_(i,j_0))\ $ If $k_M$ in the optimal set $O_alpha$ is unique, by induction $f_0(k) = sum_(i=1)^(M-1) k_i dot b_(i,j_0)$ is unique, then $ f(k) = sum_(i=1)^M k_i dot b_(i,j_0) $ is unique. Otherwise consider $k_(M 1) != k_(M 2)$ in $O_alpha$, we denote: $ k_1 = (k_11, k_21, dots.c, k_(M 1)) \ k_2 = (k_12, k_22, dots.c, k_(M 2)) \ $ Take a mapping $lambda in [0,1] -> RR^m$ using the convex combination: $ k_lambda = lambda k_1 + (1-lambda) k_2 = (k_i)_i $ By convex property of $O_alpha$, we have $k_lambda in O_alpha$. Select a $lambda$ with the following conditions: (which is the case for $forall lambda in [0,1]quad a.e$) $ &lambda k_(M 1) + (1-lambda) k_(M 2) in.not S_(M, l) quad forall l != j_0\ => & k_M := lambda k_(M 1) + (1-lambda) k_(M 2) = 1/b_(M,j_0) (a_(j_0) - sum_(i=1)^(M-1) k_i b_(i,j_0))\ $ Then $ sum_(i=1)^M (lambda k_(i 1) + (1-lambda) k_(i 2)) b_(i,j_0) = a_(j_0) quad forall lambda in [0,1] quad a.e.\ $ Consider the mapping $[0,1] ->^lambda RR^m ->^(g_(a )) RR$ is continous, $[0,1] subset RR$ is compact, we can expand the result to $RR$ (considering it's constant at each segaments (finite), and continous in $RR$) $ sum_(i=1)^M (alpha k_(i 1) + (1-alpha) k_(i 2)) b_(i,j_0) = a_(j_0) quad forall alpha in RR $ So the linear function $f(k)=sum_(i=1)^M k_i b_(i, j_0)$ is the characteristic function of the optimization problem. $qed$
https://github.com/Error-418-SWE/Documenti
https://raw.githubusercontent.com/Error-418-SWE/Documenti/src/2%20-%20RTB/Documentazione%20interna/Norme%20di%20Progetto/Norme%20di%20Progetto.typ
typst
#import "/template.typ": * #show: project.with( title: "Norme di Progetto", subTitle: "Norme, processi e disciplina", authors: ( "<NAME>", "<NAME>", "<NAME>" ), showLog: true, ); = Introduzione == Scopo del documento Questo documento contiene le regole del _way of working_ che disciplinano le attività di ogni membro del gruppo _Error_418_. Queste regole mirano a garantire coerenza, uniformità ed efficacia nel processo collaborativo, promuovendo un ambiente di lavoro strutturato ed efficiente. L'approccio adottato per la redazione di questo documento è di natura incrementale. Ciò significa che il testo è soggetto ad aggiornamenti e revisioni continue al fine di integrare progressivamente le nuove norme, le _best practices_ e i cambiamenti che emergono nel corso dello sviluppo del progetto. Questa flessibilità consente al gruppo di adattarsi prontamente alle dinamiche di lavoro e alle esigenze specifiche del contesto, garantendo un documento sempre allineato alle necessità attuali del gruppo. == Scopo del progetto Il capitolato C5, denominato _WMS3: Warehouse Management 3D_ e aggiudicato al gruppo, ha come obiettivo la realizzazione di un sistema di gestione di magazzino in tre dimensioni. L'applicazione sviluppata consentirà all'utente di accedere a un ambiente virtuale tridimensionale, dove potrà navigare all'interno di un magazzino e visualizzare gli oggetti presenti nelle scaffalature. L'utente avrà la possibilità di cercare specifici prodotti all'interno del magazzino, sfruttando la visualizzazione 3D per individuare rapidamente la posizione degli articoli desiderati, potrà modificare l'assetto del magazzino e inviare una notifica verso l'esterno in caso ci sia il bisogno di prelevare un articolo. == Glossario #glo_paragrafo == Riferimenti <riferimenti> === Riferimenti a documentazione interna <riferimenti-interni> - Documento #glo_v: \ _#link("https://github.com/Error-418-SWE/Documenti/blob/main/2%20-%20RTB/Glossario_v" + glo_vo + ".pdf")_ #lastVisitedOn(13,02,2024) - Documento #ris_v: \ _#link("https://github.com/Error-418-SWE/Documenti/blob/main/2%20-%20RTB/Documentazione%20interna/Analisi%20dei%20Rischi_v" + ris_vo + ".pdf")_ #lastVisitedOn(13,02,2024) === Riferimenti normativi <riferimenti-normativi> - Capitolato "Warehouse Management 3D" (C5) di _Sanmarco Informatica S.p.A._: \ _#link("https://www.math.unipd.it/~tullio/IS-1/2023/Progetto/C5.pdf")_ #lastVisitedOn(13, 02, 2024) - Regolamento di Progetto: \ _#link("https://www.math.unipd.it/~tullio/IS-1/2023/Dispense/PD2.pdf")_ #lastVisitedOn(13,02,2024) - Standard ISO/IEC/IEEE 12207:2017: \ _#link("https://www.iso.org/obp/ui/en/#iso:std:iso-iec-ieee:12207:ed-1:v1:en")_ #lastVisitedOn(13,02,2024) - Standard ISO/IEC/IEEE 29148:2018: \ _#link("https://ieeexplore.ieee.org/servlet/opac?punumber=8559684")_ #lastVisitedOn(13,02,2024) - SWEBOK Chapter 6: Software Configuration Management: \ _#link("http://swebokwiki.org/Chapter_6:_Software_Configuration_Management")_ #lastVisitedOn(13, 02, 2024) - Specifica Unified Modeling Language 2: \ _#link("https://www.omg.org/spec/UML/")_ #lastVisitedOn(13,02,2024) === Riferimenti informativi <riferimenti-informativi> - Documentazione Git: \ _#link("https://git-scm.com/docs")_ #lastVisitedOn(13,02,2024) - Documentazione Jira: \ _#link("https://confluence.atlassian.com/jira")_ #lastVisitedOn(13,02,2024) - Documentazione Typst: \ _#link("https://typst.app/docs/")_ #lastVisitedOn(13,02,2024) - Documentazione Three.js: \ _#link("https://threejs.org/docs/")_ #lastVisitedOn(13,02,2024) = Processi di accordo == Processo di fornitura <processo_fornitura> _Conformant to outcomes to ISO/IEC/IEEE 12207:2017 clause 6.1.2_ === Scopo e descrizione Il processo di fornitura ha come obiettivo l'offerta di un prodotto o servizio che soddisfi i requisiti concordati con Proponente e Committente. Tra quest'ultimi e il fornitore deve essere stabilito un accordo all'interno del quale vengono definiti i requisiti, le tempistiche e i costi da rispettare. Prima di allora, il fornitore avrà effettuato un'attenta analisi del progetto proposto e dei rischi annessi alla sua realizzazione, con relative linee guida per mitigarli. === Rapporti con il Proponente Il dialogo tra il gruppo _Error_418_ e il Proponente dovrà essere attivo e frequente fino al termine del progetto didattico, in modo che si riescano a raccogliere più feedback possibili riguardo la correttezza del lavoro svolto. Questa comunicazione avverrà in due modalità: + scritta, asincrona, utilizzata per: - comunicazioni di breve durata; - condivisione di verbali e materiali informativi; - coordinamento. + orale, sincrona, durante i quali si affronteranno: - feedback sul lavoro prodotto; - chiarimenti sul capitolato; - chiarimenti riguardo casi d'uso e requisiti. I meeting avranno cadenza variabile, e saranno fissati al termine di altri incontri oppure via e-mail. Il contenuto di ogni incontro sarà raccolto all'interno del relativo verbale. Ognuno di questi verbali sarà validato dal Proponente tramite l'apposizione di una firma, e sarà liberamente consultabile all'interno del repository GitHub del gruppo dedicato ai documenti (_#link("https://github.com/Error-418-SWE/Documenti/tree/main")_), al percorso `NomeMilestone/Documentazione esterna/Verbali`, dove `NomeMilestone` è uno tra: - 1 - Candidatura; - 2 - RTB; - 3 - PB. === Documentazione prodotta In questa sezione viene descritta la documentazione prodotta dal gruppo nel processo di fornitura, la quale sarà resa disponibile al Proponente, _Sanmarco Informatica_, e ai Committenti, i professori <NAME> e <NAME>. ==== Valutazione dei capitolati Documento nel quale il gruppo ha analizzato le diverse proposte di progetto rese disponibili dai vari proponenti. Per ogni capitolato vengono presentati tre paragrafi: + *Descrizione*: vengono indicati i nominativi di Proponente e Committente, e viene presentato l'obiettivo del progetto; + *Dominio tecnologico*: vengono elencate le tecnologie consigliate dal Proponente del capitolato; + *Considerazioni*: il gruppo dà la propria valutazione sul capitolato. ==== Analisi dei rischi Nel documento di Analisi dei rischi vengono presentati i rischi a cui il gruppo potrebbe essere esposto durante il periodo in cui lavora al progetto. Ogni rischio viene classificato secondo tre parametri: - *impatto*: esprime l'effetto generato dall'evento; - *probabilità*: esprime la probabilità del verificarsi del rischio; - *conseguenze*: effetti collaterali a breve o medio termine che il rischio può comportare. Ad ogni rischio sono inoltre associate delle buone pratiche da seguire per mitigarlo. ==== Preventivo dei costi Nel Preventivo dei costi viene esposta una tabella che presenta una previsione riguardo il numero di ore di lavoro totali, per membro e per ruolo e viene fornito un calcolo del costo totale del progetto. Prima della tabella vengono spiegate le motivazioni che hanno portato alla suddivisione oraria individuata, effettuando una tripartizione del periodo di lavoro complessivo e analizzando ogni ruolo presente all'interno del gruppo. ==== Lettera di presentazione Breve documento dove il gruppo si presenta e dichiara il suo impegno nello svolgimento del capitolato scelto. Viene dato un riferimento al repository dove si potranno trovare i documenti necessari alla candidatura e vengono dichiarati il costo della realizzazione del prodotto e la data di consegna prevista. ==== Analisi dei Requisiti In questo documento vengono raccolti tutti gli Use Case e requisiti individuati dal gruppo con il supporto del Proponente. Ogni Use Case e requisito è identificato da un codice, così da essere facilmente individuabile e tracciabile. All'inizio del documento sono inoltre descritti i criteri di qualità che il gruppo ha seguito durante la redazione. ==== Piano di Progetto Documento che governa la pianificazione dell'avanzamento del progetto, determinando task e obiettivi da raggiungere e analizzando il lavoro svolto. È articolato in cinque sezioni: - Rischi e loro mitigazione; - Divisione temporale di sviluppo; - Preventivo dei costi di realizzazione; - Pianificazione del lavoro; - Consuntivo del progetto. ==== Piano di Qualifica Nel Piano di Qualifica vengono fissati obiettivi di qualità e vengono descritti i processi necessari per conseguirli con relative procedure di controllo. ==== Glossario Nel Glossario vengono elencati e definiti in modo preciso tutti i termini rilevanti utilizzati all'interno del progetto. È un documento estremamente importante per evitare situazioni di ambiguità, e garantire così una corretta comprensione della documentazione da parte di tutte le parti coinvolte. === Strumenti utilizzati In questa sezione sono indicati gli strumenti utilizzati dal gruppo nel processo di fornitura. - *Zoom*: applicazione per videoconferenze; - *Google slides*: servizio cloud offerto da Google, utilizzato dal gruppo per le presentazioni del diario di bordo, ovvero l'attività in cui il gruppo aggiorna il Committente riguardo l'andamento del lavoro; - *Jira*: Issue Tracking System utilizzato per la pianificazione del lavoro. = Processi di ciclo di vita == Processi organizzativi abilitanti I processi organizzativi abilitanti hanno la funzione di garantire la capacità dell'organizzazione di acquisire e fornire prodotti o servizi attraverso l'avvio, il supporto e il controllo di progetti. \ Questi processi forniscono l'infrastruttura e le risorse necessarie a supportare i progetti e il conseguimento degli obiettivi dell'organizzazione e degli accordi fra parti. Non sono da intendersi come un insieme esaustivo di processi aziendali atti alla gestione strategica dell'organizzazione. I processi organizzativi abilitanti implementati dal gruppo sono i seguenti: + processo di gestione dei modelli di ciclo di vita; + processo di gestione dell'infrastruttura. === Processo di gestione dei modelli di ciclo di vita<processo_ciclo_di_vita> _Conformant to outcomes to ISO/IEC/IEEE 12207:2017 clause 6.2.1_ ==== Scopo Lo scopo del processo di gestione del modello di ciclo di vita è definire, mantenere e garantire regole, processi, modelli e procedure di ciclo di vita.\ Questo processo fornisce politiche, processi, modelli e procedure del ciclo di vita coerenti con gli obiettivi dell'organizzazione, che sono definiti, adattati, migliorati e mantenuti per supportare le esigenze individuali dei progetti all'interno del contesto dell'organizzazione, e che sono in grado di essere applicati mediante metodi e strumenti efficaci e comprovati.\ Il gruppo adotta il modello PDCA (Plan-Do-Check-Act) per la gestione del ciclo di vita del software. Questo modello prevede quattro fasi: + Pianificazione (Plan): definizione degli obiettivi e dei processi necessari per raggiungerli; + Esecuzione (Do): attuazione del piano; + Verifica (Check): monitoraggio e misurazione dei processi e dei prodotti rispetto agli obiettivi e ai requisiti, e reportistica dei risultati; + Attuazione (Act): azioni per migliorare le prestazioni, se necessario, in base ai risultati della verifica. ==== Organizzazione del processo ===== Pianificazione La pianificazione del processo è compito del Responsabile, il quale al termine dello sprint precedente, in base alle attività svolte e ai risultati ottenuti, pianifica le attività da svolgere nello sprint successivo. \ La pianificazione è un'attività iterativa, che viene svolta all'inizio dello sprint. Il Responsabile, in relazione al progresso svolto, può decidere di modificare la pianificazione iniziale, aggiungendo o rimuovendo attività. \ Questo processo permette di individuare le attività da svolgere, le risorse necessarie e le tempistiche di svolgimento, mediante il sistema di ticketing offerto da Jira.\ Il risultato di questo processo è visibile all'interno del documento Piano di Progetto.\ \ ===== Esecuzione Identifica il processo di sviluppo del prodotto, dove quanto pianificato viene concretamente svolto. \ Il processo di esecuzione è composto da due attività principali: + sviluppo del prodotto; + sviluppo della documentazione. Durante questo processo, ogni ruolo svolge le attività assegnate seguendo quanto stabilito nella pianificazione. Sarà compito del Responsabile verificare che le attività siano svolte correttamente e nei tempi previsti. Ogni membro avrà la possibilità di segnalare eventuali criticità, avendo a disposizione una board apposita sulla piattaforma Miro.\ Questo permette di avere un resoconto pronto a fine sprint in merito al processo di avanzamento, individuando: \ - "Keep doing": attività che hanno dato buoni risultati e che quindi vanno mantenute; - "Things to change": attività che hanno dato risultati non soddisfacenti e che quindi vanno modificate. \ La progressione del lavoro è visibile mediante: - retrospettiva; - grafici di burndown (Jira); - board di avanzamento (Miro). I prodotti di questo processo, permettono dunque di procedere con la verifica e lo stabilimento delle contromisure e dei miglioramenti necessari. \ \ ===== Verifica Al termine di ogni sprint, il gruppo procederà con il meeting di retrospettiva, durante il quale verranno analizzati i risultati ottenuti e le attività svolte, basandosi sui prodotti della fase di esecuzione: \ + grafici di burndown: - permettono di avere una visione rapida di quanto del lavoro pianificato è stato portato a termine: si tratta di una metrica puramente quantitativa, che tiene conto del numero di ticket chiusi e del numero di ticket aperti; + board di avanzamento: - "Keep doing": attività che hanno dato buoni risultati e che quindi vanno mantenute: questo permette al gruppo di individuare il _modus operandi_ più efficace ed efficiente per svolgere le attività; - "Things to change": attività che hanno dato risultati non soddisfacenti e che quindi vanno modificate: si tratta dell'aspetto più delicato da considerare, in quanto permette di individuare le criticità e le inefficienze del processo di sviluppo, e di conseguenza di apportare le modifiche necessarie per migliorare il processo stesso. Questa analisi individua i miglioramenti da apportare al processo di sviluppo, stabilendo le contromisure necessarie per migliorare il processo stesso. \ \ ===== Attuazione L'attuazione è l'ultima fase del processo di gestione del ciclo di vita, e consiste nella messa in pratica delle contromisure stabilite durante la fase di verifica. \ L'obiettivo è sopperire alle mancanze e alle inefficienze del processo di sviluppo, in modo da migliorare la qualità del prodotto e la produttività del gruppo. \ Diventa compito del Responsabile stabilire le attività necessarie per attuare le contromisure, e di conseguenza di pianificare le attività da svolgere nello sprint successivo. \ Il risultato di questo processo è visibile all'interno del documento Piano di Progetto. \ \ ==== Ruoli ===== Responsabile Il Responsabile è la figura chiave che guida il progetto, assumendo il ruolo di referente principale per il gruppo e per gli stakeholder. \ Le responsabilità del Responsabile includono: + coordinamento: ha il compito di supervisionare i membri del gruppo, assicurandosi che le attività vengano svolte nel rispetto delle norme identificate in questo documento; + pianificazione: stabilisce le attività da svolgere, le relative scadenze e priorità, sancendo l'inizio e la fine di ogni sprint; + monitoraggio e gestione dei costi: tiene sotto controllo l'andamento del progetto, stima i costi e gestisce l'analisi dei rischi, garantendo che il progetto rimanga entro il budget previsto; + norme di progetto: si occupa della stesura e dell'aggiornamento delle norme di progetto, che devono essere rispettate da tutti i membri del gruppo; + relazioni esterne: gestisce tutte le interazioni con il Proponente e i Committenti assicurando una comunicazione fluida ed efficace; \ \ ===== Amministratore L'Amministratore è la figura incaricata di gestire l'ambiente di lavoro e gli strumenti utilizzati dal gruppo per tutta la durata del progetto. Ha il compito di assicurare che gli strumenti proposti ai membri del gruppo siano efficienti e favoriscano la qualità del lavoro. Monitora, assieme al Responsabile, il rispetto delle regole stabilite in questo documento e verifica che i servizi a disposizione del gruppo siano adeguati alle attività pianificate, promuovendo la produttività. \ Le responsabilità dell'Amministratore includono: + redazione dei verbali: l'Amministratore è responsabile della stesura dei verbali relativi ai meeting interni ed esterni; + gestione delle risorse: si occupa dell'amministrazione delle risorse, delle infrastrutture e dei servizi necessari per l'esecuzione dei processi di supporto; + automatizzazione dei processi: determina gli strumenti necessari per automatizzare i processi, come la compilazione dei file sorgenti e il sistema di versionamento automatico; + risoluzione dei problemi: affronta e risolve i problemi legati alla gestione dei processi. \ \ ===== Analista L'Analista individua i bisogni del Proponente e li trasforma in requisiti che saranno l'input delle attività successive. Il suo lavoro si svolge intensamente nel periodo di avvio del progetto, e si conclude con la stesura dell'Analisi dei Requisiti. \ Il suo compito è di rilevanza in quanto un'incompleta o superficiale analisi può impattare in modo sensibile sulle attività successive, causando ritardi e costi aggiuntivi, andando a pregiudicare la qualità e la completezza del prodotto finale. \ Le responsabilità dell'Analista includono: + documento di Analisi dei Requisiti: l'Analista è incaricato di redigere questo documento, che dettaglia i requisiti specifici del progetto. + interazione con i clienti: l'Analista lavora a stretto contatto con il Proponente o i Committenti per capire e studiare i loro bisogni; + classificazione dei requisiti: individua i requisiti e li classifica come funzionali e non funzionali, e come obbligatori, desiderabili o opzionali; + definizione del problema e degli obiettivi: l'Analista esamina la situazione attuale, identifica il problema e stabilisce gli obiettivi da raggiungere; + trasformazione dei bisogni in requisiti: durante la stesura dell'Analisi dei Requisiti, l'Analista converte i bisogni dei clienti in requisiti specifici per la soluzione. \ \ ===== Progettista Il Progettista ha il compito di sviluppare una soluzione che soddisfi le esigenze identificate dall'Analista, rispettando i vincoli individuati. Il Progettista trasforma i requisiti in un'architettura che modella il problema. \ Le responsabilità del Progettista includono: + sviluppo di un'architettura robusta e resistente ai malfunzionamenti; + realizzazione di soluzioni affidabili, efficienti, sostenibili e conformi ai requisiti; + decomposizione del sistema in componenti e organizzazione delle loro interazioni, ruoli e responsabilità; + garanzia di un basso grado di accoppiamento nell'architettura. \ \ ===== Programmatore Il Programmatore è la figura più numerosa all'intero del gruppo.\ Le sue responsabilità includono: + scrittura del codice sorgente, perseguendo manutenibilità e conformità a quanto stabilito dall'architettura definita dalla progettazione; + creazione di test specifici per la verifica e la validazione del codice. \ \ ===== Verificatore Il Verificatore controlla il lavoro svolto dagli altri membri del gruppo, assicurandosi che le norme di progetto e le aspettative siano rispettate. \ Le responsabilità del Verificatore includono: + verifica della qualità e della conformità della documentazione prodotta; + approvazione della documentazione sottoposta a verifica. \ \ === Processi di gestione dell'infrastruttura ==== Scopo Lo scopo del processo di gestione dell'infrastruttura è fornire l'infrastruttura e i servizi a supporto dell'organizzazione per il conseguimento degli obiettivi di progetto nel corso dell'intero ciclo di vita. Questo processo definisce, fornisce e regola i servizi, gli strumenti e le tecnologie di comunicazione e condivisione delle informazioni a supporto degli scopi dell'organizzazione. ==== Requisiti L'infrastruttura è costituita dai servizi, dagli strumenti e dalle tecnologie di comunicazione e condivisione delle informazioni adottate a supporto degli scopi dell'organizzazione. L'infrastruttura risponde alle necessità di comunicazione interna ed esterna. I requisiti dei processi di gestione dell'infrastruttura sono: + semplicità di adozione di strumenti e servizi; + accesso rapido alle informazioni, anche in mobilità; + non ridondanza tra strumenti e servizi adottati. ==== Infrastruttura di comunicazione I principi della comunicazione che ispirano i processi di gestione dell'infrastruttura sono: + Comunicazione aperta: le comunicazioni avvengono in modalità pubblica, ovvero tutti i membri possono partecipare (compatibilmente con i loro impegni di progetto e sempre nel rispetto delle rispettive responsabilità). I membri del gruppo hanno accesso e possono liberamente consultare i messaggi, le eventuali registrazioni e i verbali; + Comunicazione onesta: quanto comunicato rappresenta sempre il reale stato del progetto. Nessun membro, in nessun caso, deve nascondere le criticità incontrate; + Comunicazione proattiva: comunicare con cognizione di causa, offrendo spunti concreti di discussione. Ogni comunicazione deve poter essere processata dagli interessati nel minor tempo possibile; + Comunicazione frequente: la frequenza della comunicazione permette di prendere decisioni in modo tempestivo e informato. ===== Comunicazione interna <comunicazione_interna> #link("https://discord.com/")[*Discord*] rappresenta il canale primario di comunicazione interna. È una piattaforma di comunicazione che fornisce: + un servizio di messaggistica istantanea che permette la suddivisione delle conversazioni in canali tematici; + un servizio di videochiamate usato per le comunicazioni sincrone interne in modalità remota. Le comunicazioni testuali tramite messaggio istantaneo sono organizzate per argomento. Discord adotta il termine "canale" per designare tale suddivisione tematica. I canali attualmente in uso sono: - canale generale (`#random`): usato per le comunicazioni informali; - canale meeting (`#meeting`): usato per l'organizzazione dei meeting interni e la condivisione degli ordini del giorno; - canale di riferimento (`#riferimenti`): usato come bacheca per raccogliere ed organizzare, in un unico luogo, le risorse a supporto degli scopi dell'organizzazione; - altri canali tematici: le comunicazioni relative ad uno specifico prodotto dei processi dell'organizzazione avvengono in un canale dedicato. La suddivisione delle comunicazioni interne in canali ha lo scopo di ridurre le distrazioni, facilitare l'accesso alle informazioni e semplificare la comunicazione interna. Le comunicazioni sincrone in videochiamata avvengono nei cosiddetti "canali vocali". Vengono forniti quattro canali vocali generici ad accesso libero. I membri dell'organizzazione hanno la facoltà di incontrarsi in qualsiasi momento in videochiamate interne. I canali vocali non sono organizzati tematicamente perché offrono la persistenza. #link("https://miro.com/")[*Miro*] è un servizio di collaborazione per team basato su _whiteboard_. Offre la possibilità di creare board multimediali e permette la collaborazione asincrona. È utilizzato per: + raccogliere i feedback interni da discutere durante i meeting di retrospettiva; + supportare gli incontri interni di _brainstorming_; + supportare i meeting con gli interlocutori esterni. Oltre a Discord e Miro, l'organizzazione comunica anche tramite *Jira* (ITS) e *GitHub* (VCS). L'uso di questi strumenti è discusso in dettaglio nelle sezioni apposite. ===== Comunicazione esterna Le modalità e la frequenza delle comunicazioni esterne sono da stabilirsi con i diretti interessati, secondo necessità e disponibilità degli interlocutori. Le comunicazioni esterne avvengono su due canali primari: Gmail e Zoom. #link("https://mail.google.com/")[*Gmail*] è il servizio di posta elettronica di Google. L'indirizzo di posta elettronica dell'organizzazione è: #align(center, `<EMAIL>`) Viene utilizzato per tutte le comunicazioni da e verso gli interlocutori esterni. Tutti i membri dell'organizzazione possono accedere in qualsiasi momento alla casella di posta elettronica. Inoltre, tutte le conversazioni vengono inoltrate automaticamente agli indirizzi e-mail istituzionali di ciascun membro. L'indirizzo è reso noto nel frontespizio di ogni documento prodotto dall'organizzazione. #link("https://zoom.us/")[*Zoom*] è un servizio di teleconferenza. A meno di accordi specifici tra le parti, l'organizzazione utilizza Zoom per effettuare videochiamate con gli interlocutori esterni. ==== Mantenimento dell'infrastruttura Sono compiti dell'amministratore il mantenimento dell'infrastruttura, l'aggiornamento delle norme e dei processi e l'identificazione di nuovi servizi a supporto delle attività dell'organizzazione. L'organizzazione adotta nuovi servizi, strumenti e tecnologie di comunicazione avendo cura di non introdurre ridondanza. L'organizzazione si dota di un insieme di strumenti e servizi sufficienti a coprire tutti i requisiti di comunicazione. === Processo di gestione delle Risorse Umane <processo_risorse_umane> La natura didattica del progetto riduce le prerogative del processo di gestione delle Risorse umane. Per questa ragione, l'organizzazione dichiara la: \ _conformance to outcomes to ISO/IEC/IEEE 12207:2017 clause 6.2.4_. ==== Scopo Questo processo fornisce all'organizzazione le risorse umane necessarie all'esecuzione dei processi di ciclo di vita al fine di realizzare gli obiettivi di progetto, dell'organizzazione e degli stakeholder. ==== Attività e compiti ===== Identificare le competenze dei membri L'organizzazione sottopone, ad ogni nuovo membro, un form conoscitivo atto a identificare le competenze pregresse. Il form è realizzato con #link("https://www.google.it/intl/it/forms/about/")[*Google Forms*] e include domande su: + strumenti di collaborazione; + linguaggi di programmazione; + tecnologie; + strumenti di automazione; + strumenti di controllo di versione. Le risposte sono non vincolanti e non influiscono in alcun modo sulla rotazione dei ruoli, sui compiti assegnati o sull'organizzazione interna. ===== Identificare le competenze richieste Le competenze richieste sono identificate tramite: + Analisi dei Capitolati; + Studio del dominio di progetto; + Incontri con i Proponenti e successivi colloqui. ===== Sviluppare le competenze <gestione-risorse-umane-sviluppo> Lo sviluppo di nuove competenze riguarda i membri, e non i ruoli. Per questa ragione, i processi di sviluppo di competenze sono universali e condivisi. L'organizzazione si adopera per sviluppare le competenze dei membri mediante: + attività di _peer-tutoring_ in concomitanza delle rotazioni di ruolo; + pubblicazione interna di tutorial tecnici scritti (eventualmente accompagnati da brevi video, se utili a migliorare la comprensione degli argomenti trattati); + attività di _tutoring_ interno su richiesta, sincrono, in base alla necessità; + attività di _mentoring_ esterno su richiesta, in base alla necessità e alla disponibilità dell'interlocutore esterno; + condivisione delle best practice in sessione collettiva. Le sessioni di tutoring sono "a sportello" ed è responsabilità dei singoli membri richiederne l'attivazione. Il responsabile, identificati i temi di maggior interesse, può espressamente richiedere che un ruolo copra le esigenze di tutoring interno tramite le modalità sopra indicate. ===== Acquisire e fornire competenze I membri dell'organizzazione sono prestabiliti. Qualora le competenze interne all'organizzazione siano deficitarie, è richiesta l'attivazione delle attività descritte in @gestione-risorse-umane-sviluppo. Non sono previste variazioni della composizione dell'organizzazione, se non in via straordinaria e comunque discussa preventivamente con il Committente. = Processi di gestione tecnica == Processo di pianificazione di progetto <pianificazione> _Conformant to outcomes to ISO/IEC/IEEE 12207:2017 clause 6.3.1_ === Scopo Il processo di pianificazione di progetto ha come scopo la produzione e coordinazione di un piano efficace ed applicabile per garantire una corretta gestione del lavoro. La pianificazione viene inserita in un documento denominato Piano di Progetto (@PdP). === Risultati (Piano di Progetto) <PdP> Il Piano di Progetto è il documento principale che viene redatto durante questo processo, e ha il compito di governare la pianificazione e l'avanzamento del progetto. In questo documento vengono determinati i task e gli obiettivi da raggiungere, fornendo anche un'analisi critica del lavoro svolto fino a quel momento accompagnata dai grafici di Gantt e di burndown. Sono presenti cinque sezioni, di cui le prime quattro rientrano nel processo di pianificazione: + Rischi e loro mitigazione; + Divisione temporale di sviluppo; + Preventivo dei costi di realizzazione; + Pianificazione del lavoro; + Consuntivo del progetto. La redazione del documento va di pari passo con l'avanzamento del progetto, in modo tale da essere sempre aggiornato alla situazione corrente del lavoro. === Attività Nel processo di pianificazione sono presenti due attività principali: + definizione del progetto; + pianificazione del progetto e della gestione tecnica. ==== Definizione del progetto In questa attività il gruppo deve definire tutto ciò che caratterizza il progetto, ovvero i suoi obiettivi e vincoli, sia di carattere funzionale che tecnologico. Durante la lavorazione del progetto verranno prodotti diversi output, che possono essere suddivisi nelle due macro categorie di: documentazione, codice. Entrambi questi prodotti dovranno essere realizzati rispettando determinate regole e processi, ed è quindi necessario che il gruppo definisca in questa attività uno o più cicli di vita da seguire. ==== Pianificazione del progetto e della gestione tecnica È l'attività principale del processo, nella quale viene definita nel concreto la pianificazione. ===== Suddivisione temporale Il gruppo ha individuato tre periodi di lavoro principali: - raccolta e Analisi dei Requisiti: vengono delineati i requisiti che il prodotto finale dovrà rispettare tramite un continuo rapporto con il Proponente; - sviluppo della Requirements and Technology Baseline (RTB): si studiano le tecnologie da utilizzare e si applicano le conoscenze acquisite per realizzare un PoC (Proof of Concept), ovvero un prodotto software che permetta di dimostrare la padronanza delle tecnologie selezionate ai fini dello sviluppo del progetto; - periodo di sviluppo del Minimum Viable Product (MVP): viene progettato e implementato un prodotto software che rispetti almeno i requisiti minimi di accettazione, e che offra tutte le funzionalità richieste. Ognuno di questi viene suddiviso a sua volta in periodi della durata di una settimana denominati _sprint_. Al termine di ogni _sprint_ viene effettuato un incontro interno di retrospettiva, nel quale si analizza criticamente la settimana appena conclusa, mostrandone aspetti positivi, aspetti da migliorare e fissando obiettivi che verranno poi riportati nell'Issue Tracking System sotto forma di task. Questi andranno a comporre il _backlog_ dello _sprint_ successivo, e il loro progressivo completamento andrà a produrre un _burndown-chart_, utilizzato dal gruppo come strumento che rappresenti in modo oggettivo l'andamento del lavoro. ===== Definizione di ruoli, responsabilità e costi Al fine di migliorare l'assegnazione del lavoro vengono definiti sei ruoli, ognuno dei quali con precise responsabilità da rispettare. Ogni membro del gruppo dovrà assumere ognuno di questi ruoli all'interno del periodo di lavoro al progetto. L'assegnazione dei ruoli avviene con frequenza bisettimanale. Di seguito viene riportata la descrizione di ogni ruolo con i relativi compiti: + *Responsabile*: è presente durante l'intero progetto, in particolare si occupa di: - coordinare il gruppo; - verificare che il lavoro proceda secondo le tempistiche e i costi stabiliti; - rappresentare il gruppo nei rapporti con il committente; - gestire la pianificazione di ogni _sprint_. + *Amministratore*: ruolo presente durante tutto il progetto. Ha il compito di: - predisporre e controllare il corretto utilizzo delle procedure e degli strumenti adottati; - implementare e manutenere gli automatismi in modo da migliorare l'efficienza del gruppo. + *Analista*: è presente principalmente nei primi due periodi del progetto. Si occupa di redigere il documento Analisi dei Requisiti, nel quale: - definisce i casi d'uso; - raccoglie e classifica i requisiti. + *Progettista*: ruolo presente principalmente negli ultimi due periodi, nei quali: - effettua uno studio delle tecnologie proposte, mirato alla definizione dello stack tecnologico da usare; - delinea l'architettura del prodotto; - definisce le linee guida implementative valutando le scelte più efficienti e sostenibili. + *Programmatore*: è attivo negli ultimi due periodi del progetto, nei quali: - si occupa della codifica del PoC, senza partire da una progettazione ben definita visto l'obiettivo del Proof of Concept; - traduce in codice eseguibile l'architettura del prodotto finale definita dal progettista durante il periodo di sviluppo del MVP. + *Verificatore*: è presente durante l'intero progetto, e si occupa di controllare che il lavoro prodotto dal gruppo rispetti gli standard qualitativi adottati. Ad ogni ruolo è inoltre associato un costo orario, sulla base del quale il gruppo calcola il preventivo totale del progetto e quello di ogni _sprint_ seguito dal relativo consuntivo. Il costo orario viene calcolato in base alla sua importanza all'interno del progetto, misurata in termini di competenze e disponibilità della risorsa. == Processo di valutazione e controllo di progetto <valutazioneControllo> _Conformant to outcomes to ISO/IEC/IEEE 12207:2017 clause 6.3.2_ === Scopo Il processo di valutazione e controllo ha lo scopo di determinare lo stato del progetto tramite la verifica dell'allineamento del lavoro con i piani definiti. Tale allineamento viene dimostrato osservando i seguenti parametri: - tempistiche; - costi; - obiettivi raggiunti. Questo viene fatto all'interno di revisioni periodiche chiamate retrospettive, e viene messo per iscritto all'interno dei verbali di tali riunioni e nei paragrafi di consuntivo del Piano di Progetto. === Risultati Come risultato dell'implementazione del processo di valutazione e controllo si elencano i seguenti: - valutazione dell'adeguatezza di ruoli, responsabilità e risorse; - esecuzione delle azioni correttive scaturite dalle revisioni di progresso; - viene avviata, se necessaria, la ripianificazione del progetto; - viene autorizzata l'azione del progetto di avanzare (o meno) da un traguardo o evento programmato al successivo; - vengono registrati gli obiettivi raggiunti. I risultati sono espressi e analizzati nei paragrafi di consuntivo del Piano di Progetto. === Attività ==== Piano di valutazione e controllo del progetto La valutazione e il controllo del progetto avvengono a cadenza settimanale, in corrispondenza della riunione di retrospettiva. Durante questa riunione si valuta ciò che è stato svolto durante il periodo di lavoro (_sprint_) che si sta concludendo, se ne identificano i problemi e si decidono soluzioni di controllo che vadano a risolvere o arginare i problemi individuati. Oltre a queste revisioni periodiche interne, sono presenti attività nelle quali il gruppo espone la propria situazione al Proponente, tramite riunione su Zoom, e Committente, tramite le attività denominate "diario di bordo". Inoltre, è necessario che il gruppo svolga delle revisioni tecniche con il Committente per avere una valutazione esterna. Queste due revisioni sono chiamate Requirements and Technology Baseline (o RTB) e Product Baseline (o PB). ==== Valutazione <valutazione> Durante l'attività di valutazione il gruppo deve analizzare la situazione del progetto, e per fare ciò deve adottare degli strumenti che rappresentino tale situazione nel modo più oggettivo possibile. Il momento in cui si effettua questo compito è la retrospettiva settimanale. Questa si svolge tramite meeting interno su Discord con il supporto di una board Miro. Il meeting è suddiviso concettualmente in tre parti, rappresentate all'interno della board da tre riquadri: - Keep doing: raccoglie tutti gli aspetti positivi (e di conseguenza da mantenere) dello sprint; - Things to change: raccoglie tutte le problematiche incontrate durante lo sprint; - To do e Improvements: raccoglie tutte le attività da svolgere nel prossimo sprint, alcune delle quali direttamente collegate agli elementi appartenenti a "Things to change". Tramite Miro il gruppo riesce ad avere una panoramica della situazione del lavoro, che viene poi completata da Jira, l'Issue Tracking System adottato. Al suo interno il gruppo ha definito le due milestone esterne (RTB e PB), nelle quali ha creato delle Epic che rappresentano ciò che è necessario produrre per quella milestone, e che raccolgono tutti i task necessari alla produzione di tali prodotti (documenti o software). Milestone e Epic vengono accompagnate all'interno di Jira da una barra di completamento che rappresenta in verde il lavoro svolto, in blu il lavoro in fase di svolgimento e lascia vuota la parte dedicata alle attività definite ma non ancora in svolgimento. Queste barre contribuiscono a fornire una rappresentazione oggettiva della situazione del progetto. Oltre a queste, Jira offre la funzionalità di visualizzazione di un burndown-chart, ovvero un grafico che rappresenta l'andamento del lavoro all'interno di uno sprint in due possibili modalità: - quantità di story point completati; - quantità di issue completate. Entrambe le rappresentazioni pongono nell'asse $x$ del grafico il tempo, indicato in giorni. Questi grafici contengono inoltre una retta rappresentante l'andamento ideale del lavoro, grazie alla quale risulta più semplice verificare l'efficienza del gruppo. Al termine dell'incontro di retrospettiva viene redatto il paragrafo di consuntivo dello sprint nel Piano di Progetto, nel quale, oltre a fare un resoconto dello sprint, si analizza il suo l'aspetto economico: in base ai ruoli impegnati e al monte ore produttivo svolto, si calcola il costo effettivo del periodo concluso, aggiornando conseguentemente il costo preventivato e il documento Piano di Progetto. Questo indicatore contribuisce ad avere un resoconto completo del progetto, e permette al gruppo di comprendere meglio come sta lavorando e se sta gestendo correttamente le risorse a sua disposizione. ==== Controllo Nell'attività di controllo figurano i seguenti task: - azioni correttive; - ripianificazione; - azioni di cambiamento dovute a richieste del Committente e/o Proponente; - autorizzazione ad avanzare alla successiva milestone. ===== Azioni correttive Nell'attività di controllo si intraprendono azioni correttive nei confronti dei problemi individuati. Questi problemi possono essere di duplice natura: - mancato raggiungimento degli obiettivi prefissati; - miglioramenti e accortezze da adottare. ====== Mancato raggiungimento degli obiettivi prefissati È necessario che alla chiusura dello sprint le attività ancora in fase di svolgimento vengano riportate nello sprint successivo, insieme a tutte quelle attività pianificate ma non ancora iniziate che sono considerate importanti. Tutte le attività che non vengono considerate importanti, ad esempio attività di cui si è rivalutato il grado di priorità, vengono riportate nel backlog. Una situazione di mancato raggiungimento degli obiettivi può essere sinonimo anche da una pianificazione errata e troppo ottimista, ed è quindi necessario che essa sia rivista e migliorata. ====== Miglioramenti e accortezze da adottare Le soluzioni correttive vengono decise dal gruppo tramite la visualizzazione e l'analisi della board Miro durante la retrospettiva. Nella board infatti, come esposto nella @valutazione, alcuni dei task raccolti rispondono direttamente ai problemi individuati nella parte di Things to change. ===== Ripianificazione La ripianificazione ha atto quando gli obiettivi cambiano nel corso dello sprint o alcune ipotesi fatte in fase di pianificazione si rivelano sbagliate. La ripianificazione viene gestita tramite Jira, che consente di aggiornare i task attivi, permettendo anche la comunicazione tempestiva dei cambiamenti al gruppo. ===== Azioni di cambiamento dovute a richieste del Committente e/o Proponente Le azioni di cambiamento dovute a richieste del Committente e/o Proponente sono recepite attraverso i canali di comunicazione con quest'ultimi (Zoom, mail) e vengono registrate nei rispettivi verbali. A queste azioni viene attribuita un'alta priorità per garantire massima soddisfazione nel cliente finale. ===== Autorizzazione ad avanzare alla successiva milestone L'autorizzazione ad avanzare alla successiva milestone di progetto viene concessa dal Committente e/o Proponente in seguito ai colloqui pianificati su Zoom con quest'ultimi. Il gruppo si riserva di procedere verso la milestone successiva solo una volta ricevuta l'approvazione richiesta, in modo da non portare avanti difetti e problematiche che potrebbero risultare insidiosi da correggere una volta entrati in un periodo avanzato del progetto. == Processo di gestione delle Decisioni <processo_gestione_decisioni> _Conformant to outcomes to ISO/IEC/IEEE 12207:2017 clause 6.3.3_ === Scopo Lo scopo del processo di Gestione delle Decisioni è fornire un quadro strutturato per identificare, categorizzare e valutare le decisioni che si intendono intraprendere, selezionando la migliore in termini di benefici attesi, costi e rischi associati. \ === Risultati Come risultato dell'efficace attuazione del processo di Gestione delle Decisioni: - vengono identificate le decisioni che richiedono un'analisi alternativa; - vengono identificati e valutati i percorsi di azione alternativi; - viene selezionato un percorso di azione preferito; - vengono identificate la risoluzione, la giustificazione della decisione e le ipotesi che portano ad una sua necessità. === Attività ==== Presentazione delle decisioni Ogni decisione viene presentata identificandone: - tipologia; - obiettivo; - soluzione proposta; - vantaggi; - svantaggi; - impatto in termini di tempi e costi. Il processo di decision making viene prevalentemente svolto nel meeting di retrospettiva, in modo da non contrastare la pianificazione dello sprint in corso ed evitare un eccessivo numero di meeting interni che potrebbero comportare difficoltà organizzative e un rallentamento dell'avanzamento. Alcune decisioni potrebbero richiedere il coinvolgimento di soggetti esterni, come Proponente e Committente, soprattutto nei casi in cui sia richiesta una figura con maggiore esperienza nel campo di riferimento. Solo decisioni critiche riguardo cambiamenti sostanziali o nuove direzioni di lavoro possono far scaturire meeting interni mirati. Il resoconto di quanto deciso sarà visibile all'interno del verbale redatto a fine meeting. ===== Strategie di decision-making utilizzate + *Strategia collaborativa*: prevede che la decisione venga presentata e votata in modo collaborativo, coinvolgendo tutti i membri del gruppo e mediante una votazione con un sistema maggioritario, in modo che il risultato rappresenti la volontà della maggioranza.\ Strategia utilizzata per le decisioni: - organizzative; - dei requisiti; - qualitative. + *Strategia expertise decision-making*: prevede che la decisione venga presentata e analizzata mediante la consultazione di figure esterne più esperte, individuabili nel Proponente o nel Committente, la cui esperienza risulta determinante. \ Questa strategia viene utilizzata per le decisioni: - implementative; - tecnologiche; - architetturali. ==== Analisi delle decisioni Le decisioni possono riguardare diversi aspetti del capitolato, e la loro categorizzazione è utile per individuare la migliore strategia di gestione e i ruoli coinvolti. Le decisioni vengono dunque così classificate: + *Decisioni organizzative*: sono relative al modo di lavorare, cioè a come vengono gestiti i processi di avanzamento del progetto. Esempi notevoli sono le decisioni focalizzate alla coordinazione del gruppo o alla scelta degli strumenti da utilizzare per la gestione del progetto (ad esempio: scelta dell'ITS, delle piattaforme per la comunicazione e per la collaborazione): - documento soggetto a modifiche: `Norme di Progetto`; - ruoli responsabili dell'aggiornamento: Responsabile, Amministratori; - strategia di decision-making: collaborativa. + *Decisioni tecnologiche*: sono relative allo stack tecnologico da adottare durante lo sviluppo del progetto: - documento soggetto a modifiche: `Norme di Progetto`; - ruoli responsabili dell'aggiornamento: Responsabile, Progettisti; - strategia di decision-making: expertise decision-making. + *Decisioni sui requisiti*: sono relative ai requisiti del prodotto software. Possono riguardare aspetti funzionali e non funzionali: - documento soggetto a modifiche: `Analisi dei Requisiti`; - ruoli responsabili dell'aggiornamento: Analisti; - strategia di decision-making: collaborativa. + *Decisioni di implementazione*: sono decisioni relative alla stesura del codice: - documento soggetto a modifiche: `Norme di Progetto`, documenti tecnici (diagramma delle classi); - ruoli responsabili dell'aggiornamento: Responsabile, Progettisti, Programmatori; - strategia di decision-making: expertise decision-making. + *Decisioni architetturali*: sono decisioni relative ai pattern e alle architetture riguardanti il software: - documento soggetto a modifiche: `Norme di Progetto`, documenti tecnici (diagramma delle classi, diagramma dei casi d'uso); - ruoli responsabili dell'aggiornamento: Responsabile, Progettisti; - strategia di decision-making: expertise decision-making. + *Decisioni sulla qualità*: sono decisioni relative ai controlli di qualità: - documento soggetto a modifiche: `Piano di Qualifica`; - ruoli responsabili dell'aggiornamento: Responsabile, Verificatori; - strategia di decision-making: collaborativa. == Processo di Gestione dei Rischi <processo_gestione_rischi> _Conformant to outcomes to ISO/IEC/IEEE 12207:2017 clause 6.3.4_ === Scopo Lo scopo del processo di Gestione dei Rischi è identificare, analizzare, trattare e monitorare costantemente i rischi, così da poterli affrontare sistematicamente durante l'intero ciclo di vita del progetto. === Risultati Come risultato dell'implementazione del processo di Gestione dei Rischi: - vengono identificati e analizzati i rischi; - vengono identificate e priorizzate le opzioni di trattamento del rischio; - viene selezionato ed implementato un trattamento appropriato; - i rischi vengono valutati per verificare cambiamenti di stato e progressi nel trattamento. I risultati sono raccolti nel documento #ris. === Attività e compiti ==== Pianificazione della Gestione dei Rischi La strategia di Gestione dei Rischi per il progetto è basata su un approccio proattivo per identificare e mitigare i rischi in tutte le fasi del suo ciclo di vita. \ Ad ogni rischio individuato viene associato un profilo basato sia sulla probabilità di occorrenza che sull'impatto che essi hanno sullo stato di avanzamento dei lavori e sul progetto stesso. L'impatto può essere "lieve", "medio" o "grave" in base alla sua entità. La probabilità di occorrenza viene identificata tramite un valore intero da 1 a 5, dove 1 esprime una probabilità molto bassa, mentre 5 esprime una frequenza attesa sostenuta.\ Il gruppo definisce approcci di trattamento appropriati, compresi piani di mitigazione specifici. ==== Gestione del profilo di rischio + *Definizione e registrazione delle soglie e delle condizioni di rischio*:\ le soglie di rischio sono stabilite sulla base della probabilità di occorrenza e dell'impatto. I rischi con un impatto negativo elevato sono trattati in modo più rigoroso rispetto a quelli con un impatto inferiore; + *Creazione e mantenimento di un profilo di rischio*:\ il profilo di rischio contiene tutte le informazioni necessarie per la Gestione dei Rischi, come il loro stato, le soglie, le probabilità, le azioni richieste in caso di occorrenza e le conseguenze previste. Viene aggiornato in modo tempestivo in risposta ai cambiamenti nelle condizioni del progetto; + *Fornitura del profilo di rischio rilevante agli stakeholder in base alle loro esigenze*:\ il profilo di rischio viene all'occorrenza discusso nei meeting interni e/o esterni e tutte le parti interessate allo stato attuale dei rischi e delle azioni di trattamento possono consultare il documento #ris_v. ==== Analisi dei rischi Questa attività consiste nei seguenti compiti: + *identificazione del rischio ed associazione ad uno specifico profilo, secondo quanto descritto nella pianificazione della Gestione dei Rischi*:\ l'identificazione avviene durante tutte le fasi di sviluppo. Inoltre, i rischi emergono dall'analisi delle misurazioni di qualità dei processi e del sistema software in evoluzione; + *valutazione di ciascun rischio rispetto alle sue soglie di accettazione*:\ ogni rischio viene valutato rispetto alle soglie stabilite, il superamento delle quali attiva delle modalità di trattamento specifiche. ==== Trattamento dei rischi Questa attività consiste nei seguenti compiti: + *definizione e registrazione delle strategie e delle misure di trattamento consigliate per ciascun rischio che superi la soglia di tolleranza*. \ Queste possono includere:\ - l'eliminazione del rischio; - la riduzione della sua probabilità o gravità; - l'accettazione del rischio. Vengono anche registrate informazioni sull'efficacia delle alternative di trattamento; + *nel caso di accettazione di un rischio al di sopra della soglia, attribuzione di priorità elevata e monitoraggio costante*:\ pratica necessaria per valutare la necessità di futuri interventi di trattamento del rischio o eventuali modifiche della sua priorità; + *coordinamento dell'azione di gestione dopo la selezione di una strategia di trattamento del rischio*:\ dopo la selezione di un trattamento del rischio, vengono coordinate azioni di gestione per implementare le decisioni prese. Il processo di valutazione e controllo del progetto può essere applicato. ==== Monitoraggio dei rischi Questa attività consiste nei seguenti compiti: + *monitoraggio continuo dei rischi e del contesto della loro gestione per eventuali loro cambiamenti*; + *monitoraggio continuo di possibili nuovi rischi durante l'intero ciclo di vita*. Il monitoraggio dei rischi avviene principalmente in sede di meeting interno a seguito di analisi retrospettive. == Processo di Gestione della Configurazione <processo_gestione_configurazione> _Conformant to outcomes to ISO/IEC/IEEE 12207:2017 clause 6.3.5_ === Scopo Lo scopo della Gestione della Configurazione è gestire e controllare gli elementi del sistema e le configurazioni durante il ciclo di vita. Lo scopo principale è tracciare e coordinare le procedure necessarie alla modifica della documentazione e del codice sorgente. === Risultati Come risultato dell'implementazione riuscita del processo di Gestione della Configurazione: - vengono identificati e gestiti gli elementi che richiedono la gestione della configurazione; - vengono stabilite le linee base di configurazione; - sono controllate le modifiche agli elementi sotto gestione della configurazione; - sono disponibili informazioni sullo stato della configurazione; - le release dei documenti sono controllate e approvate. === Attività ==== Versionamento ===== Generalità Il versionamento è un processo che permette di tenere traccia delle modifiche effettuate su un prodotto software o documentale. Per ogni modifica viene creata una nuova versione del prodotto, che viene identificata da un numero di versione. Il numero di versione è composto da tre cifre separate da un punto, e segue la convenzione seguente: #align(center, `X.Y.Z`) dove: - X: indica il numero di versione principale, aggiornato al cambiamento della struttura del documento. Riguarda dunque cambiamenti di organizzazione del documento, dei suoi paragrafi e della presentazione delle informazioni, nonché cambiamento dei parametri necessari nel template dei documenti; - Y: indica il numero di versione secondaria, aggiornato all'aggiunta o alla rimozione di paragrafi; - Z: indica il numero di versione di revisione e correzione, aggiornato a seguito di cambiamenti minimi o correzioni ortografiche. L'aggiornamento di una delle cifre del numero di versione azzera le cifre di rilevanza inferiore. - Questo schema descrive il versionamento dei documenti; - Un normale numero di versione deve avere la forma `X.Y.Z`, dove `X`, `Y` e `Z` sono interi non negativi; - Numeri di versione con `X` pari a 0 indicano documenti in lavorazione, da non considerarsi pronti al rilascio; - Dopo il rilascio, il contenuto della versione non deve essere modificato. Qualsiasi modifica successiva al rilascio deve causare un cambio nel numero di versione. ===== Tracciamento modifiche <tracciamento-modifiche> Il tracciamento delle modifiche avviene per mezzo di automazioni che permettono di identificare: - versione del documento modificato; - data di modifica (gg-mm-aaaa, ddd); - numero della pull request di riferimento; - titolo della pull request di riferimento; - autore della modifica; - revisore incaricato. Tali informazioni sono salvate in un file CSV, unico per ogni documento. Questo file, denominato _log.csv_, è salvato nella cartella dedicata al documento a cui si riferisce, e viene generato automaticamente da una GitHub Action invocata all'apertura, riapertura, sincronizzazione e chiusura di una pull request. Maggiori dettagli al paragrafo dedicato (@automazioni). Ogni documento, nella sezione direttamente sottostante all'indice, mostra in formato tabellare le informazioni relative al tracciamento delle modifiche, leggendo le informazioni dal file _log.csv_. #figure(table( align: left, columns: (1fr, 1.7fr, 0.8fr, 5fr, 2.1fr, 2.1fr), [*Ver.*],[*Data*],[*PR*],[*Titolo*],[*Redattore*],[*Verificatore*], [1.0.0], [11-12-2023,\ Mon], [90], [DOC-123 Redazione paragrafo], [Riccardo \ Carraro], [Mattia \ Todesco] ), caption: [Esempio tracciamento modifiche]) ===== Tecnologie adoperate ====== GitHub <repository-github> Lo strumento di versionamento scelto dal gruppo è GitHub. Il gruppo Error_418 ha creato un'organizzazione omonima su GitHub in modo da gestire e separare il lavoro in più repository pensate per scopi e contenuti diversi: - *Documenti*: repository contenente la documentazione prodotta; - *PoC*: repository contenente i Proof of Concept prodotti. Documenti è la repository dedicata alla documentazione prodotta, la quale possiede due branch principali: - `main`: contiene i file pdf dei documenti prodotti solamente in seguito ad un processo di review con esito positivo; - `src`: contiene i file sorgenti dei documenti prodotti, file di configurazione e di supporto. Documenti è organizzata in modo da suddividere la documentazione necessaria alle revisioni esterne che il gruppo dovrà affrontare: - *RTB*: contiene i file necessari alla Requirements and Technology Baseline; - *Documentazione esterna*: contiene i documenti ad uso esterno; - *Verbali*: contiene i verbali delle riunioni esterne; - *doc_file_name* / - doc_file_name.typ: file sorgente del documento; - log.csv: registro delle modifiche associato al documento; - *Documentazione interna*: contiene i documenti ad uso interno; - *Verbali*: contiene i verbali delle riunioni interne; - *doc_file_name* / - doc_file_name.typ: file sorgente del documento; - log.csv: registro delle modifiche associato al documento; - *PB*: contiene i file necessari alla Product Baseline. Al fine di garantire uno svolgimento delle attività in parallelo, la strategia utilizzata dal gruppo durante lo sviluppo è il _featuring branching_. È presente un branch per le release e un branch per lo sviluppo dal quale vengono creati dei branch per ogni nuova funzionalità o modifica da apportare. Questi ultimi vengono identificati dal codice DOC-XXX, dove XXX è il numero del relativo task su Jira. I branch di feature vengono integrati tramite pull request. ====== GitHub Actions <automazioni> L'intero processo di versionamento è accompagnato da una serie di automazioni, realizzate tramite GitHub Actions, che sollevano i componenti del gruppo dall'onere manuale di attività come la compilazione dei documenti, l'aggiornamento del registro delle modifiche (file _log.csv_) e la pubblicazione dei documenti dopo la verifica. *Workflow delle automazioni:* #figure(image("./imgs/flusso_actions.svg", format: "svg"), caption: [Workflow delle automazioni]); Alla creazione della pull request si avvia il workflow per la compilazione e la registrazione delle modifiche avvenute. Prima di procedere è necessario inserire informazioni essenziali ai fini di ottenere maggiore chiarezza e tracciabilità nel messaggio di pull request, quali: - titolo conforme, contenente il nome del task di riferimento su Jira legata alla pull request, nel formato _DOC-XXX titolo_; - identificativo di almeno un verificatore; - eventuali note aggiuntive. Il workflow è composto dai seguenti passaggi: + *fetch delle informazioni dei file modificati*: vengono recuperate le informazioni relative ai file modificati nella pull request, quali: - nome del file; - path del file. + *controllo del numero di file modificati*: se il numero di file modificati è maggiore di 1, il workflow termina con un errore; + *controllo dell'esistenza del file _log.csv_*: se il file non esiste, viene creato (sinonimo di creazione del documento); + *rilascio della review*: il verificatore si occupa di controllare il documento e rilasciare la review, segnando i cambiamenti richiesti; + *richiesta di una nuova review per verificare che i cambiamenti apportati siano corretti*; + *nel momento in cui la review termina con esito positivo, si procede al recupero della versione corrente del documento*: - se non esiste il corrispettivo pdf nel branch main, allora il documento non era mai stato pubblicato, pertanto la sua versione di partenza sarà fissata a 1.0.0; - se esiste il corrispettivo pdf nel branch main, essendo la versione contenuta nel nome del file, si procede al recupero della versione corrente del documento, modificando la versione X.Y.Z in base all'analisi del documento mediante uno script python; + *aggiornamento del file _log.csv_*: il file di log viene aggiornato con le informazioni relative alla modifica effettuata: questo passaggio, avvenendo solamente a seguito di review positiva, permette di garantire che vengano segnate solamente le modifiche che hanno superato il processo di verifica; + *compilazione del documento*: aggiornato il file _log.csv_ e recuperato il numero di versione, il documento è pronto per essere compilato, mostrando numero di versione e registro delle modifiche aggiornati; + *pubblicazione del documento*: terminati i workflow precedenti, se si avvia la procedura di merge a seguito del processo di verifica, il documento pdf generato dalla compilazione viene pubblicato nel ramo main della repository; + *merge non confermato*: qualora a termine della compilazione del documento non venisse confermato il merge da parte del verificatore, significa che è stato individuato un ulteriore errore o correzione da dover apportare al documento prima della sua pubblicazione sul ramo main del repository. In questa circostanza sarà dunque necessario rilasciare un'ulteriore review. L'esecuzione riprende dal punto 4. L'azione manuale si riduce solamente al rilascio di review e conferma di merge, mentre tutte le altre attività vengono automatizzate. All'approvazione della pull request, e alla conseguente chiusura del branch, un'ulteriore automazione integrata su Jira, permette di aggiornare in automatico lo stato del task collegato alla pull request, portandolo allo stato di "Completato". ====== Typst Il gruppo utilizza Typst come strumento di scrittura e compilazione dei documenti. \ Al fine di dare una struttura comune ai documenti si è creato un file _template.typ_ parametrizzato, sfruttando la possibilità di produrre un file pdf compilando insieme più file Typst. Questo file contiene le impostazioni di base per la creazione di un documento: - `title`: titolo del documento; - `subTitle`: sottotitolo del documento; - `docType`: tipologia del documento (Verbale, Documento); - `date`: data di creazione del documento; - `externalPartecipants`: partecipanti esterni al gruppo; - `authors`: autori del documento; - `reviewers`: revisori del documento; - `missingMembers`: membri assenti durante i meeting; - `location`: luogo di incontro; - `timeStart`: ora di inizio incontro; - `timeEnd`: ora di fine incontro; - `showLog`: flag che indica se mostrare il tracciamento delle modifiche; - `showIndex`: flag che indica se mostrare l'indice; - `isExternalUse`: flag che indica se il documento è per uso esterno. Al momento della creazione di un nuovo documento sarà sufficiente importare il modello e specificare i parametri sopra elencati. \ Al fine di semplificare la procedura di creazione di un documento, è stato condiviso un documento di testo denominato _quickstart.txt_ che contiene la configurazione base per la stesura dei documenti. ==== Tracciamento dei task e amministrazione dello stato di configurazione ===== Jira Jira è lo strumento centrale per la gestione e la tracciabilità dei task assegnati ai membri del gruppo. L'integrazione con GitHub permette a Jira di lavorare e apportare modifiche direttamente al repository del gruppo, permettendo la creazione, gestione e chiusura di branch e al conseguente aggiornamento dello stato dei task. Ogni task è identificato da un codice univoco incrementale nel formato `DOC-XXX`, dove `XXX` è un numero positivo sequenziale, che permette di identificarlo. Ogni task è caratterizzato da: - codice identificativo `DOC-XXX` generato automaticamente da Jira; - titolo; - descrizione (opzionale); - stato ("Da completare", "In corso", "In verifica", "Completato"); - assegnatario; - story point (stima del carico di lavoro); - epic story (milestone) di riferimento. Nel processo di versionamento e di tracciamento delle modifiche, Jira ricopre un ruolo fondamentale, grazie anche alla sua integrazione con GitHub: nel momento in cui si intende avviare un task, è necessario seguire i seguenti passaggi: - aprire il task su Jira; - selezionare l'opzione di creazione di un branch dedicato al task (integrazione con GitHub); - selezionare la repository e il branch da cui creare il nuovo branch. A questo punto, il task si aggiornerà nello stato "In corso" e verrà aperto il relativo branch. Terminato il task ed effettuata la pull request, lo stato del ticket passerà automatica a "In verifica". Superato il processo di verifica, Jira provvederà ad aggiornare lo stato del task in "Completato". ====== Backlog Ogni task da svolgere è segnato all'interno del backlog di Jira. Durante la pianificazione dello sprint, si definisce lo sprint backlog, il sottoinsieme di attività provenienti dal backlog che si intendono portare a termine entro la conclusione dello sprint. A differenza dello sprint backlog definito durante la pianificazione, il backlog viene espanso man mano che si riscontrano nuovi task necessari o a seguito di decisioni prese durante le riunioni interne o esterne. ====== Board Le board di Jira permettono, similmente allo sprint backlog, di avere una visione d'insieme delle attività da svolgere, ma con un approccio più visuale e intuitivo. I task sono organizzati in quattro colonne, rappresentanti lo stato: - *da completare*: non ancora avviati, ovvero non esiste il branch dedicato; - *in corso*: in fase di svolgimento, ovvero branch dedicato al task creato; - *in verifica*: in fase di review, dopo l'apertura di una pull request; - *completato*: task concluso, ovvero branch dedicato chiuso a seguito di merge sul ramo principale. ====== Timeline La timeline di Jira permette di avere una visione delle attività incentrata sulle tempistiche e le relazioni tra i task. Permette inoltre di mostrare il grafico di Gantt delle attività evidenziando i rapporti di dipendenza tra i task e stabilendo le scadenze necessarie per il loro svolgimento. ====== Grafici Jira offre la possibilità di produrre grafici e report relativi all'avanzamento e alla tracciabilità dei task. Tali strumenti permettono di avere delle metriche di valutazione dell'andamento del progetto e di individuare eventuali criticità. Il gruppo utilizza come metrica principale il burndown chart, che permette di avere una visione dell'avanzamento delle attività in base al tempo, basato sugli story point di ogni attività. ==== Controllo delle release Il controllo delle release viene gestito tramite il meccanismo di pull request di GitHub. Prima di integrare i nuovi cambiamenti, viene aperta una pull request dall'assegnatario del task. La pull request deve avere un titolo valido (come descritto nel paragrafo dedicato @automazioni) e deve essere designato almeno un reviewer. Di norma il reviewer di base è il Verificatore, che svolge una supervisione sulla correttezza sintattica e semantica dei contenuti. Nel caso in cui ci sia bisogno di una figura con delle competenze specifiche per quanto riguarda la semantica e il contenuto del materiale da revisionare, il Verificatore può essere affiancato da altri membri del gruppo. Per ogni richiesta di modifiche da apportare vengono aperte delle conversation, in cui è possibile evidenziare le linee del documento che hanno bisogno di cambiamenti, oltre a stabilire un canale di comunicazione fra assegnatario e Verificatore. Il processo di verifica del documento è accompagnato dall'esecuzione di GitHub Actions che si occupano di automatizzare l'aggiornamento del file _log.csv_ con i dati relativi alla modifica apportata, e la compilazione e pubblicazione del documento nel ramo main del repository. In questo modo si assicura che ogni documento presente nel ramo principale sia prima stato sottoposto ad un processo di verifica. Si può procedere alla chiusura della pull request e con l'operazione di merge solo nel caso in cui tutte le conversation siano state risolte e siano stati applicati i cambiamenti richiesti in fase di review. Solo a seguito del merge della pull request, il task collegato presente in Jira può essere definito concluso e il relativo branch viene chiuso in modo automatico. == Processo di Gestione delle Informazioni <processo_gestione_informazioni> _Conformant to outcomes to ISO/IEC/IEEE 12207:2017 clause 6.3.6_ === Scopo Lo scopo del processo di Gestione delle Informazioni è generare, ottenere, confermare, trasformare, conservare, recuperare e distribuire le informazioni e la relativa documentazione agli stakeholder interessati, garantendone chiarezza, completezza, consistenza, tracciabilità e presentazione. Le informazioni possono essere tecniche, di progetto, organizzative e di accordo. === Informazioni gestite Le informazioni gestite dal gruppo sono: - documentazione: - Piano di Progetto; - Norme di Progetto; - Piano di Qualifica; - Analisi dei Requisiti; - Glossario; - Verbali. - codice sorgente: - Proof of Concept (PoC); - Minimum Viable Product (MVP). Codice sorgente e documenti sono creati, organizzati, aggiornati, versionati e distribuiti all'interno dei repository del gruppo. === Documentazione ==== Struttura dei documenti <struttura-documenti> Ogni documento segue una struttura standard, stabilita nel template _template.typ_. \ Questo paragrafo non tratta della struttura dei verbali. Per le norme sulla struttura dei verbali si rimanda alla @struttura-verbali.\ I documenti pertanto sono così strutturati: + *Cover page*: la cover page è la pagina iniziale del documento. Essa contiene le seguenti informazioni: - nome del gruppo; - link all'organizzazione GitHub; - indirizzo e-mail del gruppo; - logo; - titolo del documento; - sottotitolo del documento; - versione; - stato; - tipo di uso: interno od esterno; - responsabile del gruppo; - redattori; - verificatori; - destinatari; - partecipanti esterni (se presenti). + *Registro delle modifiche*: sezione successiva alla cover page. Maggiori dettagli sono disponibili alla sezione dedicata (@tracciamento-modifiche); + *Indici*: Sono presenti tre tipologie di indici: - indice del contenuto: indice sempre presente che rappresenta i paragrafi del documento; - indice delle tabelle: indice presente solo se sono presenti tabelle nel documento; - indice delle figure: indice presente solo se sono presenti figure nel documento. + *Contenuto del file*: sezione successiva agli indici. Rappresenta il corpo del documento, suddiviso in paragrafi. ==== Struttura dei verbali <struttura-verbali> I verbali assumono una struttura diversa rispetto agli altri documenti, dato il diverso scopo e la struttura semplificata. I verbali sono così strutturati: - *cover page* (@struttura-documenti); - *informazioni generali*: - luogo; - data e ora nel formato (gg-mm-aaaa, hh:mm ~ hh:mm); - partecipanti; - assenti; - referente aziendale (se presente). - *ordine del giorno*: elenco degli argomenti trattati durante la riunione; - *organizzazione attività*: elenco e spiegazione delle decisioni prese durante la riunione. Questo paragrafo rappresenta il risultato fondamentale delle riunioni di retrospettiva; - *firma partecipanti esterni* (se presenti): firma dei partecipanti esterni alla riunione. === Stile e convenzioni Al fine di uniformare e conformare i prodotti del progetto, il gruppo ha stabilito delle convenzioni stilistiche e di scrittura da rispettare durante la stesura dei documenti e del codice. L'obiettivo è perseguire: - chiarezza; - leggibilità; - manutenibilità. ==== Convenzioni stilistiche globali Convenzioni stilistiche valide sia per i prodotti documentali che software. ===== Nomi dei documenti <norma_nomi_documenti> Ogni parola dei titoli dei documenti deve iniziare con la lettera maiuscola, ad eccezione delle preposizioni e degli articoli.\ I verbali avranno come titolo la data del verbale nel formato _yyyy-mm-dd_. Ogni documento alla fine del nome riporta anche la versione nel formato _\_vX.Y.Z_. \ esempio: `Norme di Progetto_v1.0.0.pdf`. ===== Formato data All'interno del documento, le date seguiranno il formato locale _dd/mm/yyyy_, mentre all'interno dei nomi dei file e dei commit di GitHub, il formato utilizzato sarà _yyyy-mm-dd_, dove: - *dd*: numero del giorno con due cifre; - *mm*: numero del mese con due cifre; - *yyyy*: numero dell'anno con quattro cifre. ==== Convenzioni stilistiche documentali Convenzioni stilistiche specifiche per i prodotti documentali. ===== TODO Per indicare sezioni del documento da completare, il gruppo ha deciso di utilizzare il termine TODO, che verrà in automatico mostrato in rosso e riquadrato, riportando il messaggio _riferimento assente_.\ Il risultato è il seguente: TODO.\ Questo permette di individuare facilmente le parti del documento da completare. ===== Corsivo, grassetto, maiuscole e monospace _Corsivo_: - citazioni; - formati; - nomi di practice; - nomi propri di dominio. *Grassetto*: - titoli; - parole chiave e significative; - termini iniziali di elenchi puntati che necessitano spiegazione. MAIUSCOLO: - acronimi; - nomi propri; - nomi strumenti e tecnologie; - iniziale nomi ruoli; - iniziale parole nei nomi documenti ad eccezione di preposizioni e articoli. Riferimento nomi file disponibile alla @norma_nomi_documenti. `Monospace`:\ - nome di un file (Riferimento nomi file disponibile alla @norma_nomi_documenti); - parametri; - porzioni di codice. ===== Elenchi - si utilizzano elenchi numerati se gli elementi mostrati richiedono un ordine (es. ordine delle sezioni); - si utilizzano elenchi non numerati se gli elementi mostrati non richiedono un ordine (es. lista di attività); - al termine di ogni punto dell'elenco viene posto ";" ad eccezione dell'ultimo elemento a cui viene posto ".". ===== Glossario Tutte le occorrenze dei termini contenuti nel glossario sono evidenziati con una G in corsivo a pedice. === Distribuzione delle informazioni Il gruppo condivide il materiale prodotto all'interno di un repository dedicato reperibile al link:\ #align(link("https://github.com/Error-418-SWE/Documenti"), center) Maggiori dettagli in merito all'organizzazione della repository sono reperibili qui: @repository-github. == Processo di Misurazione <processo_misurazione> _Conformant to outcomes to ISO/IEC/IEEE 12207:2017 clause 6.3.7_ === Scopo Lo scopo del processo di misurazione è raccogliere, analizzare e riportare dati e informazioni, al fine di dimostrare la qualità di prodotti, servizi e processi.\ Questo processo viene svolto affinché il gruppo sia in grado di prendere le corrette decisioni per gestire al meglio il raggiungimento dei propri obiettivi.\ Le misure devono soddisfare determinate caratteristiche di qualità, ovvero devono essere: + verificabili; + significative; + attuabili; + tempestive; + economicamente vantaggiose. Definiamo il concetto di "qualità" come segue: insieme delle caratteristiche di un'entità, che ne determinano la capacità di soddisfare esigenze sia esplicite che implicite. === Risultati A seguito dell'implementazione efficace del processo di misurazione: - vengono identificate le esigenze informative; - viene identificato e sviluppato un insieme appropriato di misure basato sulle esigenze informative; - i dati necessari vengono raccolti, verificati e archiviati; - i dati vengono analizzati e i risultati interpretati; - gli elementi informativi forniscono informazioni oggettive per poter prendere decisioni concrete. I risultati sono contenuti nel documento _Piano Di Qualifica_ v1.1.0. === Attività Il gruppo deve implementare le seguenti attività in conformità con le politiche e le procedure applicabili al processo di misurazione definito nel _Piano di Qualifica_ v1.1.0: + prepararsi per la misurazione: - definire la strategia di misurazione per i processi primari. La strategia scelta si compone di metriche mirate alla valutazione dei processi primari, quali: + BAC (Budget at Completion); + PV (Planned Value), che si estende in: - SPV (Sprint Planned Value); - PPV (Project Planned Value); + AC (Actual Cost), che si estende in: - SAC (Sprint Actual Cost); - PAC (Project Actual Cost); + EV (Earned Value), che si estende in: - SEV (Sprint Earned Value); - PEV (Project Earned Value); + CPI (Cost Performance Index); + EAC (Estimated at Completion). - definire la strategia di misurazione per i processi di supporto. La strategia scelta si compone di una serie di parametri e metriche che permettono di valutare la qualità dei processi di supporto: - errori ortografici; - percentuale metriche soddisfatte. - descrivere le caratteristiche del gruppo rilevanti per la misurazione, come obiettivi aziendali e obiettivi tecnici: - richieste del Proponente; - requisiti individuati. - definire procedure di raccolta, analisi, accesso e reportistica dei dati: - Piano di Qualifica: definisce i criteri e le modalità di misurazione e reportistica dei dati misurati. - definire criteri per valutare gli elementi informativi e il processo di misurazione: - Piano di Qualifica: definisce i valori ottimali e accettabili della strategia di misurazione adottata a cui tutti i documenti prodotti devono conformarsi. - identificare e pianificare le azioni da intraprendere per i casi in cui i parametri di misurazione di qualità non vengano rispettati. + eseguire la misurazione: - integrare procedure manuali o automatizzate per la generazione, raccolta, analisi e reportistica dei dati nei processi pertinenti: - controllo manuale di conformità dei documenti prodotti ai parametri individuati per i processi primari; - controllo manuale di conformità dei documenti prodotti ai parametri individuati per i processi di supporto; - revisione esterna e manuale dei documenti prodotti per il controllo di leggibilità e di eventuali errori ortografici. - raccogliere, archiviare e verificare i dati: - i dati prodotti vengono salvati e analizzati al fine di perorare una strategia di approccio ed eventuali modifiche da effettuare. - registrare i risultati e comunicarli agli stakeholder: - vengono riferiti periodicamente al Proponente gli avanzamenti e la conformità del progetto alle richieste concordate. Maggiori dettagli in merito alla definizione, al calcolo e l'analisi delle metriche sono reperibili all'interno del documento _Piano di Qualifica_ v1.1.0 == Processo di Controllo della Qualità <processo_controllo_qualità> _Conformant to outcomes to ISO/IEC/IEEE 12207:2017 clause 6.3.8_ === Scopo La International Software Testing Qualifications Board (ISTQB) definisce il processo di Controllo della Qualità come "insieme di attività incentrate sul garantire che i requisiti di qualità saranno soddisfatti".\ Il processo di Controllo della Qualità ha come obiettivo principale quello di garantire l'applicazione efficace del processo di Gestione della Qualità da parte del gruppo.\ Il suo focus fondamentale è fornire la sicurezza e la certezza che i requisiti di qualità stabiliti saranno pienamente soddisfatti. Questo si ottiene mediante un'analisi proattiva attenta dei processi e dei risultati che caratterizzano il ciclo di vita del progetto.\ L'obiettivo è assicurare che il prodotto risponda alle aspettative in termini di qualità, e che ciò avvenga in piena conformità con le linee guida, le politiche e le procedure precedentemente definite. In altre parole, la finalità ultima è garantire che la qualità desiderata sia intrinseca al prodotto finale e che ogni fase del processo segua gli standard e le disposizioni stabilite dal gruppo e dal progetto.\ === Risultati L'implementazione riuscita del processo di Controllo della Qualità produce i seguenti risultati: - sono definite e implementate le procedure di Controllo della Qualità del progetto; - vengono definiti criteri e metodi per la valutazione di Controllo della Qualità; - vengono eseguite valutazioni dei prodotti, servizi e processi del progetto; - vengono forniti agli stakeholder i risultati delle valutazioni; - vengono trattati i problemi emersi durante il periodo di sviluppo. === Attività Le seguenti attività devono essere implementate in conformità con le politiche e le procedure del gruppo: + *prepararsi per il Controllo della Qualità*: - *definire una strategia di Controllo della Qualità*. Essa consiste in: + *ruoli, responsabilità e autorità definite*: - i ruoli e i compiti di ciascun membro sono definiti e non ambigui; - ogni individuo fisico viene informato a scadenza bisettimanale dei propri compiti e delle proprie responsabilità per quel periodo di tempo. + *criteri di valutazione definiti per processi, prodotti e servizi*: - il valore delle metriche di controllo dei processi primari deve essere accettabile; - il valore delle metriche di controllo dei processi di supporto deve essere accettabile; - le tempistiche da rispettare devono essere definite; - i requisiti funzionali devono essere definiti; - i requisiti non funzionali devono essere definiti. + *attività di verifica, convalida, monitoraggio, misurazione, revisione per i prodotti o servizi*: - assegnazione di un Verificatore con il compito di monitorare e testare la qualità del materiale prodotto; - il Verificatore ha il compito di segnalare eventuali incongruenze con le metriche di qualità al redattore. + *risoluzione dei problemi e attività di miglioramento di processo e prodotto*: - le modifiche devono essere effettuate su indicazioni del Verificatore. - *stabilire l'indipendenza del controllo della qualità dagli altri processi del ciclo di vita*: - il Verificatore deve essere una persona fisica diversa da quella che ha redatto il documento. + *eseguire valutazioni di processi, prodotti e servizi*: + il Verificatore deve valutare i prodotti e i servizi al fine di garantirne la conformità rispetto ai criteri stabiliti; + il Verificatore deve assicurarsi che la verifica e la convalida degli output dei processi del ciclo di vita siano eseguiti conformemente con quanto concordato in precedenza; + il Verificatore deve applicare il processo di misurazione della qualità per verificare che il prodotto o servizio rispetti le metriche precedentemente stabilite; + il Verificatore deve esprimere un giudizio e segnalare eventuali problematiche riscontrate. + *gestire report e record del Controllo della Qualità*: - *l'attività consiste in*: + *stilare report e record relativi alle attività di Controllo della Qualità*: - i report e i record vengono generati tramite l'utilizzo coordinato di Jira, Google Sheets e Grafana che porta alla creazione di un cruscotto di qualità. Si rimanda a @tecnologie_controllo per ulteriori dettagli. + *mantenere, archiviare e distribuire i report*: - il cruscotto di qualità è consultabile in ogni momento da ogni membro del gruppo, che possiede un link per accedervi. L'aggiornamento del cruscotto avviene in automatico e in tempo reale grazie al suo collegamento con Jira. + *identificare incidenti e problemi associati alle valutazioni effettuate*: - in sede di retrospettiva, il gruppo lavora in modo coordinato per identificare gli incidenti e i problemi, servendosi delle informazioni presentate dal Verificatore tramite il cruscotto di qualità; - l'Amministratore si occupa della redazione di un verbale contenente anche gli esiti del processo di Controllo della Qualità. + *trattare incidenti e problemi*: + in caso di segnalazione di incidenti e problemi deve essere svolto un lavoro collettivo per la loro risoluzione; + tutte le criticità devono prevedere risoluzioni e arginamenti già predisposti all'interno del documento dell'_Analisi dei Rischi_ v1.0.0. + nel caso tali problemi o incidenti siano di carattere generale, deve essere avvisato collettivamente il gruppo dell'insorgenza di tali problemi o incidenti, al fine di evitare future ricorrenze degli stessi. ==== Tecnologie <tecnologie_controllo> ===== Jira Jira, essendo l'ITS del gruppo, è la fonte principale di informazioni per il cruscotto di qualità. ===== Google Sheets Google Sheets viene utilizzato per rendere meglio manipolabili i dati provenienti da Jira, in modo da poterli analizzare con più facilità e calcolare comodamente metriche come CPI, EAC, EV. ===== Grafana Grafana è l'applicazione utilizzata per visualizzare i dati raccolti tramite l'implementazione di un cruscotto di qualità. Le informazioni mostrate sono le seguenti: - sprint rimanenti; - budget rimanente; - rapporto EAC e BAC; - andamento CPI; - rapporto PPV, PAC e PEV; - metriche soddisfatte; - ore svolte e rimanenti per ruolo; - task svolti; - story point per stato; - bug aperti. I dati sono visualizzati sotto forma di grafici, per aiutarne l'analisi e la comprensione, e sono consultabili in ogni momento dal gruppo. = Processi tecnici == Processo di analisi della missione <processo_missione> _Tailored conformance on ISO/IEC/IEEE 12207:2017 clause 6.4.1 per ISO/IEC/IEEE 12207:2017 Annex A_ === Scopo Il processo di analisi della missione definisce i problemi e le opportunità dai quali scaturisce il progetto, caratterizza lo spazio delle soluzioni e determina una classe di soluzione preferita. === Strategia di identificazione e analisi della missione ==== Sistemi e servizi abilitanti Gli strumenti di comunicazione adottati dal gruppo sono descritti nella @comunicazione_interna. ==== Opportunità Si analizzano i problemi e le opportunità per acquisire una panoramica completa del contesto presentato dal Capitolato. Si identifica l'ambito del Capitolato attraverso la definizione di: - difetti e _pain point_ delle soluzioni pre-esistenti, se disponibili; - soluzioni alternative, con vantaggi e svantaggi rispetto alle soluzioni pre-esistenti, se disponibili; - contesto tecnologico di applicazione; - tipologia di utenza attesa; - destinazione d'uso del prodotto finale. La sintesi di bisogni e requisiti avviene nel contesto del processo di definizione di bisogni e requisiti degli Stakeholder disponibile nella @processo_bisogni. ==== Classi di soluzione Si identificano classi di soluzione che possano sfruttare le opportunità e risolvere i problemi individuati. Le classi di soluzione possono comprendere lo sviluppo o la modifica di sistemi software pre-esistenti. Le classi di soluzione individuano le potenziali tecnologie che ci si aspetta essere necessarie. Possono includere l'identificazione di specifici sistemi o prodotti software adatti al riutilizzo. Nel contesto del progetto didattico, il gruppo accetta le classi di soluzione proposte nel Capitolato, eventualmente utilizzandole come base per la formulazione di classi di soluzione alternative. ==== Valutazione delle classi di soluzione Si valuta ogni classe di soluzione identificata sulla base di: - fattibilità; - costi; - tempi necessari; - rischi; - interesse tecnologico e didattico; - pertinenza. La valutazione delle classi di soluzione può avvenire tramite: - studio della documentazione dei sistemi o prodotti software identificati; - realizzazione di esploratori tecnologici (detti _Proof of Concept_ o PoC); - consultazione di esperti, quali Proponente e Committente. Sulla base dei risultati della valutazione, il gruppo individua una classe di soluzione preferita e la presenta al Proponente per la convalida. ==== Analisi dei requisiti Il documento _Analisi dei Requisiti_ raccoglie le informazioni previste da questo processo. Il documento deve ricevere approvazione esplicita da parte degli Stakeholder coinvolti. == Processo di definizione di bisogni e requisiti degli stakeholder <processo_bisogni> _Conformant to outcomes to ISO/IEC/IEEE 12207:2017 clause 6.4.2_ === Scopo Il processo di definizione di bisogni e requisiti degli stakeholder definisce i requisiti di un sistema che possa fornire le funzionalità di cui gli utenti e gli stakeholder necessitano. Il processo identifica gli stakeholder coinvolti con il sistema durante l'intero suo ciclo di vita. Identifica inoltre i loro bisogni, li analizza e li trasforma in un insieme condiviso di requisiti che: - esprima i comportamenti attesi che il sistema dovrà avere nel suo ambiente operativo; - cataloghi e prioritizzi ciascun requisito; - riporti le fonti di ciascun requisito; - funga da riferimento per la validazione dell'implementazione di ciascun requisito. === Stakeholder Sono identificati tutti quegli stakeholder che possiedano una forte influenza sugli obiettivi, le strategie, l'operatività e le caratteristiche del prodotto. ==== Matrice degli stakeholder Si classificano gli stakeholder individuati sulla base di: - coinvolgimento nel progetto: indica l'interesse dello stakeholder nell'ambito di progetto; - autorità sullo sviluppo: indica il potere decisionale esercitabile sull'ambito di progetto. Entrambe le classificazioni si strutturano su tre livelli: basso, medio, alto. ==== Modalità di comunicazione <modalita-comunicazione> Per ciascuno stakeholder si identificano i canali e la frequenza della comunicazione. === Strategia di identificazione, analisi e trasformazione dei bisogni Il gruppo adotta una strategia iterativa per l'identificazione, l'analisi e la trasformazione dei bisogni in requisiti. L'approccio è finalizzato alla raccolta di feedback e prevede: - interviste e questionari; - studio individuale di tecnologie abilitanti e documentazione tecnica; - acquisizione di conoscenze tramite workshop interni e _brainstorming_; - osservazione delle criticità delle soluzioni software preesistenti. Le comunicazioni con gli stakeholder avvengono nelle modalità descritte in @modalita-comunicazione. Le attività sono supportate, quando utile, da documenti, immagini, dimostratori tecnologici e in generale qualsiasi elemento informativo utile alla comprensione dei bisogni degli stakeholder. Le informazioni sono organizzate in modo da supportare l'identificazione, l'analisi e la trasformazione dei bisogni in requisiti. Il livello di astrazione adottato può differire in base all'interlocutore e al progresso globale conseguito dal _Processo di definizione di bisogni e requisiti degli stakeholder_. Lo strumento adottato a supporto di queste operazioni è Miro. I bisogni espressi da Committente e Fornitore sono raccolti, catalogati, analizzati ed espressi nel documento di _Analisi dei Requisiti_ prodotto dal gruppo. Alcuni stakeholder possono avere interessi avversi a quelli del gruppo o in contrasto con gli interessi di altri stakeholder. Qualora gli interessi degli stakeholder siano tra di essi contrastanti, ma non siano avversi al gruppo o al sistema software, il gruppo si adopera per mediare i contrasti. La strategia di mediazione prevede l'identificazione di un sottoinsieme di interessi e bisogni comuni, il confronto con le parti e la definizione di strategie di mediazione calate nella fattispecie. Gli intenti o i desideri di chi si oppone al gruppo o ad uno o più dei processi di ciclo di vita del sistema software sono affrontati tramite il processo di Gestione dei Rischi disponibile alla @processo_gestione_rischi. Il negoziato tra le parti potrebbe essere richiesto per mediare posizioni mutualmente incompatibili, o a causa di vincoli o budget insufficiente. Anche la data di consegna prevista incide sulla realizzazione dei requisiti. Sarà sempre necessario consultare gli stakeholder coinvolti per raggiungere un accordo. Le decisioni saranno tracciate e rese disponibili agli stakeholder. ==== Identificazione dei bisogni <identificazione-bisogni> Include l'elicitazione dei bisogni direttamente dagli stakeholder o dalla documentazione fornita da essi, oppure la raccolta di bisogni impliciti basati sul dominio applicativo ed i contesti tecnologico, legislativo, normativo. I bisogni degli stakeholder scaturiscono da fonti diverse. Il gruppo si impegna ad esplorare e valutare, al fine di identificare possibili bisogni, almeno questi frangenti: - obiettivi di alto livello che il sistema dovrebbe conseguire; - contributi concreti che il sistema dovrebbe apportare a beneficio degli stakeholder; - scenari operativi, utili per limitare l'ambito e comprendere le aspettative e i bisogni; - scenari operativi quotidiani, utili per assegnare una priorità ai bisogni; - tipologie e caratteristiche degli utenti; - ambiente operativo e contesto d'utilizzo; - aspettative sulle prestazioni e la disponibilità del sistema; - pratiche di business; - norme, leggi o altri vincoli esterni. ==== Definizione delle priorità Le preferenze espresse dagli stakeholder, coadiuvate dal processo di gestione delle decisioni (@processo_gestione_decisioni), guidano la selezione e la prioritizzazione dei requisiti. ==== Casi d'uso Si definisce un insieme di casi d'uso (anche detti use case, abbreviato in UC) che identifichi tutte le funzionalità attese. I casi d'uso sono definiti ed utilizzati nel documento di _Analisi dei Requisiti_. Essi sono: - fonte di bisogni e, indirettamente, di requisiti; - un ausilio per l'esplorazione degli aspetti descritti nella @identificazione-bisogni. Ogni caso d'uso comprende: + Codice identificativo; + Titolo; + Descrizione; + Attore; + Precondizioni (opzionale); + Postcondizioni (opzionale); + Scenario principale; + Scenari alternativi (opzionale); + Generalizzazioni (opzionale). Il codice identificativo assume l'aspetto `UC-X.Y`, dove `UC-` è la radice del codice; `X` è una cifra positiva crescente di cifre che identifica un caso d'uso; `Y` è una cifra positiva crescente, attiva solo per le generalizzazioni di uno stesso caso d'uso. I casi d'uso sono arricchiti con diagrammi realizzati secondo la sintassi Unified Modeling Language (UML) 2.0. In nessun caso i casi d'uso propongono o presumono soluzioni implementative. ==== Identificazione dei vincoli I vincoli sono un tipo di requisito. Possono derivare da: - stakeholder; - sistemi software a supporto dei processi di ciclo di vita; - budget disponibile; - considerazioni su prestazioni, affidabilità, sicurezza, disponibilità, manutenibilità; - altre attività dei processi di ciclo di vita. Sono classificati per priorità e per fonte. ==== Analisi dei requisiti Il documento _Analisi dei Requisiti_ raccoglie le informazioni previste. Il documento deve ricevere approvazione esplicita da parte degli stakeholder coinvolti. #pagebreak() = Tracciamento paragrafi ISO/IEC/IEEE 12207:2017 La tabella di seguito riportata consente di associare ogni capitolo del documento al rispettivo capitolo dello standard di riferimento. Viene riportato anche il grado di conformità: - *To outcome* indica che il gruppo ha dovuto adattare lo standard al progetto, omettendo o reinterpretando sezioni incompatibili con la natura del progetto pur cercando il più possibile di perseguire l'obbiettivo di qualità che lo standard impone; - *Full* indica che il capitolo riporta fedelmente le indicazioni dello standard con poche o nessuna azione di adeguamento. #figure( table( columns: 3, [*Capitolo Norme*],[*Capitolo Standard*],[*Conformance Level*], [@processo_fornitura],[6.1.2 - Supply process],[To outcome], [@processo_ciclo_di_vita],[6.2.1 - Life cycle model management process],[To outcome], [@processo_risorse_umane],[6.2.4 - Human Resource Management process],[To outcome], [@pianificazione],[6.3.1 - Project Planning process],[To outcome], [@valutazioneControllo],[6.3.2 - Project assessment and control process],[Full], [@processo_gestione_decisioni],[6.3.3 - Decision Management process],[Full], [@processo_gestione_rischi],[6.3.4 - Risk Management process],[Full], [@processo_gestione_configurazione],[6.3.5 - Configuration Management process],[To outcome], [@processo_gestione_informazioni],[6.3.6 - Information Management process],[To outcome], [@processo_misurazione],[6.3.7 - Measurement process],[To outcome], [@processo_controllo_qualità],[6.3.8 - Quality Assurance process],[Full], [@processo_missione],[6.4.1 - Business or Mission Analysis process],[Full], [@processo_bisogni],[6.4.2 - Stakeholder Needs and Requirements Definition process],[To outcome], ), caption: "Tracciamento paragrafi ISO/IEC/IEEE 12207:2017" )
https://github.com/bigskysoftware/hypermedia-systems-book
https://raw.githubusercontent.com/bigskysoftware/hypermedia-systems-book/main/ch12-building-a-contacts-app-with-hyperview.typ
typst
Other
#import "lib/definitions.typ": * == Building A Contacts App With Hyperview Earlier chapters in this book explained the benefits of building apps using the hypermedia architecture. These benefits were demonstrated by building a robust Contacts web application. Then, Chapter 11 argued that hypermedia concepts can and should be applied to platforms other than the web. We introduced Hyperview as an example of a hypermedia format and client specifically designed for building mobile apps. But you may still be wondering: what is it like to create a fully-featured, production-ready mobile app using Hyperview? Do we have to learn a whole new language and framework? In this chapter, we will show Hyperview in action by porting the Contacts web app to a native mobile app. You will see that many web development techniques (and indeed, much of the code) are completely identical when developing with Hyperview. How is that possible? #[ #set enum(numbering: "1.", start: 1) + Our Contacts web app was built with the principle of HATEOAS (Hypermedia as the Engine of Application State). All of the app’s features (retrieving, searching, editing, and creating contacts) are implemented in the backend (the `Contacts` Python class). Our mobile app, built with Hyperview, also leverages HATEOAS and relies on the backend for all of the app’s logic. That means the `Contacts` Python class can power our mobile app the same way it powers the web app, without any changes required. + The client-server communication in the web app happens using HTTP. The HTTP server for our web app is written using the Flask framework. Hyperview also uses HTTP for client-server communication. So we can re-use the Flask routes and views from the web app for the mobile app as well. + The web app uses HTML for its hypermedia format, and Hyperview uses HXML. HTML and HXML are different formats, but the base syntax is similar (nested tags with attributes). This means we can use the same templating library (Jinja) for HTML and HXML. Additionally, many of the concepts of htmx are built into HXML. We can directly port web app features implemented with htmx (search, infinite loading) to HXML. ] Essentially, we can re-use almost everything from the web app backend, but we will need to replace the HTML templates with HXML templates. Most of the sections in this chapter will assume we have the web contacts app running locally and listening on port 5000. Ready? Let’s create new HXML templates for our mobile app’s UI. === Creating a mobile app <_creating_a_mobile_app> To get started with HXML, there’s one pesky requirement: the Hyperview client. When developing web applications, you only need to worry about the server because the client (web browser) is universally available. There’s no equivalent Hyperview client installed on every mobile device. Instead, we will create our own Hyperview client, customized to only talk to our server. This client can be packaged up into an Android or iOS mobile app, and distributed through the respective app stores. Luckily, we don’t need to start from scratch to implement a Hyperview client. The Hyperview code repository comes with a demo backend and a demo client built using Expo. We will use this demo client but point it to our contacts app backend as a starting point. #figure[```bash git clone <EMAIL>:Instawork/hyperview.git cd hyperview/demo yarn <1> yarn start <2> ```] 1. Install dependencies for the demo app 2. Start the Expo server to run the mobile app in the iOS simulator. After running `yarn start`, you will be presented with a prompt asking you to open the mobile app using an Android emulator or iOS simulator. Select an option based on which developer SDK you have installed. (The screenshots in this chapter will be taken from the iOS simulator.) With any luck, you will see the Expo mobile app installed in the simulator. The mobile app will automatically launch and show a screen saying "Network request failed." That’s because by default, this app is configured to make a request to http:\/\/0.0.0.0:8085/index.xml, but our backend is listening on port 5000. To fix this, we can make a simple configuration change in the `demo/src/constants.js` file: #figure[```js //export const ENTRY_POINT_URL = 'http://0.0.0.0:8085/index.xml'; <1> export const ENTRY_POINT_URL = 'http://0.0.0.0:5000/'; <2> ```] 1. The default entry point URL in the demo app 2. Setting the URL to point to our contacts app We’re not up and running yet. With our Hyperview client now pointing to the right endpoint, we see a different error, a "ParseError." That’s because the backend is responding to requests with HTML content, but the Hyperview client expects an XML response (specifically, HXML). So it’s time to turn our attention to our Flask backend. We will go through the Flask views, and replace the HTML templates with HXML templates. Specifically, let’s support the following features in our mobile app: - A searchable list of contacts - Viewing the details of a contact - Editing a contact - Deleting a contact - Adding a new contact #sidebar[Zero Client-Configuration in Hypermedia Applications][ #index[Hyperview][entry-point URL] For many mobile apps that use the Hyperview client, configuring this entry point URL is the only on-device code you need to write to deliver a full-featured app. Think of the entry point URL as the address you type into a web browser to open a web app. Except in Hyperview, there is no address bar, and the browser is hard-coded to only open one URL. This URL will load the first screen when a user launches the app. Every other action the user can take will be declared in the HXML of that first screen. This minimal configuration is one of the benefits of the Hypermedia-driven architecture. Of course, you may want to write more on-device code to support more features in your mobile app. We will demonstrate how to do that later in this chapter, in the section called "Extending the Client." ] === A Searchable List of Contacts <_a_searchable_list_of_contacts> We will start building our Hyperview app with the entry point screen, the list of contacts. For the initial version of this screen, let’s support the following features from the web app: - display a scrollable list of contacts - "search-as-you-type" field above the list - "infinite-scroll" to load more contacts as the user scrolls through Additionally, we will add a "pull-to-refresh" interaction on the list, since users expect this from list UIs in mobile apps. If you recall, all of the pages in the Contacts web app extended a common base template, `layout.html`. We need a similar base template for the screens of the mobile app. This base template will contain the style rules of our UI, and a basic structure common to all screens. Let’s call it `layout.xml`. #figure(caption: [Base template `hv/layout.xml`])[ ```xml <doc xmlns="https://hyperview.org/hyperview"> <screen> <styles><!-- omitted for brevity --></styles> <body style="body" safe-area="true"> <header style="header"> {% block header %} <1> <text style="header-title">Contact.app</text> {% endblock %} </header> <view style="main"> {% block content %}{% endblock %} <2> </view> </body> </screen> </doc> ``` ] 1. The header section of the template, with a default title. 2. The content section of the template, to be provided by other templates. We’re using the HXML tags and attributes covered in the previous chapter. This template sets up a basic screen layout using `<doc>`, `<screen>`, `<body>`, `<header>`, and `<view>` tags. Note that the HXML syntax plays well with the Jinja templating library. Here, we’re using Jinja’s blocks to define two sections (`header` and `content`) that will hold the unique content of a screen. With our base template completed, we can create a template specifically for the contacts list screen. #figure( caption: [Start of `hv/index.xml`], )[ ```xml {% extends 'hv/layout.xml' %} <1> {% block content %} <2> <form> <3> <text-field name="q" value="" placeholder="Search..." style="search-field" /> <list id="contacts-list"> <4> {% include 'hv/rows.xml' %} </list> </form> {% endblock %} ``` ] 1. Extend the base layout template 2. Override the `content` block of the layout template 3. Create a search form that will issue an HTTP `GET` to `/contacts` 4. The list of contacts, using a Jinja `include` tag. This template extends the base `layout.xml`, and overrides the `content` block with a `<form>`. At first, it might seem strange that the form wraps both the `<text-field>` and the `<list>` elements. But remember: in Hyperview, the form data gets included in any request originating from a child element. We will soon add interactions to the list (pull to refresh) that will require the form data. Note the use of a Jinja `include` tag to render the HXML for the rows of contacts in the list (`hv/rows.xml`). Just like in the HTML templates, we can use the `include` to break up our HXML into smaller pieces. It also allows the server to respond with just the `rows.xml` template for interactions like searching, infinite scroll, and pull-to-refresh. #figure(caption: [`hv/rows.xml`])[ ```xml <items xmlns="https://hyperview.org/hyperview"> <1> {% for contact in contacts %} <2> <item key="{{ contact.id }}" style="contact-item"> <3> <text style="contact-item-label"> {% if contact.first %} {{ contact.first }} {{ contact.last }} {% elif contact.phone %} {{ contact.phone }} {% elif contact.email %} {{ contact.email }} {% endif %} </text> </item> {% endfor %} </items> ``` ] 1. An HXML element that groups a set of `<item>` elements in a common ancestor. 2. Iterate over the contacts that were passed in to the template. 3. Render an `<item>` for each contact, showing the name, phone number, or email. In the web app, each row in the list showed the contact’s name, phone number, and email address. But in a mobile app, we have less real-estate. It would be hard to cram all this information into one line. Instead, the row just shows the contact’s first and last name, and falls back to email or phone if the name is not set. To render the row, we again make use of Jinja template syntax to render dynamic text with data passed to the template. We now have templates for the base layout, the contacts screen, and the contact rows. But we still have to update the Flask views to use these templates. Let’s take a look at the `contacts()` view in its current form, written for the web app: #figure( caption: [`app.py`], )[ ```py @app.route("/contacts") def contacts(): search = request.args.get("q") page = int(request.args.get("page", 1)) if search: contacts_set = Contact.search(search) if request.headers.get('HX-Trigger') == 'search': return render_template("rows.html", contacts=contacts_set, page=page) else: contacts_set = Contact.all(page) return render_template("index.html", contacts=contacts_set, page=page) ``` ] This view supports fetching a set of contacts based on two query params, `q` and `page`. It also decides whether to render the full page (`index.html`) or just the contact rows (`rows.html`) based on the `HX-Trigger` header. This presents a minor problem. The `HX-Trigger` header is set by the htmx library; there’s no equivalent feature in Hyperview. Moreover, there are multiple scenarios in Hyperview that require us to respond with just the contact rows: - searching - pull-to-refresh - loading the next page of contacts Since we can’t depend on a header like `HX-Trigger`, we need a different way to detect if the client needs the full screen or just the rows in the response. We can do this by introducing a new query param, `rows_only`. When this param has the value `true`, the view will respond to the request by rendering the `rows.xml` template. Otherwise, it will respond with the `index.xml` template: #figure( caption: [`app.py`], )[ ```py @app.route("/contacts") def contacts(): search = request.args.get("q") page = int(request.args.get("page", 1)) rows_only = request.args.get("rows_only") == "true" <1> if search: contacts_set = Contact.search(search) else: contacts_set = Contact.all(page) template_name = "hv/rows.xml" if rows_only else "hv/index.xml" <1> return render_template(template_name, contacts=contacts_set, page=page) ``` ] 1. Check for a new `rows_only` query param. 2. Render the appropriate HXML template based on `rows_only`. There’s one more change we have to make. Flask assumes that most views will respond with HTML. So Flask defaults the `Content-Type` response header to a value of `text/html`. But the Hyperview client expects to receive HXML content, indicated by a `Content-Type` response header with value `application/vnd.hyperview+xml`. The client will reject responses with a different content type. To fix this, we need to explicitly set the `Content-Type` response header in our Flask views. We will do this by introducing a new helper function, `render_to_response()`: #figure( caption: [`app.py`], )[ ```py def render_to_response(template_name, *args, **kwargs): content = render_template(template_name, *args, **kwargs) <1> response = make_response(content) <2> response.headers['Content-Type'] = 'application/vnd.hyperview+xml' <3> return response ``` ] 1. Renders the given template with the supplied arguments and keyword arguments. 2. Create an explicit response object with the rendered template. 3. Sets the response `Content-Type` header to XML. As you can see, this helper function uses `render_template()` under the hood. `render_template()` returns a string. This helper function uses that string to create an explicit `Response` object. The response object has a `headers` attribute, allowing us to set and change the response headers. Specifically, `render_to_response()` sets `Content-Type` to `application/vnd.hyperview+xml` so that the Hyperview client recognizes the content. This helper is a drop-in replacement for `render_template` in our views. So all we need to do is update the last line of the `contacts()` function. #figure( caption: [`contacts() function`], )[ ```py return render_to_response(template_name, contacts=contacts_set, page=page) <1> ``` ] 1. Render the HXML template to an XML response. With these changes to the `contacts()` view, we can finally see the fruits of our labor. After restarting the backend and refreshing the screen in our mobile app, we can see the contacts screen! #figure([#image("images/screenshot_hyperview_list.png")], caption: [ Contacts Screen ]) ==== Searching Contacts #index[Hyperview][search] So far, we have a mobile app that displays a screen with a list of contacts. But our UI doesn’t support any interactions. Typing a query in the search field doesn’t filter the list of contacts. Let’s add a behavior to the search field to implement a search-as-you-type interaction. This requires expanding `<text-field>` to add a `<behavior>` element. #figure( caption: [Snippet of `hv/index.xml`], )[ ```xml <text-field name="q" value="" placeholder="Search..." style="search-field"> <behavior trigger="change" <1> action="replace-inner" <2> target="contacts-list" <3> href="/contacts?rows_only=true" <4> verb="get" <5> /> </text-field> ``` ] 1. This behavior will trigger when the value of the text field changes. 2. When the behavior triggers, the action will replace the content inside the target element. 3. The target of the action is the element with ID `contacts-list`. 4. The replacement content will be fetched from this URL path. 5. The replacement content will be fetched with the `GET` HTTP method. The first thing you’ll notice is that we changed the text field from using a self-closing tag (`<text-field />`) to using opening and closing tags (`<text-field>…​</text-field>`). This allows us to add a child `<behavior>` element to define an interaction. The `trigger="change"` attribute tells Hyperview that a change to the value of the text field will trigger an action. Any time the user edits the content of the text field by adding or deleting characters, an action will trigger. The remaining attributes on the `<behavior>` element define the action. `action="replace-inner"` means the action will update content on the screen, by replacing the HXML content of an element with new content. For `replace-inner` to do its thing, we need to know two things: the current element on the screen that will be targeted by the action, and the content that will used for the replacement. `target="contacts-list"` tells us the ID of the current element. Note that we set `id="contacts-list"` on the `<list>` element in `index.xml`. So when the user enters a search query into the text field, Hyperview will replace the content of `<list>` (a bunch of `<item>` elements) with new content (`<item>` elements that match the search query) received in the relative href response. The domain here is inferred from the domain used to fetch the screen. Note that `href` includes our `rows_only` query param; we want the response to only include the rows and not the entire screen. #figure([#image("images/screenshot_hyperview_search.png")], caption: [ Searching for Contacts ]) That’s all it takes to add search-as-you-type functionality to our mobile app! As the user types a search query, the client will make requests to the backend and replace the list with the search results. You may be wondering, how does the backend know the query to use? The `href` attribute in the behavior does not include the `q` param expected by our backend. But remember, in `index.xml`, we wrapped the `<text-field>` and `<list>` elements with a `<form>` element. The `<form>` element defines a group of inputs that will be serialized and included in any HTTP requests triggered by its child elements. In this case, the `<form>` element surrounds the search behavior and the text field. So the value of the `<text-field>` will be included in our HTTP request for the search results. Since we are making a `GET` request, the name and value of the text field will be serialized as a query param. Any existing query params on the `href` will be preserved. This means the actual HTTP request to our backend looks like `GET /contacts?rows_only=true&q=Car`. Our backend already supports the `q` param for searching, so the response will include rows that match the string "Car." ==== Infinite scroll #index[Hyperview][infinite scroll] If the user has hundreds or thousands of contacts, loading them all at once may result in poor app performance. That’s why most mobile apps with long lists implement an interaction known as "infinite scroll." The app loads a fixed number of initial items in the list, let’s say 100 items. If the user scrolls to the bottom of the list, they see a spinner indicating more content is loading. Once the content is available, the spinner is replaced with the next page of 100 items. These items are appended to the list, they don’t replace the first set of items. So the list now contains 200 items. If the user scrolls to the bottom of the list again, they will see another spinner, and the app will load the next set of content. Infinite scroll improves app performance in two ways: - The initial request for 100 items will be processed quickly, with predictable latency. - Subsequent requests can also be fast and predictable. - If the user doesn’t scroll to the bottom of the list, the app won’t have to make subsequent requests. Our Flask backend already supports pagination on the `/contacts` endpoint via the `page` query param. We just need to modify our HXML templates to make use of this parameter. To do this, let’s edit `rows.xml` to add a new `<item>` below the Jinja for-loop: #figure(caption: [Snippet of `hv/rows.xml`])[ ```xml <items xmlns="https://hyperview.org/hyperview"> {% for contact in contacts %} <item key="{{ contact.id }}" style="contact-item"> <!-- omitted for brevity --> </item> {% endfor %} {% if contacts|length > 0 %} <item key="load-more" id="load-more" style="load-more-item"> <1> <behavior trigger="visible" <2> action="replace" <3> target="load-more" <4> href="/contacts?rows_only=true&page={{ page + 1 }}" <5> verb="get" /> <spinner /> <6> </item> {% endif %} </items> ``` ] 1. Include an extra `<item>` in the list to show the spinner. 2. The item behavior triggers when visible in the viewport. 3. When triggered, the behavior will replace an element on the screen. 4. The element to be replaced is the item itself (ID `load-more`). 5. Replace the item with the next page of content. 6. The spinner element. If the current list of contacts passed to the template is empty, we can assume there’s no more contacts to fetch from the backend. So we use a Jinja conditional to only include this new `<item>` if the list of contacts is non-empty. This new `<item>` element gets an ID and a behavior. The behavior defines the infinite scroll interaction. Up until now, we’ve seen `trigger` values of `change` and `refresh`. But to implement infinite scroll, we need a way to trigger the action when the user scrolls to the bottom of the list. The `visible` trigger can be used for this exact purpose. It will trigger the action when the element with the behavior is visible in the device viewport. In this case, the new `<item>` element is the last item in the list, so the action will trigger when the user scrolls down far enough for the item to enter the viewport. As soon as the item is visible, the action will make an HTTP GET request, and replace the loading `<item>` element with the response content. Note that our href must include the `rows_only=true` query param, so that our response will only include HXML for the contact items, and not the entire screen. Also, we’re passing the `page` query param, incrementing the current page number to ensure we load the next page. What happens when there’s more than one page of items? The initial screen will include the first 100 items, plus the "load-more" item at the bottom. When the user scrolls to the bottom of the screen, Hyperview will request the second page of items (`&page=2`), and replace the "load-more" item with the new items. But this second page of items will include a new "load-more" item. So once the user scrolls through all of the items from the second page, Hyperview will again request more items (`&page=3`). And once again, the "load-more" item will be replaced with the new items. This will continue until all of the items will be loaded on the screen. At that point, there will be no more contacts to return, the response will not include another "load-more" item, and our pagination is over. ==== Pull-to-refresh #index[Hyperview][pull-to-refresh] Pull-to-refresh is a common interaction in mobile apps, especially on screens featuring dynamic content. It works like this: At the top of a scrolling view, the user pulls the scrolling content downwards with a swipe-down gesture. This reveals a spinner "below" the content. Pulling the content down sufficiently far will trigger a refresh. While the content refreshes, the spinner remains visible on screen, indicating to the user that the action is still taking place. Once the content is refreshed, the content retracts back up to its default position, hiding the spinner and letting the user know that the interaction is done. #figure([#image("images/screenshot_hyperview_refresh_cropped.png")], caption: [ Pull-to-refresh ]) This pattern is so common and useful that it’s built in to Hyperview via the `refresh` action. Let’s add pull-to-refresh to our list of contacts to see it in action. #figure(caption: [Snippet of `hv/index.xml`])[ ```xml <list id="contacts-list" trigger="refresh" <1> action="replace-inner" <2> target="contacts-list" <3> href="/contacts?rows_only=true" <4> verb="get" <5> > {% include 'hv/rows.xml' %} </list> ``` ] 1. This behavior will trigger when the user does a "pull-to-refresh" gesture. 2. When the behavior triggers, this action will replace the content inside the target element. 3. The target of the action is the `<list>` element itself. 4. The replacement content will be fetched from this URL path. 5. The replacement content will be fetched with the `GET` HTTP method. You’ll notice something unusual in the snippet above: rather than adding a `<behavior>` element to the `<list>`, we added the behavior attributes directly to the `<list>` element. This is a shorthand notation that’s sometimes useful for specifying single behaviors on an element. It is equivalent to adding a `<behavior>` element to the `<list>` with the same attributes. So why did we use the shorthand syntax here? It has to do with the action, `replace-inner`. Remember, this action replaces all child elements of the target with the new content. This includes `<behavior>` elements too! Let’s say our `<list>` did contain a `<behavior>`. If the user did a search or pull-to-refresh, we would replace the content of `<list>` with the content from `rows.xml`. The `<behavior>` would no longer be defined on the `<list>`, and subsequent attempts to pull-to-refresh would not work. By defining the behavior as attributes of `<list>`, the behavior will persist even when replacing the items in the list. Generally, we prefer to use explicit `<behavior>` elements in HXML. It makes it easier to define multiple behaviors, and to move the behavior around while refactoring. But the shorthand syntax is good to apply in situations like this. ==== Viewing The Details Of A Contact <_viewing_the_details_of_a_contact> Now that our contacts list screen is in good shape, we can start adding other screens to our app. The natural next step is to create a details screen, which appears when the user taps an item in the contacts list. Let’s update the template that renders the contact `<item>` elements, and add a behavior to show the details screen. #figure( caption: [`hv/rows.xml`], )[ ```xml <items xmlns="https://hyperview.org/hyperview"> {% for contact in contacts %} <item key="{{ contact.id }}" style="contact-item"> <behavior trigger="press" action="push" href="/contacts/{{ contact.id }}" /> <1> <text style="contact-item-label"> <!-- omitted for brevity --> </text> </item> {% endfor %} </items> ``` ] 1. Behavior to push the contact details screen onto the stack when pressed. Our Flask backend already has a route for serving the contact details at `/contacts/<contact_id>`. In our template, we use a Jinja variable to dynamically generate the URL path for the current contact in the for-loop. We also used the "push" action to show the details by pushing a new screen onto the stack. If you reload the app, you can now tap any contact in the list, and Hyperview will open the new screen. However, the new screen will show an error message. That’s because our backend is still returning HTML in the response, and the Hyperview client expects HXML. Let’s update the backend to respond with HXML and the proper headers. #figure(caption: [`app.py`])[ ```py @app.route("/contacts/<contact_id>") def contacts_view(contact_id=0): contact = Contact.find(contact_id) return render_to_response("hv/show.xml", contact=contact) <1> ``` ] 1. Generate an XML response from a new template file. Just like the `contacts()` view, `contacts_view()` uses `render_to_response()` to set the `Content-Type` header on the response. We’re also generating the response from a new HXML template, which we can create now: #figure( caption: [`hv/show.xml`], )[ ```xml {% extends 'hv/layout.xml' %} <1> {% block header %} <2> <text style="header-button"> <behavior trigger="press" action="back" /> <3> Back </text> {% endblock %} {% block content %} <4> <view style="details"> <text style="contact-name"> {{ contact.first }} {{ contact.last }} </text> <view style="contact-section"> <text style="contact-section-label">Phone</text> <text style="contact-section-info">{{contact.phone}}</text> </view> <view style="contact-section"> <text style="contact-section-label">Email</text> <text style="contact-section-info">{{contact.email}}</text> </view> </view> {% endblock %} ``` ] 1. Extend the base layout template. 2. Override the `header` block of the layout template to include a "Back" button. 3. Behavior to navigate to the previous screen when pressed. 4. Override the `content` block to show the full details of the selected contact. The contacts detail screen extends the base `layout.xml` template, just like we did in `index.xml`. This time, we’re overriding content in both the `header` block and `content` block. Overriding the header block lets us add a "Back" button with a behavior. When pressed, the Hyperview client will unwind the navigation stack and return the user to the contacts list. Note that triggering this behavior is not the only way to navigate back. The Hyperview client respects navigation conventions on different platforms. On iOS, users can also navigate to the previous screen by swiping right from the left edge of the device. On Android, users can also navigate to the previous screen by pressing the hardware back button. We don’t need to specify anything extra in the HXML to get these interactions. #figure([#image("images/screenshot_hyperview_detail_cropped.png")], caption: [ Contact Details Screen ]) With just a few simple changes, we’ve gone from a single-screen app to a multi-screen app. Note that we didn’t need to change anything in the actual mobile app code to support our new screen. This is a big deal. In traditional mobile app development, adding screens can be a significant task. Developers need to create the new screen, insert it into the appropriate place of the navigation hierarchy, and write code to open the new screen from existing screens. In Hyperview, we just added a behavior with `action="push"`. === Editing a Contact <_editing_a_contact> So far, our app lets us browse a list of contacts, and view details of a specific contact. Wouldn’t it be nice to update the name, phone number, or email of a contact? Let’s add UI to edit contacts as our next enhancement. First we have to figure out how we want to display the editing UI. We could push a new editing screen onto the stack, the same way we pushed the contact details screen. But that’s not the best design from a user-experience perspective. Pushing new screens makes sense when drilling down into data, like going from a list to a single item. But editing is not a "drill-down" interaction, it’s a mode switch between viewing and editing. So instead of pushing a new screen, let’s replace the current screen with the editing UI. That means we need to add a button and behavior that use the `reload` action. This button can be added to the header of the contact details screen. #figure( caption: [Snippet of `hv/show.xml`], )[ ```xml {% block header %} <text style="header-button"> <behavior trigger="press" action="back" /> Back </text> <text style="header-button"> <1> <behavior trigger="press" action="reload" href="/contacts/{{contact.id}}/edit" /> <2> Edit </text> {% endblock %} ``` ] 1. The new "Edit" button. 2. Behavior to reload the current screen with the edit screen when pressed. Once again, we’re reusing an existing Flask route (`/contacts/<contact_id>/edit`) for the edit UI, and filling in the contact ID using data passed to the Jinja template. We also need to update the `contacts_edit_get()` view to return an XML response based on an HXML template (`hv/edit.xml`). We’ll skip the code sample because the needed changes are identical to what we applied to `contacts_view()` in the previous section. Instead, let’s focus on the template for the edit screen. #figure(caption: [`hv/edit.xml`])[ ```xml {% extends 'hv/layout.xml' %} {% block header %} <text style="header-button"> <behavior trigger="press" action="back" href="#" /> Back </text> {% endblock %} {% block content %} <form> <1> <view id="form-fields"> <2> {% include 'hv/form_fields.xml' %} <3> </view> <view style="button"> <4> <behavior trigger="press" action="replace-inner" target="form-fields" href="/contacts/{{contact.id}}/edit" verb="post" /> <text style="button-label">Save</text> </view> </form> {% endblock %} ``` ] 1. Form wrapping the input fields and buttons. 2. Container with ID, containing the input fields. 3. Template include to render the input fields. 4. Button to submit the form data and update the input fields container. Since the edit screen needs to send data to the backend, we wrap the entire content section in a `<form>` element. This ensures the form field data will be included in the HTTP requests to our backend. Within the `<form>` element, our UI is divided into two sections: the form fields, and the Save button. The actual form fields are defined in a separate template (`form_fields.xml`) and added to the edit screen using a Jinja include tag. #figure( caption: [`hv/form_fields.xml`], )[ ```xml <view style="edit-group"> <view style="edit-field"> <text-field name="first_name" placeholder="<NAME>" value="{{ contact.first }}" /> <1> <text style="edit-field-error">{{ contact.errors.first }}</text> <2> </view> <view style="edit-field"> <3> <text-field name="last_name" placeholder="<NAME>" value="{{ contact.last }}" /> <text style="edit-field-error">{{ contact.errors.last }}</text> </view> <!-- same markup for contact.email and contact.phone --> </view> ``` ] 1. Text input holding the current value for the contact’s first name. 2. Text element that could display errors from the contact model. 3. Another text field, this time for the contact’s last name. We omitted the code for the contact’s phone number and email address, because they follow the same pattern as the first and last name. Each contact field has its own `<text-field>`, and a `<text>` element below it to display possible errors. The `<text-field>` has two important attributes: - `name` defines the name to use when serializing the text-field’s value into form data for HTTP requests. We are using the same names as the web app from previous chapters (`first_name`, `last_name`, `phone`, `email`). That way, we don’t need to make changes in our backend to parse the form data. - `value` defines the pre-filled data in the text field. Since we are editing an existing contact, it makes sense to pre-fill the text field with the current name, phone, or email. You might be wondering, why did we choose to define the form fields in a separate template (`form_fields.xml`)? To understand that decision, we need to first discuss the "Save" button. When pressed, the Hyperview client will make an HTTP `POST` request to `contacts/<contact_id>/edit`, with form data serialized from the `<text-field>` inputs. The HXML response will replace the contents of form field container (ID `form-fields`). But what should that response be? That depends on the validity of the form data: 1. If the data is invalid (e.g., duplicate email address), our UI will remain in the editing mode and show error messages on the invalid fields. This allows the user to correct the errors and try saving again. 1. If the data is valid, our backend will persist the edits, and our UI will switch back to a display mode (the contact details UI). So our backend needs to distinguish between a valid and invalid edit. To support these two scenarios, let’s make some changes to the existing `contacts_edit_post()` view in the Flask app. #figure( caption: [`app.py`], )[ ```py @app.route("/contacts/<contact_id>/edit", methods=["POST"]) def contacts_edit_post(contact_id=0): c = Contact.find(contact_id) c.update( request.form['first_name'], request.form['last_name'], request.form['phone'], request.form['email']) <1> if c.save(): <2> flash("Updated Contact!") return render_to_response("hv/form_fields.xml", contact=c, saved=True) <3> else: return render_to_response("hv/form_fields.xml", contact=c) <4> ``` ] 1. Update the contact object from the request’s form data. 2. Attempt to persist the updates. This returns `False` for invalid data. 3. On success, render the form fields template, and pass a `saved` flag to the template 4. On failure, render the form fields template. Error messages are present on the contact object. This view already contains conditional logic based on whether the contact model `save()` succeeds. If `save()` fails, we render the `form_fields.xml` template. `contact.errors` will contain error messages for the invalid fields, which will be rendered into the `<text style="edit-field-error">` elements. If `save()` succeeds, we will also render the `form_fields.xml` template. But this time, the template will get a `saved` flag, indicating success. We will update the template to use this flag to implement our desired UI: switching the UI back to display mode. #figure( caption: [`hv/form_fields.xml`], )[ ```xml <view style="edit-group"> {% if saved %} <1> <behavior trigger="load" <2> action="reload" <3> href="/contacts/{{contact.id}}" <4> /> {% endif %} <view style="edit-field"> <text-field name="first_name" placeholder="<NAME>" value="{{ contact.first }}" /> <text style="edit-field-error">{{ contact.errors.first }}</text> </view> <!-- same markup for the other fields --> </view> ``` ] 1. Only include this behavior after successfully saving a contact. 2. Trigger the behavior immediately. 3. The behavior will reload the entire screen. 4. The screen will be reloaded with the contact details screen. The Jinja template conditional ensures that our behavior only renders on successful saves, and not when the screen first opens (or the user submits invalid data). On success, the template includes a behavior that triggers immediately thanks to `trigger="load"`. The action reloads the current screen with the Contact Details screen (from the `/contacts/<contact_id>` route). The result? When the user hits "Save", our backend persists the new contact data, and the screen switches back to the Details screen. Since the app will make a new HTTP request to get the contact details, it’s guaranteed to show the freshly saved edits. #sidebar[Why Not Redirect?][ You may remember the web app version of this code behaved a little differently. On a successful save, the view returned `redirect("/contacts/" + str(contact_id))`. This HTTP redirect would tell the web browser to navigate to the contact details page. This approach is not supported in Hyperview. Why? A web app’s navigation stack is simple: a linear sequence of pages, with only one active page at a time. Navigation in a mobile app is considerably more complex. Mobile apps use a nested hierarchy of navigation stacks, modals, and tabs. All screens in this hierarchy are active, and may be displayed instantly in response to user actions. In this world, how would the Hyperview client interpret an HTTP redirect? Should it reload the current screen, push a new one, or navigate to a screen in the stack with the same URL? Instead of making a choice that would be suboptimal for many scenarios, Hyperview takes a different approach. Server-controlled redirects are not possible, but the backend can render navigation behaviors into the HXML. This is what we do to switch from the Edit UI to the Details UI in the code above. Think of these as client-side redirects, or better yet client-side navigations. ] We now have a working Edit UI in our contacts app. Users can enter the Edit mode by pressing a button on the contact details screen. In the Edit mode, they can update the contact’s data and save it to the backend. If the backend rejects the edits as invalid, the app stays in Edit mode and shows the validation errors. If the backend accepts and persists the edits, the app will switch back to the details mode, showing the updated contact data. Let’s add one more enhancement to the Edit UI. It would be nice to let the user switch away from the Edit mode without needing to save the contact. This is typically done by providing a "Cancel" action. We can add this as a new button below the "Save" button. #figure( caption: [Snippet of `hv/edit.xml`], )[ ```xml <view style="button"> <behavior trigger="press" action="replace-inner"target="form-fields" href="/contacts/{{contact.id}}/edit" verb="post" /> <text style="button-label">Save</text> </view> <view style="button"> <1> <behavior trigger="press" action="reload" <2> href="/contacts/{{contact.id}}" <3> /> <text style="button-label">Cancel</text> </view> ``` ] 1. A new Cancel button on the edit screen. 2. When pressed, reload the entire screen. 3. The screen will be reloaded with the contact details screen. This is the same technique we used to switch from the edit UI to the details UI upon successfully editing the contact. But pressing "Cancel" will update the UI faster than pressing "Save." On save, the app will first make a `POST` request to save the data, and then a `GET` request for the details screen. Cancelling skips the `POST`, and immediately makes the `GET` request. #figure([#image("images/screenshot_hyperview_edit.png")], caption: [ Contact Edit Screen ]) ==== Updating the Contacts List <_updating_the_contacts_list> At this point, we can claim to have fully implemented the Edit UI. But there’s a problem. In fact, if we stopped here, users may even consider the app to be buggy! Why? It has to do with syncing the app state across multiple screens. Let’s walk through this series of interactions: 1. Launch the app to the Contacts List. 2. Press on the contact "<NAME>" to load his Contact Details. 3. Press Edit to switch to the edit mode, and change the contact’s first name to "Joseph." 4. Press Save to switch back to viewing mode. The contact’s name is now "<NAME>." 5. Hit the back button to return to the Contacts List. Did you catch the issue? Our Contacts list is still showing the same list of names as when we launched the app. The contact we just renamed to "Joseph" is still showing up in the list as "Joe." This is a general problem in hypermedia applications. The client does not have a notion of shared data across different parts of the UI. Updates in one part of the app will not automatically update other parts of the app. Luckily, there’s a solution to this problem in Hyperview: events. Events are built into the behavior system, and allow lightweight communication between different parts of the UI. #sidebar[Event Behaviors][ #index[Hyperview][events] Events are a client-side feature of Hyperview. In #link("/client-side-scripting/#_hyperscript")[Client-Side Scripting], we discussed events while working with HTML, \_hyperscript and the DOM. DOM Elements will dispatch events as a result of user interactions. Scripts can listen for these events, and respond to them by running arbitrary JavaScript code. Events in Hyperview are a good deal simpler, but they don’t require any scripting and can be defined declaratively in the HXML. This is done through the behavior system. Events require adding a new behavior attribute, action type, and trigger type: - `event-name`: This attribute of `<behavior>` defines the name of the event that will either be dispatched or listened for. - `action="dispatch-event"`: When triggered, this behavior will dispatch an event with the name defined by the `event-name` attribute. This event is dispatched globally across the entire Hyperview app. - `trigger="on-event"`: This behavior will trigger if another behavior in the app dispatches an event matching the `event-name` attribute. If a `<behavior>` element uses `action="dispatch-event"` or `trigger="on-event"`, it must also define an `event-name`. Note that multiple behaviors can dispatch an event with the same name. Likewise, multiple behaviors can trigger on the same event name. Let’s look at this simple behavior: `<behavior trigger="press" action="toggle" target="container" />`. Pressing an element containing this behavior will toggle the visibility of an element with the ID "container". But what if the element we want to toggle is on a different screen? The "toggle" action and target ID lookup only work on the current screen, so this solution wouldn’t work. The solution is to create two behaviors, one on each screen, communicating via events: - Screen A: `<behavior trigger="press" action="dispatch-event" event-name="button-pressed" />` - Screen B: `<behavior trigger="on-event" event-name="button-pressed" action="toggle" target="container" />` Pressing an element containing the first behavior (on Screen A) will dispatch an event with the name "button-pressed". The second behavior (on Screen B) will trigger on an event with this name, and toggle the visibility of an element with ID "container". Events have plenty of uses, but the most common is to inform different screens about backend state changes that require the UI to be re-fetched. ] We now know enough about Hyperview’s event system to solve the bug in our app. When the user saves a change to a contact, we need to dispatch an event from the Details screen. And the Contacts screen needs to listen to that event, and reload itself to reflect the edits. Since the `form_fields.xml` template already gets the `saved` flag when the backend successfully saves a contact, it’s a good place to dispatch the event: #figure(caption: [Snippet from `hv/form_fields.xml`])[ ```xml {% if saved %} <behavior trigger="load" <1> action="dispatch-event" <2> event-name="contact-updated" <2> /> <behavior <4> trigger="load" action="reload" href="/contacts/{{contact.id}}" /> {% endif %} ``` ] 1. Trigger the behavior immediately. 2. The behavior will dispatch an event. 3. The event name is "contact-updated". 4. The existing behavior to show the Details UI. Now, we just need the contacts list to listen for the `contact-updated` event, and reload itself: #figure(caption: [Snippet from `hv/index.xml`])[ ```xml <form> <behavior trigger="on-event" <1> event-name="contact-updated" <2> action="replace-inner" <3> target="contacts-list" href="/contacts?rows_only=true" verb="get" /> <!-- text-field omitted --> <list id="contacts-list"> {% include 'hv/rows.xml' %} </list> </form> ``` ] 1. Trigger the behavior on event dispatch. 2. Trigger the behavior for dispatched events with the name "contact-updated". 3. When triggered, replace the contents of the `<list>` element with rows from the backend. Any time the user edits a contact, the Contacts List screen will update to reflect the edits. The addition of these two `<behavior>` elements fixes the bug: the Contacts List screen will correctly show "<NAME>" in the list. Note that we intentionally added the new behavior inside the `<form>` element. The ensures the triggered request will preserve any search query. To show what we mean, let’s revisit the set of steps that demonstrated the buggy behavior. Assume that before pressing on "<NAME>," the user had searched the contacts by typing "Joe" in the search field. When the user later updates the contact to "<NAME>", our template dispatches the "contact-updated" event, which triggers the `replace-inner` behavior on the contact list screen. Due to the `<form>` element, the search query "Joe" will be serialized with the request: `GET /contacts?rows_only=true&q=Joe`. Since the name "Joseph" doesn’t match the query "Joe", the contact we edited will not appear in the list (until the user clears out the query). Our app’s state remains consistent across our backend and all active screens. Events introduce a level of abstraction to behaviors. So far, we’ve seen that editing a contact will cause the list of contacts to refresh. But the list of contacts should also refresh after other actions, such as deleting a contact or adding a new contact. As long as our HXML responses for deletion or creation include a behavior to dispatch a `contact-updated` event, then we will get the desired refresh behavior on the contacts list screen. The screen doesn’t care what causes the `contact-updated` event to be dispatched. It just knows what it needs to do when it happens. === Deleting a Contact <_deleting_a_contact> Speaking of deleting a contact, this is a good next feature to implement. We will let users delete a contact from the Edit UI. So let’s add a new button to `edit.xml`. #figure( caption: [Snippet of `hv/edit.xml`], )[ ```xml <view style="button"> <behavior trigger="press" action="replace-inner" target="form-fields" href="/contacts/{{contact.id}}/edit" verb="post" /> <text style="button-label">Save</text> </view> <view style="button"> <behavior trigger="press" action="reload" href="/contacts/{{contact.id}}" /> <text style="button-label">Cancel</text> </view> <view style="button"> <1> <behavior trigger="press" action="append" <2> target="form-fields" href="/contacts/{{contact.id}}/delete" <3> verb="post" /> <text style="button-label button-label-delete">Delete Contact</text> </view> ``` ] 1. New Delete Contact button on the edit screen. 2. When pressed, append HXML to a container on the screen. 3. The HXML will be fetched by making a `POST /contacts/<contact_id>/delete` request. The HXML for the Delete button is pretty similar to the Save button, but there are a few subtle differences. Remember, pressing the Save button results in one of two expected outcomes: failing and showing validation errors on the form, or succeeding and switching to the contact details screen. To support the first outcome (failing and showing validation errors), the save behavior replaces the contents of the `<view id="form-fields">` container with a re-rendered version of `form_fields.xml`. Therefore, using the `replace-inner` action makes sense. Deletion does not involve a validation step, so there’s only one expected outcome: successfully deleting the contact. When deletion succeeds, the contact no longer exists. It doesn’t make sense to show the edit UI or contact details for a non-existent contact. Instead, our app will navigate back to the previous screen (the contacts list). Our response will only include behaviors that trigger immediately, there’s no UI to change. Therefore, using the `append` action will preserve the current UI while Hyperview runs the actions. #figure( caption: [Snippet of `hv/deleted.xml`], )[ ```xml <view> <behavior trigger="load" action="dispatch-event" event-name="contact-updated" /> <1> <behavior trigger="load" action="back" /> <2> </view> ``` ] 1. On load, dispatch the `contact-updated` event to update the contact lists screen. 2. Navigate back to the contacts list screen. Note that in addition to behavior to navigate back, this template also includes a behavior to dispatch the `contact-updated` event. In the previous chapter section, we added a behavior to `index.xml` to refresh the list when that event is dispatched. By dispatching the event after a deletion, we will make sure the deleted contact gets removed from the list. Once again, we’ll skip over the changes to the Flask backend. Suffice it to say, we will need to update the `contacts_delete()` view to respond with the `hv/deleted.xml` template. And we need to update the route to support `POST` in addition to `DELETE`, since the Hyperview client only understands `GET` and `POST`. We now have a fully functioning deletion feature! But it’s not the most user-friendly: it takes one accidental tap to permanently delete a contact. For destructive actions like deleting a contact, it’s always a good idea to ask the user for confirmation. We can add a confirmation to the delete behavior by using the `alert` system action described in the previous chapter. As you recall, the `alert` action will show a system dialog box with buttons that can trigger other behaviors. All we have to do is wrap the delete `<behavior>` in a behavior that uses `action="alert"`. #figure(caption: [Delete button in `hv/edit.xml`])[ ```xml <view style="button"> <behavior <1> xmlns:alert="https://hyperview.org/hyperview-alert" trigger="press" action="alert" alert:title="Confirm delete" alert:message="Are you sure you want to delete {{ contact.first }}?" > <alert:option alert:label="Confirm"> <2> <behavior <3> trigger="press" action="append" target="form-fields" href="/contacts/{{contact.id}}/delete" verb="post" /> </alert:option> <alert:option alert:label="Cancel" /> <4> </behavior> <text style="button-label button-label-delete">Delete Contact</text> </view> ``` ] 1. Pressing "Delete" triggers an action to show the system dialog with the given title and message. 2. The first pressable option in the system dialog. 3. Pressing the first option will trigger contact deletion. 4. The second pressable option has no behavior, so it only closes the dialog. Unlike before, pressing the delete button will not have an immediate effect. Instead, the user will be presented with the dialog box and asked to confirm or cancel. Our core deletion behavior didn’t change, we just chained it from another behavior. #figure([#image("images/screenshot_hyperview_delete_cropped.png")], caption: [ Delete Contact confirmation ]) === Adding a New Contact <_adding_a_new_contact> Adding a new contact is the last feature we want to support in our mobile app. And luckily, it’s also the easiest. We can reuse the concepts (and even some templates) from features we’ve already implemented. In particular, adding a new contact is very similar to editing an existing contact. Both features need to: - Show a form to collect information about the contact. - Have a way to save the entered information. - Show validation errors on the form. - Persist the contact when there are no validation errors. Since the functionality is so similar, we’ll summarize the changes here without showing the code. 1. Update `index.xml`. - Override the `header` block to add a new "Add" button. - Include a behavior in the button. When pressed, push a new screen as a modal by using `action="new"`, and request the screen content from `/contacts/new`. 2. Create a template `hv/new.xml`. - Override the header block to include a button that closes the modal, using `action="close"`. - Include the `hv/form_fields.xml` template to render empty form fields - Add a "Add Contact" button below the form fields. - Include a behavior in the button. When pressed, make a `POST` request to `/contacts/new`, and use `action="replace-inner"` to update the form fields. 3. Update the Flask view. - Change `contacts_new_get()` to use `render_to_response()` with the `hv/new.xml` template. - Change `contacts_new()` to use `render_to_response()` with the `hv/form_fields.xml` template. Pass `saved=True` when rendering the template after successfully persisting the new contact. By reusing `form_fields.xml` for both editing and adding a contact, we get to reuse some code and ensure the two features have a consistent UI. Also, our "Add Contact" screen will benefit from the "saved" logic that’s already a part of `form_fields.xml`. After successfully adding a new contact, the screen will dispatch the `contact-updated` event, which will refresh the contacts list and show the newly added contact. The screen will reload itself to show the Contact Details. #figure([#image("images/screenshot_hyperview_add.png")], caption: [ Add Contact modal ]) === Deploying the App #index[Hyperview][deployment] With the completion of the contact creation UI, we have a fully implemented mobile app. It supports searching a list of contacts, viewing the details of a contact, editing and deleting a contact, and adding a new contact. But so far, we’ve been developing the app using a simulator on our desktop computer. How can we see it running on a mobile device? And how can we get it into the hands of our users? To see the app running on a physical device, let’s take advantage of the Expo platform’s app preview functionality. #[ #set enum(numbering: "1.", start: 1) + Download the Expo Go app on an Android or iOS device. + Restart the Flask app, binding to an interface accessible on your network. This might look something like `flask run --host 192.168.7.229`, where the host is your computer’s IP address on the network. + Update the Hyperview client code so that `ENTRY_POINT_URL` (in `demo/src/constants.js`) points to the IP and port that the Flask server is bound to. + After running `yarn start` in the Hyperview demo app, you will see a QR code printed in the console, with instructions on how to scan it on Android and iOS. ] Once you scan the QR code, the full app will run on the device. As you interact with the app, you will see HTTP requests made to the Flask server. You can even use the physical device during development. Any time you make a change in the HXML, just reload the screen to see the UI updates. So we have the app running on a physical device, but it’s still not production ready. To get the app into the hands of our users, there’s a few things we need to do: #[ #set enum(numbering: "1.", start: 1) + Deploy our backend in production. We need to use a production-grade web server like Gunicorn instead of the Flask development server. And we should run our app on a machine reachable on the Internet, most likely using a cloud provider like AWS or Heroku. + Create standalone binary apps. By following the instructions from the Expo project, we can create a `.ipa` or `.apk` file, for the iOS and Android platforms. Remember to update `ENTRY_POINT_URL` in the Hyperview client to point to the production backend. + Submit our binaries to the iOS App Store or Google Play Store, and wait for app approval. ] Once the app is approved, congratulations! Our mobile app can be downloaded by Android and iOS users. And here’s the best part: Because our app uses the hypermedia architecture, we can add features to our app by simply updating the backend. The UI and interactions are completely specified with the HXML generated from server-side templates. Want to add a new section to a screen? Just update an existing HXML template. Want to add a new type of screen to the app? Create a new route, view, and HXML template. Then, add a behavior to an existing screen that will open the new screen. To push these changes to your users, you just need to re-deploy the backend. Our app knows how to interpret HXML, and that’s enough for it to understand how to handle the new features. === One Backend, Multiple Hypermedia formats <_one_backend_multiple_hypermedia_formats> To create a mobile app using the hypermedia architecture, we started with the web-based contacts app and made a few changes, primarily replacing HTML templates with HXML templates. But in the process of porting the backend to serve our mobile app, we lost the web application functionality. Indeed, if you tried to visit `http://0.0.0.0:5000` in a web browser, you would see a jumble of text and XML markup. That’s because web browsers don’t know how to render plain XML, and they certainly don’t know how to interpret the tags and attributes of HXML to render an app. It’s a shame, because the Flask code for the web application and mobile app are nearly identical. The database and model logic are shared, and most of the views are unchanged as well. At this point you’re surely wondering: is it possible to use the same backend to serve both a web application and mobile app? The answer is yes! In fact, this is one of the benefits of using a hypermedia architecture across multiple platforms. We don’t need to port any client-side logic from one platform to another, we just need to respond to requests with the appropriate Hypermedia format. To do this, we will utilize content negotiation built into HTTP. ==== What is Content Negotiation? <_what_is_content_negotiation> Imagine a German speaker and Japanese speaker both visit `https://google.com` in their web browser. They will see the Google home page localized in German and Japanese, respectively. How does Google know to return a different version of the homepage based on the user’s preferred language? The answer lies in the REST architecture, and how it separates the concepts of resources and representations. In the REST architecture, the Google homepage is considered to be a single "resource," represented by a unique URL. However, that single resource can have multiple "representations." Representations are variations on how the content of the resource is presented to the client. The German and Japanese versions of the Google homepage are two representations of the same resource. To determine the best representation of a resource to return, HTTP clients and servers engage in a process called "content negotiation." It works like this: - Clients specify the preferred representation through `Accept-*` request headers. - The server tries to match the preferred representation as best it can, and communicates back the chosen representation using `Content-*`. In the Google homepage example, the German speaker uses a browser that is set to prefer content localized for German. Every HTTP request made by the web browser will include a header `Accept-Language: de-DE`. The server sees the request header, and it will return a response localized for German (if it can). The HTTP response will include a `Content-Language: de-DE` header to inform the client of the language of the response content. Language is just one factor for resource representation. More importantly for us, resources can be represented using different content types, such as HTML or HXML. Content negotiation over content type is done using the `Accept` request header and `Content-Type` response header. Web browsers set `text/html` as the preferred content type in the `Accept` header. The Hyperview client sets `application/vnd.hyperview+xml` as the preferred content type. This gives our backend a way to distinguish requests coming from a web browser or Hyperview client, and serve the appropriate content to each. There are two main approaches to content negotiation: fine-grained and global. ==== Approach 1: Template Switching <_approach_1_template_switching> When we ported the Contacts app from the web to mobile, we kept all of the Flask views but made some minor changes. Specifically, we introduced a new function `render_to_response()` and called it in the return statement of each view. Here’s the function again to refresh your memory: #figure(caption: [`app.py`])[ ```py def render_to_response(template_name, *args, **kwargs): content = render_template(template_name, *args, **kwargs) response = make_response(content) response.headers['Content-Type'] = 'application/vnd.hyperview+xml' return response ``` ] `render_to_response()` renders a template with the given context, and turns it into an Flask response object with the appropriate Hyperview `Content-Type` header. Obviously, the implementation is highly-specific to serving our Hyperview mobile app. But we can modify the function to do content negotiation based on the request’s `Accept` header: #figure( caption: [`app.py`], )[ ```py HTML_MIME = 'text/html' HXML_MIME = 'application/vnd.hyperview+xml' def render_to_response( html_template_name, hxml_template_name, *args, **kwargs <1> ): response_type = request.accept_mimetypes.best_match( [HTML_MIME, HXML_MIME], default=HTML_MIME) <2> template_name = hxml_template_name if response_type == HXML_MIME else html_template_name <3> content = render_template(template_name, *args, **kwargs) response = make_response(content) response.headers['Content-Type'] = response_type <4> return response ``` ] 1. Function signature takes two templates, one for HTML and one for HXML. 2. Determine whether the client wants HTML or HXML. 3. Select the template based on the best match for the client. 4. Set the `Content-Type` header based on the best match for the client. Flask’s request object exposes an `accept_mimetypes` property to help with content negotiation. We pass our two content MIME types to `request.accept_mimetypes.best_match()` and get back the MIME type that works for our client. Based on the best matching MIME type, we choose to either render an HTML template or HXML template. We also make sure to set the `Content-Type` header to the appropriate MIME type. The only difference in our Flask views is that we need to provide both an HTML and HXML template: #figure( caption: [`app.py`], )[ ```py @app.route("/contacts/<contact_id>") def contacts_view(contact_id=0): contact = Contact.find(contact_id) return render_to_response("show.html", "hv/show.xml", contact=contact) ``` ] - Template switching between an HTML and HXML template, based on the client. After updating all of the Flask views to support both templates, our backend will support both web browsers and our mobile app! This technique works well for the Contacts app because the screens in the mobile app map directly to pages of the web application. Each app has a dedicated page (or screen) for listing contacts, showing and editing details, and creating a new contact. This meant the Flask views could be kept as-is without major changes. But what if we wanted to re-imagine the Contacts app UI for our mobile app? Perhaps we want the mobile app to use a single screen, with rows that expanded in-line to support viewing and editing the information? In situations where the UI diverges between platforms, Template Switching becomes cumbersome or impossible. We need a different approach to have one backend serve both hypermedia formats. ==== Approach 2: The Redirect Fork <_approach_2_the_redirect_fork> If you recall, the Contacts web app has an `index` view, routed from the root path `/`: #figure(caption: [`app.py`])[ ```py @app.route("/") def index(): return redirect("/contacts") <1> ``` ] 1. Redirect requests from "/" to "/contacts" When someone requests to the root path of the web application, Flask redirects them to the `/contacts` path. This redirect also works in our Hyperview mobile app. The Hyperview client’s `ENTRY_POINT_URL` points to `http://0.0.0.0:5000/`, and the server redirects it to `http://0.0.0.0:5000/contacts`. But there’s no law that says we need to redirect to the same path in our web application and mobile app. What if we used the `Accept` header to redirect to decide on the redirect path? #figure( caption: [`app.py`], )[ ```py HTML_MIME = 'text/html' HXML_MIME = 'application/vnd.hyperview+xml' @app.route("/") def index(): response_type = request.accept_mimetypes.best_match( [HTML_MIME, HXML_MIME], default=HTML_MIME) <1> if response_type == HXML_MIME: return redirect("/mobile/contacts") <2> else: return redirect("/web/contacts") <3> ``` ] 1. Determine whether the client wants HTML or HXML. 2. If the client wants HXML, redirect them to `/mobile/contacts`. 3. If the client wants HTML, redirect them to `/web/contacts`. The entry point is a fork in the road: if the client wants HTML, we redirect them to one path. If the client wants HXML, we redirect them to a different path. These redirects would be handled by different Flask views: #figure(caption: [`app.py`])[ ```py @app.route("/mobile/contacts") def mobile_contacts(): # Render an HXML response @app.route("/web/contacts") def web_contacts(): # Render an HTML response ``` ] The `mobile_contacts()` view would render an HXML template with a list of contacts. Tapping a contact item would open a screen requested from `/mobile/contacts/1`, handled by a view `mobile_contacts_view`. After the initial fork, all subsequent requests from our mobile app go to paths prefixed with `/mobile/`, and get handled by mobile-specific Flask views. Likewise, all subsequent requests from the web app go to paths prefixed with `/web/`, and get handled by web-specific Flask views. (Note that in practice, we would want to separate the web and mobile views into separate parts of our codebase: `web_app.py` and `mobile_app.py`. We may also choose not to prefix the web paths with `/web/`, if we want more elegant URLs displayed in the browser’s address bar.) You may be thinking that the Redirect Fork leads to a lot of code duplication. After all, we need to write double the number of views: one set for the web application, and one set for the mobile app. That is true, which is why the Redirect Fork is only preferred if the two platforms require a disjointed set of view logic. If the apps are similar on both platforms, Template Switching will save a lot of time and keep the apps consistent. Even if we need to use the Redirect Fork, the bulk of the logic in our models can be shared by both sets of views. In practice, you may start out using Template Switching, but then realize you need to implement a fork for platform-specific features. In fact, we’re already doing that in the Contacts app. When porting the app from web to mobile, we didn’t bring over certain features like archiving functionality. The dynamic archive UI is a power feature that wouldn’t make sense on a mobile device. Since our HXML templates don’t expose any entry points to the Archive functionality, we can treat it as "web-only" and not worry about supporting it in Hyperview. === Contact.app, in Hyperview <_contact_app_in_hyperview> We’ve covered a lot of ground in this chapter. Take a breath and take stock of how far we’ve come: we ported the core functionality of the Contact.app web application to mobile. And we did it by re-using much of our Flask backend and while sticking with Jinja templating. We again saw the utility of events for connecting different aspects of an application. We’re not done yet. In the next chapter we’ll implement custom behaviors and UI elements to finish our mobile Contact.app. === Hypermedia Notes: API Endpoints <_hypermedia_notes_api_endpoints> Unlike a JSON API, the hypermedia API you produce for your hypermedia-driven application should feature endpoints specialized for your particular application’s UI needs. Because hypermedia APIs are not designed to be consumed by general-purpose clients you can set aside the pressure to keep them generalized and produce the content specifically needed for your application. Your endpoints should be optimized to support your particular applications UI/UX needs, not for a general-purpose data-access model for your domain model. A related tip is that, when you have a hypermedia-based API, you can aggressively refactor your API in a way that is heavily discouraged when writing JSON API-based SPAs or mobile clients. Because hypermedia-based applications use Hypermedia As The Engine Of Application State, you are able and, in fact, encouraged, to change the shape of them as your application developers and as use cases change. A great strength of the hypermedia approach is that you can completely rework your API to adapt to new needs over time without needing to version the API or even document it. Take advantage of it!
https://github.com/herbhuang/utdallas-thesis-template-typst
https://raw.githubusercontent.com/herbhuang/utdallas-thesis-template-typst/main/content/proposal/motivation.typ
typst
MIT License
#import "/utils/todo.typ": TODO = Motivation #TODO[ // Remove this block *Proposal Motivation* - Outline why it is (scientifically) important to solve the problem - Again use the actors to present your solution, but don't be to specific - Do not repeat the problem, instead focus on the positive aspects when the solution to the problem is available - Be visionary! - Optional: motivate with existing research, previous work ]
https://github.com/jgm/typst-hs
https://raw.githubusercontent.com/jgm/typst-hs/main/test/typ/meta/document-02.typ
typst
Other
// This, too. // Error: 23-29 expected string, found integer #set document(author: (123,)) What's up?
https://github.com/AliothCancer/AppuntiUniversity
https://raw.githubusercontent.com/AliothCancer/AppuntiUniversity/main/FormularioApplicazioni.typ
typst
#import "latest_style.typ": apply_my_style #let ind = h(2em) #let col(body) = columns(2, body) #apply_my_style(title: "Formulario di Applicazioni ITPS")[ #include "capitoli_applicazioni/biocompatibilità.typ" #include "capitoli_applicazioni/emodialisi.typ" #include "capitoli_applicazioni/vad.typ" #include "capitoli_applicazioni/ossigenatore.typ" ]
https://github.com/jgm/typst-hs
https://raw.githubusercontent.com/jgm/typst-hs/main/test/typ/text/raw-code-02.typ
typst
Other
#set page(width: 180pt) #set text(6pt) ```py import this def hi(): print("Hi!") ```
https://github.com/SkytAsul/INSA-Typst-Template
https://raw.githubusercontent.com/SkytAsul/INSA-Typst-Template/main/packages/silky-letter-insa/template/main.typ
typst
MIT License
#import "@preview/silky-letter-insa:{{VERSION}}": * #show: doc => insa-letter( author: [ <NAME>\ Rôle / Département ], date: datetime.today(), // peut être remplacé par une date, par ex. "23/03/2024" doc ) // gros titre en haut au centre #v(15pt) #align(center, text(size: 22pt, font: heading-fonts, weight: "bold", upper("Probabilités - Annale X"))) #v(5pt) #set heading(numbering: "1.") // numérotation des titres = Gros titre == Sous section Équation sur une ligne : $overline(x_n) = 1/n sum_(i=1)^n x_i$ == Autre sous section Grosse équation : $ "Variance biaisée :" s^2 &= 1/n sum_(i=1)^n (x_i - overline(x_n))^2\ "Variance corrigée :" s'^2 &= n/(n-1) s^2 $ === Petite section Code R : ```R data = c(1653, 2059, 2281, 1813, 2180, 1721, 1857, 1677, 1728) moyenne = mean(data) s_prime = sqrt(var(data)) # car la variance de R est déjà corrigée n = 9 alpha = 0.08 IC_min = moyenne + qt(alpha / 2, df = n - 1) * s_prime / sqrt(n) IC_max = moyenne + qt(1 - alpha / 2, df = n - 1) * s_prime / sqrt(n) ```
https://github.com/tsar-boomba/resume
https://raw.githubusercontent.com/tsar-boomba/resume/main/resume.typ
typst
#import "template.typ": resume, header, resume_heading, edu_item, exp_item, project_item, skill_item #show: resume #header( name: "<NAME>", phone: "704-804-1261", email: "<EMAIL>", linkedin: "linkedin.com/in/igamble", site: "igamble.dev", ) #resume_heading[Education] #edu_item( name: "Georgia Institute of Technology", degree: "Bachelor of Science in Computer Science - GPA 3.82/4.0", location: "Atlanta, GA", date: "Graduating May 2026", [Concentrating in _Embedded Devices_ & _Systems and Architecture_], [Relevant Courses: Data Structures & Algorithms, Computer Organization, Computer Systems & Networking] ) #resume_heading[Experience] #exp_item( name: "MongoDB", role: "Software Engineer Intern", location: "New York City, NY", date: "Jun. 2024 - Aug. 2024", [Worked with the Cloud Payments Team to ensure the consistency of payment data by designing and implementing automatic Jira issue creation for job failures using _Java_], [Developed API endpoint to run specific jobs, expediting post-fix testing and automating Jira issue resolution], [Wrote unit tests, integration tests, and third-party tests that interface with Jira using _JUnit_], ) #exp_item( name: "Hack4Impact GT: Bits Of Good", role: "Developer", location: "Atlanta, GA", date: "Aug. 2024 - Present", [Working on an _Agile_ team to create an application for Atlanta 501(c)(3) Motherhood Beyond Bars], [Translating _Figma_ designs from an experienced designer into fully functional _React_ components], [Creating backend functionality using _Node.js_, and employed Server-Side Rendering for optimal user experience], ) #exp_item( name: "Secure Process Intelligence", role: "Software Engineer Intern", location: "Remote", date: "Jun. 2023 - Present", [Created two internal tools with _Rust_, _React.js_, and _TypeScript_ which increased productivity by reverse engineering proprietary solutions for our workflow], [Programmed a microcontroller, using _C_ and _Rust_, which uses Modbus to extract data from a monitoring device], [Interfaced with a 4G LTE modem over UART to send collected data to a dashboard for customer viewing] ) #resume_heading[Projects] #project_item( name: "Genius Dashboard", skills: "React, TypeScript, Rust, Pub/Sub", [Solved flaws in an existing robot dashboard application while improving user experience and performance], [Improved memory usage by _50%_ and CPU usage by _70%_ over the old dashboard], [Designed a free-form drag-and-drop interface for creating custom user dashboards], ) #project_item( name: "Robotics Scouting", skills: "React, TypeScript, Next.js, MongoDB", [Created a webapp to collect data from matches at robotics competitions. Has auth and data analysis tools], [Enabled our team to make informed, data-driven decisions during competitions], ) #project_item( name: "ESP Spotify Display", skills: "Embedded, Rust", [Created an embedded project that shows what I'm listening to on Spotify through an _AWS Lambda_ function], [Uses the SPI peripheral to communicate with and FreeRTOS's tasks for non-blocking updates to the screen], ) #project_item( name: "Oxide", skills: "Linux, Docker, Rust, Embedded", [Developed a custom frontend for a Nintendo GameBoy emulator], [Streamlined _UX_ for ease of use with optimized sleep mode & fast start-up], [Interacts with low-level _Linux_ APIs such as ioctl and `/dev`], ) #resume_heading[Additional Experience and Awards] // Re-using this template cause im lazy #skill_item( category: "Provost Scholarship", skills: "Prestigious merit scholarship awarded to 60 out-of-state students, from a pool of thousands", ) #skill_item( category: "VIP Member", skills: "Member of the Intelligent Digital Communications VIP on the Systems and Operations subteam" ) #skill_item( category: "Hacklytics 2024", skills: "Placed 2nd in the sports track and 3rd in the healthcare track, against 200 other submissions", ) #resume_heading[Technical Skills] #skill_item( category: "Languages", skills: "TypeScript, HTML, CSS, Java, C, Rust, SQL, Python, Bash", ) #skill_item( category: "Frameworks", skills: "React, Node.js, Next.js, Nest.js, PostgreSQL, MongoDB, JUnit, Material-UI, ESP-IDF, FreeRTOS", ) #skill_item( category: "Developer Tools", skills: "Linux, Git, GitHub, Docker, AWS, Google Cloud Platform, VS Code, IntelliJ, Agile, Jira", )
https://github.com/hargoniX/bachelor
https://raw.githubusercontent.com/hargoniX/bachelor/main/thesis/template.typ
typst
#import "@preview/glossarium:0.2.4": make-glossary, print-glossary, gls, glspl #import "@preview/bytefield:0.0.2": bytefield, bit, bits, bytes, flagtext #import "@preview/ctheorems:1.0.0": * #let theorem = thmplain("theorem", "Theorem") #let definition = thmplain("definition", "Definition") #let proof = thmplain( "proof", "Proof", base: "theorem", bodyfmt: body => [#body #h(1fr) $square$] ).with(numbering: none) #let bfield(..args) = [ #set text(7pt); #bytefield(msb_first: true, ..args); ] #let buildMainHeader(mainHeadingContent) = { [ #align(center, smallcaps(mainHeadingContent)) #line(length: 100%) ] } #let buildSecondaryHeader(mainHeadingContent, secondaryHeadingContent) = { [ #smallcaps(mainHeadingContent) #h(1fr) #emph(secondaryHeadingContent) #line(length: 100%) ] } // To know if the secondary heading appears after the main heading #let isAfter(secondaryHeading, mainHeading) = { let secHeadPos = secondaryHeading.location().position() let mainHeadPos = mainHeading.location().position() if (secHeadPos.at("page") > mainHeadPos.at("page")) { return true } if (secHeadPos.at("page") == mainHeadPos.at("page")) { return secHeadPos.at("y") > mainHeadPos.at("y") } return false } #let getHeader() = { locate(loc => { // Find if there is a level 1 heading on the current page let nextMainHeading = query(selector(heading).after(loc), loc).find(headIt => { headIt.location().page() == loc.page() and headIt.level == 1 }) if (nextMainHeading != none) { return buildMainHeader(nextMainHeading.body) } // Find the last previous level 1 heading -- at this point surely there's one :-) let lastMainHeading = query(selector(heading).before(loc), loc).filter(headIt => { headIt.level == 1 }).last() // Find if the last level > 1 heading in previous pages let previousSecondaryHeadingArray = query(selector(heading).before(loc), loc).filter(headIt => { headIt.level > 1 }) let lastSecondaryHeading = if (previousSecondaryHeadingArray.len() != 0) {previousSecondaryHeadingArray.last()} else {none} // Find if the last secondary heading exists and if it's after the last main heading if (lastSecondaryHeading != none and isAfter(lastSecondaryHeading, lastMainHeading)) { return buildSecondaryHeader(lastMainHeading.body, lastSecondaryHeading.body) } return buildMainHeader(lastMainHeading.body) }) } #let thesis( title: "This is my title", name: "", email: "", matriculation: "", abstract: none, paper-size: "a4", bibliography-file: none, glossary: (), supervisor_institution: "", supervisor_company: "", institution: "", logo_company: none, logo_institution: none, logo_size: 0%, submition_date: "", body ) = { set document(title: title, author: name) set text(font: "New Computer Modern", size: 11pt, lang: "en") set page(paper: paper-size) set heading(numbering: "1.1") set par(justify: true) show: make-glossary show link: set text(fill: blue.darken(60%)) show outline.entry.where( level: 1 ): it => { v(12pt, weak: true) strong(it) } show: thmrules show raw: set text(font: "JuliaMono", size: 9pt) set list(indent: 1em) set enum(indent: 1em) // Logo v(5%) grid( columns: (50%, 50%), align(center + horizon, image(logo_institution, width: logo_size)), align(center + horizon, image(logo_company, width: logo_size)), ) // Institution v(5%) align(center)[ #text(1.5em, weight: 400, institution) ] // Title page v(3%) line(length: 100%) align(center)[ #text(2em, weight: 500, title) ] line(length: 100%) // Author information v(1fr) // push to bottom grid( columns: (1fr), gutter: 1em, align(center)[ *#name* \ #email \ #matriculation \ #supervisor_institution \ #supervisor_company ], ) // Submition date v(2%) align(center, submition_date) pagebreak() // Abstract page. set page(numbering: "I", number-align: center) align(center)[ #heading( outlined: false, numbering: none, text(0.85em, smallcaps[Abstract]), ) ] abstract counter(page).update(1) pagebreak() // Table of contents. outline(depth: 3, indent: true) pagebreak() // Main body. set page(numbering: "1", number-align: center) set page(header: getHeader()) counter(page).update(1) body pagebreak(weak: true) bibliography(bibliography-file, title: [References]) pagebreak(weak: true) set heading(numbering: "A.1") counter(heading).update(0) heading("Appendix", level: 1) heading("Glossary", level: 2) print-glossary(glossary) }
https://github.com/MobtgZhang/sues-thesis-typst-bachelor
https://raw.githubusercontent.com/MobtgZhang/sues-thesis-typst-bachelor/main/info.typ
typst
MIT License
// 定义本科学位论文模板 // 中文封面页信息 // 论文中文题目 #let bachelor_chinese_title = "上海工程技术大学学士学位论文Typst模板" // 论文英文题目 #let bachelor_english_title = "This is an English Title" // 学院名称 #let bachelor_chinese_faculty_name = "电子电气工程学院" // 专业名称 #let bachelor_chinese_major_name = "计算机科学与技术" // 学号信息 #let bachelor_class_number = "M987654321" // 作者姓名 #let bachelor_chinese_candidate_name = "这里是作者姓名" // 导师姓名 #let bachelor_chinese_supervisor_name = "这里是导师姓名" // 完成日期 #let bachelor_chinese_finish_date_time = "2023 年 12月"
https://github.com/protohaven/printed_materials
https://raw.githubusercontent.com/protohaven/printed_materials/main/common-tools/abrasive_chop_saw.typ
typst
#import "../environment/env-protohaven-class_handouts.typ": * = TOOL (Overview paragraph(s)) == Notes === Safety === Common Hazards === Care === Use === Consumables == Parts of the TOOL === == Basic Operation === Setting Up === Workholding === USE === Cleaning Up
https://github.com/Stautaffly/typ
https://raw.githubusercontent.com/Stautaffly/typ/main/级数.typ
typst
#let c = counter("theorem") #let b = counter("prove") #let a = counter("lemma") #let d = counter("proposition") #let e = counter("example") #let lemma(name,neiron) = block[ //计数器变量记得改 #a.step() #set math.equation(numbering: "(1)",supplement: [le.]) #text(size: 20pt)[*Lemma #a.display(): #name *] \ #line(stroke: (paint: gray, thickness: 1pt, dash: "dashed"),length: 100%) #neiron ] #let theorem(name,neiron) = block[ #c.step() #set math.equation(numbering: "(1)",supplement: [Th.]) #text(size: 20pt)[*Theorem #c.display(): #name *] \ #line(stroke: (paint: gray, thickness: 1pt, dash: "dashed"),length: 100%) #neiron ] #set text(size: 15pt) #set enum(tight: false,spacing: 3%)//设置列表间距 #theorem("级数的基本收敛判别法",[ + \(柯西收敛) $forall epsilon>0 exists N in NN " "forall n>m>N in NN "使得"abs(sum_(m+1)^n a_n)< epsilon $ + \(等价形式) $forall epsilon>0 exists N in NN forall n>=N "so" \(forall p in NN " " abs(sum_n^(n+p)a_n)<epsilon )$ ])<级数的基本收敛判别法> with #theorem("收敛级数的线性",[ 若$display(sum_n^infinity a_n) $,$display(sum_n^infinity b_n ) $都收敛,则$ alpha sum_n^infinity a_n+beta sum_n^infinity b_n $<收敛级数的线性>也收敛 ]) @收敛级数的线性 \ dadadaddadaddadada#let c = counter("theorem") #let b = counter("prove") #let a = counter("lemma") #let d = counter("proposition") #let e = counter("example") #let lemma(name,neiron) = block[ //计数器变量记得改 #a.step() #set math.equation(numbering: "(1)",supplement: [le.]) #text(size: 20pt)[*Lemma #a.display(): #name *] \ #line(stroke: (paint: gray, thickness: 1pt, dash: "dashed"),length: 100%) #neiron ] #let theorem(name,neiron) = block[ #c.step() #set math.equation(numbering: "(1)",supplement: [Th.]) #text(size: 20pt)[*Theorem #c.display(): #name *] \ #line(stroke: (paint: gray, thickness: 1pt, dash: "dashed"),length: 100%) #neiron ] #set text(size: 15pt) #set enum(tight: false,spacing: 3%)//设置列表间距 #theorem("级数的基本收敛判别法",[ + \(柯西收敛) $forall epsilon>0 exists N in NN " "forall n>m>N in NN "使得"abs(sum_(m+1)^n a_n)< epsilon $ + \(等价形式) $forall epsilon>0 exists N in NN forall n>=N "so" \(forall p in NN " " abs(sum_n^(n+p)a_n)<epsilon )$ ])<级数的基本收敛判别法> with #theorem("收敛级数的线性",[ 若$display(sum_n^infinity a_n) $,$display(sum_n^infinity b_n ) $都收敛,则$ alpha sum_n^infinity a_n+beta sum_n^infinity b_n $<收敛级数的线性>也收敛 ]) @收敛级数的线性 111111
https://github.com/protohaven/printed_materials
https://raw.githubusercontent.com/protohaven/printed_materials/main/meta-environments/env-features.typ
typst
#import "/meta-environments/env-branding.typ": * /* * ORNAMENTS * * Functions that ornament text: highlights, boxes, etc. */ #let safety_hazard_box(content) = { rect(width: auto, stroke: color.warning, [ #text(color.warning, weight: "bold", [Safety Warning!]) #content ] ) } #let warning(content) = { text(color.warning, weight: "bold", content) } #let license_block() = { rect( width: 100%, inset: 2em, stroke: 2pt + color.lightgrey, grid( columns: (110pt, 1fr), gutter: 1em, image("/common-graphics/licensing/by-nc-sa.svg"), [This work is licensed under CC BY-NC-SA 4.0. To view a copy of this license, visit https://creativecommons.org/licenses/by-nc-sa/4.0/] ) ) }
https://github.com/typst/packages
https://raw.githubusercontent.com/typst/packages/main/packages/preview/embiggen/0.0.1/demo.typ
typst
Apache License 2.0
#import "@preview/embiggen:0.0.1": * = embiggen Here's an equation of sorts: $ {lr(1/2x^2|)^(x=n)_(x=0) + (2x+3)} $ And here are some bigger versions of it: $ {big(1/2x^2|)^(x=n)_(x=0) + big((2x+3))} $ $ {Big(1/2x^2|)^(x=n)_(x=0) + Big((2x+3))} $ $ {bigg(1/2x^2|)^(x=n)_(x=0) + bigg((2x+3))} $ $ {Bigg(1/2x^2|)^(x=n)_(x=0) + Bigg((2x+3))} $ And now, some smaller versions (#text([#link("https://x.com/tsoding/status/1756517251497255167", "cAn YoUr LaTeX dO tHaT?")], fill: rgb(50, 20, 200), font: "Noto Mono")): $ small(1/2x^2|)^(x=n)_(x=0) $ $ Small(1/2x^2|)^(x=n)_(x=0) $ $ smalll(1/2x^2|)^(x=n)_(x=0) $ $ Smalll(1/2x^2|)^(x=n)_(x=0) $
https://github.com/noahjutz/AD
https://raw.githubusercontent.com/noahjutz/AD/main/uebungen/3/main.typ
typst
#import "/config.typ": theme #import "/components/math.typ": hlp #import "/components/admonition.typ": admonition = Rekursion == MaxTeilSum-2d Gesucht ist die Teilmatrix, dessen Komponenten aufsummiert maximal sind. #align(center, box(width: 50%, include "mts_2d.typ" ) ) === Naiver Algorithmus Man könnte durch alle Teilmatrizen iterieren und die Summen vergleichen. Die Laufzeit ist $Theta(n^6)$, weil es $n^4$ Kombinationen gibt, welche in $n^2$ Zeit summiert werden ```python for i2 in range(n+1): for i1 in range(i2): for j2 in range(n+1): for j1 in range(j2): matrix[i1:i2, j1:j2].sum() ``` === Mit Kadane Der Algorithmus von Kanade findet die maximale Teilsumme eines Arrays in linearer Laufzeit. Die For-Loops mit Zähler $i_1$ und $i_2$ iterieren durch alle möglichen Zeilenkombinationen. Summieren wir die Zeilen von $i_1$ bis $i_2$ spaltenweise auf, erhalten wir ein Array, das der Algorithmus von Kanade verarbeiten kann. ```python for i2 in range(n+1): for i1 in range(i1): yield np.sum(mtx[i1:i2], axis=0) ``` Die Laufzeit ist nur noch $Theta(n^3)$, weil es $n^2$ Zeilenkombinationen gibt, welche jeweils mit dem linearen Algorithmus von Kadane verarbeitet werden. Gesamtes Programm: @code-mts2d == Iteration und Substitution === Gleichung 1 $ T(n) = cases( 1 "falls" n=1, 4T(n/2) + n "sonst" ) $ ==== Iteration $ T(n) = 4 &hlp(T(n/2^1)) + n/2^0 \ = 4 (4 &hlp(T(n/2^2)) + n/2^1) + n/2^0 \ = 4 (4 (4 &hlp(T(n/2^3)) + n/2^2) + n/2^1) + n/2^0 \ = 4 (4 (4 (4 &hlp(T(n/2^4)) + n/2^3) + n/2^2) + n/2^1) + n/2^0 \ $ $ = ... \ = 4^i T(n/2^i) + sum_(k=0)^i n/2^k $ Wobei $i$ die Rekursionstiefe ist. Der Base-Case ist bei einer Eingabelänge von 1 erreicht. $ n/2^i &= 1 \ n &= 2^i \ log_2 n &= i $ Der Base-Case ist also nach $log_2 n$ Rekursionen erreicht. $ T(n) &= 4^(log_2 n) T(n/2^(log_2 n)) + sum_(k=0)^(log_2 n) n/2^k \ &= (2^(log_2 n))^2 T(1) + n sum_(k=0)^(log_2 n) (1/2)^k \ &= n^2 + n dot (1-(1/2)^(log_2 n+1))/(1-1/2) \ &= n^2 + n dot 2 dot (1 - 1/(2 dot 2^(log_2 n))) \ &= n^2 + n (2 - 1/n) \ &= n^2 + 2n - 1 \ &= Theta(n^2) $ ==== Beweis Zu zeigen: $ T(n) = Theta(n^2) $ Induktionsanfang: $ T(1) = 1 = 1^2 #h(4pt) checkmark $ Induktionsschritt: $ T(n) &= 4 underbrace(T(n/2), = Theta(n^2)) + n \ &= 4n^2 + n \ &= Theta(n^2) #h(4pt) checkmark $ === Gleichung 2 $ T(n) = cases( 1 "falls" n=1, 2T(n/4) + sqrt(n) "sonst" ) $ ==== Iteration $ T(n) = 2 &hlp(T(n/4^1)) + n^(1/2^1) \ = 2 (2 &hlp(T(n/4^2)) + n^(1/2^2)) + n^(1/2^1) \ = 2 (2 (2 &hlp(T(n/4^3)) + n^(1/2^3)) + n^(1/2^2)) + n^(1/2^1) \ $ $ = ... \ = 2^i T(n/4^i) + sum_(k=1)^i n^(1/2^k) \ = 2^(log_4 n) T(1) + sum_(k=1)^(log_4 n) n^(1/2^k) \ = sqrt(n) + underbrace( root(2, n) + root(4, n) + root(8, n) + ... + root(sqrt(n), n), log_4n "Terme" ) \ $ ==== Obere Schranke $ &T(n) <= sqrt(n) + sqrt(n) dot log_4 n \ => &T(n) = O(sqrt(n) log n) $ ==== Untere Schranke $ T(n) &= sqrt(n) + sum_(k=1)^(log_4 n) n^(1/2^k) \ &>= sum_(k=hlp(log_(8) n))^(log_4 n) n^(1/2^k) \ &>= 1/3 log_4 n dot n^(1/2^(log_(8) n)) \ &= 1/3 log_4 n dot root(root(3, n), n) \ $ // todo erschließe untere schranke von sqrt(n) log n === Gleichung 3 $ T(n) = cases( 1 "falls" n in {1, 2, 3}, 2T(n-1) + n^2 "sonst" ) $ ==== Iteration $ T(n) = 2&hlp(T(n-1)) + n^2 \ = 2 (2&hlp(T(n-1)) + n^2) + n^2 \ = 2 (2 (2&hlp(T(n-1)) + n^2) + n^2) + n^2 $ $ = ... \ = 2^i T(n-i) + 2^(i-1) n^2 \ = 2^(n-1) T(1) + 2^(n-1) n^2 \ = 2^(n-1) dot (1 + n^2) \ = Theta(2^n) $ ==== Beweis Induktionsanfang: $ T(1) = 1 = 1/2 dot 2^1 #h(4pt) checkmark $ Induktionsschritt: $ T(n) &= 2underbrace(T(n-1), = Theta(2^n)) + n^2 \ &= 2 dot 2^(n-1) + n^2 \ &= Theta(2^n) #h(4pt) checkmark $ == Master-Methode === Gleichung 1 $ T(n) = cases( 1 "falls" n=1, T(n/2)+1 "sonst" ) $ ==== Zu zeigen $ T(n) = Theta(log n) $ ==== Beweis - $a = 1$ - $b = 2$ - $f(n) = 1$ $ =>&& n^(log_b a) &= n^0 = 1 \ =>&& f(n) &= Theta(n^(log_b a)) \ =>&& T(n) &= Theta(n^(log_b a) log n) \ &&&= Theta(log n) #h(4pt) square.filled $ === Gleichung 2 $ T(n) = cases( 1 "falls" n=1, 3T(n/4) + n log n "sonst" ) $ ==== Zu zeigen $ T(n) = Theta(n log n) $ ==== Beweis - $a = 3$ - $b = 4$ - $f(n) = n log n$ - $epsilon := 1-log_4 3$ $ =>&& n^(log_b a + epsilon) &= n \ =>&& lim_(n -> infinity) (f(n))/n^(log_b a+epsilon) &= infinity \ =>&& f(n) &= Omega(n^(log_b a+epsilon)) $ Zusätzlich muss gelten: $ &&a dot f(n/b) &<= c dot f(n) \ <=>&& 3 dot n/4 log n/4 &<= c dot n log n \ <=>&& 3 dot (n/4 log n/4)/(n log n) &<= c \ <=>&& 3/4 log_n n/4 &<= c \ <=>&& 3/4 underbrace((1 - log_n 4), <= 1) &<= c #h(4pt) checkmark \ $ $ => T(n) &= Theta(f(n)) \ &= Theta(n log n) #h(4pt) square.filled $ === Gleichung 3 $ T(n) = cases( 1 "falls" n=1, 7T(n/2)+n^2 "sonst" ) $ ==== Zu zeigen $ T(n) = Theta(n^2.81) $ ==== Beweis - $a = 7$ - $b = 2$ - $f(n) = n^2$ - $epsilon := log_2(7) - 2$ $ =>&& n^(log_b a - epsilon) &= n^2 \ =>&& f(n) &= Theta(n^(log_b a - epsilon)) \ =>&& T(n) &= Theta(n^(log_b a)) \ &&&approx Theta(n^2.81) #h(4pt) square.filled $ == Ackermannfunktion $ f(n, m) = cases( m + 1 "falls" n=0, f(n-1, 1) "falls" m=0 "und" n >= 1, f(n-1, f(n, m-1)) "sonst" ) $ === Rekursiver Algorithmus ```python def ack(n, m): if n == 0: return m+1 if m == 0 and n >= 1: return ack(n-1, 1) return ack(n-1, ack(n, m-1)) ``` === Iterativer Algorithmus ```python stack = deque(((n, m),)) result=0 while stack: n, m = stack.pop() if m is None: m = result if n == 0: result = m+1 continue if m == 0: stack.append((n-1, 1)) continue stack.append((n-1, None)) stack.append((n, m-1)) return result ``` === Korrektheit Um zu zeigen, dass $f(n, m)$ für alle Eingaben $(n, m) in NN_0^2$ ein Ergebnis liefert, verwenden wir eine Induktion über zwei Variablen @bib-multivariable-induction. ==== Zu zeigen $ forall n, m in NN_0: f(n, m) "ist definiert" $ ==== Beweis Wir zeigen, dass $f$ für alle $n$ definiert ist, indem wir zeigen, dass $ f(n-1, m) "definiert" => f(n, m) "definiert" $ Für jedes $n$ zeigen wir mittels verschaltelter Induktion, dass $f$ für dieses $n$ und für jedes $m in NN_0$ definiert ist. $ f(n, m-1) "definiert" => f(n, m) "definiert" $ ==== Induktionsanfang (n = 0) Es gilt per Definition für $n = 0$ und alle $m in NN_0$: $ f(0, m) = m+1 #h(4pt) checkmark $ ==== Induktionsschritt (n - 1 #sym.arrow n) Wir nehmen an, dass $f(n-1, m)$ für ein $n-1$ und alle $m in NN_0$ definiert ist. Das dürfen wir, weil wir im Basisfall gezeigt haben, dass $f(0, m)$ für alle $m in NN_0$ definiert ist. Anhand dieser Annahme möchten wir zeigen, dass $f(n, m)$ für $n$ und alle $m in NN_0$ definiert ist. #admonition("Verschachtelte Induktion")[ ==== Induktionsanfang (m = 0) $ f(n, 0) = f(n-1, 1) "[Def.]" \ $ Nach Induktionsannahme ist $f$ für ein $n-1$ und alle $m in NN_0$, insbesondere $m=1$ definiert. $checkmark$ ==== Induktionsschritt (m - 1 #sym.arrow m) Wir nehmen an, dass $f(n, m-1)$ definiert ist, und folgern daraus, dass $f(n, m)$ definiert ist. $ f(n, m) &= f\(n-1, underbrace(f(n, m-1), =: x in NN_0 "(Nach IV)")) "[Def.]" \ &= f(n-1, x) $ Nach innerer Induktionsannahme ist $f(n, m-1) =: x$ definiert. Nach äußerer Induktionsannahme ist $f(n-1, x)$ für alle $x in NN_0$ definiert. $checkmark$ ==== Induktionsschluss Wir haben gezeigt, dass $f(n, m)$ für alle $m$ definiert ist, sofern $f(n-1, m)$ für alle $m$ definiert ist. $square$ ] ==== Induktionsschluss Wir haben gezeigt, dass $f(n, m)$ für alle $n$ definiert ist, sofern $f(n-1, m)$ definiert ist. In der verschachtelten Induktion haben wir für alle $n$ gezeigt, dass $f(n, m)$ auch für alle $m$ definiert ist. $square.filled$
https://github.com/TypstApp-team/typst
https://raw.githubusercontent.com/TypstApp-team/typst/master/tests/typ/meta/figure-caption.typ
typst
Apache License 2.0
// Test figure captions. --- // Test figure.caption element #show figure.caption: emph #figure( [Not italicized], caption: [Italicized], ) --- // Test figure.caption element for specific figure kinds #show figure.caption.where(kind: table): underline #figure( [Not a table], caption: [Not underlined], ) #figure( table[A table], caption: [Underlined], ) --- // Test creating custom figure and custom caption #let gap = 0.7em #show figure.where(kind: "custom"): it => rect(inset: gap, { align(center, it.body) v(gap, weak: true) line(length: 100%) v(gap, weak: true) align(center, it.caption) }) #figure( [A figure], kind: "custom", caption: [Hi], supplement: [A], ) #show figure.caption: it => emph[ #it.body (#it.supplement #it.counter.display(it.numbering)) ] #figure( [Another figure], kind: "custom", caption: [Hi], supplement: [B], )
https://github.com/heloineto/utfpr-tcc-template
https://raw.githubusercontent.com/heloineto/utfpr-tcc-template/main/template/abstract-page.typ
typst
#let abstract-page(body, lang: "pt", keywords: ()) = { [ #set align(center) #set text(weight: "bold") #(if lang == "pt" { "RESUMO" } else { "ABSTRACT" }) ] v(30pt) [ #set text(weight: "regular") #set align(left) #set par(justify: true) #body ] [ #text(weight: "bold", if lang == "pt" { "Palavras-chave:" } else { "Keywords" }) #keywords.join("; "). ] pagebreak() }
https://github.com/polarkac/MTG-Stories
https://raw.githubusercontent.com/polarkac/MTG-Stories/master/stories/016%20-%20Fate%20Reforged/003_The%20Reforged%20Chain.typ
typst
#import "@local/mtgstory:0.2.0": conf #show: doc => conf( "The Reforged Chain", set_name: "Fate Reforged", story_date: datetime(day: 21, month: 01, year: 2015), author: "<NAME>", doc ) #emph[Sarkhan Vol followed the whispers of the spirit dragon Ugin back into Tarkir's past, with no idea what to expect. He found a glorious world, full of hungry dragons and vigorous clans.] #emph[But all is not well in ancient Tarkir. Yasova, khan of this era's Temur clan, ] #emph[revealed to Sarkhan ] #emph[that she is following the guidance of a dragon as well. Unbeknownst to her, her patron is—or will later become—Sarkhan's most hated enemy: the unfathomably ancient dragon Planeswalker <NAME>.] #emph[Now, Sarkhan races against time to find Ugin before Bolas can set Tarkir's history—and Sarkhan's own—on the path to ruin.] #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) Sarkhan thrashed his wings against the frigid air, flying over the tundra toward the churning storm. Thoughts flashed across his mind, mirroring the pops of lightning and mana illuminating the tempests ahead, thoughts that broke into nothingness like brittle ash. He had traveled all this way, shattered the laws of time and history—and for what? He had found a time when dragons still lived, when dragon tempests still birthed mighty sky tyrants onto his world, when warriors sought glory by clashing with dragon-kind—but it had amounted to nothing, because the shadow of Nicol Bolas loomed even here. Even in this precious place, a time long before the mistakes of Tarkir's history, in a refuge hidden centuries before Sarkhan's own errors of judgment—the influence of Bolas had somehow made it here before him. Sarkhan spat a blast of fire at the air and flew through it. #emph[Do you understand now, dragon mage? ] Questions exploded at him in roaring tones, as if voiced by the thundercracks of the storm ahead—but they were only his own mind shouting at itself. #emph[Do you see why Ugin would lead you here, to witness this? Do you grasp the lesson now? ] A sobering answer crept over Sarkhan's mind: perhaps the lesson of this entire quest was that fate was inescapable. That he should embrace despair and accept the iron rigidity of time, and of Bolas's dominion over him. In a flash, the grim, circular joke of it all took shape for Sarkhan. Bolas had killed Ugin over some ancient feud. Ugin's death ended Tarkir's dragon tempests, which wiped out dragons on Tarkir long before Sarkhan was born, and the clans rose to rule the plane. The clans' remembrance of dragons led the young Sarkhan to revere the ancient beasts, which led to Sarkhan, in a moment of weakness, bowing his head in loyalty to Bolas, the very dragon who had made Sarkhan's obsession possible in the first place. The chain looped back on itself, inevitable and unbreakable. Sarkhan was here just to serve as witness to the forging of its earliest link. Sarkhan felt like letting his wings drop, to stall his flight in the air. He could just fall, here, as Ugin would fall. Some part of him wanted to plunge, to let gravity be his final master, to meet the ground at speed and feel everything collapse. But instead he tipped his head up, wingbeats hammering the air as he climbed. The cold tore at him and ozone filled his lungs, but he continued to climb up and up, trying to punish the clouds with his rage. There was still a chance. He still had the hedron shard with him, a piece of Ugin's chamber on Zendikar, and the thought of it pulled him onward. If he was still here, still alive, then there was a chance he could reforge the chain. If he still held on to the breath in his chest—then maybe Ugin could too. #figure(image("003_The Reforged Chain/01.jpg", width: 100%), caption: [Fearsome Awakening | Art by Véronique Meignaud], supplement: none, numbering: none) Sarkhan flew through the tempests. He could feel the wings of other dragons passing through the storms around him, and heard their roars. He broke through the rumbling cloudbank and his breath caught at what he saw. The shimmering, ghostlike dragon Ugin flew across the atmosphere like a comet, dragging a tail made of storm. Sarkhan knew Ugin instantly, as surely as he knew the sun or the earth. Pale blue mist trailed out behind the spirit dragon, merging with the tempests, like a cape that spread out to connect him to all of Tarkir. Sarkhan forgot everything that had brought him to this moment, and his soul stirred. It was #emph[Ugin] —and #emph[not] Bolas—who had truly birthed his fascination with dragons. Ugin was the true beginning of the chain that made Sarkhan who he was—and made Tarkir what it should have been. Sarkhan felt like staying in dragon form forever, dancing in the clouds around this immense and wise progenitor. He flew at a distance, just watching Ugin's wings hold him effortlessly in the air. This, before him, was his purpose. This was the reason he was here. He could stop what was about to happen, to alter Tarkir's path. He would do whatever he needed to do. He would— Kill <NAME>. Or at least he would help Ugin fight Bolas when the time came, so Ugin would survive and Tarkir's dragons would never die out. Sarkhan sped toward Ugin, a tiny satellite approaching a great star. Sarkhan roared out to him, but it was lost in the chorus of thunder and draconic voices ringing through the clouds below. It was a tilt of Ugin's head that made Sarkhan notice the spell happening down on the ground. Sarkhan followed Ugin's eyes. Through a break in the clouds, he saw lines of greenish elemental energy tracing a curving pattern across the snow and ice, anchored at certain nodes like tethered lightning. As Sarkhan looked closer, he could see that the nodes were carved boulders, marked by slashing claw patterns. Sarkhan cursed a name in his mind. #emph[Yasova.] Together, the claw-rune sites formed a pathway. The pathway marked the exact path of the dragon tempests—and therefore, predicted the path of Ugin. Yasova had been tracking the storms in order to track the spirit dragon. But Yasova's path down on the tundra was not for her own benefit. It was a guiding spell, but not for her sabertooth cat or Temur warriors to follow. This pattern was meant to be seen from the air—by <NAME>. A hiss of bile and rage rose in Sarkhan's throat. And at that very moment, <NAME> appeared out of a ripple of sky, like a dropped pebble in reverse, the world giving way for this being. Bolas was positioned directly in Ugin's path. His wings unfurled like a billowing cloak, shadowing the sun with his liquid-dark scales. His great horns swept up, crownlike, with his gem hovering between them. The great elder dragon's attention was focused on Ugin, the one he had come to destroy. Sarkhan was still too far off for Bolas to notice—perhaps this was his chance to strike. Ugin drew up with a flurry of wingbeats, taking in Bolas's arrival, and the two dragon Planeswalkers faced off. #figure(image("003_The Reforged Chain/02.jpg", width: 100%), caption: [Crux of Fate | Art by <NAME>], supplement: none, numbering: none) Bolas spoke something to Ugin, barbed words in low tones that Sarkhan couldn't hear over the wind. Ugin spoke back, calm and serious, with a note of warning, and Bolas's smile spread like a stain. The dragons spiraled around each other, great lungs and great wings churning air, eyes darting from weak spot to weak spot. The storm clouds encircled them, two titans at the eye of a hurricane. Sarkhan flew as fast as he could, but his wings were failing him. His shoulders burned as he pumped his wings, and he was losing altitude, his tail skimming the clouds. Now that he saw Bolas again, a thousand years before he had laid eyes on him for the first time—or was this the first time, now?—he realized he could do nothing that would affect this mighty creature. Bolas was like a god, Sarkhan an insect. But he thought maybe if he flew in at the right angle—maybe if he blasted him with fire at just the right moment—he could distract him just long enough so that Ugin could deal the fatal blow. He clenched his teeth and flew on. Bolas and Ugin dipped and dived around each other, occasionally switching directions, each matching the other's movements with jabs and feints. Bolas blew a gust of smoke from his nostrils and slapped at Ugin's wing. Ugin dodged to the side and made a test snap with his jaws. They threw spells, but not at each other—just shimmering runes on the air, laying mystical groundwork for the fight. They spun around each other, lashing out with a claw or a hot breath, never quite overcommitting to a strategy, never quite making the first true move. Then Ugin roared, and it was the roar of a force of nature, the roar of an entire plane. And with that roar, Sarkhan felt a wrenching impulse reverberate in his soul. The feeling spread through his draconic body, electrifying him, goading him to join the fight at Ugin's side, as if that roar spoke to the core of his very being. Some part of him was conscious of how strange this feeling was, but his dragon's brain seethed with irresistible drive. Sarkhan found himself roaring in answer, and his muscles responded. As he roared, he heard calls from all the dragons throughout the tempests. Dragons appeared in droves, flying out of the dragon tempests toward the fight. Sarkhan's heart leapt—this was Ugin's advantage. The progenitor of Tarkir was calling his kind to fight at his side, and they were answering the call. Bolas's grin dissolved. He attacked all-out with a barrage of jagged spells, pummeling Ugin with his strange utterances. Sarkhan saw Ugin recoil, chunks of glimmering scales exploding from his body, his head thrashing back and forth from some kind of simultaneous mental assault, his wings chopping at the air to maintain altitude. #figure(image("003_The Reforged Chain/03.jpg", width: 100%), caption: [Ugin, the Spirit Dragon | Art by Raymond Swanland], supplement: none, numbering: none) Ugin spun in the air and blasted back with his own magic. He cut an arc across Bolas's body with a torrent of invisible fire, and followed it up with a lunge of pale mist that struck like thunder. He pivoted in space, firing forth more invisible impacts. Bolas slapped away half of the assaults, but many of them landed, and Sarkhan saw the effort in Bolas's face. Determination surged through Sarkhan, making his skin prickle with heat. This could be the crossroads of history, this moment. Tarkir dragons closed in in from every direction, a circular army collapsing in around its leader. Sarkhan even saw new dragons spawning from the clouds, each one born with a mission to fight for Ugin. Sarkhan and the other dragons were about to converge on the fight. He swooped, about to blast a chestful of breath weapon onto <NAME>, but then— —a crackling of elemental energy, reaching up from the ground like fingers— —a glance down, to see Yasova weaving some passionate elemental magic, her claw-rune spell meant not only to guide Bolas, but for some other, more disruptive reason— —a body-wracking surge, as the elemental spell struck, struck him, struck dozens of dragons at once— —a new impulse seizing Sarkhan's soul, even more powerful than Ugin's roar, goading him to fight— —a strange bloodlust kindling in his heart, driving him to want nothing more than to— Kill Ugin. #emph[Yes] , said his draconic heart. #emph[Yes, destroy the all-father. Destroy the progenitor who commands us. Destroy him, and be free of his rule.] #emph[No] , said some small part of Sarkhan. #emph[No!] All around him, the other Tarkir dragons were seized by the same spell. Yasova's power drowned out the force of Ugin's call, and the dragons converged on Ugin instead of Bolas. #figure(image("003_The Reforged Chain/04.jpg", width: 100%), caption: [<NAME>, Planeswalker | Art by D. <NAME>], supplement: none, numbering: none) Sarkhan was close now. He could feel his ribcage filling with heat. He could feel himself wanting to unleash fire on Ugin, the very source of draconic spirit on Tarkir, the very dragon who brought him to this moment. He exhaled. But as his breath was about to emerge as fire, instead he shouted a savage "No!"—a human word, shouted in a human voice, as he forced himself out of dragon form. His wings collapsed inside him. His face became stubbled skin instead of overlapping scales. And his drive to kill Ugin melted away, as the spell no longer gripped his draconic mind. What gripped him instead was gravity. He fell. And it was a long fall. He fell past the Tarkir dragons, who breathed their fire and lightning and death onto Ugin from all sides. He fell past Bolas, who never glanced his way, but only watched Ugin's own progeny shriek and attack their forefather viciously. He fell through the churning clouds, and through a breathless distance of empty air. He heard a thundering crack from high above, a sound with terrible, unmistakable import—Bolas's final blow, the battle-ending deathblow that broke Ugin's body. As Sarkhan hurtled through air, he caught glimpses of the other dragons scattering like birds away from the disturbance. Before he got to see Ugin himself, there was a savage, crunching bounce, as his body ricocheted once, and then sickeningly twice against the rocks of a great spiraling crag. He took a chaotic tumble off one snow-padded cliff, onto another, and rolled down a slope, as his mind whirled along with his limbs. Thundering motion and the cracking sound of an avalanche followed, and a crushing sensation. The world was all ice and snow. And then it stopped. He was suspended in a snowbank, a foot or a mile from air, lungs compressed, suffocating. He held onto a thread of consciousness, enough to tell him that he was dying. When the claws dug away the snow above him, Sarkhan thought for a moment that it was Bolas, come to finish the job, to finally have his victory. But it wasn't. It was Yasova's sabertooth cat, clearing snow with great swipes of its paws. Its tusks bit into the back of his collar, grabbing him by the scruff, and lurched him painfully out of the snowbank. The cat laid him out on his back on the tundra. #figure(image("003_The Reforged Chain/05.jpg", width: 100%), caption: [Yasova Dragonclaw | Art by <NAME>], supplement: none, numbering: none) Sarkhan was a limp thing, a sack of skin with assorted bone-pieces inside. Through squinting eyes he could see Yasova looking down at him. She held his staff, with the hedron shard dangling from it. "Don't try to move," she said. "Don't try to speak." She said some other words in a low voice, and he could feel his insides begin to sort themselves out. "Ugin," Sarkhan managed. "Don't try to speak," she repeated. But she looked up at the sky, and then back down at him. "It's just about over. The Unwritten Now will finally be free of the blight of dragons." Sarkhan twisted his eyes to one side, to see as much as he could see. What he saw was Ugin's body falling out of the clouds, streaking toward the ground. Ugin defeated. Dragons on the road to extinction. Tarkir's fate sealed. Sarkhan groaned. "I don't know what you are," said Yasova. "But you seem like you might have some answers in you. So do me a favor, and don't die just yet. I'll drag you back to my shamans and see what you're about." The healing spell had not completed its work, but Sarkhan lurched onto his side anyway. Everything hurt—consciousness was a wall of pain—but somehow he rolled onto his hands and knees. "What are you doing, fool thing?" said Yasova. At that moment, Sarkhan raised his head to see Ugin hitting the tundra. There was a moment, before the force of it hit them, that Sarkhan and Yasova glanced at each other. They both felt it. Something had tilted on Tarkir. The world was poised to change forever. For a moment, Sarkhan thought he saw a shadow of concern brush across Yasova's face. Then the wave of force, stronger than the power of Ugin's roar, hit them. Snow exploded into them, and the earth bucked. Sarkhan, Yasova, and the sabertooth were knocked over. Sarkhan's staff tumbled and landed in snow. Sarkhan crouched as the snow blast pummeled him for what felt like a thousand heartbeats. After the blast of snow and force subsided, he crawled back to his knees, but then huddled again as rocks and chunks of ice rained down. When the rubble-rain ended, Sarkhan coughed and shuddered. He looked for the crater, to find where Ugin's body had landed. He saw the place where Ugin fell, but it wasn't just a crater—it was an entire chasm punched into the land, a massive crack of shattered earth, with Ugin's body somewhere far below the level of the snow. It was the same place Sarkhan had come to in his own time—the site of the temporal nexus. Sarkhan glanced up to see <NAME> turn toward the sky and vanish. The air rippled, and he was gone, along with Sarkhan's chance to destroy him. Sarkhan climbed to his feet, climbing out of the snow and rubble. He pulled his staff from the snow, and felt an urging to move when he saw the hedron shard attached to it. "Where do you think you're going?" asked Yasova, dusting herself off. "To save him," said Sarkhan, and he turned and stomped toward the chasm. His balance wavered, and his muscles and bones protested, but Yasova's healing spell, still at work in his bones, dulled the pain. "You weren't meant to do this," warned Yasova. "I can't let you do this." Sarkhan snapped around to her. He lashed an accusatory hand at the ancient Temur khan. His hand became the head of a dragon, and that dragon's head breathed forth a flame as hot as Sarkhan's rage, blasting Yasova full on in the chest. Yasova tumbled back from the force of the spell, flying boots over head into the snow. She landed, and slumped, and let out a groan. #figure(image("003_The Reforged Chain/06.jpg", width: 100%), caption: [Banefire | Art by Raymond Swanland], supplement: none, numbering: none) The sabertooth leaped over to her, sniffed her breath, and then snapped around to snarl at Sarkhan. Sarkhan snarled back with ten times its intensity, heaving icy breaths, his arms and legs out in challenge. The big cat flinched, then slowly lowered its head in reluctant submission, staying near its unconscious master. After one more snarl of warning, Sarkhan marched off toward Ugin. The climb down to the floor of the chasm was an awkward skid more than a climb. Sarkhan didn't take time to choose footholds carefully, and he half-slipped his way down the craggy walls of the gorge, reinjuring his already battered bones. His body felt like a broken marionette, but he continued forcing it to move, using his staff like a crutch. Ugin was laid out against the chasm floor, burned and abraded on every surface, littered with rubble from the impact. His eyes were closed. Sarkhan's heart leaped when he saw that a slow exhale was escaping the dragon's nostrils. There was still part of a breath in him, he thought. There was still time. Sarkhan ran over to the dragon. He brushed away the rubble from the twisting, runic shapes along Ugin's neck, and pressed his own face against Ugin's. He closed his eyes, and tried to feel the essence of the great dragon, tried to hear the same voice that had drawn him back to his home plane. But there was nothing. There was no voice, just the long, ragged exhale of a broken titan. Sarkhan's heart sank. The only voice was an unwelcome one, from Sarkhan's own mind, an echo meant to torture himself with old questions. #emph[Do you understand now, dragon mage? ] The question rang in his skull. #emph[Do you grasp the lesson now? Do you see why you had to come?] "No, I don't!" he whispered into Ugin's face. "I don't understand! Tell me! Guide me!" #emph[Do you see now? Do you understand the lesson?] "No! I don't! I can't!" He slapped Ugin's scales softly with his hand. "Ugin, help me, please. Help me…" #emph[Do you understand how you must always fail?] Sarkhan gritted his teeth and gripped his staff. "No! I—I can't!" #emph[Do you understand that you must always fail, as long as your goal is not truth, but guidance?] "What does that mean? I don't understand! I don't see it!" #emph[…that as long as you seek dragons around you, you will never become the dragon within you?] Sarkhan pushed his forehead into Ugin's scales and squeezed his eyes shut tight. He tensed every muscle in his beaten body, trying to force an answer, some missing truth, into his brain. He felt the wood of his staff start to splinter in his white-knuckled fist. Then, as Ugin's final breath slowly ended, Sarkhan unclenched. His body loosened, and he caressed Ugin's face gently. He took in a long breath, and let it out slowly. With that breath, he let out all the pain, all the uncertainty, all the struggle that suffused his body. He stood straight, opened his eyes, and breathed in and out again. "Ugin, I've brought something for you," he said. He detached the hedron shard from his staff, that small stone remnant he had brought from the Eye of Ugin, Ugin's chamber on faraway Zendikar. He held the stone in his hand. The runes on the hedron-piece glowed pale blue at his touch, mirroring the shapes etched in Ugin's face and neck. It was a piece of Ugin's shelter on another world, a piece of Ugin's edifice that he had built for himself. The Eye of Ugin was a place for containment, yes, a place to concentrate on the spell that contained the Eldrazi—but it was also a place for recuperation, a safehold in a world torn by powerful forces. Sarkhan raised the hedron shard. Its runes glowed brighter, and it hovered in the air between them. Sarkhan put his hands around the shard, gently drawing it toward him, and concentrated on what he desired. He inhaled deeply, and then slowly blew air out over the hedron—not the fire of a dragon, nor truly the exhalation of a man, but the breath of Sarkhan Vol, the dragon mage. #figure(image("003_The Reforged Chain/07.jpg", width: 100%), caption: [Art by Daarken], supplement: none, numbering: none) He released the stone shard. The hedron hovered, rotating slowly in the air. Its surfaces began to glow brighter and brighter, and then it began expanding—unfolding. Planes of stone replicated themselves, shifting and sliding outward from the shard like an infinitely blooming flower. Impossible surfaces unpacked and unfolded, creating an interlocking structure that grew and grew, repeating the runes from the Eye of Ugin, from Ugin himself, over and over again. Sarkhan stepped back to the wall of the chasm. The spell was done. The hedron shards unfolded themselves faster now, creating an edifice, filling in around Ugin's body like a massive cocoon. He watched with wonder at the beauty of it. Sarkhan caught Ugin's eye opening just slightly, just for a moment, and then saw it close again. The protective cocoon assembled itself around Ugin now, hiding him away from Sarkhan, enclosing the great dragon in an impenetrable, mystical shell. "What have we done?" came an echoing shout, Yasova's voice, from the top of the chasm. Sarkhan looked up to see her peering down at him from the chasm's edge, a bewildered expression on her face. Framing her, in the sky high above, the dragon tempests churned with new vigor. New dragons erupted from them, shrieking with the simple, unrestrained glory of being. Sarkhan smiled up at Yasova, a crooked smile made of gratitude and simple dumb joy. "What we were meant to," he yelled up at her. "Thank you, <NAME>." #figure(image("003_The Reforged Chain/08.jpg", width: 100%), caption: [Crucible of the Spirit Dragon | Art by Jung Park], supplement: none, numbering: none) She looked around at the hedron cocoon, confounded, and Sarkhan laughed. It struck him that the chain of events that had brought him here was not a circular joke at all—it was a chain with a purpose. Fate had conspired to place him here, at this crossroads of history, to give him the chance to act. If he had never served Bolas, if he had never been sent to the Eye of Ugin, if he had never come to Tarkir with voices ringing in his broken mind—without all of that hardship, he wouldn't have had a chance to forge a new chain for his world. For the first time in a long while, Sarkhan's skull felt like his own. An unfamiliar sensation of clarity and elation spread through him, as if he were waking from a dream in which his eyes didn't quite work. His thoughts flowed simply, without their usual jaggedness, his consciousness undivided and unbroken. Then all at once— —as Sarkhan's presence became an impossibility— —as his travel to the past of his own world had become an affront to the laws and flow of history— —as his actions had irrevocably changed the conditions that had led to the nexus of a dead dragon Planeswalker in this chasm— —as all the events that had led to his world's history, and even had led to his own existence, had become nullified— —temporal forces whisked Sarkhan away. Snowflakes fell past Yasova, dropping flecks of white on the snug structure at the bottom of the chasm. Her sabertooth padded over and nuzzled her, and she put her hand on its head. High above, dragons screeched and soared across the sky.
https://github.com/alberto-lazari/computer-science
https://raw.githubusercontent.com/alberto-lazari/computer-science/main/advanced-topics-cs/quantum-algorithms/report.typ
typst
#import "@local/unipd-doc:0.0.1": * #show: unipd-doc( title: [Introduction to Quantum Algorithms], subtitle: [Short course report], author: [<NAME> -- 2089120], date: [June 2024], ) #pagebreak() #include "chapters/computational-model.typ" #include "chapters/amplitude-amplification.typ" #include "chapters/qft.typ" #include "chapters/gradient.typ" #include "chapters/linear-systems.typ" #include "chapters/deepening.typ"
https://github.com/cnaak/lyceum.typ
https://raw.githubusercontent.com/cnaak/lyceum.typ/main/README.md
markdown
MIT License
# lyceum.typ academic book template in typst
https://github.com/rinmyo/titech-thm
https://raw.githubusercontent.com/rinmyo/titech-thm/main/README.md
markdown
Other
# titech-thm This is a [Typst](https://github.com/typst/typst) slide template for Tokyo Tech based on the [typst-slides](https://github.com/andreasKroepelin/typst-slides) project. This project is on development and aim to mimic the [official version(available within campus)](https://www.titech.ac.jp/public-relations/staff/logo/cards). Any issue and PRs are welcome. ## font the default font is "Noto Sans CJK JP" and "Noto Sans". Please install them in advance or replace them as your preference ## COPYRIGHT - 東工大のシンボルマークは商標登録済です。
https://github.com/alberto-lazari/cns-report
https://raw.githubusercontent.com/alberto-lazari/cns-report/main/webcam.typ
typst
= Webcam virtualization <webcam_virtualization> In order to decide how to virtualize the camera, we considered several tools: == v4l2loopback v4l2loopback @v4l2loopback is a lightweight kernel module that provides a simple way to create virtual video devices. It integrates directly with the Linux Video4Linux2 (v4l2) subsystem, moreover it is open source, well known for its reliability and has already been used in several applications requiring virtual camera functionality. Using v4l2loopback presents some drawbacks, in fact configuration and setup might require some familiarity with Linux kernel modules and system administration, making it less user-friendly for novice users. There may be occasional compatibility issues with specific software or older kernel versions. Finally it is only available on Linux and it does not provide advanced features such as scene composition and effects. == OBS OBS (Open Broadcaster Software) @OBS is a free and open-source app for screencasting and live streaming. OBS offers a wide range of features including scene composition, overlays, transitions, and effects, making it suitable for creating complex virtual camera setups. It is available for Windows, macOS, and Linux and with an intuitive interface and extensive documentation, it is relatively easy to use for new users. On the other hand OBS is difficult to be used entirely from the command line and even if it is user-friendly, the extensive feature set of the tool can be overwhelming for users looking for simple virtual camera functionality. == GStreamer GStreamer @GStreamer is a pipeline-based multimedia framework that links together a wide variety of media processing systems to complete complex workflows. GStreamer offers extensive flexibility and customization options and it is available for Windows, macOS, and Linux. Despite that GStreamer's extensive feature set and complex pipeline syntax may present a steep learning curve for users unfamiliar with multimedia frameworks and while GStreamer has extensive documentation, finding specific information may be challenging due to the framework's complexity. == Selected tool After carefully considering the advantages and drawbacks outlined above, we decided to use v4l2loopback for our project. Our decision was based from the project's main objective of improving the scalability of QR fuzzing. Relying on a tool that does not provide a good support for the usage from command line like OBS was not an option because it would have significantly limited the whole automation process. We also decided not to go for GStreamer because the complex set of options offered by the tool was not necessary for our purposes. In the end v4l2loopback was the most appropriate solution for our project. Although configuring the kernel module required an initial investment of time, the process was manageable and well-documented. Moreover, v4l2loopback's straightforward interface aligned with our objectives, allowing us to focus on optimizing the automation process without the distractions of extraneous features. Furthermore, the absence of advanced video editing features within v4l2loopback was not a limit for us. Our only requirement of resizing QR codes could be achieved without the need for additional effects or modifications.
https://github.com/noahjutz/CV
https://raw.githubusercontent.com/noahjutz/CV/main/sidebar/social.typ
typst
#let _social( al, img, body, ) = block( below: 12pt, align( al, stack( dir: ltr, spacing: 6pt, image(img, width: 20pt), body ) ) ) #let social( al: horizon, img, url: none, body ) = if url != none { link( url, _social( al, img, body ) ) } else { _social( al, img, body ) }
https://github.com/TypstApp-team/typst
https://raw.githubusercontent.com/TypstApp-team/typst/master/tests/typ/meta/outline.typ
typst
Apache License 2.0
#set page("a7", margin: 20pt, numbering: "1") #set heading(numbering: "(1/a)") #show heading.where(level: 1): set text(12pt) #show heading.where(level: 2): set text(10pt) #outline() = Einleitung #lorem(12) = Analyse #lorem(10) #[ #set heading(outlined: false) == Methodik #lorem(6) ] == Verarbeitung #lorem(4) == Programmierung ```rust fn main() { panic!("in the disco"); } ``` ==== Deep Stuff Ok ... // Ensure 'bookmarked' option doesn't affect the outline #set heading(numbering: "(I)", bookmarked: false) = #text(blue)[Zusammen]fassung #lorem(10)
https://github.com/Otto-AA/definitely-not-tuw-thesis
https://raw.githubusercontent.com/Otto-AA/definitely-not-tuw-thesis/main/src/statement.typ
typst
MIT No Attribution
#import "translations/translations.typ": translate #import "utils.typ": name-with-titles #let statement = (author, date) => { heading(translate("statement"), outlined: false) name-with-titles(author) v(2em) translate("statement-own-work") linebreak() linebreak() translate("statement-ai-tools") v(8em) grid( columns: (1fr, 1fr), align: (left, center), [Wien, #date.display("[day].[month].[year]")], [#line(length: 60%, stroke: 0.5pt) #author.at("name", default: "")], ) }
https://github.com/herbertskyper/HITsz_Proposal_report_Template
https://raw.githubusercontent.com/herbertskyper/HITsz_Proposal_report_Template/main/utils/numbering.typ
typst
MIT License
#let heading_numbering(..nums) = { let nums_vec = nums.pos() if nums_vec.len() > 0 { let without_first = nums_vec.slice(1, nums_vec.len()) // let without_second = nums_vec.slice(2, nums_vec.len()) if without_first.len() == 4 [ #numbering( "1)" , ..nums_vec.slice(4,5) ) #h(0cm) ] else if without_first.len() == 1 [ #numbering( "(一)" , ..nums_vec.slice(1,2)) ] else { numbering("1.1", ..without_first) } } }
https://github.com/AxiomOfChoices/Typst
https://raw.githubusercontent.com/AxiomOfChoices/Typst/master/Research/Winter%202024/Masters%20Thesis/Thesis%20Template.typ
typst
#import "@preview/cetz:0.2.1" #import "@preview/ctheorems:1.1.0": * #import "@preview/outrageous:0.1.0" #let latex( doc ) = { set page(margin: (x: 2cm, top: 2cm, bottom: 2cm), header-ascent: 18%) set par(leading: 0.55em, first-line-indent: 1.8em, justify: true) set text(font: "New Computer Modern", size: 12pt) show raw: set text(font: "New Computer Modern Mono") show par: set block(spacing: 0.55em) show heading: set block(above: 0.9em, below: 0.7em) doc } #let style(doc) = { show heading.where(level: 1): set text(size: 24pt) show heading.where(level: 2): set text(size: 18pt) show heading.where(level: 3): set text(size: 18pt) set text(size: 12pt) show heading: set block(above: 0.9em, below: 1em) doc } #let start_outline(doc) = { outline() set page(numbering: "i") counter(page).update(1) doc } #let chapter_headings(doc) = { set heading(numbering: "1.1") set page(numbering: "1") counter(page).update(1) show heading.where(level: 1): it => { if it.numbering == "1.1" { [ #set text(size: 24pt) Chapter #counter(heading).display() #block(it.body) ] } else { it } } doc } #let outline_style(doc) = { show outline.entry: outrageous.show-entry.with( ..outrageous.presets.typst, fill: (none, none), ) show outline.entry: it => { if it.element.numbering == "1.1" { show outline.entry: outrageous.show-entry.with( // the typst preset retains the normal Typst appearance ..outrageous.presets.typst, // we only override a few things: // level-1 entries are italic, all others keep their font style font-weight: ("bold", auto), // no fill for level-1 entries, a thin gray line for all deeper levels fill: (none, line(length: 100%, stroke: gray + .5pt)), ) it } else { it } } set outline(indent: auto) doc } #let frontpage( toptitle: none, name: none, middletitle: none, bottomtitle: none, info: none, doc ) = { show: doc => latex(doc) v(10%) align(center)[ #text(smallcaps(toptitle), weight: "bold", size: 20pt) #v(10%) #name #v(10%) #middletitle #v(5%) #datetime.today().display("[month repr:long] [day padding:none], [year]") #v(5%) #bottomtitle #v(10%) #info ] pagebreak(weak: true) doc } #let name = "CHANGE NAME" #let title = "CHANGE TITLE" #show: style #show: doc => frontpage( toptitle: [#title], name: [#name #linebreak() Master of Science ], middletitle: [ #image("./thumbnail_HIGH RES RED.png", width: 50%) Mathematics and Statistics \ McGill University \ Montreal, Quebec, Canada], bottomtitle: [ A thesis submitted to McGill University in partial\ fulfillment of the requirements of the degree of a\ Master of Science ], info: [#sym.copyright #name, #datetime.today().display("[year]")], doc) #show: thmrules #show: outline_style #set page(margin: (x: 1in, top: 1in, bottom: 1in)) #pagebreak(weak:true) #show: start_outline #pagebreak(weak:true) = Abstract Test #pagebreak(weak:true) = Acknowledgements Test #pagebreak(weak:true) = Contribution Test #show: chapter_headings = Introduction Test
https://github.com/MatheSchool/typst-g-exam
https://raw.githubusercontent.com/MatheSchool/typst-g-exam/develop/test/parameters/test-001.typ
typst
MIT License
#import "../../src/lib.typ": * #show: g-exam.with( school: ( name: [] ) ) #g-question(points: 1)[Question 1] #g-question(points: 1)[Question 2] #g-question(points: 1.5)[Question 3]
https://github.com/kom113/ucas-typst-slide
https://raw.githubusercontent.com/kom113/ucas-typst-slide/master/README.md
markdown
MIT License
# ucas-typst-slide a typst slide template for students in ucas based on polylux
https://github.com/bnse/typst_tempalte_cn
https://raw.githubusercontent.com/bnse/typst_tempalte_cn/main/main.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: project.with( title: "mytypst", authors: ( (name: "bnse", email: "<EMAIL>"), ), // Insert your abstract after the colon, wrapped in brackets. // Example: `abstract: [This is my abstract...]` abstract: lorem(59), date: "June 7, 2023", ) // We generated the example code below so you can see how // your document will look. Go ahead and replace it with // your own content! = Introduction #lorem(60) == In this paper #lorem(20) === Contributions #lorem(40) = Related Work #lorem(500)
https://github.com/jneug/typst-mantys
https://raw.githubusercontent.com/jneug/typst-mantys/main/template/manual.typ
typst
MIT License
#import "@preview/mantys:0.1.4": * #show: mantys.with( name: "mantys", version: "0.1.0", authors: ( "<NAME>", ), license: "MIT", description: "Helpers to build manuals for Typst packages.", repository:"https://github.com/jneug/typst-mantys", /// Uncomment to load the above package information /// directly from the typst.toml file // ..toml("typst.toml"), title: "Manual title", // subtitle: "Tagline", date: datetime.today(), // url: "", abstract: [ #lorem(50) ], // examples-scope: () // toc: false ) /// Helper for Tidy-Support /// Uncomment, if you are using Tidy for documentation // #let show-module(name, scope: (:), outlined: true) = tidy-module( // read(name + ".typ"), // name: name, // show-outline: outlined, // include-examples-scope: true, // extract-headings: 3, // tidy: tidy // )
https://github.com/yhtq/Notes
https://raw.githubusercontent.com/yhtq/Notes/main/数理逻辑/作业/ml-1_1-hw.typ
typst
#import "../../template.typ": proof, note, corollary, lemma, theorem, definition, example, remark #import "../../template.typ": * #import "../main.typ": not1, True, False, infer #import "../main.typ": * #show: note.with( title: "作业12", author: "YHTQ", date: datetime.today().display(), logo: none, withOutlined : false, withTitle : false, withHeadingNumbering: false ) #let p = $p$ #let q = $q$ #let r = $r$ #let T = True #let F = False #let U = TODO = 1 == 1.1 === (a) 令: $ A = "需求不变"\ B = "价格上升"\ C = "营业额下降" $ 则命题变为: $ (A and B) -> C $ === (b) 令: $ A = x "是有理数"\ B = y "是整数"\ C = z "不是实数" $ 则命题变成: $ A -> (B -> C) $ == 1.2 #let or1 = $or'$ 用 $or1$ 表示通常的与运算,则: #table( columns: 6, align: horizon, table.header( $A$, $B$, $A or B$, $A and B$, $(A or B) or (A and B)$, $A or1 B$ ), T, T, F, T, T, T, T, F, T, F, T, T, F, T, T, F, T, T, F, F, F, F, F, F ) 表明 $(A or B) or (A and B) = A or1 B$ == 1.3 === (a) #table( columns: 13, $(p$, infer, $(q$, infer, $r))$, infer, $((p$, infer, $q)$, infer, $(p$, infer, $r))$, T, T, T, T, T, T, T, T, T, T, T, T, T, T, F, T, F, F, T, T, T, T, F, T, F, F, T, T, F, T, T, T, T, F, T, T, T, T, T, F, T, T, T, T, T, F, T, T, T, F, T, T, T, F, F, T, F, T, T, F, F, T, T, F, F, F, T, T, F, F, T, F, T, T, T, F, T, F, F, T, F, T, T, T, F, T, F, T, F, T, T, F, T, F, T, F, T, F, T, F, T, F, T, F ) === (b) #table( columns: 5, align: center, p, q, r, $(not1 p -> q or r)$, $(not1 q -> (not1 r -> p))$, T, T, T, T, T, T, T, F, T, T, T, F, T, T, T, F, T, T, T, T, T, F, F, T, T, F, T, F, T, T, F, F, T, T, T, F, F, F, F, F ) 易知它们有相同的真值函数 == 1.4 === (a) 是重言式: #table( columns: 4, q, r, $q or r$, $not1 r -> q$, T, T, T, T, T, F, T, T, F, T, T, T, F, F, F, F ) === (b) 不是重言式,当 $p = F, r = T$ 时,前件为真,后件为假 == 1.5 === (a) #table( columns: 4, q, r, $q or r$, $not1 r -> q$, T, T, T, T, T, F, T, T, F, T, T, T, F, F, F, F ) 可见它们有相同的真值函数,故等价 === (b) #table( columns: 5, p, q, r, $(p or q) and r$, $(p and r) or (q and r)$, T, T, T, T, T, T, T, F, F, F, T, F, T, T, T, F, T, T, T, T, T, F, F, F, F, F, T, F, F, F, F, F, T, F, F, F, F, F, F, F ) 可见它们有相同的真值函数,故等价 == 1.6 === (a) 取 $p = #T, q = #T$,则 $not1 p -> q$ 为真,$p -> not1 q$ 为假,从而原式为假 === (b) 取 $calA = (p <-> p), calB = (p <-> p)$ 即可,既然它们都是重言式,值恒为真,因此由上面的推理知原式恒为假,是矛盾式 == 1.7 === (a) 设 $X = {A "是集合" | A in.not A}$,则: - 若 $X in X$,则应该有 $X in.not X$,矛盾 - 若 $X in.not X$,则应该有 $X in X$,矛盾 === (b) 我们设 $A_i$ 是第 $i$ 天这个时候说出的命题,则其定义“我明天这个时候说的这句话是假的”可以写作: $ A_i := not1 A_(i+1), i in NN $ 若我们承认这一系列定义合法,则若 $A_0$ 为真,则 $A_1$ 为假,$A_2$ 为真...... 并不构成矛盾。然而也可以认为对于任何一个 $i$,其定义的形式都是无法终止的递归定义,因此不能被合法地定义为命题。
https://github.com/ckunte/m-one
https://raw.githubusercontent.com/ckunte/m-one/master/inc/slenderness.typ
typst
= Tube slenderness During a pushover simulation last week, the jacket kept struggling at the set load increments. These had not changed from a previous such exercise, the difference being that a particular frame normal to the environmental attack direction had been revised. #figure( image("/img/slenderness.png", width: 100%), caption: [Braces buckling when subjected to incremental increase in environmental loading], ) <bb> When these braces, directly in the line of attack, continued to struggle --- exhibiting excessive displacements in the revised model configuration causing negative matrix errors, I had to re-check their slenderness, even if they did not seem slender at all. So back to basics. The criteria for a ductile design, recommended by $section$11.4, ISO 19902@iso19902_2020 is as follows: $ K L / r lt.eq 80 $ $ lambda lt.eq (80 / pi) sqrt(f_(y c) / E) $ $ f_y D / (E t) lt.eq 0.069 $ From $section$13 of ISO 19902: $ lambda = K L / (pi r) sqrt(f_(y c) / E) $ $ f_(y c) &= f_y "for" f_y / F_(x e) lt.eq 0.170 \ &= (1.047 - 0.274 f_y / f_(x e)) f_y "for" f_y / f_(x e) gt 0.170 $ $ f_(x e) = 2 C_x E t / D $ where, - $lambda$ -- column buckling parameter - $C_x$ -- elastic critical buckling coefficient - D, t, _L_ -- tube size - E -- modulus of steel elasticity - $f_y$ -- yield strength of steel - $f_(y c)$ -- representative local buckling strength of steel - $f_(x e)$ -- representative elastic local buckling strength of steel /* _Quick digression:_ While checking these above expressions for this note, I think I uncovered an error in the latest ISO 19902:2020 standard. Notice the conditional statements in equations 13.2-8 and 13.2-9 in the screenshot below. <figure> <img alt="Conditional statement error uncovered in Eq. 13.2-9, ISO 19902:2020." class="fig" src="/img/iso19902-2020-err.png"> <figcaption>Conditional statement error uncovered in Eq. 13.2-9, ISO 19902:2020.</figcaption> </figure> <mark>The conditional statement in equation 13.2-9 should instead be _(fy / fxe > 0.170)_</mark>, otherwise both conditionals (i.e., in 13.2-8 and 13.2-9) mean (about) the same. &#x1F643; It looks like an editorial mix-up. Anyway, back to my braces. */ For a set of brace sizes (selecting one in each bay), the script lets me check their slenderness. And sure enough, three out of the four braces exceed the criteria for ductile design, resulting in premature buckling, as the figure above shows. #let slenderness = read("/src/slenderness.py") #{linebreak();raw(slenderness, lang: "python")} Producing the following: ``` $ python3 sl.py fy (MPa) = 400.0 D (mm) = [1300.0, 900.0, 1000.0, 1200.0] t (mm) = [50.0, 20.0, 20.0, 30.0] L (mm) = [20518.0, 52151.0, 59685.0, 77500.0] A (mm^2) = [196349.5, 55292.0, 61575.2, 110269.9] I (mm^4) = [38410878928.7, 5355033173.6, 7395183442.8, 18880963994.1] r (mm) = [442.295, 311.207, 346.555, 413.793] fxe (MPa) = [4730.769, 2733.333, 2460.0, 3075.0] fyc (MPa) = [400.0, 400.0, 400.0, 400.0] D/t = [26.0, 45.0, 50.0, 40.0] KL/r (NTE 80) = [32.473, 117.304, 120.557, 131.104] lambda = [0.457, 1.649, 1.695, 1.843] lambda (NTE) = [1.125, 1.125, 1.125, 1.125] fyD/Et (NTE 0.069) = [0.051, 0.088, 0.098, 0.078] ``` From above results, clearly the only member that is not considered slender is the one with size, 1,300$times$50$times$20,518. The last three tubes exhibit some form of slenderness --- mostly on account of length, and may warrant suitable resizing. The lambda is python's built-in anonymous function I use to power through lists, which should not be confused with $lambda$ -- the column buckling parameter, the latter corresponds to `lmbda` in the script --- note the intentional spelling change to avoid the built-in function clashing with the formula. $ - * - $
https://github.com/Fabioni/Typst-TUM-Thesis-Template
https://raw.githubusercontent.com/Fabioni/Typst-TUM-Thesis-Template/main/cover.typ
typst
MIT No Attribution
#let covertitel( degree: "", program: "", ) = { // --- Cover --- v(1cm) align(center, image("TUM_logo.svg", width: 26%)) v(5mm) upper(align(center, text(font: "New Computer Modern", 1.55em, weight: 600, "Technical University of Munich"))) v(5mm) smallcaps(align(center, text(font: "New Computer Modern", 1.38em, weight: 500, "School of Computation, Information and Technology \n Informatics"))) v(25mm) align(center, text(1.3em, weight: 100, degree + "’s Thesis in " + program)) v(15mm) } #let cover( title: "", degree: "", program: "", author: "", ) = { covertitel(degree: degree, program: program) align(center, text(2em, weight: 700, title)) v(10mm) align(center, text(2em, weight: 500, author)) pagebreak() }
https://github.com/TypstApp-team/typst
https://raw.githubusercontent.com/TypstApp-team/typst/master/tests/typ/compiler/dict.typ
typst
Apache License 2.0
// Test dictionaries. // Ref: false --- // Ref: true // Empty #(:) // Two pairs and string key. #let dict = (normal: 1, "spacy key": 2) #dict #test(dict.normal, 1) #test(dict.at("spacy key"), 2) --- // Test lvalue and rvalue access. #{ let dict = (a: 1, "b b": 1) dict.at("b b") += 1 dict.state = (ok: true, err: false) test(dict, (a: 1, "b b": 2, state: (ok: true, err: false))) test(dict.state.ok, true) dict.at("state").ok = false test(dict.state.ok, false) test(dict.state.err, false) } --- // Test rvalue missing key. #{ let dict = (a: 1, b: 2) // Error: 11-23 dictionary does not contain key "c" and no default value was specified let x = dict.at("c") } --- // Test default value. #test((a: 1, b: 2).at("b", default: 3), 2) #test((a: 1, b: 2).at("c", default: 3), 3) --- // Test remove with default value. #{ let dict = (a: 1, b: 2) test(dict.remove("b", default: 3), 2) } #{ let dict = (a: 1, b: 2) test(dict.remove("c", default: 3), 3) } --- // Missing lvalue is not automatically none-initialized. #{ let dict = (:) // Error: 3-9 dictionary does not contain key "b" and no default value was specified dict.b += 1 } --- // Test dictionary methods. #let dict = (a: 3, c: 2, b: 1) #test("c" in dict, true) #test(dict.len(), 3) #test(dict.values(), (3, 2, 1)) #test(dict.pairs().map(p => p.first() + str(p.last())).join(), "a3c2b1") #dict.remove("c") #test("c" in dict, false) #test(dict, (a: 3, b: 1)) --- // Test that removal keeps order. #let dict = (a: 1, b: 2, c: 3, d: 4) #dict.remove("b") #test(dict.keys(), ("a", "c", "d")) --- // Error: 24-29 duplicate key: first #(first: 1, second: 2, first: 3) --- // Error: 17-20 duplicate key: a #(a: 1, "b": 2, "a": 3) --- // Simple expression after already being identified as a dictionary. // Error: 9-10 expected named or keyed pair, found identifier #(a: 1, b) // Identified as dictionary due to initial colon. // The boolean key is allowed for now since it will only cause an error at the evaluation stage. // Error: 4-5 expected named or keyed pair, found integer // Error: 5 expected comma // Error: 17 expected expression #(:1 b:"", true:) --- // Error: 3-15 cannot mutate a temporary value #((key: "val").other = "some") --- #{ let dict = ( func: () => 1, ) // Error: 8-12 type dictionary has no method `func` // Hint: 8-12 to call the function stored in the dictionary, surround the field access with parentheses dict.func() } --- #{ let dict = ( nonfunc: 1 ) // Error: 8-15 type dictionary has no method `nonfunc` dict.nonfunc() } --- #let a = "hello" #let b = "world" #let c = "value" #let d = "conflict" #assert.eq(((a): b), ("hello": "world")) #assert.eq(((a): 1, (a): 2), ("hello": 2)) #assert.eq((hello: 1, (a): 2), ("hello": 2)) #assert.eq((a + b: c, (a + b): d, (a): "value2", a: "value3"), ("helloworld": "conflict", "hello": "value2", "a": "value3")) --- // Error: 7-10 expected identifier, found group // Error: 12-14 expected identifier, found integer #let ((a): 10) = "world" --- // Error: 3-7 expected string, found boolean // Error: 16-18 expected string, found integer #(true: false, 42: 3)
https://github.com/TypstApp-team/typst
https://raw.githubusercontent.com/TypstApp-team/typst/master/tests/typ/compiler/let.typ
typst
Apache License 2.0
// Test let bindings. --- // Automatically initialized with none. #let x #test(x, none) // Manually initialized with one. #let z = 1 #test(z, 1) // Syntax sugar for function definitions. #let fill = conifer #let f(body) = rect(width: 2cm, fill: fill, inset: 5pt, body) #f[Hi!] --- // Termination. // Terminated by line break. #let v1 = 1 One // Terminated by semicolon. #let v2 = 2; Two // Terminated by semicolon and line break. #let v3 = 3; Three #test(v1, 1) #test(v2, 2) #test(v3, 3) --- // Test parenthesised assignments. // Ref: false #let (a) = (1, 2) --- // Ref: false // Simple destructuring. #let (a, b) = (1, 2) #test(a, 1) #test(b, 2) --- // Ref: false #let (a,) = (1,) #test(a, 1) --- // Ref: false // Destructuring with multiple placeholders. #let (a, _, c, _) = (1, 2, 3, 4) #test(a, 1) #test(c, 3) --- // Ref: false // Destructuring with a sink. #let (a, b, ..c) = (1, 2, 3, 4, 5, 6) #test(a, 1) #test(b, 2) #test(c, (3, 4, 5, 6)) --- // Ref: false // Destructuring with a sink in the middle. #let (a, ..b, c) = (1, 2, 3, 4, 5, 6) #test(a, 1) #test(b, (2, 3, 4, 5)) #test(c, 6) --- // Ref: false // Destructuring with an empty sink. #let (..a, b, c) = (1, 2) #test(a, ()) #test(b, 1) #test(c, 2) --- // Ref: false // Destructuring with an empty sink. #let (a, ..b, c) = (1, 2) #test(a, 1) #test(b, ()) #test(c, 2) --- // Ref: false // Destructuring with an empty sink. #let (a, b, ..c) = (1, 2) #test(a, 1) #test(b, 2) #test(c, ()) --- // Ref: false // Destructuring with an empty sink and empty array. #let (..a) = () #test(a, ()) --- // Ref: false // Destructuring with unnamed sink. #let (a, .., b) = (1, 2, 3, 4) #test(a, 1) #test(b, 4) // Error: 10-11 at most one binding per identifier is allowed #let (a, a) = (1, 2) // Error: 12-15 at most one destructuring sink is allowed #let (..a, ..a) = (1, 2) // Error: 12-13 at most one binding per identifier is allowed #let (a, ..a) = (1, 2) // Error: 13-14 at most one binding per identifier is allowed #let (a: a, a) = (a: 1, b: 2) // Error: 13-20 expected identifier, found function call #let (a, b: b.at(0)) = (a: 1, b: 2) // Error: 7-14 expected identifier or destructuring sink, found function call #let (a.at(0),) = (1,) --- // Error: 13-14 not enough elements to destructure #let (a, b, c) = (1, 2) --- // Error: 6-20 not enough elements to destructure #let (..a, b, c, d) = (1, 2) --- // Error: 6-12 cannot destructure boolean #let (a, b) = true --- // Ref: false // Simple destructuring. #let (a: a, b, x: c) = (a: 1, b: 2, x: 3) #test(a, 1) #test(b, 2) #test(c, 3) --- // Ref: false // Destructuring with a sink. #let (a: _, ..b) = (a: 1, b: 2, c: 3) #test(b, (b: 2, c: 3)) --- // Ref: false // Destructuring with a sink in the middle. #let (a: _, ..b, c: _) = (a: 1, b: 2, c: 3) #test(b, (b: 2)) --- // Ref: false // Destructuring with an empty sink. #let (a: _, ..b) = (a: 1) #test(b, (:)) --- // Ref: false // Destructuring with an empty sink and empty dict. #let (..a) = (:) #test(a, (:)) --- // Ref: false // Destructuring with unnamed sink. #let (a, ..) = (a: 1, b: 2) #test(a, 1) --- // Trailing placeholders. // Error: 10-11 not enough elements to destructure #let (a, _, _, _, _) = (1,) #test(a, 1) --- // Error: 10-13 expected identifier, found string // Error: 18-19 expected identifier, found integer #let (a: "a", b: 2) = (a: 1, b: 2) --- // Error: 10-11 dictionary does not contain key "b" #let (a, b) = (a: 1) --- // Error: 10-11 dictionary does not contain key "b" #let (a, b: b) = (a: 1) --- // Error: 7-11 cannot destructure named elements from an array #let (a: a, b) = (1, 2, 3) --- // Error: 5 expected identifier #let // Error: 6 expected identifier #{let} // Error: 5 expected identifier // Error: 5 expected semicolon or line break #let "v" // Error: 7 expected semicolon or line break #let v 1 // Error: 9 expected expression #let v = // Error: 5 expected identifier // Error: 5 expected semicolon or line break #let "v" = 1 // Terminated because expression ends. // Error: 12 expected semicolon or line break #let v4 = 4 Four // Terminated by semicolon even though we are in a paren group. // Error: 18 expected expression // Error: 11-12 unclosed delimiter #let v5 = (1, 2 + ; Five // Error: 9-13 expected identifier, found boolean #let (..true) = false --- #let _ = 4 #for _ in range(2) [] // Error: 2-3 unexpected underscore #_ // Error: 8-9 unexpected underscore #lorem(_) // Error: 3-4 expected expression, found underscore #(_,) // Error: 3-4 expected expression, found underscore #{_} // Error: 8-9 expected expression, found underscore #{ 1 + _ } --- // Error: 13 expected equals sign #let func(x) // Error: 15 expected expression #let func(x) =
https://github.com/enseignantePC/2023-24
https://raw.githubusercontent.com/enseignantePC/2023-24/master/act_template.typ
typst
#import "detect.typ": detect #import "style.typ": doc #let page_to_footnotes_map = state("ptfm", (:)) #let question(body, supplement : none) = detect( body: (counter, loc) => text( size: 1.2em, )[*Question #supplement #counter.display())*] + [#h(.5em) #body #linebreak()], add: (counter, loc) => place( bottom + right, )[*La question #counter.display() continue sur la page suivante ...*], ) #let bonus = [ #set align(center) #v(1em, weak: true) #box( inset: (top: 2pt, bottom: 2pt, x: 5pt), text(18pt)[_\~\~*BONUS*_\~\~], ) ] #let minititle(it, size : 18pt) = box( inset: (top: 2pt, bottom: 2pt, x: 5pt), text(size,hyphenate: false)[_#it _], ) #let introduction(title: [Introduction], it) = { rect( stroke: (left: 1.8pt), fill: blue.lighten(80%), inset: (bottom: 10pt, x: 10pt), )[ #minititle(title) #it ] } #let activité( title: none, chapter_name: none, kind : [Activité], number: none, body, ) = [ #set page( paper: "a4", margin: (x: 1.2cm, top: 2cm, bottom: 2cm), footer: align( center, counter(page).display("1 / 1", both: true), ), header: [ #kind #number --- chap. #chapter_name #h(1fr) 2023-24 #h(1fr) <NAME> #v(-5pt) ], ) #set heading(numbering: "1.", supplement: [Partie]) #show heading.where(level: 1): it => [ #v(1em, weak: true) #set align(center) #minititle[#it.supplement #counter(heading).display() #it.body] ] #set text(size: 13pt) #show footnote.entry: set text(12pt) #show footnote.entry: it => { // add the footnote to the map locate(loc => { page_to_footnotes_map.update(x => { let key = str(loc.position().page) if x.at(key, default: none) != none { x.at(key).push(it) } else { x.insert(key, (it,)) } x }) }) // compare with different from last on this page locate( loc => { let dict = page_to_footnotes_map.final(loc) let page = loc.position().page let list = dict.at(str(page)) if list.last() == it [#it #v(1em)] else [#it] }, ) } #align( center, )[#rect(width: 90%, radius: 130pt, fill: gray)[ #layout(size => align(center)[#rect( inset: 7pt, width: 95% * size.width, fill: white, radius: 5pt, )[ #set text(size: 21pt) *#kind #number * #if title != none [*: #title*] ]]) ]] #body ] #activité( title: [Titre générique], chapter_name: [Nom Du Chapitre], number: 1, )[ #introduction(title: [Introduction], lorem(70)) = Le coté physique #columns(2, /*TODO tight*/)[ #doc(lorem(20)) #colbreak() #doc(lorem(60)) ] #question(lorem(50)) #question(lorem(150)) #question(lorem(190)) #question(lorem(50)) // #question(lorem(150)) = La chimie du monde #bonus ]
https://github.com/typst/packages
https://raw.githubusercontent.com/typst/packages/main/packages/preview/cetz/0.0.2/intersection.typ
typst
Apache License 2.0
#import "vector.typ" #import "util.typ" /// Check for line-line intersection and return point or none /// /// - a (vector): Line 1 point 1 /// - b (vector): Line 1 point 2 /// - c (vector): Line 2 point 1 /// - d (vector): Line 2 point 2 /// -> (vector,none) #let line-line(a, b, c, d) = { let lli8(x1, y1, x2, y2, x3, y3, x4, y4) = { let nx = (x1*y2 - y1*x2)*(x3 - x4)-(x1 - x2)*(x3*y4 - y3*x4) let ny = (x1*y2 - y1*x2)*(y3 - y4)-(y1 - y2)*(x3*y4 - y3*x4) let d = (x1 - x2)*(y3 - y4)-(y1 - y2)*(x3 - x4) if d == 0 { return none } return (nx / d, ny / d, 0) } let pt = lli8(a.at(0), a.at(1), b.at(0), b.at(1), c.at(0), c.at(1), d.at(0), d.at(1)) if pt != none { let on-line(pt, a, b) = { let (x, y, ..) = pt let epsilon = util.float-epsilon let mx = calc.min(a.at(0), b.at(0)) - epsilon let my = calc.min(a.at(1), b.at(1)) - epsilon let Mx = calc.max(a.at(0), b.at(0)) + epsilon let My = calc.max(a.at(1), b.at(1)) + epsilon return mx <= x and Mx >= x and my <= y and My >= y } if on-line(pt, a, b) and on-line(pt, c, d) { return pt } } } /// Check for path-path intersection in 2D /// /// - a (path): Path a /// - b (path): Path b /// - samples (int): Number of samples to use for bezier curves #let path-path(a, b, samples: 25) = { import "bezier.typ" // Convert segment to vertices by sampling curves let linearize-segment(s) = { let t = s.at(0) if t == "line" { return s.slice(1) } else if t == "quadratic" { return range(samples + 1).map( t => bezier.quadratic-point(..s.slice(1), t/samples)) } else if t == "cubic" { return range(samples + 1).map( t => bezier.cubic-point(..s.slice(1), t/samples)) } } // Check for segment-segment intersection and return list of points let segment-segment(a, b) = { let pts = () let av = linearize-segment(a) let bv = linearize-segment(b) for ai in range(0, av.len() - 1) { for bi in range(0, bv.len() - 1) { let isect = line-line(av.at(ai), av.at(ai + 1), bv.at(bi), bv.at(bi + 1)) if isect != none { pts.push(isect) } } } return pts } let pts = () for sa in a.segments { for sb in b.segments { pts += segment-segment(sa, sb) } } return pts }
https://github.com/alejandrgaspar/pub-analyzer
https://raw.githubusercontent.com/alejandrgaspar/pub-analyzer/main/pub_analyzer/internal/templates/author/author_summary.typ
typst
MIT License
// Author Summary = Author. #let summary-card(title: "Title", body) = { return block( width: 100%, height: 150pt, fill: rgb("e5e7eb"), stroke: 1pt, radius: 2pt, )[ #v(20pt) #align(center)[#text(size: 12pt)[#title]] #v(5pt) #block(width: 100%, inset: (x: 20pt))[#body] ] } // Cards #grid( columns: (1fr, 1fr, 1fr), column-gutter: 15pt, [ // Last institution. #summary-card(title:"Last institution:")[ {% if report.author.last_known_institutions%} {% set last_known_institution = report.author.last_known_institutions[0] %} #grid( rows: auto, row-gutter: 10pt, [*Name:* {{ last_known_institution.display_name }}], [*Country:* {{ last_known_institution.country_code }}], [*Type:* {{ last_known_institution.type.value|capitalize }}], ) {% endif %} ] ], [ // Author identifiers. #summary-card(title:"Identifiers:")[ #grid( rows: auto, row-gutter: 10pt, {% for key, value in report.author.ids.model_dump().items() %} {% if value %} [- #underline( [#link("{{ value }}")[{{ key }}]] )], {% endif %} {% endfor %} ) ] ], [ // Citation metrics. #summary-card(title: "Citation metrics:")[ #grid( rows: auto, row-gutter: 10pt, [*2-year mean:* {{ report.author.summary_stats.two_yr_mean_citedness|round(5) }}], [*h-index:* {{ report.author.summary_stats.h_index }}], [*i10 index:* {{ report.author.summary_stats.i10_index }}] ) ] ], ) #v(10pt) #align(center, text(11pt)[_Counts by year_]) #grid( columns: (1fr, 1fr), column-gutter: 15pt, align: (auto, horizon), [ #table( columns: (1fr, 2fr, 2fr), inset: 8pt, align: horizon, // Headers [*Year*], [*Works count*], [*Cited by count*], // Content {% set max_year_count = 0 %} {% for year_count in report.author.counts_by_year[:8] %} [{{ year_count.year }}], [{{ year_count.works_count }}], [{{ year_count.cited_by_count }}], {% set max_year_count = year_count %} {% endfor %} ) ], grid.cell( inset: (x: 10pt, bottom: 10pt, top: 2.5pt), stroke: 1pt )[ #align(center, text(10pt)[Cites by year]) #v(5pt) #canvas(length: 100%, { plot.plot( size: (0.90, 0.48), axis-style: "scientific-auto", plot-style: (stroke: (1pt + PALETTE.at(0)),), x-min: auto, x-max: auto, x-tick-step: 1, y-tick-step: auto, x-label: none, y-label: none, { plot.add(( {% for year_count in report.author.counts_by_year[:8] %} ({{ year_count.year }}, {{ year_count.cited_by_count }}), {% endfor %} )) }) }) ] ) #pagebreak()
https://github.com/Myriad-Dreamin/typst.ts
https://raw.githubusercontent.com/Myriad-Dreamin/typst.ts/main/fuzzers/corpora/bugs/footnote-keep-multiple_00.typ
typst
Apache License 2.0
#import "/contrib/templates/std-tests/preset.typ": * #show: test-page #set page(height: 100pt) #v(40pt) A #footnote[a] \ B #footnote[b]
https://github.com/maantjemol/Aantekeningen-Jaar-2
https://raw.githubusercontent.com/maantjemol/Aantekeningen-Jaar-2/main/project%20management/aantekeningen.typ
typst
#import "../template/lapreprint.typ": template #import "../template/frontmatter.typ": loadFrontmatter #import "@preview/drafting:0.2.0": * #import "@preview/cetz:0.2.2" #let default-rect(stroke: none, fill: none, width: 0pt, content) = { pad(left:width*(1 - marginRatio), rect(width: width*marginRatio, stroke: stroke)[ #content ]) } #let defaultColor = rgb("#2d75f2") #let caution-rect = rect.with(inset: 1em, radius: 0.5em, fill: defaultColor.lighten(96%), width:100%, stroke: defaultColor.lighten(80%)) #let note = (content) => inline-note(rect: caution-rect, stroke: defaultColor.lighten(60%))[#content] #show: template.with( title: "Project management", subtitle: "Samenvatting", short-title: "", venue: [ar#text(fill: red.darken(20%))[X]iv], // This is relative to the template fsile // When importing normally, you should be able to use it relative to this file. theme: defaultColor, authors: ( ( name: "<NAME> . ", ), ), kind: "Samenvatting", abstract: ( (title: "Samenvatting", content: [#lorem(100)]), ), open-access: true, margin: ( ( title: "", content: [ ], ), ), font-face: "Open Sans" ) #set page( margin: (left: 1in, right: 1in), paper: "a4" ) #let marginRatio = 0.8 #let default-rect(stroke: none, fill: none, width: 0pt, content) = { pad(left:width*(1 - marginRatio), rect(width: width*marginRatio, stroke: stroke)[ #content ]) } #set-page-properties() #show terms: it => [ #note[#text(defaultColor, weight: 600, size: 10pt)[#it.children.first().term]\ #it.children.first().description] ] #set heading(numbering: none) #show heading: set text(defaultColor, weight: "medium") = Het plan van aanpak (4-5 pagina's) Er zit een duidelijk verschil tussen het doel van het project en het daadwerkelijke resultaat wat je krijgt uit het project. / APDRA: #text[ Achtergrond, Probleemstelling, Doelstelling, Resultaat, Afbakening.\ ] Het plan van aanpak kan gemaakt worden door de APDRA en GO-KIT te volgen. / GO-KIT + R: #text[ - *Geld*: Mag in ons geval ook tijd zijn (40 uur) - *Organisatie:* rollen verdelen, wie doet wat? - *Kwaliteit*: Wat zijn de eisen van het project? - *Informatie*: Hoe en waar documenteer je alles? - *Tijd*: Wanneer moet wat af zijn, tijdsplan? - *Risico's*: Anticiperen op dingen die gaan gebeuren. ]
https://github.com/tzx/NNJR
https://raw.githubusercontent.com/tzx/NNJR/main/resume.typ
typst
MIT License
#import "template.typ": resume, header, resume_heading, edu_item, exp_item, project_item, skill_item #show: resume #header( name: "<NAME>", phone: "123-456-7890", email: "<EMAIL>", linkedin: "linkedin.com/in/jake", site: "github.com/jake", ) #resume_heading[Education] #edu_item( name: "Southwestern University", degree: "Bachelor of Arts in Computer Science, Minor in Business", location: "Georgetown, TX", date: "Aug. 2018 - May 2021" ) #edu_item( name: "Blinn College", degree: "Associate's in Liberal Arts", location: "Bryan, TX", date: "Aug. 2014 - May 2018" ) #resume_heading[Experience] #exp_item( role: "Undergraduate Research Assistant", name: "Texas A&M University", location: "College Station, TX", date: "June 2020 - Present", [Developed a REST API using FastAPI and PostgreSQL to store data from learning management systems], [Developed a full-stack web application using Flask, React, PostgreSQL and Docker to analyze GitHub data], [Explored ways to visualize GitHub collaboration in a classroom setting] ) #exp_item( role: "Information Technology Support Specialist", name: "Southwestern University", location: "Georgetown, TX", date: "Sep. 2018 - Present", [Communicate with managers to set up campus computers used on campus], [Assess and troubleshoot computer problems brought by students, faculty and staff], [Maintain upkeep of computers, classroom equipment, and 200 printers across campus] ) #exp_item( role: "Artificial Intelligence Research Assistant", name: "Southwestern University", location: "Georgetown, TX", date: "May 2019 - July 2019", [Explored methods to generate video game dungeons based off of #emph[The Legend of Zelda]], [Developed a game in Java to test the generated dungeons], [Contributed 50K+ lines of code to an established codebase via Git], [Conducted a human subject study to determine which video game dungeon generation technique is enjoyable], [Wrote an 8-page paper and gave multiple presentations on-campus], [Presented virtually to the World Conference on Computational Intelligence] ) #resume_heading("Projects") #project_item( name: "Gitlytics", skills: "Python, Flask, React, PostgreSQL, Docker", date: "June 2020 - Present", [Developed a full-stack web application using with Flask serving a REST API with React as the frontend], [Implemented GitHub OAuth to get data from user’s repositories], [Visualized GitHub data to show collaboration], [Used Celery and Redis for asynchronous tasks] ) #project_item( name: "<NAME>", skills: "Spigot API, Java, Maven, TravisCI, Git", date: "May 2018 - May 2020", [Developed a Minecraft server plugin to entertain kids during free time for a previous job], [Published plugin to websites gaining 2K+ downloads and an average 4.5/5-star review], [Implemented continuous delivery using TravisCI to build the plugin upon new a release], [Collaborated with Minecraft server administrators to suggest features and get feedback about the plugin] ) #resume_heading("Technical Skills") #skill_item( category: "Languages", skills: "Java, Python, C/C++, SQL (Postgres), JavaScript, HTML/CSS, R" ) #skill_item( category: "Frameworks", skills: "React, Node.js, Flask, JUnit, WordPress, Material-UI, FastAPI" ) #skill_item( category: "Developer Tools", skills: "Git, Docker, TravisCI, Google Cloud Platform, VS Code, Visual Studio, PyCharm, IntelliJ, Eclipse" ) #skill_item( category: "Libraries", skills: "pandas, NumPy, Matplotlib" )
https://github.com/flavio20002/cyrcuits
https://raw.githubusercontent.com/flavio20002/cyrcuits/main/tests/invert/test.typ
typst
Other
#import "../../lib.typ": * #set page(width: auto, height: auto, margin: 0.5cm) #show: doc => cyrcuits( scale: 1, doc, ) ```circuitkz \begin{circuitikz} \draw (0,0) to[battery1=$E$] ++ (0,2) to[R=$R_1$,f>_=$i_1$] ++ (0,2) to[short,-*] ++ (2,0) coordinate (aux1) to[R,l_=$R_2$,f>_=$i_2$] ++ (0,-4) to[short,*-] ++ (-2,0); \draw (aux1) to[short] ++ (2,0) coordinate (aux2) to[battery1,l=$V_C^0$,f>_=$i_C$,invert] ++ (0,-4) to[short] ++ (-2,0); \end{circuitikz} ```
https://github.com/jgm/typst-hs
https://raw.githubusercontent.com/jgm/typst-hs/main/test/typ/compiler/color-00.typ
typst
Other
// Test CMYK color conversion. #let c = cmyk(50%, 64%, 16%, 17%) #stack( dir: ltr, spacing: 1fr, rect(width: 1cm, fill: cmyk(69%, 11%, 69%, 41%)), rect(width: 1cm, fill: c), rect(width: 1cm, fill: c.negate()), ) #for x in range(0, 11) { box(square(size: 9pt, fill: c.lighten(x * 10%))) } #for x in range(0, 11) { box(square(size: 9pt, fill: c.darken(x * 10%))) }
https://github.com/Myriad-Dreamin/typst.ts
https://raw.githubusercontent.com/Myriad-Dreamin/typst.ts/main/fuzzers/corpora/text/emphasis_05.typ
typst
Apache License 2.0
#import "/contrib/templates/std-tests/preset.typ": * #show: test-page // // // Error: 11-12 unclosed delimiter // // Error: 3-4 unclosed delimiter // #[_Cannot *be interleaved]
https://github.com/Kasci/LiturgicalBooks
https://raw.githubusercontent.com/Kasci/LiturgicalBooks/master/CU/oktoich/1_generated/0_all/Hlas7.typ
typst
#import "../../../all.typ": * #show: book = #translation.at("HLAS") 7 #include "../Hlas7/0_Nedela.typ" #pagebreak() #include "../Hlas7/1_Pondelok.typ" #pagebreak() #include "../Hlas7/2_Utorok.typ" #pagebreak() #include "../Hlas7/3_Streda.typ" #pagebreak() #include "../Hlas7/4_Stvrtok.typ" #pagebreak() #include "../Hlas7/5_Piatok.typ" #pagebreak() #include "../Hlas7/6_Sobota.typ" #pagebreak()
https://github.com/maucejo/presentation_touying
https://raw.githubusercontent.com/maucejo/presentation_touying/main/src/_boxes.typ
typst
MIT License
#import "@preview/touying:0.5.3": * #import "@preview/showybox:2.0.3": * #import "@preview/codelst:2.0.1": sourcecode // Emphasized box (for equations) #let _emphbox(self: none, body) = { set align(center) box( stroke: 1pt + self.colors.box.lighten(20%), radius: 5pt, inset: 0.5em, fill: self.colors.box.lighten(80%), )[#body] } #let emphbox(body) = touying-fn-wrapper(_emphbox.with(body)) //---- #let _subtitle(self: none, body) = { if self.store.navigation == "topbar" { set text(size: 1.2em, fill: self.colors.primary, weight: "bold") place(top + left, pad(left: -0.8em, top: -0.25em, body)) v(1em) } } #let subtitle(body) = touying-fn-wrapper(_subtitle.with(body)) //---- Utilities for boxes ---- #let box-title(a, b) = { grid(columns: 2, column-gutter: 0.5em, align: (horizon), a, b ) } #let colorize(svg, color) = { let blk = black.to-hex(); if svg.contains(blk) { svg.replace(blk, color.to-hex()) } else { svg.replace("<svg ", "<svg fill=\""+color.to-hex()+"\" ") } } #let color-svg( path, color, ..args, ) = { let data = colorize(read(path), color) return image.decode(data, ..args) } //---- //---- Utility boxes ---- // Information box #let _info(self: none, body) = { set text(size: 0.8em) showybox( title: box-title(color-svg("resources/assets/icons/info.svg", self.colors.info, width: 1em), [*Note*]), title-style: ( color: self.colors.info, sep-thickness: 0pt, ), frame: ( title-color: self.colors.info.lighten(80%), border-color: self.colors.info, body-color: none, thickness: (left: 3pt), radius: (top-left: 0pt, bottom-right: 1em, top-right: 1em), ) )[#body] } #let info(body) = touying-fn-wrapper(_info.with(body)) // Tip box #let _tip(self: none, body) = { set text(size: 0.8em) showybox( title: box-title(color-svg("resources/assets/icons/light-bulb.svg", self.colors.tip, width: 1em), [*Tip*]), title-style: ( color: self.colors.tip, sep-thickness: 0pt, ), frame: ( title-color: self.colors.tip.lighten(80%), border-color: self.colors.tip, body-color: none, thickness: (left: 3pt), radius: (top-left: 0pt, bottom-right: 1em, top-right: 1em), ) )[#body] } #let tip(body) = touying-fn-wrapper(_tip.with(body)) // Important box #let _important(self: none, body) = { set text(size: 0.8em) showybox( title: box-title(color-svg("resources/assets/icons/report.svg", self.colors.important, width: 1em), [*Important*]), title-style: ( color: self.colors.important, sep-thickness: 0pt, ), frame: ( title-color: self.colors.important.lighten(80%), border-color: self.colors.important, body-color: none, thickness: (left: 3pt), radius: (top-left: 0pt, bottom-right: 1em, top-right: 1em), ) )[#body] } #let important(body) = touying-fn-wrapper(_important.with(body)) // Question box #let _question(self: none, body) = { set text(size: 0.8em) showybox( title: box-title(color-svg("resources/assets/icons/question.svg", self.colors.question, width: 1em), [*Question*]), title-style: ( color: self.colors.question, sep-thickness: 0pt, ), frame: ( title-color: self.colors.question.lighten(80%), border-color: self.colors.question, body-color: none, thickness: (left: 3pt), radius: (top-left: 0pt, bottom-right: 1em, top-right: 1em), ) )[#body] } #let question(body) = touying-fn-wrapper(_question.with(body)) // Code box #let _code(self: none, lang: none, body) = sourcecode( frame: showybox.with( title: [*Code* #h(1fr) #strong(lang)], frame: ( title-color: self.colors.primary, border-color: self.colors.primary, body-color: none, thickness: (left: 3pt), radius: (top-left: 0pt, top-right: 1em), ) ), body ) #let code(lang: none, body) = touying-fn-wrapper(_code.with(lang: lang, body)) // Link box #let _link-box(self: none, location, name) = { block(fill: self.colors.primary, radius: 1em, inset: 0.5em)[ #set text(fill: white, size: 0.8em, weight: "bold") #link(location, name) ] } #let link-box(location, name) = touying-fn-wrapper(_link-box.with(location, name))
https://github.com/TOETOE55/TOETOE-s-Bizarre-Adventure
https://raw.githubusercontent.com/TOETOE55/TOETOE-s-Bizarre-Adventure/master/resume.typ
typst
Other
#import "lib.typ": * #show: resume.with( author: ( firstname: "", lastname: "邓乐涛", email: "<EMAIL>", phone: "(+86) 186-7500-3737", github: "TOETOE55", ), date: datetime.today().display(), colored_headers: true ) = 教育经历 #resume-entry( title: "陕西师范大学", location: "西安", date: "2017.7 - 2021.6", description: "软件工程" ) = 工作经历 #resume-entry( title: "RustSDK开发工程师(客户端),日历业务", location: "北京", date: "2021.7 - 2022.5", description: "字节跳动,飞书" ) #resume-item[ - 负责日历会议室视图需求的开发与迭代 - 参与日历日程同步流程的重构工作 ] #resume-entry( title: "RustSDK开发工程师(客户端),平台能力方向", location: "北京", date: "2022.5 - 2023.6", description: "字节跳动,飞书" ) #resume-item[ - 主导rust-sdk一些业务基础能力(比如一些网络重试基建、三方加密库等)的重构、设计与开发 - 深度参与rust-sdk用户态架构的迁移与设计 - 参与rust-sdk测试框架的设计与后续搭建 - 参与rust-sdk开发教程的开发 ] #resume-entry( title: "iOS开发工程师,多轨工具与素材方向", location: "广州", date: "2023.6 - 2024.4", description: "字节跳动,剪映" ) #resume-item[ - 参与基础剪辑与智能剪辑需求的开发迭代 - 完善了一些与ab实验相关的基础功能 - 在剪映工作流程引入新的日志分析系统提高问题排查效率 - 一些oncall自动化的工作 ] = 项目经历 #resume-entry( title: text(default-accent-color)[会议室支持多层级], date: "2021.8 - 2022.6", description: "RustSDK RD/Tech Owner" ) #resume-item[ - #text(default-accent-color)[*概述:*] KA客户定制化需求,使得会议室可以灵活设置在一个树状的组织结构下,以便支持会议室与组织架构绑定,以及批量预约会议室的能力 - #text(default-accent-color)[*产出:*] + 一期定义了多层级会议室的基础结构以及CRUD接口,从0到1搭建起完整的多层级会议室链路 + 二期定义了旧会议室结构与多层级会议室结构的mapping和新旧系统的切换规则,支持新旧会议室系统的兼容,方便客户在新旧会议室系统之间迁移 + 三期引入缓存、迭代拉取、分页拉取等技术,完善了若干体验问题(如查询速度),对标旧会议室系统 ] #resume-entry( title: text(default-accent-color)[日程同步流程重构], date: "2021.11 - 2021.12", description: "RustSDK RD" ) #resume-item[ - #text(default-accent-color)[*概述:*] 日程通过日程同步机制实现客户端 \<\-\> 服务端之间数据的同步,日程同步是日程保存、修改、查看、回复等功能的核心数据流。重构日程同步流程以解决若干遗留问题,比如接口对服务端压力大、数据不一致等 - #text(default-accent-color)[*产出:*] + 对原先单一接口单一流程,拆解为读与写的两部分,在不同时机选择走不同的流程,减少了功能的耦合,降低了对服务端压力 + 将日程参与人的部分从原先的日程全量的同步中拆分出来,减少每次同步的数据量,同样减轻了服务端的压力 + 重新约定客户端、服务端同步的协议,SDK侧使用同步队列的方式,保证了数据的一致性 + 整体重构后 p99首屏同步耗时少了60%,首次同步耗时减少52%。尤其在首次订阅日历耗时体感明显降低 ] #resume-entry( title: text(default-accent-color)[用户态架构迁移], date: "2022.3 - 2023.6", description: "RustSDK RD" ) #resume-item[ - #text(default-accent-color)[*概述:*] RustSDK旧框架中,与用户相关的数据、资源分散在各个全局变量中,以及缺乏收敛的用户数据管理能力,导致旧框架下存在用户串数据的问题,也无法支持多用户同时在线。在新架构中将所有用户相关的逻辑全部收敛到“用户态容器”中管理,解决旧架构所带来的问题 - #text(default-accent-color)[*角色:*] 深度参与用户态架构的设计与开发,主要完成三部分工作 + 业务迁移 + 基建改造 + 框架本身功能的完善 - #text(default-accent-color)[*产出:*] + 通过对登录登出流程重构,重新整理并定义好登录登出的接口与流程,引入了“用户状态不变量”检查、并发控制、压力测试、流程埋点等手段,消灭了由登录登出引起的用户串数据问题 + 将长链接,pipeline,客户端调用与推送,迁移至用户态架构内,添加用户校验以及一些生命周期管理的逻辑,从数据源头上解决用户串数据问题。 + 将基于线程的worker基建,重新设计为基于异步且兼容用户态框架的worker基建,复用共有的异步运行时,减少多用户环境下的开销;同时利用异步rust的特性,能在用户态下更好地管理worker的生命周期 + 迁移了日历核心业务和im部分业务逻辑,并指导vc业务、ccm业务的迁移工作 + 总共迁移4万+行代码 + 基本解决用户串数据问题 ] #resume-entry( title: text(default-accent-color)[SDK网络请求中间件], date: "2022.12 - 2023.6", description: "RustSDK RD/Tech Owner" ) #resume-item[ - #text(default-accent-color)[*概述:*] 在客户端环境中容易遇到网络不稳定以及杀App的情况,对于一些需要“必达”的网络请求,各个业务经常重新实现一套不完整不鲁棒的重试逻辑,会带很多业务问题。所以统一实现一个支持离线和弱网下发起请求,上线后恢复的请求重试基建 - #text(default-accent-color)[*产出:*] + 通过维护事件循环来进行并发控制,控制请求任务执行的时机,可以避开一些资源使用的高峰期(比如说冷启动时),可以控制任务执行的并发数,减少网络资源的拥塞情况 + 将请求重试的过程描述为一个状态机,可以精确定义每个步骤的前置条件和后置条件,方便测试代码的编写 + 接口上区分是否幂等请求,一方面提醒业务方考虑当前场景是否幂等,还能不同情况下采取不同的重试策略提高性能 ] #resume-entry( title: text(default-accent-color)[容器反转实验], date: "2023.7", description: "iOS RD" ) #resume-item[ - #text(default-accent-color)[*概述:*] 在剪映中引入容器反转实验,可以观察某个业务线长期迭代,引入多个需求的收益 - #text(default-accent-color)[*产出:*] + 添加新的配置,可以直接在配置平台配置容器绑定的需求实验,方便后续新需求接入 + 实现上hook了代码中获取实验值的地方,使得命中容器反转实验时,自动返回容器内配置的实验值,而无需新增额外的反转实验的代码 ] #resume-entry( title: text(default-accent-color)[马赛克特效支持应用于多人脸], date: "2023.11 - 2023.12", description: "iOS RD" ) #resume-item[ - #text(default-accent-color)[*概述:*] 剪映的马赛克特效希望可以应用于多个人脸,且支持让用户选择特效应用于哪个人脸 - #text(default-accent-color)[*角色:*] 主要负责在播放器上人脸编辑的能力 - #text(default-accent-color)[*产出:*] + 多人脸马赛克之于旧的单人脸马赛克导出渗透率有明显提升 + 搭建了多人脸特效的通用链路,支持后续直接添加可编辑的多人脸特效 + (使用混合模式)额外实现了一个支持挖多个孔蒙层的组件 ] #resume-entry( title: text(default-accent-color)[数字人克隆], date: "2024.1 - 2024.3", description: "iOS RD" ) #resume-item[ - #text(default-accent-color)[*概述:*] 可以通过录制一段视频,训练出一个专属的个人数字人形象,应用于文本朗读中 - #text(default-accent-color)[*工作:*] + 主要负责拍摄链路的开发,以及新数字人面板前期的设计工作 + 拍摄器部分每个组件都是用MVVM模式,再通过一个主VC和主VM将所有组件组合在一起,负责组件间通信以及生命周期管理。比较好地将几个拍摄阶段、拍摄状态以及环境检查状态几个相互耦合的状态管理起来。 ] = 个人项目 #resume-entry( title: text(default-accent-color)[cfg-vis], location: [#github-link("TOETOE55/cfg-vis")], description: "Designer/Developer" ) #resume-item[ - 使用过程宏模拟cfg,可以控制rust items的模块可见性。可以应用在跨crate写内部测试的场景(由飞书RustSDK框架引出的需求) - 在 #link("https://crates.io/crates/cfg-vis")[crates.io] 上已有 86k 下载量 ] #resume-entry( title: text(default-accent-color)[dep-inj], location: [#github-link("TOETOE55/dep-inj")], description: "Designer/Developer" ) #resume-item[ - 一个rust静态的依赖注入库,允许使用者通过泛型进行依赖注入,在编译时可以检查依赖项是否注入。这是由飞书用户态框架引出的需求,以解决动态依赖注入带来的各种问题。 - 已经有商业项目使用 #link("https://github.com/kuintessence/agent") ] #resume-entry( title: text(default-accent-color)[lens-rs], location: [#github-link("TOETOE55/lens-rs")], description: "Designer/Developer" ) #resume-item[ - rust的lens库,可以通过组合“lens”,直接访问复杂的深层次结构。 - 已获得106个star ] = 个人规划 == 技术方面 #resume-item[ - 充分掌握大前端(客户端、Web端以及客户端SDK)各项基本技术,能从比较全局的视角上看问题;后续也打算尝试接触更多后端相关技术。 ] == 作为工程师方面 #resume-item[ - 积累更多业务经验,培养项目推进以及沟通能力。 ] = 博客 #resume-item[ - #link("https://toetoe55.github.io/post/2024-3-9-rust-rvo.html")[Is RVO the Basis for Rust's Move trait and Placement New?] - #link("https://ng6qpa7sht.feishu.cn/docx/YhyUdPtW6ojzbkxqmiTckZs4nef")[线程安全、原子变量、内存顺序] - #link("https://zhuanlan.zhihu.com/p/659797131")[你懂Unicode吗?可以教教我吗?] - #link("https://ng6qpa7sht.feishu.cn/docx/XlmhdLPqjouSw9xENjHcLvEXnah")[稍微聊聊Rust中的Invariant —— 那些必须保持的性质] - #link("https://zhuanlan.zhihu.com/p/606068692")[来谈谈Rust的大目标和原则], - #link("https://zhuanlan.zhihu.com/p/1042381202")[函数式的动态规划] ] = 工作技能 #resume-skill-item("编程语言", (strong("Rust"), "Swift", "TypeScript", "Haskell", "Kotlin", "Java", "C")) #resume-skill-item("工具框架", ("tokio(Rust)", "UIKit(Swift)", "Node.js(TypeScript)", "React(Typescript)", "sqlite", "git")) #resume-skill-item("其它知识储备", ("编程语言理论(类型系统,静态分析)", "多线程(线程安全,原子变量内存顺序相关)", "字符串处理(unicode相关知识)", "函数式编程"))
https://github.com/Error-418-SWE/Documenti
https://raw.githubusercontent.com/Error-418-SWE/Documenti/src/2%20-%20RTB/Glossario/Glossario.typ
typst
#import "/template.typ": * #show: project.with( title: "Glossario", authors: ( "<NAME>", ), reviewers: ( "<NAME>", ), showIndex: false, //overridden showImagesIndex: false, showTablesIndex: false ); #let glossary = json("/Glossario.json"); #outline(depth: 1) #pagebreak() #set heading( level: 1, numbering: none, ) #let previousTerm = glossary.keys().at(0) #heading( level: 1, previousTerm.at(0) ) #line(length: 100%) #for term in glossary.keys() { if (term.at(0) != previousTerm.at(0)) { pagebreak() heading( level: 1, term.at(0) ) line(length: 100%) } heading( level: 2, if glossary.at(term).acronyms.len() > 0 { term + " (" + glossary.at(term).acronyms.join(", ") + ")" } else { term } ) text( glossary.at(term).description ) previousTerm = term }
https://github.com/katamyra/Notes
https://raw.githubusercontent.com/katamyra/Notes/main/Compiled%20School%20Notes/CS3001/Modules/IntellectualProperty.typ
typst
#import "../../../template.typ": * = Intellectual Property #definition[ *Intellectual property* refers to creations of the mind: inventions, literary works, names and images used in commerce, etc. ] A *trade secret* is a confidential piece of intellectual properly that protects a company with a competitive advantage, such as formulas, processes, and other information. In order to maintain its rights to a trade secret, a company must take active measures to keep it from being discovered. Trade sets don't make sense for example for movies, since you wouldn't want a movie to be confidential. A *trademark* is a word, symbol, picture, sound, or color used by a business to identify goods. A *service mark* is a mark identifying a service. A *patent* is how the US government provides IP for a limited period of time to creators of machines, systems and other inventions. A patent is quite different from a trade secret because a patent is a public document that provides a detailed description of the invention. After 20 years, anyone can make use of its ideas. A *copyright* is how the US government provides authors with certain rights to original works they have written. _Rights_ + The right to reproduce the copyright work + The right to distribute copies of the work to the public + The right to display copies of the work in public + The right to perform in public + The right to produce new works derived from the copyrighted work Copyright owners have the right to authorize others to exercise these rights with respect to their works
https://github.com/juraph-dev/usyd-slides-typst
https://raw.githubusercontent.com/juraph-dev/usyd-slides-typst/main/usyd_polylux_theme.typ
typst
MIT License
#import "@preview/polylux:0.3.1": * // University of Sydney Typst Polylux theme // // By Juraph (github.com/juraph) // // Please feel free to improve this theme // by submitting a PR. #let s-white = rgb("#ffffff") #let s-half-white = rgb("#E68673") #let s-black = rgb("#000000") #let s-ochre = rgb("#e64626") #let s-charcoal = rgb("#424242") #let s-sandstone = rgb("#FCEDE2") #let s-light-gray = rgb("#F1F1F1") #let s-rose = rgb("#DAA8A2") #let s-jacaranda = rgb("#8F9EC9") #let s-navy = rgb("#1A345E") #let s-eucalypt = rgb("#71A399") #let uni-short-title = state("uni-short-title", none) #let uni-short-author = state("uni-short-author", none) #let uni-short-date = state("uni-short-date", none) #let uni-progress-bar = state("uni-progress-bar", true) #set page(paper: "presentation-16-9") #let usyd-outline( enum-args: (:), padding: 0pt, min-window-size: 3, max-length: 90pt, ) = locate(loc => { let sections = utils.sections-state.final(loc) let current-section = utils.sections-state.get() if current-section.len() == 0 { return } let current-index = sections.position(s => s == current-section.at(-1)) // Calculate the window size based on section lengths. Kinda overkill // for a glorified powerpoint let window-size = sections.len() let total-length = sections .slice(0, window-size) .map(s => measure(s.body).width) .sum() while window-size > min-window-size and total-length > max-length { let start = calc.max(0, current-index - window-size / 2 + 1) let end = int(calc.min(sections.len(), start + window-size)) start = calc.floor(calc.max(0, end - window-size)) total-length = sections.slice(start, window-size).map(s => measure(s.body).width).sum() if total-length > max-length { window-size -= 1 } } let start = calc.max(0, current-index - window-size / 2 + 1) let end = int(calc.min(sections.len(), start + window-size)) start = calc.floor(calc.max(0, end - window-size)) let visible-sections = sections.slice(start, end) pad( padding, box( width: 100%, align(center + horizon)[ #grid( columns: visible-sections.len(), gutter: 1fr, ..visible-sections.enumerate().map(((i, section)) => { if section == current-section.at(-1) { text(fill: s-white, link(section.loc, section.body)) } else { text(fill: s-half-white, link(section.loc, section.body)) } }) ) ], ), ) }) ) #let usyd-rounded-block(radius: 3mm, body) = { block( radius: ( bottom-left: radius, bottom-right: radius, ), clip: true, body, ) } #let usyd-color-block(title: [], colour: [], body) = { usyd-rounded-block()[ #block( width: 100%, inset: (x: 0.5em, top: 0.3em, bottom: 0.4em), fill: gradient.linear( (s-ochre, 0%), (s-ochre, 10%), (s-ochre, 100%), dir: ttb, ), text(fill: s-white, title), ) #block( inset: 0.5em, above: 0pt, fill: colour, width: 100%, text(fill: s-black, body), ) ] } #let usyd-info-block(title: [], body) = { usyd-color-block(title: title, colour: s-eucalypt, body) } #let usyd-example-block(title: [], body) = { usyd-color-block(title: title, colour: s-jacaranda, body) } #let usyd-alert-block(title: [], body) = { usyd-color-block(title: title, colour: s-rose, body) } #let usyd-theme( aspect-ratio: "16-9", short-title: none, short-author: none, short-date: none, progress-bar: true, body, ) = { set page( paper: "presentation-" + aspect-ratio, margin: 0em, header: none, footer: none, ) show footnote.entry: set text(size: .6em) uni-progress-bar.update(progress-bar) uni-short-title.update(short-title) uni-short-author.update(short-author) if short-date != none { uni-short-date.update(short-date) } else { uni-short-date.update(datetime.today().display()) } body } #let title-slide( title: [], subtitle: none, authors: (), date: none, logo: none, title_image: none, ) = { let authors = if type(authors) == "array" { authors } else { (authors,) } let bck_img = if title_image != none { title_image } else { "./figures/usyd.jpg" } let content = locate(loc => { grid( columns: (50%, 50%), block( fill: s-ochre, width: 100%, height: 100%, inset: (x: 3em), align( horizon, { block( breakable: false, { v(55pt) text(size: 28pt, fill: s-white, strong(title)) if subtitle != none { v(4pt) text(size: 25pt, fill: s-black, subtitle) } }, ) v(44pt) set text(size: 15pt) grid( columns: (1fr,) * calc.min(authors.len(), 3), column-gutter: 1em, row-gutter: 1em, ..authors.map(author => strong(text(fill: s-black, author))) ) v(45pt) if date != none { parbreak() text(size: 14pt, date, fill: s-black) } v(60pt) image("./figures/usyd-long.png", width: 35%) }, ), ), align(center, image(bck_img, height:100%)), ) }) logic.polylux-slide(content) } #let slide( title: none, footer: none, new-section: none, body, ) = { let body = pad(y:10pt, x: 60pt, body) let header-text = { let cell(fill: none, it) = rect( width: 100%, height: 100%, inset: (x: 6pt), outset: 0mm, fill: s-ochre, stroke: none, align(center + horizon, text(fill: s-black, it, size: 15pt)), ) if new-section != none { utils.register-section(new-section) } locate(loc => { grid( columns: (30%, 70%), inset: (y: 4.5pt), align(center + horizon, image("./figures/usyd-long-white.png", height: 100%)), cell(usyd-outline()), ) }) } let header = { grid(rows: (auto), header-text) } let footer = { set text(size: 12pt) set align(center + horizon) if footer != none { footer } else { locate(loc => { grid( columns: (30%, 35%, 35%), rect( fill: s-ochre, inset: (y: 25%), width: 100%, height: 60%, uni-short-author.display(), ), align( left, block( fill: s-white, inset: (y: 25%, x: 5%), width: 100%, height: 100%, text(fill: s-charcoal, uni-short-title.display()), ), ), align( right, block( fill: s-white, inset: (y: 25%, x: 5%), width: 100%, height: 100%, text(fill: s-charcoal, uni-short-date.display()), ), ), ) }) } } set page( margin: (top: 50pt, bottom: 28pt), header: header, footer: footer, footer-descent: 0.0em, header-ascent: 6pt, ) let content = locate(loc => { grid(inset: (x: 55pt, y: 11pt), rows: (10%, auto), align( horizon, strong( text( size: 28pt, title, fill: s-ochre, ), ), ), align(horizon, text(size: 15pt, fill: s-charcoal, body))) }) logic.polylux-slide(content) } #let focus-slide(background-color: none, background-img: none, body) = { let background-color = if background-img == none and background-color == none { s-navy } else { background-color } set page(fill: background-color, margin: 1em) if background-color != none set page( background: { set image(fit: "stretch", width: 100%, height: 100%) background-img }, margin: 1em, ) if background-img != none set text(fill: white, size: 2em) logic.polylux-slide(align(center + horizon, body)) } #let matrix-slide(columns: none, rows: none, ..bodies) = { let bodies = bodies.pos() let columns = if type(columns) == "integer" { (1fr,) * columns } else if columns == none { (1fr,) * bodies.len() } else { columns } let num-cols = columns.len() let rows = if type(rows) == "integer" { (1fr,) * rows } else if rows == none { let quotient = calc.quo(bodies.len(), num-cols) let correction = if calc.rem(bodies.len(), num-cols) == 0 { 0 } else { 1 } (1fr,) * (quotient + correction) } else { rows } let num-rows = rows.len() if num-rows * num-cols < bodies.len() { panic("number of rows (" + str(num-rows) + ") * number of columns (" + str(num-cols) + ") must at least be number of content arguments (" + str( bodies.len(), ) + ")") } let cart-idx(i) = (calc.quo(i, num-cols), calc.rem(i, num-cols)) let color-body(idx-body) = { let (idx, body) = idx-body let (row, col) = cart-idx(idx) let color = if calc.even(row + col) { white } else { silver } set align(center + horizon) rect(inset: .5em, width: 100%, height: 100%, fill: color, body) } let content = grid( columns: columns, rows: rows, gutter: 0pt, ..bodies.enumerate().map(color-body) ) logic.polylux-slide(content) } #let usyd-pres-outline() = { set page(fill: s-charcoal, margin: 22pt) let content = locate(loc => { place( top + left, image("./figures/usyd-long-inv.png", height: 40pt), ) set align(horizon) { show par: set block(spacing: 0em) set text(size: 3em, fill: s-white) let outline = utils.polylux-outline() let measured = measure(outline) let available-height = (page.height - 380pt) let scale-factor = calc.min(1, available-height / measured.height) * 100% scale(scale-factor, outline) } }) logic.polylux-slide(content) } #let new-section-slide(name) = { set page(fill: s-charcoal, margin: 60pt) let content = locate(loc => { utils.register-section(name) place( top + left, image("./figures/usyd-long-inv.png", height: 40pt), ) set align(center + horizon) { show par: set block(spacing: 0em) set text(size: 28pt, fill: white) strong(name) parbreak() } }) logic.polylux-slide(content) }
https://github.com/hugoledoux/msc_geomatics_thesis_typst
https://raw.githubusercontent.com/hugoledoux/msc_geomatics_thesis_typst/main/chapters/relatedwork.typ
typst
MIT License
#import "../template.typ": * = Related Work In @chap:intro[Chapter] we saw many important things. And in @sec:cross-ref we saw some too. Lemongrass frosted gingerbread bites banana bread orange crumbled lentils sweet potato black bean burrito green pepper springtime strawberry ginger lemongrass agave green tea smoky maple tempeh glaze enchiladas couscous. Cranberry spritzer Malaysian cinnamon pineapple salsa apples spring cherry bomb bananas blueberry pops scotch bonnet pepper spiced pumpkin chili lime eating together kale blood orange smash arugula salad. Bento box roasted peanuts pasta Sicilian pistachio pesto lavender lemonade elderberry Southern Italian citrusy mint lime taco salsa lentils walnut pesto tart quinoa flatbread sweet potato grenadillo. == Some new section #lorem(400) #lorem(400) == Some new section again #lorem(400) #lorem(400)
https://github.com/RhenzoHideki/com1
https://raw.githubusercontent.com/RhenzoHideki/com1/main/Relatorio-04/Relatorio-04.typ
typst
#import "@preview/klaro-ifsc-sj:0.1.0": report #show: doc => report( title: "Relatório 04", subtitle: " Sistemas de comunicação I (COM029007)", // Se apenas um autor colocar , no final para indicar que é um array authors:("<NAME>",), date: "11 de abril de 2024", doc, ) = Introdução Este relatório abrange as seções 9.1 a 9.4 do livro "Software Defined Radio Using MATLAB & Simulink and the RTL-SDR", detalhando aspectos teóricos e práticos da Modulação em Frequência (FM). Serão abordados temas como a história da FM, a matemática da FM e o Índice de Modulação, a largura de banda do sinal FM e a demodulação FM. Além disso, serão apresentadas conclusões sobre os tópicos discutidos. #pagebreak() = Conteúdo teórico == 9.1 História do Padrão FM A Modulação em Frequência (FM) foi concebida por <NAME> em 1933 como uma solução para os problemas de ruído estático em transmissões de AM. Armstrong, renomado professor da Columbia University e engenheiro elétrico, contribuiu significativamente para o campo do rádio, desenvolvendo processos como a regeneração e o receptor super-heteródino. Apesar de suas contribuições, Armstrong enfrentou disputas legais que culminaram em seu suicídio em 1954. A popularização da FM ocorreu nas décadas de 1960 e 1970, superando as estações de AM em número. == 9.2 Matemática da FM e o Índice de Modulação A modulação FM é fundamentada em conceitos matemáticos, com destaque para o Oscilador Controlado por Tensão (VCO) como gerador de sinais FM. As equações que descrevem a modulação FM relacionam a frequência de modulação, a constante de modulação FM e o sinal de informação, resultando em sinais cujas variações de frequência são proporcionais à amplitude do sinal de informação. Além disso, a modulação FM com um sinal de informação composto por várias frequências é abordada, evidenciando como a composição espectral do sinal de informação influencia a largura de banda do sinal FM. == 9.3 Largura de Banda do Sinal FM A largura de banda do sinal FM é determinada pelo índice de modulação, permitindo classificá-la em estreita (NFM) ou larga (WFM). A NFM, com pequeno desvio de frequência, permite simplificações matemáticas. Já a WFM, com desvio de frequência maior e usada em estações de rádio comerciais, possui largura de banda teoricamente infinita, mas limitada na prática por padrões regulatórios. A regra de Carson é discutida para estimar a largura de banda necessária para transmitir o sinal FM com distorção mínima. == 9.4 Demodulação FM Usando Diferenciação A demodulação FM pode ser realizada diferenciando o sinal recebido, gerando um sinal que, após detecção de envelope, revela a informação original. Esse processo é um método padrão para demodular sinais FM, aproveitando as propriedades matemáticas da diferenciação para extrair a modulação de frequência como variações de amplitude. #pagebreak() = Desenvolvimento O capitulo a seguir irá detalhar os resultados obtidos sobre a modulação e demodulação trabalhada em sala. #figure( image("./Figuras/Sinais.png",width:100%), caption: [ Sinais genéricos gerados \ Fonte: Elaborada pelo autor ], supplement: "Figura" ); O primeiro sinal é o sinal que será modulado. \ O segundo sinal é o sinal da portadora \ O Terceiro sinal é o sinal modulado , utilizando a modulação fm. como aprendido na aula utilizamos a equação $ s_t = A_c.*cos(2*pi*f_c*t + T_s*k_0*integral m(t) dif t) $ para modular o sinal #figure( image("./Figuras/frequencia.png",width:100%), caption: [ Frequência dos sinais gerados \ Fonte: Elaborada pelo autor ], supplement: "Figura" ); Nesta figura é possivel ver o dominio da frequência dos respectivos sinais comentados da figura 1. Onde a primeira parte em azul está parte da demodulação podendo se ver a alteração na frequência e amplitude em relação ao sinal em vermelho, a segunda parte é o dominio da frequência. #figure( image("./Figuras/sinaisRestaurado.png",width:100%), caption: [ Sinais Restaurados \ Fonte: Elaborada pelo autor ], supplement: "Figura" ); Na figura 3 é possivel ver parte do processo de demodulação. = Conclusão Com base nos estudos realizados nas seções 9.1 a 9.4, pode-se concluir que a Modulação em Frequência (FM) é uma técnica importante no campo das telecomunicações, tendo sido desenvolvida como uma solução para os problemas de ruído estático em transmissões de AM. A matemática da FM envolve equações que descrevem a relação entre a frequência de modulação, a constante de modulação FM e o sinal de informação, resultando em sinais com variações de frequência proporcionais à amplitude do sinal de informação. A largura de banda do sinal FM é influenciada pelo índice de modulação, podendo ser classificada em estreita (NFM) ou larga (WFM). A demodulação FM pode ser realizada através da diferenciação do sinal recebido, gerando um sinal que, após detecção de envelope, revela a informação original. Este processo é um método padrão para demodular sinais FM, aproveitando as propriedades matemáticas da diferenciação para extrair a modulação de frequência como variações de amplitude.